From jay.mccarthy at gmail.com Sat Aug 1 09:22:19 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sat Aug 1 09:22:39 2009 Subject: [plt-scheme] Re: [ANN] New PLaneT packages In-Reply-To: References: Message-ID: A few more... this time data structures and algorithms (require (planet jaymccarthy/batched-deque)) Functional Deque http://planet.plt-scheme.org/display.ss?package=batched-deque.plt&owner=jaymccarthy (require (planet jaymccarthy/connected)) Connected Components http://planet.plt-scheme.org/display.ss?package=connected.plt&owner=jaymccarthy (require (planet jaymccarthy/floyd-warshall)) An implementation of the Floyd-Warshall all shortest paths algorithm. http://planet.plt-scheme.org/display.ss?package=floyd-warshall.plt&owner=jaymccarthy Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From toddobryan at gmail.com Sat Aug 1 09:59:03 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 1 10:06:54 2009 Subject: [plt-scheme] Field names in the class system Message-ID: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> How do I get the names I use when passing in values with new to match the internal field names? In other words, I'd like to be able to do (new foo% [name "blah"]) and then assign the field name the value "blah" inside the class. My first attempt was: (define foo% (class object% (init name) (super-new) (define name name))) ; doesn't work because name is already defined I tried using the maybe-renamed construct, but the name is backwards from what I expected: (define foo% (class object% (init (field-name name)) ...) means that I have to do (new foo% [field-name "blah"]), rather than [name "blah"]. I'm sure I'm just missing something obvious... Todd From matthias at ccs.neu.edu Sat Aug 1 10:18:55 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Aug 1 10:19:32 2009 Subject: [plt-scheme] Field names in the class system In-Reply-To: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> References: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> Message-ID: <3C12A7B0-696C-4720-A8F6-F76B97DD1E19@ccs.neu.edu> Use init-field. On Aug 1, 2009, at 9:59 AM, Todd O'Bryan wrote: > How do I get the names I use when passing in values with new to match > the internal field names? > > In other words, I'd like to be able to do > > (new foo% [name "blah"]) > > and then assign the field name the value "blah" inside the class. > > My first attempt was: > > (define foo% > (class object% > (init name) > > (super-new) > > (define name name))) ; doesn't work because name is already > defined > > I tried using the maybe-renamed construct, but the name is backwards > from what I expected: > > (define foo% > (class object% > (init (field-name name)) > ...) > > means that I have to do (new foo% [field-name "blah"]), rather than > [name "blah"]. > > I'm sure I'm just missing something obvious... > > Todd > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Sat Aug 1 10:58:12 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Aug 1 10:58:46 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: <19059.46695.736503.458567@winooski.ccs.neu.edu> References: <91a2ba3e0902251023l2d97edafx719eca5bdc3eecd@mail.gmail.com> <19059.46695.736503.458567@winooski.ccs.neu.edu> Message-ID: <4E6A42B0-99A4-4E88-AE2F-26B31C530E04@ccs.neu.edu> On Jul 31, 2009, at 11:28 PM, Eli Barzilay wrote: > And now coms the obvious fun part -- if there's a bug, not only do you > not have source location of where the bug is, you need to start > sifting through random form elements trying to find where is the > relevant code. This is not an inherent problem. In DrScheme/BSL, students are event programming all the time and they do get error locations and we can provide guidance on how to understand what's going on. Plus event systems are easier to unit test than thread-base systems, which is the alternative. From eli at barzilay.org Sat Aug 1 11:02:14 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Aug 1 11:02:35 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: <4E6A42B0-99A4-4E88-AE2F-26B31C530E04@ccs.neu.edu> References: <91a2ba3e0902251023l2d97edafx719eca5bdc3eecd@mail.gmail.com> <19059.46695.736503.458567@winooski.ccs.neu.edu> <4E6A42B0-99A4-4E88-AE2F-26B31C530E04@ccs.neu.edu> Message-ID: <19060.22774.68840.454238@winooski.ccs.neu.edu> On Aug 1, Matthias Felleisen wrote: > > On Jul 31, 2009, at 11:28 PM, Eli Barzilay wrote: > > > And now coms the obvious fun part -- if there's a bug, not only do > > you not have source location of where the bug is, you need to > > start sifting through random form elements trying to find where is > > the relevant code. > > This is not an inherent problem. In DrScheme/BSL, students are event > programming all the time and they do get error locations and we can > provide guidance on how to understand what's going on. Plus event > systems are easier to unit test than thread-base systems, which is > the alternative. I should have clarified the problem -- it's nothing inherent of course, the problem is in making people come up with such horrible environments when they have this idea that "the code" is all made of only event handlers. The Lotus Notes thing was a perfect example of such a poor development environment (having a notes installation was very expensive, so it's far from some quickly hacked-on tool). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From toddobryan at gmail.com Sat Aug 1 11:04:25 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 1 11:04:47 2009 Subject: [plt-scheme] Field names in the class system In-Reply-To: <3C12A7B0-696C-4720-A8F6-F76B97DD1E19@ccs.neu.edu> References: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> <3C12A7B0-696C-4720-A8F6-F76B97DD1E19@ccs.neu.edu> Message-ID: <904774730908010804u253dd56aj5051f192cf77956b@mail.gmail.com> But doesn't that make the field public? Is there any way to do it without making the field public? On Sat, Aug 1, 2009 at 10:18 AM, Matthias Felleisen wrote: > > Use init-field. > > On Aug 1, 2009, at 9:59 AM, Todd O'Bryan wrote: > >> How do I get the names I use when passing in values with new to match >> the internal field names? >> >> In other words, I'd like to be able to do >> >> (new foo% [name "blah"]) >> >> and then assign the field name the value "blah" inside the class. >> >> My first attempt was: >> >> (define foo% >> ?(class object% >> ? ?(init name) >> >> ? ?(super-new) >> >> ? ?(define name name))) ? ; doesn't work because name is already defined >> >> I tried using the maybe-renamed construct, but the name is backwards >> from what I expected: >> >> (define foo% >> ?(class object% >> ? ?(init (field-name name)) >> ? ?...) >> >> means that I have to do (new foo% [field-name "blah"]), rather than >> [name "blah"]. >> >> I'm sure I'm just missing something obvious... >> >> Todd >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From carl.eastlund at gmail.com Sat Aug 1 11:08:21 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sat Aug 1 11:09:02 2009 Subject: [plt-scheme] Field names in the class system In-Reply-To: <904774730908010804u253dd56aj5051f192cf77956b@mail.gmail.com> References: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> <3C12A7B0-696C-4720-A8F6-F76B97DD1E19@ccs.neu.edu> <904774730908010804u253dd56aj5051f192cf77956b@mail.gmail.com> Message-ID: <990e0c030908010808k3f8d128bmc0ad305497d5cb80@mail.gmail.com> If you want a private field with the same name as an initialization argument, you want to give the initialization argument a different internal name. It should work something like this: (class ... (init ([name other-name] default)) (define name other-name) ...) You can leave out the default value, but you still need the extra layer of parentheses that distinguish other-name from default. --Carl On Sat, Aug 1, 2009 at 11:04 AM, Todd O'Bryan wrote: > But doesn't that make the field public? Is there any way to do it > without making the field public? > > On Sat, Aug 1, 2009 at 10:18 AM, Matthias Felleisen wrote: >> >> Use init-field. >> >> On Aug 1, 2009, at 9:59 AM, Todd O'Bryan wrote: >> >>> How do I get the names I use when passing in values with new to match >>> the internal field names? >>> >>> In other words, I'd like to be able to do >>> >>> (new foo% [name "blah"]) >>> >>> and then assign the field name the value "blah" inside the class. >>> >>> My first attempt was: >>> >>> (define foo% >>> ?(class object% >>> ? ?(init name) >>> >>> ? ?(super-new) >>> >>> ? ?(define name name))) ? ; doesn't work because name is already defined >>> >>> I tried using the maybe-renamed construct, but the name is backwards >>> from what I expected: >>> >>> (define foo% >>> ?(class object% >>> ? ?(init (field-name name)) >>> ? ?...) >>> >>> means that I have to do (new foo% [field-name "blah"]), rather than >>> [name "blah"]. >>> >>> I'm sure I'm just missing something obvious... >>> >>> Todd From jay.mccarthy at gmail.com Sat Aug 1 11:27:59 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sat Aug 1 11:28:21 2009 Subject: [plt-scheme] Re: [ANN] New PLaneT packages In-Reply-To: References: Message-ID: Probably my last package for the day... This combines two demos of the Chipmunk and GL packages from yesterday. http://planet.plt-scheme.org/display.ss?package=pyramidstack.plt&owner=jaymccarthy The documentation just describes the intent of the code. Their purpose is for you to read the code and try it out. You are likely to have slight difficulties getting Chipmunk on your system. Here's what I did on OS X: cd $PLTROOT/lib svn checkout http://chipmunk-physics.googlecode.com/svn/trunk/ chipmunk cd chipmunk cmake make cd .. ln -s chipmunk/src/libchipmunk.dylib . Now it is built on your system and the dylib is available where PLT expects it. Since the FFI tracks Chipmunk SVN, I don't know if Debian (etc) packages will work. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From toddobryan at gmail.com Sat Aug 1 11:34:02 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 1 11:34:21 2009 Subject: [plt-scheme] Field names in the class system In-Reply-To: <990e0c030908010808k3f8d128bmc0ad305497d5cb80@mail.gmail.com> References: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> <3C12A7B0-696C-4720-A8F6-F76B97DD1E19@ccs.neu.edu> <904774730908010804u253dd56aj5051f192cf77956b@mail.gmail.com> <990e0c030908010808k3f8d128bmc0ad305497d5cb80@mail.gmail.com> Message-ID: <904774730908010834r3754f092gc40cdb0a04fef6e2@mail.gmail.com> Are you sure? Just trying to run this code (class object% (init ([name other-name] 'default)) (define name other-name)) causes the error class: duplicate declared identifier in: name Todd On Sat, Aug 1, 2009 at 11:08 AM, Carl Eastlund wrote: > If you want a private field with the same name as an initialization > argument, you want to give the initialization argument a different > internal name. ?It should work something like this: > > (class > ?... > ?(init ([name other-name] default)) > ?(define name other-name) > ?...) > > You can leave out the default value, but you still need the extra > layer of parentheses that distinguish other-name from default. > > --Carl > > On Sat, Aug 1, 2009 at 11:04 AM, Todd O'Bryan wrote: >> But doesn't that make the field public? Is there any way to do it >> without making the field public? >> >> On Sat, Aug 1, 2009 at 10:18 AM, Matthias Felleisen wrote: >>> >>> Use init-field. >>> >>> On Aug 1, 2009, at 9:59 AM, Todd O'Bryan wrote: >>> >>>> How do I get the names I use when passing in values with new to match >>>> the internal field names? >>>> >>>> In other words, I'd like to be able to do >>>> >>>> (new foo% [name "blah"]) >>>> >>>> and then assign the field name the value "blah" inside the class. >>>> >>>> My first attempt was: >>>> >>>> (define foo% >>>> ?(class object% >>>> ? ?(init name) >>>> >>>> ? ?(super-new) >>>> >>>> ? ?(define name name))) ? ; doesn't work because name is already defined >>>> >>>> I tried using the maybe-renamed construct, but the name is backwards >>>> from what I expected: >>>> >>>> (define foo% >>>> ?(class object% >>>> ? ?(init (field-name name)) >>>> ? ?...) >>>> >>>> means that I have to do (new foo% [field-name "blah"]), rather than >>>> [name "blah"]. >>>> >>>> I'm sure I'm just missing something obvious... >>>> >>>> Todd > From carl.eastlund at gmail.com Sat Aug 1 12:47:36 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sat Aug 1 12:55:06 2009 Subject: [plt-scheme] Field names in the class system In-Reply-To: <904774730908010834r3754f092gc40cdb0a04fef6e2@mail.gmail.com> References: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> <3C12A7B0-696C-4720-A8F6-F76B97DD1E19@ccs.neu.edu> <904774730908010804u253dd56aj5051f192cf77956b@mail.gmail.com> <990e0c030908010808k3f8d128bmc0ad305497d5cb80@mail.gmail.com> <904774730908010834r3754f092gc40cdb0a04fef6e2@mail.gmail.com> Message-ID: <990e0c030908010947p5c22ab2ala632ed4a9ad7bbbf@mail.gmail.com> Sorry, my mistake. The internal name comes first. The init declaration should be: (init ([other-name name] 'default)) See the documentation for class* to get the whole grammar for init declarations: http://docs.plt-scheme.org/reference/createclass.html#(form._((lib._scheme/private/class-internal..ss)._class*)) Carl Eastlund On Sat, Aug 1, 2009 at 11:34 AM, Todd O'Bryan wrote: > Are you sure? Just trying to run this code > > (class object% > ?(init ([name other-name] 'default)) > ?(define name other-name)) > > causes the error > > class: duplicate declared identifier in: name > > Todd > > On Sat, Aug 1, 2009 at 11:08 AM, Carl Eastlund wrote: >> If you want a private field with the same name as an initialization >> argument, you want to give the initialization argument a different >> internal name. ?It should work something like this: >> >> (class >> ?... >> ?(init ([name other-name] default)) >> ?(define name other-name) >> ?...) >> >> You can leave out the default value, but you still need the extra >> layer of parentheses that distinguish other-name from default. >> >> --Carl From toddobryan at gmail.com Sat Aug 1 15:03:27 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 1 15:03:49 2009 Subject: [plt-scheme] Field names in the class system In-Reply-To: <990e0c030908010947p5c22ab2ala632ed4a9ad7bbbf@mail.gmail.com> References: <904774730908010659l31519d88y111b3f7555acce9e@mail.gmail.com> <3C12A7B0-696C-4720-A8F6-F76B97DD1E19@ccs.neu.edu> <904774730908010804u253dd56aj5051f192cf77956b@mail.gmail.com> <990e0c030908010808k3f8d128bmc0ad305497d5cb80@mail.gmail.com> <904774730908010834r3754f092gc40cdb0a04fef6e2@mail.gmail.com> <990e0c030908010947p5c22ab2ala632ed4a9ad7bbbf@mail.gmail.com> Message-ID: <904774730908011203t358c647r6c4c7e7898ecc2ba@mail.gmail.com> That did it. I actually read the docs and misread them in the same way you misremembered them. Thanks! On Sat, Aug 1, 2009 at 12:47 PM, Carl Eastlund wrote: > Sorry, my mistake. ?The internal name comes first. ?The init > declaration should be: > > (init ([other-name name] 'default)) > > See the documentation for class* to get the whole grammar for init declarations: > > http://docs.plt-scheme.org/reference/createclass.html#(form._((lib._scheme/private/class-internal..ss)._class*)) > > Carl Eastlund > > On Sat, Aug 1, 2009 at 11:34 AM, Todd O'Bryan wrote: >> Are you sure? Just trying to run this code >> >> (class object% >> ?(init ([name other-name] 'default)) >> ?(define name other-name)) >> >> causes the error >> >> class: duplicate declared identifier in: name >> >> Todd >> >> On Sat, Aug 1, 2009 at 11:08 AM, Carl Eastlund wrote: >>> If you want a private field with the same name as an initialization >>> argument, you want to give the initialization argument a different >>> internal name. ?It should work something like this: >>> >>> (class >>> ?... >>> ?(init ([name other-name] default)) >>> ?(define name other-name) >>> ?...) >>> >>> You can leave out the default value, but you still need the extra >>> layer of parentheses that distinguish other-name from default. >>> >>> --Carl > From spdegabrielle at gmail.com Sun Aug 2 02:52:58 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Sun Aug 2 02:53:22 2009 Subject: [plt-scheme] Re: may I copy scribble? In-Reply-To: <7b63fe65-313c-425a-b2a0-e91a5d9c232a@k30g2000yqf.googlegroups.com> References: <19054.56997.785723.929845@winooski.ccs.neu.edu> <7b63fe65-313c-425a-b2a0-e91a5d9c232a@k30g2000yqf.googlegroups.com> Message-ID: <595b9ab20908012352n832a84am62e7409666098519@mail.gmail.com> *http://barzilay.org/misc/scribble-reader.pdf * On Tue, Jul 28, 2009 at 1:27 PM, Rob wrote: > Thanks. Will your paper be available online? I'll definitely want to > read it. > > Rob > > > On Jul 28, 7:19 am, Eli Barzilay wrote: > > On Jul 26, Rob wrote: > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- -- Stephen De Gabrielle stephen.degabrielle@acm.org Telephone +44 (0)20 85670911 Mobile +44 (0)79 85189045 http://www.degabrielle.name/stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090802/e66435c9/attachment.htm From ifl2009 at shu.edu Sun Aug 2 09:28:45 2009 From: ifl2009 at shu.edu (IFL 2009) Date: Sun Aug 2 09:29:09 2009 Subject: [plt-scheme] IFL 2009: Call for Papers and Participation Message-ID: An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090802/beb849f6/attachment.html From mftian at gmail.com Sun Aug 2 09:46:06 2009 From: mftian at gmail.com (Xie&Tian) Date: Sun Aug 2 09:46:24 2009 Subject: [plt-scheme] DrScheme not responding to keyboard input Message-ID: Hello, everybody I'm new to DrScheme/mzscheme. I downloaded the source and make && make install it successfully on my OpenSUSE 11. The weird thing is that DrScheme window wouldn't accept any keyboard input. In other words, I can't type anything into DrScheme. Meanwhile DrScheme behaves normal to mouse input and mzscheme works well too. Any help is appreciated. Thanks in advance. Xie From chaguidiao at gmail.com Sun Aug 2 11:11:21 2009 From: chaguidiao at gmail.com (nandehutu) Date: Sun Aug 2 11:19:49 2009 Subject: [plt-scheme] Re: DrScheme not responding to keyboard input In-Reply-To: References: Message-ID: Hi Xie I believe you have your locale set to other languages other then english (example: chinese)? In terminal, try run "LANG=C drscheme &". This is currently the only workaround I know. Dan On Aug 2, 9:46?pm, "Xie&Tian" wrote: > Hello, everybody > > I'm new to DrScheme/mzscheme. I downloaded the source and make && make > install it successfully on my OpenSUSE 11. The weird thing is that > DrScheme window wouldn't accept any keyboard input. In other words, I > can't type anything into DrScheme. Meanwhile DrScheme behaves normal > to mouse input and mzscheme works well too. > > Any help is appreciated. Thanks in advance. > > Xie > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From wimmersimon at googlemail.com Sat Aug 1 13:35:22 2009 From: wimmersimon at googlemail.com (SiWi) Date: Sun Aug 2 13:33:18 2009 Subject: [plt-scheme] Getting started with Scheme: How can I improve my code for generating prime numbers? Message-ID: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> Hello PLT Scheme community, this is my first post here, so please excuse any mistakes. I'm 16 years old and so far my programming experience has mainly been in Python. To learn about functional programming, I just started with Scheme. For training I tried to convert some prime number generator code from Python to Scheme. It's using a sieve algorithm. The problem is that my Scheme code is about 1000-10000 times slower than my Python code. I would greatly appreciate it if you could give me some hints on how to improve my code. Python code: def primes(n): sieve=[True for x in range(3,n+1,2)] root=n**0.5 length=len(sieve) for i in range(len(sieve)): x=2*i+3 if x>root: break if sieve[i]: for j in range((x*x-x)/2+i,length,x): sieve[j]=False return [2]+[x*2+3 for x in range(length) if sieve[x]] Scheme code: (define (primes n) (letrec ((primes-go (lambda (n lst i x nroot) (if (> x nroot) lst (let ((temp-lst (lst- remove lst 0 (+ (/ (- (* x x) x) 2) i) x))) (primes-go n temp- lst (+ i 1) (+ (* 2 i) 3) nroot))))) (lst-remove (lambda (lst i goal step) (if (null? lst) '() (if (= goal i) (cons #f (lst-remove (cdr lst) (+ i 1) (+ goal step) step)) (cons (car lst) (lst-remove (cdr lst) (+ i 1) goal step)))))) (list-bool (lambda (n i) (if (>= i n) '() (cons #t (list-bool n (+ i 2)))))) (filter (lambda (lst final i length) (if (>= i length) final (if (list-ref lst i) (filter lst (append final (list (+ (* 2 i) 3))) (+ i 1) length) (filter lst final (+ i 1) length)))))) (filter (primes-go n (list-bool (+ n 1) 3) 0 3 (sqrt n)) (list 2) 0 (length (list-bool (+ n 1) 3))))) From robby at eecs.northwestern.edu Sun Aug 2 13:43:07 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Aug 2 13:43:28 2009 Subject: [plt-scheme] Re: can't connect to PLaneT on Windows XP machine In-Reply-To: <92141db3-9e00-4f52-8413-c7c1f362513a@j9g2000prh.googlegroups.com> References: <90d1a0cc-7d15-48ff-8916-672b0cf243df@z4g2000prh.googlegroups.com> <92141db3-9e00-4f52-8413-c7c1f362513a@j9g2000prh.googlegroups.com> Message-ID: <932b2f1f0908021043r11240e01pd2aeaf8fbff6515e@mail.gmail.com> Rebooting is unlikely to help. First thing is to make sure that your firewall is not blocking plt scheme from connecting to the internet. And can you connect to planet.plt-scheme.org from your web browser (drscheme makes a web connection to that machine to download the packages). Also, is it exactly the same error, or just mostly the same error? Robby On Fri, Jul 31, 2009 at 3:16 PM, Andy LeClair wrote: > I've been having the same error on Windows XP. ?Is the solution to > just reboot? ?I get the error when trying to connect to PlaneT and > when trying to run the webserver using web-start/insta on port 80. > -A > > On Jul 29, 10:33?pm, Gregg Williams wrote: >> I'm trying to get PLT Scheme to work on a Windows XP machine, and I >> can't add needed modules from PLaneT. When I do so in the customary >> way, I get the following error: >> >> --- >> require: PLaneT could not download the requested package: tcp-connect: >> connection to planet.plt-scheme.org, port 80 failed (at step 4: An >> operation was attempted on something that is not a socket.; errno= >> 10038) in: (planet lizorkin/ssax:2:0/ssax) >> --- >> >> I've looked both on the web and on this mailing list and didn't find >> anything useful. I did however learn from one page to check to see >> whether port 80 is being used by other software. I checked, using the >> Windows command-line utility netstat, which showed no sign of any >> "active connection" using port 80. >> >> I also consulted Internet web pages telling me how to open port 80, as >> well as checking my antivirus software for possible conflicts; neither >> of these helped. >> >> Anybody got any ideas? Thanks. >> _________________________________________________ >> ? 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 grettke at acm.org Sun Aug 2 14:31:48 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Aug 2 14:32:05 2009 Subject: [plt-scheme] Re: can't connect to PLaneT on Windows XP machine In-Reply-To: <932b2f1f0908021043r11240e01pd2aeaf8fbff6515e@mail.gmail.com> References: <90d1a0cc-7d15-48ff-8916-672b0cf243df@z4g2000prh.googlegroups.com> <92141db3-9e00-4f52-8413-c7c1f362513a@j9g2000prh.googlegroups.com> <932b2f1f0908021043r11240e01pd2aeaf8fbff6515e@mail.gmail.com> Message-ID: <756daca50908021131j40f1cb24nb7ca36b83aed2e07@mail.gmail.com> On Sun, Aug 2, 2009 at 12:43 PM, Robby Findler wrote: > Rebooting is unlikely to help. First thing is to make sure that your > firewall is not blocking plt scheme from connecting to the internet. FWIW: Sometimes after installing 'Windows Updates', firewall settings get changed resulting in surprises like this. From matthias at ccs.neu.edu Sun Aug 2 15:06:05 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Aug 2 15:06:47 2009 Subject: [plt-scheme] Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> Message-ID: <4FB3D7A4-C459-4598-9AB7-5363FB75D757@ccs.neu.edu> Let me quickly respond with a few comments and a snippet of code. 1. Functional programming is something you can do in every programming language: assembly, c, c++, java, python, you name it. I bet I could do it in cobol. 2. When you do program functionally, it is not about translating some snippet of code from one language to another. In case you know a foreign language, doing so is like translating English sentences into say German word by word. In all likelihood, it makes no sense whatsoever. 3. If your task is to sieve through __all__ natural numbers so that you get all prime numbers, you program with the object that comprises __all__ naturals and get the object of __all__ primes. Picking the first n is boring and it is only done because the typical Python programmer isn't trained to think of the full range of possibilities. (See 1 -- functional programming can be done in pyton). Here is the code for that: #lang lazy ; this is the lazy scheme dialect available with plt scheme, both in drscheme and in mzscheme ;; all natural numbers (define nats$ (cons 0 (map add1 nats$))) ;; all primes ;; Stream[Number] -> Stream[Number] ;; generative: eliminate all first elements from the rest of the stream, then recur (define (sieve s$) (define fst (first s$)) (cons fst (sieve (filter (lambda (m) (not (= (remainder m fst) 0))) s$)))) (define primes$ (sieve (rest (rest nats$)))) ;; --- for you only --- ;; print the first n primes (define (print-primes n) (for-each (lambda (x) (display x) (newline)) (!list (take n primes $)))) (print-primes 1000) Here is how this runs: [home] $ mzscheme sieve.ss 1.827u 0.205s 0:02.18 92.6% 0+0k 0+1io 0pf+0w 4. Now if you want to learn Scheme programming, you're right in that Scheme programmers think functionally a lot of the time. But you also need ot know that they throw in assignment statements, exceptions, continuations, and other effects when needed. Scheme is a full- spectrum language. I'll take a closer look at your code now. -- Matthias On Aug 1, 2009, at 1:35 PM, SiWi wrote: > Hello PLT Scheme community, > this is my first post here, so please excuse any mistakes. > I'm 16 years old and so far my programming experience has mainly been > in Python. > To learn about functional programming, I just started with Scheme. > For training I tried to convert some prime number generator code from > Python to Scheme. > It's using a sieve algorithm. > The problem is that my Scheme code is about 1000-10000 times slower > than my Python code. > I would greatly appreciate it if you could give me some hints on how > to improve my code. > > Python code: > > def primes(n): > sieve=[True for x in range(3,n+1,2)] > root=n**0.5 > length=len(sieve) > for i in range(len(sieve)): > x=2*i+3 > if x>root: > break > if sieve[i]: > for j in range((x*x-x)/2+i,length,x): > sieve[j]=False > return [2]+[x*2+3 for x in range(length) if sieve[x]] > > > Scheme code: > > (define (primes n) > (letrec ((primes-go (lambda (n lst i x nroot) (if (> x nroot) > lst > (let ((temp-lst > (lst- > remove lst 0 (+ (/ (- (* x x) x) 2) i) x))) > (primes-go n temp- > lst (+ i 1) (+ (* 2 i) 3) nroot))))) > (lst-remove (lambda (lst i goal step) (if (null? lst) > '() > (if (= goal i) > (cons #f > (lst-remove (cdr lst) (+ i 1) (+ goal step) step)) > (cons (car > lst) (lst-remove (cdr lst) (+ i 1) goal step)))))) > (list-bool (lambda (n i) (if (>= i n) > '() > (cons #t (list-bool n (+ i > 2)))))) > (filter (lambda (lst final i length) (if (>= i length) > final > (if (list-ref lst i) > (filter lst (append final > (list (+ (* 2 i) 3))) (+ i 1) length) > (filter lst final (+ i 1) > length)))))) > (filter (primes-go n (list-bool (+ n 1) 3) 0 3 (sqrt n)) (list 2) > 0 (length (list-bool (+ n 1) 3))))) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Sun Aug 2 15:18:58 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Aug 2 15:19:21 2009 Subject: [plt-scheme] Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> Message-ID: <19061.59042.713314.535426@winooski.ccs.neu.edu> On Aug 1, SiWi wrote: > Hello PLT Scheme community, > this is my first post here, so please excuse any mistakes. I'm 16 > years old and so far my programming experience has mainly been in > Python. > To learn about functional programming, I just started with Scheme. > For training I tried to convert some prime number generator code > from Python to Scheme. > It's using a sieve algorithm. > The problem is that my Scheme code is about 1000-10000 times slower > than my Python code. > I would greatly appreciate it if you could give me some hints on how > to improve my code. You have several problems in your code, which are a result of translating the Python code into a more Scheme-ish version. A few things that I've noticed can all be seen in this expression that you wrote: (append final (list (+ (* 2 i) 3))) * "Python lists" are really not the same as "Scheme lists". In Scheme, this refers to a linked list, where each item is a "cons cell" which holds a value and a pointer to the next item in the list. This makes certain operations much faster. For example, adding a value at the front of an existing list is a constant time operation (since it has a pointer to the input list). It is also very natural for a whole bunch of problems that programmers run into, and it is easy to iterate over directly. In Python, the lists are really more like arrays. They are faster for things like random-access of some value (you just look at the given offset in the array), but if you want to add an item at the front of the "list", you need to move everything down. It is also inconvenient to iterate on (you can't do it directly, you need to use an index as a counter), and it is natural in cases where you know that you need a chunk of values, usually of some fixed size (some languages allow these arrays to vary dynamically, or even be able to use any value for an index). * In your python code, you just create one such vector, then change, and finally collect the results into the output. In Scheme, you keep creating new lists -- which is very expensive. Think about it this way: your `list-bool' function takes the current sieve as an input, *copies* it to a new one while changing some bits to true. This is obviously much slower. * Finally, I didn't talk about adding an item at the end of a list. With lists, this (append some-list (list new-value)) is very expensive because you need to copy the whole list to have a different last value. If you do this 10000 times, then each of these steps creates a new copy of the list so far, which is a lot of work for the GC. But this was not really necessary -- looking at your python code, you only add an item at the front of the list. Just to measure the speed difference, I added this line to your code: print(len(primes(100000000))) And then I did a direct translation of your code to PLT Scheme: #lang scheme/base (define (primes n) (define root (expt n 0.5)) (define len (/ (- (+ n 1) 3) 2)) (define sieve (make-vector len #t)) (for ([i (in-range len)]) (define x (+ (* i 2) 3)) (unless (> x root) (when (vector-ref sieve i) (for ([j (in-range (+ (/ (- (* x x) x) 2) i) len x)]) (vector-set! sieve j #f))))) (cons 2 (for/list ([x (in-range len)] #:when (vector-ref sieve x)) (+ (* x 2) 3)))) (length (primes 100000000)) This might be fitting on some cases, but it's mostly not an example of typical Scheme code. Anyway, the timings I'm getting on my machine are python: 28.64s user 2.94s system 99% cpu 31.891 total mzscheme: 10.03s user 0.53s system 99% cpu 10.562 total -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From matthias at ccs.neu.edu Sun Aug 2 15:21:39 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Aug 2 15:22:21 2009 Subject: [plt-scheme] Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <19061.59042.713314.535426@winooski.ccs.neu.edu> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> <19061.59042.713314.535426@winooski.ccs.neu.edu> Message-ID: <0E4BE3A8-4E62-4FCA-A374-3FB6B5CFF9C0@ccs.neu.edu> Thanks :-) I had just gotten yeah far: (define (primes.v1 n) (define len (quotient (- (+ n 1) 3) 2)) (define sieve (make-vector len #t)) (define root (sqrt n)) sieve) :-) On Aug 2, 2009, at 3:18 PM, Eli Barzilay wrote: > On Aug 1, SiWi wrote: >> Hello PLT Scheme community, >> this is my first post here, so please excuse any mistakes. I'm 16 >> years old and so far my programming experience has mainly been in >> Python. >> To learn about functional programming, I just started with Scheme. >> For training I tried to convert some prime number generator code >> from Python to Scheme. >> It's using a sieve algorithm. >> The problem is that my Scheme code is about 1000-10000 times slower >> than my Python code. >> I would greatly appreciate it if you could give me some hints on how >> to improve my code. > > You have several problems in your code, which are a result of > translating the Python code into a more Scheme-ish version. > > A few things that I've noticed can all be seen in this expression that > you wrote: > > (append final (list (+ (* 2 i) 3))) > > * "Python lists" are really not the same as "Scheme lists". In > Scheme, this refers to a linked list, where each item is a "cons > cell" which holds a value and a pointer to the next item in the > list. This makes certain operations much faster. For example, > adding a value at the front of an existing list is a constant time > operation (since it has a pointer to the input list). It is also > very natural for a whole bunch of problems that programmers run > into, and it is easy to iterate over directly. > > In Python, the lists are really more like arrays. They are faster > for things like random-access of some value (you just look at the > given offset in the array), but if you want to add an item at the > front of the "list", you need to move everything down. It is also > inconvenient to iterate on (you can't do it directly, you need to > use an index as a counter), and it is natural in cases where you > know that you need a chunk of values, usually of some fixed size > (some languages allow these arrays to vary dynamically, or even be > able to use any value for an index). > > * In your python code, you just create one such vector, then change, > and finally collect the results into the output. In Scheme, you > keep creating new lists -- which is very expensive. Think about it > this way: your `list-bool' function takes the current sieve as an > input, *copies* it to a new one while changing some bits to true. > This is obviously much slower. > > * Finally, I didn't talk about adding an item at the end of a list. > With lists, this (append some-list (list new-value)) is very > expensive because you need to copy the whole list to have a > different last value. If you do this 10000 times, then each of > these steps creates a new copy of the list so far, which is a lot of > work for the GC. But this was not really necessary -- looking at > your python code, you only add an item at the front of the list. > > Just to measure the speed difference, I added this line to your code: > > print(len(primes(100000000))) > > And then I did a direct translation of your code to PLT Scheme: > > #lang scheme/base > (define (primes n) > (define root (expt n 0.5)) > (define len (/ (- (+ n 1) 3) 2)) > (define sieve (make-vector len #t)) > (for ([i (in-range len)]) > (define x (+ (* i 2) 3)) > (unless (> x root) > (when (vector-ref sieve i) > (for ([j (in-range (+ (/ (- (* x x) x) 2) i) len x)]) > (vector-set! sieve j #f))))) > (cons 2 (for/list ([x (in-range len)] #:when (vector-ref sieve x)) > (+ (* x 2) 3)))) > (length (primes 100000000)) > > This might be fitting on some cases, but it's mostly not an example of > typical Scheme code. Anyway, the timings I'm getting on my machine > are > > python: 28.64s user 2.94s system 99% cpu 31.891 total > mzscheme: 10.03s user 0.53s system 99% cpu 10.562 total > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli > Barzilay: > http://barzilay.org/ Maze is > Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jensaxel at soegaard.net Sun Aug 2 15:35:40 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Sun Aug 2 15:35:58 2009 Subject: [plt-scheme] Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> Message-ID: <4072c51f0908021235l147a7afeg788a4ba5df6cdcd8@mail.gmail.com> Instead of translating the Python program as-is, try to rewrite it little by little. To get you started, here is a naive prime sieve in standard PLT Scheme. (Use the module language). Try to modify it, to use the same sqrt(n) observation the Python code does. #lang scheme ; any-divisors-in-list? : number list-of-numbers -> boolean ; If a number in the list divisors is a divisor of n, ; then true is returned, otherwise false is returned (define (any-divisors-in-list? n divisors) (cond [(null? divisors) #f] [(= (remainder n (car divisors)) 0) #t] [else (any-divisors-in-list? n (cdr divisors))])) ; primes : number -> list-of-number ; returns a list of the primes below n (define (primes n) (define numbers-from-0-to-n (build-list n (? (x) x))) (define numbers-from-2-to-n (cdr (cdr numbers-from-0-to-n))) (let loop ([primes '()] [non-primes '()] [candidates numbers-from-2-to-n]) (if (null? candidates) primes (let ([n (car candidates)]) (if (any-divisors-in-list? n non-primes) ; n had a divisor (loop primes (cons n non-primes) (cdr candidates)) ; n was a prime (loop (cons n primes) non-primes (cdr candidates))))))) (primes 20) BTW - Did you take a look at HtDP? -- Jens Axel S?gaard From matthias at ccs.neu.edu Sun Aug 2 17:37:27 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Aug 2 17:38:05 2009 Subject: [plt-scheme] Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <4072c51f0908021235l147a7afeg788a4ba5df6cdcd8@mail.gmail.com> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> <4072c51f0908021235l147a7afeg788a4ba5df6cdcd8@mail.gmail.com> Message-ID: <7D0AECA4-2DB2-479D-A21B-50E9C129EB22@ccs.neu.edu> Before we throw out all solutions, let me add a couple of more comments to my original post: (4 expanded) 5. Since Scheme covers imperative as well as functional programming, you can do both -- as Jens and Eli showed in detail and, amazingly, you can do both in a reasonably elegant manner, close to what you would do in conventional languages. But see (*) below. Question is what is your goal? -- functional programming per se (as a philosopher, I would have to question if it exists) -- Scheme programming in a functional way? -- Scheme programming in the 'best' possible way? -- best could mean 'fastest' (as you saw Eli's program is faster than yours) -- best could mean 'suitable for proving theorems automatically' -- and many more things 6. Scheme programming is one thing, PLT Scheme is something completely different. In my mind, PLT Scheme relates to Scheme in the same way that Scheme relates to Lisp (its original implementation language) and Algol (one of its two influential idea-ancestors, the other one being Actors/ Smalltalk). As such, PLT Scheme would accommodate an OO solution and a lazy functional solution (which I showed you in my message) in addition to the above. Better still, as Eli demonstrated, PLT Scheme comes with the right kind of 'syntactic sugar' so that you can program imperatively as if you were in a plain imperative language like core Python or C. (*) So Eli's program isn't real Scheme at all. It is PLT Scheme, and it exploits the features that we added (so-called syntactic extensions, unavailable in most other languages) to make Scheme code look concise and elegant -- in all aspects. So the last question is: -- perhaps you really want to learn to program in PLT Scheme so that you can see what elegant lazy functional programmers do, strict lazy programmers, OO programmers, logic programmers, and imperative programmers without ever leaving the language. I am not sure whether you knew what you were getting into but now you have at least the landscape laid out for you -- Matthias From eli at barzilay.org Sun Aug 2 18:02:59 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Aug 2 18:03:21 2009 Subject: [plt-scheme] Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <7D0AECA4-2DB2-479D-A21B-50E9C129EB22@ccs.neu.edu> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> <4072c51f0908021235l147a7afeg788a4ba5df6cdcd8@mail.gmail.com> <7D0AECA4-2DB2-479D-A21B-50E9C129EB22@ccs.neu.edu> Message-ID: <19062.3347.890496.316577@winooski.ccs.neu.edu> On Aug 2, Matthias Felleisen wrote: > > Better still, as Eli demonstrated, PLT Scheme comes with the right > kind of 'syntactic sugar' so that you can program imperatively as if > you were in a plain imperative language like core Python or C. (*) > So Eli's program isn't real Scheme at all. A big +1 to everything Matthias said[*], and in addition note that I was careful to write: "a direct translation of your code to >>PLT<< Scheme" ([*] Including the philosophical question of whether purely functional programming exists.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From michele.simionato at gmail.com Mon Aug 3 05:54:33 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Mon Aug 3 06:03:15 2009 Subject: [plt-scheme] Re: may I copy scribble? In-Reply-To: <19054.56997.785723.929845@winooski.ccs.neu.edu> References: <19054.56997.785723.929845@winooski.ccs.neu.edu> Message-ID: <2fcf090f-3f67-40e1-b2a0-ec114d3808af@w41g2000yqb.googlegroups.com> On Jul 28, 1:19?pm, Eli Barzilay wrote: > we (or at least *I*) would be happy if more implementations > supported the scribble syntax. FWIW, Ikarus recently added some support for the scribble syntax: http://groups.google.com/group/ikarus-users/browse_frm/thread/ab28d2b823ce812 From jay.mccarthy at gmail.com Mon Aug 3 10:04:52 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Aug 3 10:12:50 2009 Subject: [plt-scheme] Re: Twitter in PLT demo In-Reply-To: References: Message-ID: I've finally gotten around to putting this on PLaneT for easier dissemination and so people can stumble upon it. http://planet.plt-scheme.org/display.ss?package=pltwitter.plt&owner=jaymccarthy Jay On Mon, Apr 6, 2009 at 3:56 PM, Jay McCarthy wrote: > In honor of Twitter ditching Ruby, here's a quick demo of Twitter with > PLT (pronounced Pwitter) > > wget http://faculty.cs.byu.edu/~jay/tmp/200904061550-pltwitter.tar.gz > tar xzvf 200904061550-pltwitter.tar.gz > cd pltwitter > mzscheme -t run.ss > > I've tried to be very simple and streamlined, so it doesn't do > following or authentication. But it demos good uses of dispatch and > templates. > > Code breakdown: > > ? ? ?82 main.ss > ? ? ?35 static/script.js > ? ? ?68 static/style.css > ? ? ?10 templates/error.html > ? ? ? 8 templates/footer.html > ? ? ?13 templates/header.html > ? ? ?13 templates/home.html > ? ? ? 9 templates/update.html > ? ? ?14 templates/user.html > ? ? 252 total > > Jay > > p.s. Go to http://localhost:8000/register (with no queries) to see the > fail whale. > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From geoff at knauth.org Mon Aug 3 11:57:23 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Mon Aug 3 11:57:44 2009 Subject: [plt-scheme] Re: Twitter in PLT demo In-Reply-To: References: Message-ID: On Aug 3, 2009, at 10:04, Jay McCarthy wrote: > I've finally gotten around to putting this on PLaneT for easier > dissemination and so people can stumble upon it. > http://planet.plt-scheme.org/display.ss?package=pltwitter.plt&owner=jaymccarthy Dude, awesome! My students will LOL this is so few LOC. From d.j.gurnell at gmail.com Mon Aug 3 12:09:17 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Mon Aug 3 12:09:39 2009 Subject: [plt-scheme] Re: Twitter in PLT demo In-Reply-To: References: Message-ID: <0834B184-77E9-41CE-A410-D1423AB30521@gmail.com> >> I've finally gotten around to putting this on PLaneT for easier >> dissemination [...] > > Dude, awesome! My students will LOL this is so few LOC. @jaymccarthy Nice work on the #pltwitter code - now I can tweet in style! From samdphillips at gmail.com Mon Aug 3 14:28:49 2009 From: samdphillips at gmail.com (Sam Phillips) Date: Mon Aug 3 14:29:07 2009 Subject: [plt-scheme] Byte Swapping Bitmap Performance Message-ID: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> Hi, I've pieced together a simple foreign interface to cairo2 that draws to a canvas. Cairo's image surfaces have a function cairo_image_surface_get_data that exposes the raw bytes of the surface, in the format that the surface is set up for. Setting up the surface to use the ARGB32 format I would expect it to be trivial to do a set-argb-pixels on a bitmap-dc and be done with it. Except that the bytes from cairo_image_surface_get_data come back as BGRA, and I have to do a byte swapping operation before setting the pixels in the bitmap-dc. Which adds about a second to each screen draw. Is there a faster way to do this that I'm missing? Cheers, Sam From samdphillips at gmail.com Mon Aug 3 14:32:41 2009 From: samdphillips at gmail.com (Sam Phillips) Date: Mon Aug 3 14:33:01 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: <5DEC3946-2ECD-419E-ADDF-BD131ECE23EE@ccs.neu.edu> References: <20090225011519.GA14127@topoi.pooq.com> <5DEC3946-2ECD-419E-ADDF-BD131ECE23EE@ccs.neu.edu> Message-ID: <73b251310908031132l434213a0t7d059c2e598684d3@mail.gmail.com> On Tue, Feb 24, 2009 at 7:36 PM, Matthias Felleisen wrote: > And while I am writing an email to you: Olin Shivers is on > the record saying that "you can write a Scheme interpreter in > an afternoon, but you may spend a life-time maintaining it." > What he really meant is that writing an interpreter for > Scheme is really a trivial task. If you know EOPL or PLAI > you design the interpreter and derive the abstract machine > for your favorite language during the day time and you will > write the run-time library during night time (assuming the > language is GCed). But then people will start using your > silly little interpreter, and before you know it, you have > a bug database and you want to please those people and ... > life's up. Got to go. This explains the Scheme in X implementations I've got littering my home directory, that have never been released. :) Cheers, Sam From jon.philpott at gmail.com Mon Aug 3 17:56:41 2009 From: jon.philpott at gmail.com (Jon Philpott) Date: Mon Aug 3 17:57:00 2009 Subject: [plt-scheme] Bug in FTP unit in plt-scheme 4.2.1 Message-ID: Hi All, I noticed a bug in ftp-unit.ss in plt-scheme 4.2.1 where the unit is using the old invocation style of open-output-file. I have attached a patch. HTH, Jon. -------------- next part -------------- A non-text attachment was scrubbed... Name: ftp-unit.patch Type: text/x-patch Size: 553 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090803/dabc5ddb/ftp-unit.bin From phelps.da at gmail.com Mon Aug 3 12:09:02 2009 From: phelps.da at gmail.com (Daniel) Date: Mon Aug 3 19:39:48 2009 Subject: [plt-scheme] DrScheme: Reference to undefined identifier: require Message-ID: <65aa6c6a-a57e-463f-aac0-b23d4744e330@a26g2000yqn.googlegroups.com> Hello Everybody: I am new to Scheme, so please be patient with me. I have 2 files: ch2.scm and schemeTests.scm. I would like to include schemeTests.scm in the ch2.scm file. According to the documentation, the include procedure "inlines the syntax in the file designated by path-spec in place of the include expression." http://docs.plt-scheme.org/reference/include.html This behavior is what I need. However, I am having some trouble. Hopefully, this short interactive session can tell you something. Welcome to DrScheme, version 4.2.1 [3m]. Language: R5RS; memory limit: 128 megabytes. > (require scheme/include) . . reference to undefined identifier: require > (include "schemeTests.scm") . . reference to undefined identifier: include > #lang scheme . . reference to undefined identifier: module If I place a call to (require scheme/include) in my source file, I receive the same error. However, if I change the language from R5RS to advanced student custom, I get no complaints about 'require', but it breaks some of my previously existing code. What am I doing wrong? Your help and consideration is appreciated. Sincerely, Daniel From zaneshelby at gmail.com Mon Aug 3 20:58:45 2009 From: zaneshelby at gmail.com (Zane Shelby) Date: Mon Aug 3 20:59:27 2009 Subject: [plt-scheme] DrScheme: Reference to undefined identifier: require In-Reply-To: <65aa6c6a-a57e-463f-aac0-b23d4744e330@a26g2000yqn.googlegroups.com> References: <65aa6c6a-a57e-463f-aac0-b23d4744e330@a26g2000yqn.googlegroups.com> Message-ID: <37248c620908031758x79d806a9xf7ced7c524a7eebe@mail.gmail.com> Hey Daniel! The problem is 'require' isn't part of the R5RS language, so when you try to use it in that language you're going to get an error. You could use load, but that has slightly different behavior. Is there particular reason why you'd like to use r5rs? If not, I'd recommend you use PLT Scheme by selecting 'module' from the pulldown and putting '#lang scheme' at the top of your file. Hope that helps, Zane On Mon, Aug 3, 2009 at 12:09 PM, Daniel wrote: > Hello Everybody: > ? ?I am new to Scheme, so please be patient with me. ?I have 2 files: > ch2.scm and schemeTests.scm. ?I would like to include schemeTests.scm > in the ch2.scm file. > > According to the documentation, the include procedure "inlines the > syntax in the file designated by path-spec in place of the include > expression." ?http://docs.plt-scheme.org/reference/include.html ?This > behavior is what I need. ?However, I am having some trouble. > Hopefully, this short interactive session can tell you something. > > Welcome to DrScheme, version 4.2.1 [3m]. > Language: R5RS; memory limit: 128 megabytes. >> (require scheme/include) > . . reference to undefined identifier: require >> (include "schemeTests.scm") > . . reference to undefined identifier: include >> #lang scheme > . . reference to undefined identifier: module > > If I place a call to (require scheme/include) in my source file, I > receive the same error. ?However, if I change the language from R5RS > to advanced student custom, I get no complaints about 'require', but > it breaks some of my previously existing code. ?What am I doing > wrong? ?Your help and consideration is appreciated. > > Sincerely, > Daniel > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From toddobryan at gmail.com Mon Aug 3 23:14:36 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Aug 3 23:14:59 2009 Subject: [plt-scheme] Formlet problem with PLT Web Server Message-ID: <904774730908032014n50e9bd1dre46364854655949@mail.gmail.com> What am I doing wrong here? I've gotten the code down to a really small example, but I think I'm missing something minor. ------------------------ #lang web-server/insta (require web-server/formlets) (define login-formlet (formlet (div "Username:" ,{(to-string (required (text-input))) . => . username} "Password:" ,{(to-string (required (password-input))) . => . password}) (list username password))) (define (start req) `(html (head (title "Home Page")) (body (h1 "Home Page") ,(formlet-display login-formlet)))) -------------------------- Running this gives this error: you broke the contract xexpr? on start; Not an Xexpr. Expected a symbol as the element name, given (div () "Username:" (input ((name "input_0") (type "text"))) "Password:" (input ((name "input_1") (type "text")))) It looks like there's an extra () in the formlet-display result that's not there in the docs here: http://docs.plt-scheme.org/web-server/formlets.html#(part._.Basic_.Formlet_.Usage) Thanks, Todd P.S. Yes, I know I'm missing a
tag and all kinds of other stuff. I just want to see if I can display the inputs before I do all the rest of the stuff. From skeptic2000 at hotmail.com Mon Aug 3 23:20:04 2009 From: skeptic2000 at hotmail.com (Skeptic .) Date: Mon Aug 3 23:20:25 2009 Subject: [plt-scheme] scheme code in SlideShow Message-ID: Hi, Is there an easy way to add scheme code (or REPL interractions) in a SlideShow ? Or should I stay with Scribble instead ? Thanks. _________________________________________________________________ Cr?ez un personnage ? votre image pour votre WL Messenger http://go.microsoft.com/?linkid=9656622 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090803/6fb8edd8/attachment.htm From jay.mccarthy at gmail.com Mon Aug 3 23:32:46 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Aug 3 23:33:07 2009 Subject: [plt-scheme] Formlet problem with PLT Web Server In-Reply-To: <904774730908032014n50e9bd1dre46364854655949@mail.gmail.com> References: <904774730908032014n50e9bd1dre46364854655949@mail.gmail.com> Message-ID: Hi Todd, formlet-display returns an xexpr-forest which is a list of xexprs rather than a single xexpr Your code use unquote (,) to include the result of formlet-display, which results in the invalid xexpr: (html (head (title "Home Page")) (body (h1 "Home Page") ((div () "Username:" (input ((name "input_0") (type "text"))) "Password:" (input ((name "input_1") (type "text"))))))) If you change that unquote to unquote-splicing (,@) then you are collapsing the forest into the surrounding xexpr: `(html (head (title "Home Page")) (body (h1 "Home Page") ,@(formlet-display login-formlet))) with the result: (html (head (title "Home Page")) (body (h1 "Home Page") (div () "Username:" (input ((name "input_0") (type "text"))) "Password:" (input ((name "input_1") (type "text")))))) Hope this helps, Jay On Mon, Aug 3, 2009 at 9:14 PM, Todd O'Bryan wrote: > What am I doing wrong here? I've gotten the code down to a really > small example, but I think I'm missing something minor. > > ------------------------ > #lang web-server/insta > > (require web-server/formlets) > > (define login-formlet > ?(formlet > ? (div > ? ?"Username:" ,{(to-string (required (text-input))) . => . username} > ? ?"Password:" ,{(to-string (required (password-input))) . => . password}) > ? (list username password))) > > (define (start req) > ?`(html (head (title "Home Page")) > ? ? ? ? (body (h1 "Home Page") > ? ? ? ? ? ? ? ,(formlet-display login-formlet)))) > -------------------------- > > Running this gives this error: > > you broke the contract xexpr? on start; Not an Xexpr. Expected a > symbol as the element name, given (div () "Username:" (input ((name > "input_0") (type "text"))) "Password:" (input ((name "input_1") (type > "text")))) > > It looks like there's an extra () in the formlet-display result that's > not there in the docs here: > > http://docs.plt-scheme.org/web-server/formlets.html#(part._.Basic_.Formlet_.Usage) > > Thanks, > Todd > > P.S. Yes, I know I'm missing a tag and all kinds of other > stuff. I just want to see if I can display the inputs before I do all > the rest of the stuff. > _________________________________________________ > ?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 jay.mccarthy at gmail.com Mon Aug 3 23:34:44 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Aug 3 23:35:07 2009 Subject: [plt-scheme] scheme code in SlideShow In-Reply-To: References: Message-ID: I think you are looking for the code macro documented here: http://docs.plt-scheme.org/slideshow/Typesetting_Scheme_Code.html But if you also want evaluation, then you'll also want to read about clickbacks http://docs.plt-scheme.org/slideshow/Primary_Slide_Functions.html#(def._((lib._slideshow/base..ss)._clickback)) Jay On Mon, Aug 3, 2009 at 9:20 PM, Skeptic . wrote: > > Hi, > Is there an easy way to add scheme code (or REPL interractions) in a > SlideShow ? Or should I stay with Scribble instead ? > > Thanks. > > > ________________________________ > Cr?ez un personnage ? votre image pour votre WL Messenger Venez voir > _________________________________________________ > ?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 czhu at cs.utah.edu Mon Aug 3 23:40:24 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Mon Aug 3 23:40:55 2009 Subject: [plt-scheme] scheme code in SlideShow In-Reply-To: References: Message-ID: <4A77ADA8.8060804@cs.utah.edu> I just use `code' provided from slideshow/code. If it's some REPL interaction, (code > (input) output) looks fine to me. Chongkai Skeptic . wrote: > > Hi, > > Is there an easy way to add scheme code (or REPL interractions) in a > SlideShow ? Or should I stay with Scribble instead ? > > Thanks. > > > > ------------------------------------------------------------------------ > Cr?ez un personnage ? votre image pour votre WL Messenger Venez voir > > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From andrew-scheme at areilly.bpc-users.org Mon Aug 3 23:56:44 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Mon Aug 3 23:57:05 2009 Subject: [plt-scheme] Examples of subprocess use, for expect-like dialogs? Message-ID: <20090804035644.GA34599@duncan.reilly.home> Hi all, Does anyone know of code examples or guide-level documentation that describes the why-s, wherefores and gotchas associated with (subprocess)? I'm trying to do some expect-style chatting to an interactive command-line executable, and I suspect that I'm bumping into a buffer flushing or discipline issue and can't figure out what I'm doing wrong. I haven't tried using separate threads, because it *should* be OK for the read-line side of the equation to block until the subprocess proudces output: it should respond immediately. What is even more confusing, is that simple examples that I've tried work or fail (block forever, usually) depending on what appear to be unrelated details. For example, this works as expected: (let-values (((proc in-p outp errp) (subprocess #f #f #f "/bin/cat"))) (display "foo bar baz quux and so on" outp) (newline outp) (flush-output outp) (display (read-line in-p)) (newline) (display "1 2 3 4" outp) (newline outp) (flush-output outp) (display (read-line in-p)) (newline) (display " In other words, people like this treat the tools they use as, well, tools: they are good in so far as they are useful to the task at hand, and different tools are useful for different tasks. Now, pause for a minute and consider whether people are actually like this. On the whole they are not. In fact, for most people, most of the time, the aim is to put as many obstacles in the way of *getting stuff done* as possible. EOM" outp) (newline outp) (flush-output outp) (map (lambda (l) (display l) (newline)) (let loop () (let ((l (read-line in-p))) (cond ((eof-object? l) '()) ((string=? l "EOM") '()) (else (cons l (loop))))))) (close-input-port in-p) (close-output-port outp) (close-input-port errp) (subprocess-wait proc)) However if I change the subprocess call to: (subprocess #f #f #f "/bin/cat" "-n") then it blocks at the first read-line. It's not just the presence of the extra command line argument, either, because (subprocess #f #f #f "/bin/cat" "-") does work. Needless to say, my real task doesn't involve cat, and the possibility must exist that I've done something wrong there, too. Thoughts or suggestions? Cheers, -- Andrew From mflatt at cs.utah.edu Tue Aug 4 05:29:17 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Aug 4 05:29:38 2009 Subject: [plt-scheme] Examples of subprocess use, for expect-like dialogs? In-Reply-To: <20090804035644.GA34599@duncan.reilly.home> References: <20090804035644.GA34599@duncan.reilly.home> Message-ID: <20090804092918.B95B8650102@mail-svr1.cs.utah.edu> At Tue, 4 Aug 2009 13:56:44 +1000, Andrew Reilly wrote: > Does anyone know of code examples or guide-level documentation > that describes the why-s, wherefores and gotchas associated with > (subprocess)? I'm trying to do some expect-style chatting to an > interactive command-line executable, and I suspect that I'm > bumping into a buffer flushing or discipline issue and can't > figure out what I'm doing wrong. I haven't tried using separate > threads, because it *should* be OK for the read-line side of the > equation to block until the subprocess proudces output: it > should respond immediately. > > [...] > > However if I change the subprocess call to: > (subprocess #f #f #f "/bin/cat" "-n") > > then it blocks at the first read-line. On my machine, `cat -n' doesn't respond immediately unless the output is a terminal. `cat -n -u' responds immediately (but then the example gets stuck in the loop, since no result line is ever "EOM"). Beware, also, that if the multi-line string is much larger, then your example can get stuck due to the buffers between the processes. If you send a lot of text to `cat' without reading its output, then eventually `cat' will block writing output until your program reads some of it. If your program keeps writing, meanwhile, then it will eventually get stuck for the same reason, since `cat' is stuck and not reading the data that you're sending it. From jcoglan at googlemail.com Tue Aug 4 07:03:12 2009 From: jcoglan at googlemail.com (James Coglan) Date: Tue Aug 4 07:03:32 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: <73b251310908031132l434213a0t7d059c2e598684d3@mail.gmail.com> References: <20090225011519.GA14127@topoi.pooq.com> <5DEC3946-2ECD-419E-ADDF-BD131ECE23EE@ccs.neu.edu> <73b251310908031132l434213a0t7d059c2e598684d3@mail.gmail.com> Message-ID: 2009/8/3 Sam Phillips > On Tue, Feb 24, 2009 at 7:36 PM, Matthias Felleisen > wrote: > > And while I am writing an email to you: Olin Shivers is on > > the record saying that "you can write a Scheme interpreter in > > an afternoon, but you may spend a life-time maintaining it." > > What he really meant is that writing an interpreter for > > Scheme is really a trivial task. If you know EOPL or PLAI > > you design the interpreter and derive the abstract machine > > for your favorite language during the day time and you will > > write the run-time library during night time (assuming the > > language is GCed). But then people will start using your > > silly little interpreter, and before you know it, you have > > a bug database and you want to please those people and ... > > life's up. Got to go. > > This explains the Scheme in X implementations I've got littering my > home directory, that have never > been released. Speaking of releases, should it interest anybody here Heist 0.3 came out last week. It now supports all the R5RS data types and their libraries, and I've fixed a bunch of macro bugs that were present in the first release. The only R5RS stuff missing now is file I/O, and some continuation stuff -- `values`, `call-with-values` and `dynamic-wind` (`call/cc` has in been in since the first release). I'm also missing the exact/inexact converters -- can someone point me in the right direction for how to implement `rationalize`? James -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090804/cef2b8be/attachment.html From czhu at cs.utah.edu Tue Aug 4 09:03:55 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Tue Aug 4 09:04:26 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: References: <20090225011519.GA14127@topoi.pooq.com> <5DEC3946-2ECD-419E-ADDF-BD131ECE23EE@ccs.neu.edu> <73b251310908031132l434213a0t7d059c2e598684d3@mail.gmail.com> Message-ID: <4A7831BB.5080500@cs.utah.edu> I just checked both r5rs and r6rs. Their definition of "/simplest/ rational number" is more complex than it can be. Here's PLT's (and another system's) doc of rationalize: ---- (rationalize x tolerance) ? real? x : real? tolerance : real? Among the real numbers within (abs tolerance) of x, returns the one corresponding to an exact number whose denominator is smallest. If multiple integers are within tolerance of x, the one closest to 0 is used. ---- rationalize(x,dx) yields the rational number with smallest denominator that lies within dx of x. ---- in which you can see only to make the denominator smallest is enough. Is this enough hint for you to come to an algorithm? Chongkai James Coglan wrote: > > can someone point me in the right direction for how to implement > `rationalize`? > > James > From jcoglan at googlemail.com Tue Aug 4 09:15:43 2009 From: jcoglan at googlemail.com (James Coglan) Date: Tue Aug 4 09:16:03 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: <4A7831BB.5080500@cs.utah.edu> References: <20090225011519.GA14127@topoi.pooq.com> <5DEC3946-2ECD-419E-ADDF-BD131ECE23EE@ccs.neu.edu> <73b251310908031132l434213a0t7d059c2e598684d3@mail.gmail.com> <4A7831BB.5080500@cs.utah.edu> Message-ID: 2009/8/4 Chongkai Zhu > I just checked both r5rs and r6rs. Their definition of "/simplest/ rational > number" is more complex than it can be. Here's PLT's (and another system's) > doc of rationalize: > > ---- > (rationalize x tolerance) ? real? > x : real? > tolerance : real? > > Among the real numbers within (abs tolerance) of x, returns the one > corresponding to an exact number whose denominator is smallest. If multiple > integers are within tolerance of x, the one closest to 0 is used. > > ---- > > rationalize(x,dx) > yields the rational number with smallest denominator that lies within dx of > x. > > ---- > > in which you can see only to make the denominator smallest is enough. Is > this enough hint for you to come to an algorithm? That's certainly enough of a simplification to give me an idea, though I'm not sure it'll be very efficient. I'll try to implement it and post here for feedback. James -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090804/e2c29db2/attachment.html From jcoglan at googlemail.com Tue Aug 4 10:00:56 2009 From: jcoglan at googlemail.com (James Coglan) Date: Tue Aug 4 10:01:17 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: References: <20090225011519.GA14127@topoi.pooq.com> <5DEC3946-2ECD-419E-ADDF-BD131ECE23EE@ccs.neu.edu> <73b251310908031132l434213a0t7d059c2e598684d3@mail.gmail.com> <4A7831BB.5080500@cs.utah.edu> Message-ID: 2009/8/4 James Coglan > > > 2009/8/4 Chongkai Zhu > >> I just checked both r5rs and r6rs. Their definition of "/simplest/ >> rational number" is more complex than it can be. Here's PLT's (and another >> system's) doc of rationalize: >> >> ---- >> (rationalize x tolerance) ? real? >> x : real? >> tolerance : real? >> >> Among the real numbers within (abs tolerance) of x, returns the one >> corresponding to an exact number whose denominator is smallest. If multiple >> integers are within tolerance of x, the one closest to 0 is used. >> >> ---- >> >> rationalize(x,dx) >> yields the rational number with smallest denominator that lies within dx >> of x. >> >> ---- >> >> in which you can see only to make the denominator smallest is enough. Is >> this enough hint for you to come to an algorithm? > > > That's certainly enough of a simplification to give me an idea, though I'm > not sure it'll be very efficient. I'll try to implement it and post here for > feedback. > This is an attempt at finding the first rational with the smallest denominator that's in range. Anyone spot anything terribly wrong with it? (define (rationalize x tolerance) (cond [(rational? x) x] [(not (zero? (imag-part x))) (make-rectangular (rationalize (real-part x) tolerance) (rationalize (imag-part x) tolerance))] [else (let* ([t (abs tolerance)] [a (- x t)] [b (+ x t)] (do ([i 1 (+ i 1)] [z '()]) ((number? z) z) (let ([p (ceil (* a i))] [q (floor (* b i))]) (if (<= p q) (set! z (/ (if (positive? p) p q) i))))))])) James -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090804/f06af67e/attachment.htm From jcoglan at googlemail.com Tue Aug 4 10:07:13 2009 From: jcoglan at googlemail.com (James Coglan) Date: Tue Aug 4 10:07:34 2009 Subject: [plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby In-Reply-To: References: <20090225011519.GA14127@topoi.pooq.com> <5DEC3946-2ECD-419E-ADDF-BD131ECE23EE@ccs.neu.edu> <73b251310908031132l434213a0t7d059c2e598684d3@mail.gmail.com> <4A7831BB.5080500@cs.utah.edu> Message-ID: 2009/8/4 James Coglan > > > 2009/8/4 James Coglan > > >> >> 2009/8/4 Chongkai Zhu >> >>> I just checked both r5rs and r6rs. Their definition of "/simplest/ >>> rational number" is more complex than it can be. Here's PLT's (and another >>> system's) doc of rationalize: >>> >>> ---- >>> (rationalize x tolerance) ? real? >>> x : real? >>> tolerance : real? >>> >>> Among the real numbers within (abs tolerance) of x, returns the one >>> corresponding to an exact number whose denominator is smallest. If multiple >>> integers are within tolerance of x, the one closest to 0 is used. >>> >>> ---- >>> >>> rationalize(x,dx) >>> yields the rational number with smallest denominator that lies within dx >>> of x. >>> >>> ---- >>> >>> in which you can see only to make the denominator smallest is enough. Is >>> this enough hint for you to come to an algorithm? >> >> >> That's certainly enough of a simplification to give me an idea, though I'm >> not sure it'll be very efficient. I'll try to implement it and post here for >> feedback. >> > > This is an attempt at finding the first rational with the smallest > denominator that's in range. Anyone spot anything terribly wrong with it? > Apologies, `ceil` should have read `ceiling`: (define (rationalize x tolerance) (cond [(rational? x) x] [(not (zero? (imag-part x))) (make-rectangular (rationalize (real-part x) tolerance) (rationalize (imag-part x) tolerance))] [else (let* ([t (abs tolerance)] [a (- x t)] [b (+ x t)] (do ([i 1 (+ i 1)] [z '()]) ((number? z) z) (let ([p (ceiling (* a i))] [q (floor (* b i))]) (if (<= p q) (set! z (/ (if (positive? p) p q) i))))))])) James -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090804/533a3ddf/attachment.html From jensaxel at soegaard.net Tue Aug 4 10:11:15 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Tue Aug 4 10:11:34 2009 Subject: [plt-scheme] Changing source location information Message-ID: <4072c51f0908040711q4359430bv5c388670dd237580@mail.gmail.com> Hi All, I want to use the at-exp syntax for a little macro. My problem is how to produce the correct source location when reading from the string. A simple version of the problem can be seen in the macro foo below. The macro application (foo "(+ 1 x)") simply calls read-syntax on the string and returns the result. The problem is to get the correct source location for, say, x. A simple way to see the problem is to uncomment the definition for x - and see how DrScheme can't color the x red. What I need is a simple way to transfer the source location information from #'str to the port ip. #lang at-exp scheme (require (for-syntax scheme)) (define-syntax (foo stx) (syntax-case stx () [(_ str) (let ([ip (open-input-string (syntax->datum #'str))]) (port-count-lines! ip) (let ([result (read-syntax stx ip)]) ;(display #'str) (newline) ;(display result) (newline) (datum->syntax #'str (syntax->datum result))))])) (define x 3) (foo "(+ 1 x)") @foo{(+ 1 x)} -- Jens Axel S?gaard From eli at barzilay.org Tue Aug 4 10:27:32 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Aug 4 10:27:59 2009 Subject: [plt-scheme] Changing source location information In-Reply-To: <4072c51f0908040711q4359430bv5c388670dd237580@mail.gmail.com> References: <4072c51f0908040711q4359430bv5c388670dd237580@mail.gmail.com> Message-ID: <19064.17748.536808.317468@winooski.ccs.neu.edu> On Aug 4, Jens Axel S?gaard wrote: > Hi All, > > I want to use the at-exp syntax for a little macro. My problem is > how to produce the correct source location when reading from the > string. > > A simple version of the problem can be seen in the macro foo below. I'm not sure what is exactly the problem with at-exp -- I see both uses suffering from the same problem. In any case, I think that you're missing a third #'str in (datum->syntax #'str (syntax->datum result) #'str) ^^^^^ here (But I'm not sure I'm following the code, looks like the `syntax->datum' is a temporary hack to figure out what's wrong?) To make it work better, you'll want to scan the resulting syntax, and adjust source information from the string to correspond to the location in the real source. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From jensaxel at soegaard.net Tue Aug 4 10:35:07 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Tue Aug 4 10:35:26 2009 Subject: [plt-scheme] Changing source location information In-Reply-To: <19064.17748.536808.317468@winooski.ccs.neu.edu> References: <4072c51f0908040711q4359430bv5c388670dd237580@mail.gmail.com> <19064.17748.536808.317468@winooski.ccs.neu.edu> Message-ID: <4072c51f0908040735p1c2ae9c4n9c1a9394dfba492c@mail.gmail.com> Hi Eli, 2009/8/4 Eli Barzilay : > On Aug ?4, Jens Axel S?gaard wrote: >> Hi All, >> >> I want to use the at-exp syntax for a little macro. ?My problem is >> how to produce the correct source location when reading from the >> string. >> >> A simple version of the problem can be seen in the macro foo below. > > I'm not sure what is exactly the problem with at-exp -- >I see both uses suffering from the same problem. There is not a problem with at-exp. I wrote both versions to make sure the at-exp syntax wasn't causing the problem. > In any case, I think that > you're missing a third #'str in > > ?(datum->syntax #'str (syntax->datum result) #'str) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^^^^ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?here Ideally I'd like to write simply use result as-is. > (But I'm not sure I'm following the code, looks like the > `syntax->datum' is a temporary hack to figure out what's wrong?) Yes. > To make it work better, you'll want to scan the resulting syntax, and > adjust source information from the string to correspond to the > location in the real source. That's exactly what I was hoping to avoid, I am now experimeting a little with relocate-input-port. -- Jens Axel S?gaard From eli at barzilay.org Tue Aug 4 10:44:59 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Aug 4 10:45:21 2009 Subject: [plt-scheme] Changing source location information In-Reply-To: <4072c51f0908040735p1c2ae9c4n9c1a9394dfba492c@mail.gmail.com> References: <4072c51f0908040711q4359430bv5c388670dd237580@mail.gmail.com> <19064.17748.536808.317468@winooski.ccs.neu.edu> <4072c51f0908040735p1c2ae9c4n9c1a9394dfba492c@mail.gmail.com> Message-ID: <19064.18795.187720.950750@winooski.ccs.neu.edu> On Aug 4, Jens Axel S?gaard wrote: > > > To make it work better, you'll want to scan the resulting syntax, > > and adjust source information from the string to correspond to the > > location in the real source. > > That's exactly what I was hoping to avoid, > > I am now experimeting a little with relocate-input-port. I was about to take back the scan+change and suggest the relocated thing (I had a vague memory of something relevant, and took a while to reconstruct) -- but I'm not sure that it will work. You'll need to grab the source information from the string, and use that to do the relocation. This will require one hack, where you'd distinguish Scheme strings from at-exp strings, since the latter includes the quotation marks -- or better than that, just forbid Scheme strings. But things will also not work right when the string contents is not in direct correspondence with the source, like when you have escapes, or in the at-exp case, when you have an indented body. So maybe the scan+change is unavoidable, or implement a custom port that can change locations information dynamically. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eddieSull at hotmail.com Tue Aug 4 11:51:30 2009 From: eddieSull at hotmail.com (Eddie Sullivan) Date: Tue Aug 4 11:51:24 2009 Subject: [plt-scheme] XML ease of use Message-ID: Hello. I've lately been having all kinds of frustrations making things work with the XML library. The biggest hurdle seems to be keeping track of all the types. We have "document" and "element" and "content" and "prolog" and "entity" and "pcdata" and so on and so forth. Every function seems to accept a different type. I think it would be helpful if there were some kind of abstract super-type for at least some of these things. Something similar to what the "content/c" contract checks for would be ideal, so that all those items could be treated the same until we wanted to differentiate them. Except I would think that "pcdata" and the like would be subtypes of "element." One other thing that bites me every time is that the "content" field of the "element" structure is actually specified by the contract (listof content/c). Either the name is wrong or the contract is. I don't know if self-referential contracts are possible, but it would be nice if content/c was really something like (or/c (current-definition-of-content/c) (listof content/c)). That's only one possible solution, though. The reason I don't like getting this (listof content/c) is that there is not much useful I can do with it. Since it doesn't satisfy content/c, I can't pass it to xml->xexpr or write-xml/content. Since it's not a document, I can't pass it to write-xml. I suppose I could do (apply string-append (map write-xml thing)), but that seems more involved than it has to be. If I could treat (listof content/c) the same as content/c that would go a long way towards making things easier. A form like "xml-match" would be very helpful, too, to avoid having to delve into the internals of the different xml structures. I think PLT Scheme's XML capabilities are very close to being the best thing out there, so I hope you take these as constructive suggestions. Thanks! -Eddie Sullivan From jay.mccarthy at gmail.com Tue Aug 4 12:10:16 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Aug 4 12:10:38 2009 Subject: [plt-scheme] XML ease of use In-Reply-To: References: Message-ID: Hi Eddie, On Tue, Aug 4, 2009 at 9:51 AM, Eddie Sullivan wrote: > Hello. > I've lately been having all kinds of frustrations making things work with > the XML library. The biggest hurdle seems to be keeping track of all the > types. We have "document" and "element" and "content" and "prolog" and > "entity" and "pcdata" and so on and so forth. Every function seems to accept > a different type. The contracts in the XML library are very strict and specific to ensure that only correct XML (modulo the cdata escape valve) is generated. Each function accepts a different type because that is what they must accept. Perhaps what you'd like is some stratum of write/read-xml and xml->xexpr variants that deal with only the subtypes of document and element. These are implemented in the collect and could conceivably be exposed. Is that what you mean? > I think it would be helpful if there were some kind of abstract super-type > for at least some of these things. Something similar to what the "content/c" > contract checks for would be ideal, so that all those items could be treated > the same until we wanted to differentiate them. Except I would think that > "pcdata" and the like would be subtypes of "element." It sounds like you are saying that you'd like dispatching inside of the XML collect rather than selection outside of the XML collect. This is an imaginable supplement and I would consider including it in the collect, but I don't think the core library should change in that error-prone direction. With this approach, when you give the wrong type it is an error, in that regime you would get different behavior because a different dispatch would be invoked. > One other thing that bites me every time is that the "content" field of the > "element" structure is actually specified by the contract (listof > content/c). Either the name is wrong or the contract is. Unfortunately 'content' can be plural or singular in English. The element has content, that content is made up of a list of content item. A content item's contract is content/c and the element contains a number of these. Perhaps if it were easy to change from content to contents and not break too much code, I'd consider a change. > I don't know if self-referential contracts are possible, but it would be > nice if content/c was really something like (or/c > (current-definition-of-content/c) (listof content/c)). That's only one > possible solution, though. That would be incorrect in other cases, such as write-xml/content and xexpr->xml. > The reason I don't like getting this (listof content/c) is that there is not > much useful I can do with it. Since it doesn't satisfy content/c, I can't > pass it to xml->xexpr or write-xml/content. Since it's not a document, I > can't pass it to write-xml. I suppose I could do (apply string-append (map > write-xml thing)), but that seems more involved than it has to be. If I > could treat (listof content/c) the same as content/c that would go a long > way towards making things easier. You could write: (define (write-xml/contents cs) (for-each write-xml/content cs)) and use the same with-output-to-string that you would normally. This is the sort of thing that a patch might be reasonable. > A form like "xml-match" would be very helpful, too, to avoid having to delve > into the internals of the different xml structures. What would this do? Would it be an XQuery? > I think PLT Scheme's XML capabilities are very close to being the best thing > out there, so I hope you take these as constructive suggestions. > Thanks! > -Eddie Sullivan Thank _you_. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From eddieSull at hotmail.com Tue Aug 4 12:22:34 2009 From: eddieSull at hotmail.com (Eddie Sullivan) Date: Tue Aug 4 12:22:12 2009 Subject: [plt-scheme] XML ease of use References: Message-ID: Thanks for the reply, Jay. I guess your point is that since XML is strict about types, the library must be as well. That does make sense. I think I'll try Robby's suggested approach of converting xml to xexpr, processing, then converting back to xml. Is there any potential data loss I need to worry about with that approach? (BTW, I hope the tone of my original email wasn't too grumpy. It's still early in the morning here.) -Eddie Sullivan ----- Original Message ----- From: "Jay McCarthy" To: "Eddie Sullivan" Cc: Sent: Tuesday, August 04, 2009 9:10 AM Subject: Re: [plt-scheme] XML ease of use > Hi Eddie, > > On Tue, Aug 4, 2009 at 9:51 AM, Eddie Sullivan > wrote: >> Hello. >> I've lately been having all kinds of frustrations making things work with >> the XML library. The biggest hurdle seems to be keeping track of all the >> types. We have "document" and "element" and "content" and "prolog" and >> "entity" and "pcdata" and so on and so forth. Every function seems to >> accept >> a different type. > > The contracts in the XML library are very strict and specific to > ensure that only correct XML (modulo the cdata escape valve) is > generated. Each function accepts a different type because that is what > they must accept. Perhaps what you'd like is some stratum of > write/read-xml and xml->xexpr variants that deal with only the > subtypes of document and element. These are implemented in the collect > and could conceivably be exposed. Is that what you mean? > >> I think it would be helpful if there were some kind of abstract >> super-type >> for at least some of these things. Something similar to what the >> "content/c" >> contract checks for would be ideal, so that all those items could be >> treated >> the same until we wanted to differentiate them. Except I would think that >> "pcdata" and the like would be subtypes of "element." > > It sounds like you are saying that you'd like dispatching inside of > the XML collect rather than selection outside of the XML collect. This > is an imaginable supplement and I would consider including it in the > collect, but I don't think the core library should change in that > error-prone direction. With this approach, when you give the wrong > type it is an error, in that regime you would get different behavior > because a different dispatch would be invoked. > >> One other thing that bites me every time is that the "content" field of >> the >> "element" structure is actually specified by the contract (listof >> content/c). Either the name is wrong or the contract is. > > Unfortunately 'content' can be plural or singular in English. The > element has content, that content is made up of a list of content > item. A content item's contract is content/c and the element contains > a number of these. Perhaps if it were easy to change from content to > contents and not break too much code, I'd consider a change. > >> I don't know if self-referential contracts are possible, but it would be >> nice if content/c was really something like (or/c >> (current-definition-of-content/c) (listof content/c)). That's only one >> possible solution, though. > > That would be incorrect in other cases, such as write-xml/content and > xexpr->xml. > >> The reason I don't like getting this (listof content/c) is that there is >> not >> much useful I can do with it. Since it doesn't satisfy content/c, I can't >> pass it to xml->xexpr or write-xml/content. Since it's not a document, I >> can't pass it to write-xml. I suppose I could do (apply string-append >> (map >> write-xml thing)), but that seems more involved than it has to be. If I >> could treat (listof content/c) the same as content/c that would go a long >> way towards making things easier. > > You could write: > > (define (write-xml/contents cs) > (for-each write-xml/content cs)) > > and use the same with-output-to-string that you would normally. > > This is the sort of thing that a patch might be reasonable. > >> A form like "xml-match" would be very helpful, too, to avoid having to >> delve >> into the internals of the different xml structures. > > What would this do? Would it be an XQuery? > >> I think PLT Scheme's XML capabilities are very close to being the best >> thing >> out there, so I hope you take these as constructive suggestions. >> Thanks! >> -Eddie Sullivan > > Thank _you_. > > Jay > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > From robby at eecs.northwestern.edu Tue Aug 4 11:58:51 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Aug 4 12:29:15 2009 Subject: [plt-scheme] XML ease of use In-Reply-To: References: Message-ID: <932b2f1f0908040858x4d759017w788e15a699324720@mail.gmail.com> I know this isn't too much help, but I avoid most of that in my own programming by programming with xexprs most of the time and only using the XML structs right before I print out the xml, or right after I read it in. Robby On Tue, Aug 4, 2009 at 10:51 AM, Eddie Sullivan wrote: > Hello. > I've lately been having all kinds of frustrations making things work with > the XML library. The biggest hurdle seems to be keeping track of all the > types. We have "document" and "element" and "content" and "prolog" and > "entity" and "pcdata" and so on and so forth. Every function seems to accept > a different type. > > I think it would be helpful if there were some kind of abstract super-type > for at least some of these things. Something similar to what the "content/c" > contract checks for would be ideal, so that all those items could be treated > the same until we wanted to differentiate them. Except I would think that > "pcdata" and the like would be subtypes of "element." > > One other thing that bites me every time is that the "content" field of the > "element" structure is actually specified by the contract (listof > content/c). Either the name is wrong or the contract is. > > I don't know if self-referential contracts are possible, but it would be > nice if content/c was really something like (or/c > (current-definition-of-content/c) (listof content/c)). That's only one > possible solution, though. > > The reason I don't like getting this (listof content/c) is that there is not > much useful I can do with it. Since it doesn't satisfy content/c, I can't > pass it to xml->xexpr or write-xml/content. Since it's not a document, I > can't pass it to write-xml. I suppose I could do (apply string-append (map > write-xml thing)), but that seems more involved than it has to be. If I > could treat (listof content/c) the same as content/c that would go a long > way towards making things easier. > > A form like "xml-match" would be very helpful, too, to avoid having to delve > into the internals of the different xml structures. > > I think PLT Scheme's XML capabilities are very close to being the best thing > out there, so I hope you take these as constructive suggestions. > Thanks! > -Eddie Sullivan > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Tue Aug 4 12:34:34 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Aug 4 12:34:56 2009 Subject: [plt-scheme] XML ease of use In-Reply-To: References: Message-ID: On Tue, Aug 4, 2009 at 10:22 AM, Eddie Sullivan wrote: > Thanks for the reply, Jay. > I guess your point is that since XML is strict about types, the library must > be as well. That does make sense. > > I think I'll try Robby's suggested approach of converting xml to xexpr, > processing, then converting back to xml. Is there any potential data loss I > need to worry about with that approach? The xexpr syntax drops the prologs, misc entries, and p-is. Those are all at the top though, so you can recover them fairly easily. Jay > > (BTW, I hope the tone of my original email wasn't too grumpy. It's still > early in the morning here.) > > -Eddie Sullivan > > ----- Original Message ----- From: "Jay McCarthy" > To: "Eddie Sullivan" > Cc: > Sent: Tuesday, August 04, 2009 9:10 AM > Subject: Re: [plt-scheme] XML ease of use > > >> Hi Eddie, >> >> On Tue, Aug 4, 2009 at 9:51 AM, Eddie Sullivan >> wrote: >>> >>> Hello. >>> I've lately been having all kinds of frustrations making things work with >>> the XML library. The biggest hurdle seems to be keeping track of all the >>> types. We have "document" and "element" and "content" and "prolog" and >>> "entity" and "pcdata" and so on and so forth. Every function seems to >>> accept >>> a different type. >> >> The contracts in the XML library are very strict and specific to >> ensure that only correct XML (modulo the cdata escape valve) is >> generated. Each function accepts a different type because that is what >> they must accept. Perhaps what you'd like is some stratum of >> write/read-xml and xml->xexpr variants that deal with only the >> subtypes of document and element. These are implemented in the collect >> and could conceivably be exposed. Is that what you mean? >> >>> I think it would be helpful if there were some kind of abstract >>> super-type >>> for at least some of these things. Something similar to what the >>> "content/c" >>> contract checks for would be ideal, so that all those items could be >>> treated >>> the same until we wanted to differentiate them. Except I would think that >>> "pcdata" and the like would be subtypes of "element." >> >> It sounds like you are saying that you'd like dispatching inside of >> the XML collect rather than selection outside of the XML collect. This >> is an imaginable supplement and I would consider including it in the >> collect, but I don't think the core library should change in that >> error-prone direction. With this approach, when you give the wrong >> type it is an error, in that regime you would get different behavior >> because a different dispatch would be invoked. >> >>> One other thing that bites me every time is that the "content" field of >>> the >>> "element" structure is actually specified by the contract (listof >>> content/c). Either the name is wrong or the contract is. >> >> Unfortunately 'content' can be plural or singular in English. The >> element has content, that content is made up of a list of content >> item. A content item's contract is content/c and the element contains >> a number of these. Perhaps if it were easy to change from content to >> contents and not break too much code, I'd consider a change. >> >>> I don't know if self-referential contracts are possible, but it would be >>> nice if content/c was really something like (or/c >>> (current-definition-of-content/c) (listof content/c)). That's only one >>> possible solution, though. >> >> That would be incorrect in other cases, such as write-xml/content and >> xexpr->xml. >> >>> The reason I don't like getting this (listof content/c) is that there is >>> not >>> much useful I can do with it. Since it doesn't satisfy content/c, I can't >>> pass it to xml->xexpr or write-xml/content. Since it's not a document, I >>> can't pass it to write-xml. I suppose I could do (apply string-append >>> (map >>> write-xml thing)), but that seems more involved than it has to be. If I >>> could treat (listof content/c) the same as content/c that would go a long >>> way towards making things easier. >> >> You could write: >> >> (define (write-xml/contents cs) >> (for-each write-xml/content cs)) >> >> and use the same with-output-to-string that you would normally. >> >> This is the sort of thing that a patch might be reasonable. >> >>> A form like "xml-match" would be very helpful, too, to avoid having to >>> delve >>> into the internals of the different xml structures. >> >> What would this do? Would it be an XQuery? >> >>> I think PLT Scheme's XML capabilities are very close to being the best >>> thing >>> out there, so I hope you take these as constructive suggestions. >>> Thanks! >>> -Eddie Sullivan >> >> Thank _you_. >> >> Jay >> >> -- >> Jay McCarthy >> Assistant Professor / Brigham Young University >> http://teammccarthy.org/jay >> >> "The glory of God is Intelligence" - D&C 93 >> > > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From eddieSull at hotmail.com Tue Aug 4 14:25:14 2009 From: eddieSull at hotmail.com (Eddie Sullivan) Date: Tue Aug 4 14:24:54 2009 Subject: [plt-scheme] XML ease of use References: Message-ID: ----- Original Message ----- From: "Dave Gurnell" > Just the bit I know about: > > There's an xml-match in WebIt (on PLaneT). Not sure if it's up-to-date > for PLT 4. > Ah, that must be where the idea got into my head from. I guess if I'm going the xexpr route, it's a moot point, though. ----- Original Message ----- From: "Jay McCarthy" > The xexpr syntax drops the prologs, misc entries, and p-is. Those are > all at the top though, so you can recover them fairly easily. Ok, sounds like that's the way to go then. Thanks all for the quick replies. -Eddie From jensaxel at soegaard.net Tue Aug 4 15:07:45 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Tue Aug 4 15:08:04 2009 Subject: [plt-scheme] Changing source location information In-Reply-To: <4072c51f0908040735p1c2ae9c4n9c1a9394dfba492c@mail.gmail.com> References: <4072c51f0908040711q4359430bv5c388670dd237580@mail.gmail.com> <19064.17748.536808.317468@winooski.ccs.neu.edu> <4072c51f0908040735p1c2ae9c4n9c1a9394dfba492c@mail.gmail.com> Message-ID: <4072c51f0908041207t433fa653l3a72841a7cf81cd9@mail.gmail.com> 2009/8/4 Jens Axel S?gaard : > 2009/8/4 Eli Barzilay : >> On Aug ?4, Jens Axel S?gaard wrote: >>> I want to use the at-exp syntax for a little macro. ?My problem is >>> how to produce the correct source location when reading from the >>> string. > I am now experimeting a little with relocate-input-port. The experiments have led to the sample program below. Here the source location is correct, but the lexical information is not. Is there a way to get read-syntax to return syntax objects with lexical information such that example below will work? #lang at-exp scheme (require scheme/port (for-syntax scheme)) (define-syntax (foo stx) (syntax-case stx () [(_ str str* ...) (let* ([from-at? (syntax-property stx 'scribble)] [offset (if from-at? 0 1)] [ip (open-input-string (apply string-append (map syntax->datum (syntax->list #'(str str* ...)))))]) (display stx) (newline) (port-count-lines! ip) (let* ([line (syntax-line #'str)] [col (+ (syntax-column #'str) offset)] [pos (+ (syntax-position #'str) offset)]) (display (list line col pos)) (newline) (let ([rip (relocate-input-port ip line col pos)]) (port-count-lines! rip) (let ([result (read-syntax (syntax-source stx) rip)]) (display #'str) (newline) (display result) (newline) result #;(datum->syntax stx (syntax->datum result) stx stx stx)))))])) #;(datum->syntax #'stx result #f #'stx #'stx) (define x 3) (foo "( + 1 x)") @foo{( + 1 x)} From phelps.da at gmail.com Tue Aug 4 16:48:56 2009 From: phelps.da at gmail.com (Daniel) Date: Tue Aug 4 16:49:19 2009 Subject: [plt-scheme] Re: DrScheme: Reference to undefined identifier: require In-Reply-To: <37248c620908031758x79d806a9xf7ced7c524a7eebe@mail.gmail.com> References: <65aa6c6a-a57e-463f-aac0-b23d4744e330@a26g2000yqn.googlegroups.com> <37248c620908031758x79d806a9xf7ced7c524a7eebe@mail.gmail.com> Message-ID: <4c5c39ea-b5ec-4109-a0fb-55addae5ac44@g31g2000yqc.googlegroups.com> Zane: Your answer was right on, and I was able to figure out the details. Life seems a bit easier when using module, require and provide. I picked R5RS when I began, because DrScheme says it's "no frills", and I'm a no frills kind of guy. Following your recommendation broke a couple things, but nothing that could not be fixed in 5 minutes. This is how things ended up: In ch-2.scm: (module ch-2 mzscheme ; - A collection of super-clever solutions to problems in my textbook (provide $FUNCTION_NAMES)) In ch-2-tests.scm: (module ch-2-tests mzscheme (require "ch-2.scm") (require "dp-test-framework.scm") ; - The test suite for my impressive solutions. ) In dp-test-framework.scm: (module dp-test-framework mzscheme ;a pretty cute way to run tests and aggregate the results (provide $A_COUPLE_FUNCTIONS)) Based on what you see above, do I understand module, require and provide? Is this a good way to work with Scheme? Do you have any pointers for a newbie? I look forward to hearing your response. Thanks for your help so far. Sincerely, Daniel On Aug 3, 7:58?pm, Zane Shelby wrote: > Hey Daniel! > > The problem is 'require' isn't part of the R5RS language, so when you > try to use it in that language you're going to get an error. You could > use load, but that has slightly different behavior. > > Is there particular reason why you'd like to use r5rs? If not, I'd > recommend you use PLT Scheme by selecting 'module' from the pulldown > and putting '#lang scheme' at the top of your file. > > Hope that helps, > Zane > > > > On Mon, Aug 3, 2009 at 12:09 PM, Daniel wrote: > > Hello Everybody: > > ? ?I am new to Scheme, so please be patient with me. ?I have 2 files: > > ch2.scm and schemeTests.scm. ?I would like to include schemeTests.scm > > in the ch2.scm file. > > > According to the documentation, the include procedure "inlines the > > syntax in the file designated by path-spec in place of the include > > expression." ?http://docs.plt-scheme.org/reference/include.html?This > > behavior is what I need. ?However, I am having some trouble. > > Hopefully, this short interactive session can tell you something. > > > Welcome to DrScheme, version 4.2.1 [3m]. > > Language: R5RS; memory limit: 128 megabytes. > >> (require scheme/include) > > . . reference to undefined identifier: require > >> (include "schemeTests.scm") > > . . reference to undefined identifier: include > >> #lang scheme > > . . reference to undefined identifier: module > > > If I place a call to (require scheme/include) in my source file, I > > receive the same error. ?However, if I change the language from R5RS > > to advanced student custom, I get no complaints about 'require', but > > it breaks some of my previously existing code. ?What am I doing > > wrong? ?Your help and consideration is appreciated. > > > Sincerely, > > Daniel > > _________________________________________________ > > ?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 eddieSull at hotmail.com Tue Aug 4 17:40:56 2009 From: eddieSull at hotmail.com (Eddie Sullivan) Date: Tue Aug 4 17:40:29 2009 Subject: [plt-scheme] XML ease of use References: Message-ID: Sorry, one last question. I see that read-html-as-xml returns a (listof content/c). I would have expected this to return a document object. What is the best way to turn this returned value into an xexpr? Thanks. -Eddie From zaneshelby at gmail.com Tue Aug 4 18:01:36 2009 From: zaneshelby at gmail.com (Zane Shelby) Date: Tue Aug 4 18:02:18 2009 Subject: [plt-scheme] Re: DrScheme: Reference to undefined identifier: require In-Reply-To: <4c5c39ea-b5ec-4109-a0fb-55addae5ac44@g31g2000yqc.googlegroups.com> References: <65aa6c6a-a57e-463f-aac0-b23d4744e330@a26g2000yqn.googlegroups.com> <37248c620908031758x79d806a9xf7ced7c524a7eebe@mail.gmail.com> <4c5c39ea-b5ec-4109-a0fb-55addae5ac44@g31g2000yqc.googlegroups.com> Message-ID: <37248c620908041501k483bea3bu4c939ef3caaa3448@mail.gmail.com> Hey Daniel! Looking good. My only other comment would be that you're probably going to want to use the 'scheme' module rather than the 'mzscheme' module. 'mzscheme' is a legacy module language for previous versions of PLT Scheme. If you want the latest and greatest, then 'scheme' is the way to go, e.x.: (module xxx mzscheme ...) becomes (module xxx scheme ...) Aside from that, any detailed advice would be contingent upon knowing more about your background and your goals in learning Scheme, but here's the PLT Scheme Guide which may be useful: http://docs.plt-scheme.org/guide/index.html Good luck, and have fun! Zane On Tue, Aug 4, 2009 at 4:48 PM, Daniel wrote: > Zane: > ?Your answer was right on, and I was able to figure out the details. > Life seems a bit easier when using module, require and provide. ?I > picked R5RS when I began, because DrScheme says it's "no frills", and > I'm a no frills kind of guy. ?Following your recommendation broke a > couple things, but nothing that could not be fixed in 5 minutes. > > This is how things ended up: > > In ch-2.scm: > (module ch-2 mzscheme > ?; - A collection of super-clever solutions to problems in my > textbook > (provide $FUNCTION_NAMES)) > > In ch-2-tests.scm: > (module ch-2-tests mzscheme > ?(require "ch-2.scm") > ?(require "dp-test-framework.scm") > ?; ?- The test suite for my impressive solutions. > ) > > In dp-test-framework.scm: > (module dp-test-framework mzscheme > ?;a pretty cute way to run tests and aggregate the results > (provide $A_COUPLE_FUNCTIONS)) > > > Based on what you see above, do I understand module, require and > provide? ?Is this a good way to work with Scheme? ?Do you have any > pointers for a newbie? ?I look forward to hearing your response. > Thanks for your help so far. > > Sincerely, > Daniel > > On Aug 3, 7:58?pm, Zane Shelby wrote: >> Hey Daniel! >> >> The problem is 'require' isn't part of the R5RS language, so when you >> try to use it in that language you're going to get an error. You could >> use load, but that has slightly different behavior. >> >> Is there particular reason why you'd like to use r5rs? If not, I'd >> recommend you use PLT Scheme by selecting 'module' from the pulldown >> and putting '#lang scheme' at the top of your file. >> >> Hope that helps, >> Zane >> >> >> >> On Mon, Aug 3, 2009 at 12:09 PM, Daniel wrote: >> > Hello Everybody: >> > ? ?I am new to Scheme, so please be patient with me. ?I have 2 files: >> > ch2.scm and schemeTests.scm. ?I would like to include schemeTests.scm >> > in the ch2.scm file. >> >> > According to the documentation, the include procedure "inlines the >> > syntax in the file designated by path-spec in place of the include >> > expression." ?http://docs.plt-scheme.org/reference/include.html?This >> > behavior is what I need. ?However, I am having some trouble. >> > Hopefully, this short interactive session can tell you something. >> >> > Welcome to DrScheme, version 4.2.1 [3m]. >> > Language: R5RS; memory limit: 128 megabytes. >> >> (require scheme/include) >> > . . reference to undefined identifier: require >> >> (include "schemeTests.scm") >> > . . reference to undefined identifier: include >> >> #lang scheme >> > . . reference to undefined identifier: module >> >> > If I place a call to (require scheme/include) in my source file, I >> > receive the same error. ?However, if I change the language from R5RS >> > to advanced student custom, I get no complaints about 'require', but >> > it breaks some of my previously existing code. ?What am I doing >> > wrong? ?Your help and consideration is appreciated. >> >> > Sincerely, >> > Daniel >> > _________________________________________________ >> > ?For list-related administrative tasks: >> > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> ? For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Tue Aug 4 18:24:11 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Aug 4 18:24:34 2009 Subject: [plt-scheme] XML ease of use In-Reply-To: References: Message-ID: I think I would do `(html ,@(map content->xexpr (read-html-as-xml))) where content->xexpr was the right stuff using xml->xexpr. Jay On Tue, Aug 4, 2009 at 3:40 PM, Eddie Sullivan wrote: > Sorry, one last question. > I see that read-html-as-xml returns a (listof content/c). I would have > expected this to return a document object. What is the best way to turn this > returned value into an xexpr? > Thanks. > -Eddie > > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From eddieSull at hotmail.com Tue Aug 4 18:47:45 2009 From: eddieSull at hotmail.com (Eddie Sullivan) Date: Tue Aug 4 18:47:22 2009 Subject: [plt-scheme] XML ease of use References: Message-ID: It turns out read-html-as-xml was returning something like (list # # #), where the two pcdatas are whitespace and the element is an HTML element. I was able to write a simple function to go through and find the HTML element and call xml->xexpr on that. That seems a reasonable approach, assuming the HTML file is at least somewhat well-formed (which in my case I can). Thanks again. -Eddie ----- Original Message ----- From: "Jay McCarthy" >I think I would do > > `(html ,@(map content->xexpr (read-html-as-xml))) > > where content->xexpr was the right stuff using xml->xexpr. > > Jay > > On Tue, Aug 4, 2009 at 3:40 PM, Eddie Sullivan > wrote: >> Sorry, one last question. >> I see that read-html-as-xml returns a (listof content/c). I would have >> expected this to return a document object. What is the best way to turn >> this >> returned value into an xexpr? >> Thanks. >> -Eddie >> >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > From robby at eecs.northwestern.edu Tue Aug 4 19:42:47 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Aug 4 19:43:08 2009 Subject: [plt-scheme] Re: DrScheme: Reference to undefined identifier: require In-Reply-To: <4c5c39ea-b5ec-4109-a0fb-55addae5ac44@g31g2000yqc.googlegroups.com> References: <65aa6c6a-a57e-463f-aac0-b23d4744e330@a26g2000yqn.googlegroups.com> <37248c620908031758x79d806a9xf7ced7c524a7eebe@mail.gmail.com> <4c5c39ea-b5ec-4109-a0fb-55addae5ac44@g31g2000yqc.googlegroups.com> Message-ID: <932b2f1f0908041642k62b1a509mdbd8108db9ea85da@mail.gmail.com> On Tue, Aug 4, 2009 at 3:48 PM, Daniel wrote: > I picked R5RS when I began, because DrScheme says it's "no frills", and > I'm a no frills kind of guy. Apparently not. ;) Robby From phelps.da at gmail.com Tue Aug 4 20:38:38 2009 From: phelps.da at gmail.com (Daniel) Date: Tue Aug 4 20:38:59 2009 Subject: [plt-scheme] Re: DrScheme: Reference to undefined identifier: require In-Reply-To: <932b2f1f0908041642k62b1a509mdbd8108db9ea85da@mail.gmail.com> References: <65aa6c6a-a57e-463f-aac0-b23d4744e330@a26g2000yqn.googlegroups.com> <37248c620908031758x79d806a9xf7ced7c524a7eebe@mail.gmail.com> <4c5c39ea-b5ec-4109-a0fb-55addae5ac44@g31g2000yqc.googlegroups.com> <932b2f1f0908041642k62b1a509mdbd8108db9ea85da@mail.gmail.com> Message-ID: Ha! Bear with me; I'll figure out what's going on soon enough. Thanks again for your input, Zane. I'm sure to return in the near future with many more deep inquiries about the convoluted intricacies of Scheme. Have a nice day. :) Sincerely, Daniel On Aug 4, 6:42?pm, Robby Findler wrote: > On Tue, Aug 4, 2009 at 3:48 PM, Daniel wrote: > > I picked R5RS when I began, because DrScheme says it's "no frills", and > > I'm a no frills kind of guy. > > Apparently not. ;) > > Robby > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Wed Aug 5 04:59:22 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Aug 5 04:59:44 2009 Subject: [plt-scheme] Byte Swapping Bitmap Performance In-Reply-To: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> References: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> Message-ID: I've been playing around with squirting out bits of assembler when I need speed. It is amusing, but not yet really practical. So, after that completely useless statement, something helpful. Matthew has been rebuilding MrEd on top of Cairo. The code is here: http://svn.plt-scheme.org/plt/branches/mflatt/mred-experiment/ You might this implementation useful, and you might like to contribute further to it. I did a bit of work on the dc implementation -- you could take up where I left off. N. On Mon, Aug 3, 2009 at 7:28 PM, Sam Phillips wrote: > Hi, > > I've pieced together a simple foreign interface to cairo2 that draws to > a canvas. ?Cairo's image surfaces have a function > cairo_image_surface_get_data that exposes the raw bytes of the surface, > in the format that the surface is set up for. ?Setting up the surface to > use the ARGB32 format I would expect it to be trivial to do a > set-argb-pixels on a bitmap-dc and be done with it. > > Except that the bytes from cairo_image_surface_get_data come back as > BGRA, and I have to do a byte swapping operation before setting the > pixels in the bitmap-dc. ?Which adds about a second to each screen draw. > > Is there a faster way to do this that I'm missing? > > Cheers, > Sam > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From p3k at iki.fi Wed Aug 5 07:40:14 2009 From: p3k at iki.fi (Pekka Karjalainen) Date: Wed Aug 5 07:40:36 2009 Subject: [plt-scheme] Turtles module gives an error with 4.2 Message-ID: <233457100908050440xbe701eag4b17806b2ccb56e0@mail.gmail.com> If I write the following two lines in DrScheme 4.2 and press Run, it gives me an error message. #lang scheme (require graphics/turtles) The results is the following message. >define-compound-unit/infer: untagged initialization dependent signature mred^ is >supplied from a later unit with link temp3 Another attempt. This program works and shows the "spyro-gyra" image. I suppose the problem is with the traditional turtles module, since the two lines are all it takes for the error to come up. #lang scheme (require graphics/value-turtles) (require graphics/value-turtles-examples) (spyro-gyra (turtles 200 200)) This happens to me both with 4.2 that I installed on Windows with the installer and another 4.2 that I built from the source distrib on my laptop with Ubuntu 8.10. Finally, I spotted a typographical error: The documentation has a wrong name for the value-turtles-examples module on the Value Turtles page (doc/turtles/Value_Turtles.html). It doesn't have the s at the end of turtles under the heading "2.1 Examples," saying "(require graphics/value-turtle-examples)". The text below is missing the same s from the name too. Pekka Karjalainen From mflatt at cs.utah.edu Wed Aug 5 08:21:00 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Aug 5 08:21:22 2009 Subject: [plt-scheme] Byte Swapping Bitmap Performance In-Reply-To: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> References: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> Message-ID: <20090805122101.88B296500C6@mail-svr1.cs.utah.edu> At Mon, 3 Aug 2009 11:28:49 -0700, Sam Phillips wrote: > Except that the bytes from cairo_image_surface_get_data come back as > BGRA, and I have to do a byte swapping operation before setting the > pixels in the bitmap-dc. Which adds about a second to each screen draw. > > Is there a faster way to do this that I'm missing? 1 second sounds like a long time. Can you show the code that you're using for the swap? I tried (define (rgba->argb src) (let* ([len (bytes-length src)] [dest (make-bytes len)]) ; could be just src to overwrite (for ([i (in-range 0 len 4)]) (let ([r (bytes-ref src i)] [g (bytes-ref src (+ i 1))] [b (bytes-ref src (+ i 2))] [a (bytes-ref src (+ i 3))]) (bytes-set! dest i a) (bytes-set! dest (+ i 1) r) (bytes-set! dest (+ i 2) g) (bytes-set! dest (+ i 3) b))) dest)) which swaps a byte string representing a 1024x768 area in about 0.1 seconds on my machine. The following version is about twice as fast, because it uses `bytes-copy!' to shift the RGB part and then a loop to patch the A part: (define (rgba->argb2 src) (let* ([len (bytes-length src)] [dest (make-bytes len)]) (bytes-copy! dest 1 src 0 (sub1 len)) (for ([i (in-range 0 len 4)]) (let ([a (bytes-ref src (+ i 3))]) (bytes-set! dest i a))) dest)) Allocation of the new byte string account for about 1/3 of the time for that second version. So, if it's ok to update the array: (define (rgba->argb! src) (let* ([len (bytes-length src)] [dest src] [last (bytes-ref src (sub1 len))]) (bytes-copy! dest 1 src 0 (sub1 len)) (for ([i (in-range 0 (- len 4) 4)]) (let ([a (bytes-ref src (+ i 4))]) (bytes-set! dest i a))) (bytes-set! dest (- len 4) last))) which takes about 0.025 seconds on my machine for a 1024x768x4 byte string. It looks like an implementation of `rgba->argb!' in C would be about 10 times as fast as that last version. From robby at eecs.northwestern.edu Wed Aug 5 08:33:32 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Aug 5 08:33:56 2009 Subject: [plt-scheme] Turtles module gives an error with 4.2 In-Reply-To: <233457100908050440xbe701eag4b17806b2ccb56e0@mail.gmail.com> References: <233457100908050440xbe701eag4b17806b2ccb56e0@mail.gmail.com> Message-ID: <932b2f1f0908050533x661e92f1xb8f09612a79892d2@mail.gmail.com> The define-compound-unit/infer bug has been fixed in 4.2.1. Thanks for pointing out the docs typos. Robby On Wed, Aug 5, 2009 at 6:40 AM, Pekka Karjalainen wrote: > If I write the following two lines in DrScheme 4.2 and press Run, it > gives me an error message. > > #lang scheme > (require graphics/turtles) > > The results is the following message. > >>define-compound-unit/infer: untagged initialization dependent signature mred^ is >>supplied from a later unit with link temp3 > > Another attempt. This program works and shows the "spyro-gyra" image. > I suppose the problem is with the traditional turtles module, since > the two lines are all it takes for the error to come up. > > #lang scheme > (require graphics/value-turtles) > (require graphics/value-turtles-examples) > (spyro-gyra (turtles 200 200)) > > This happens to me both with 4.2 that I installed on Windows with the > installer and another 4.2 that I built from the source distrib on my > laptop with Ubuntu 8.10. > > Finally, I spotted a typographical error: The documentation has a > wrong name for the value-turtles-examples module on the Value Turtles > page (doc/turtles/Value_Turtles.html). It doesn't have the s at the > end of turtles under the heading "2.1 Examples," saying "(require > graphics/value-turtle-examples)". The text below is missing the same s > from the name too. > > Pekka Karjalainen > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From thomas.gordon at fokus.fraunhofer.de Wed Aug 5 11:37:13 2009 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Wed Aug 5 11:45:25 2009 Subject: [plt-scheme] Reimplementation of MrEd in Cairo/GTK? References: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> Message-ID: Noel Welsh writes: > So, after that completely useless statement, something helpful. > Matthew has been rebuilding MrEd on top of Cairo. The code is here: > > http://svn.plt-scheme.org/plt/branches/mflatt/mred-experiment/ > Very interesting! Just Cairo, or also on the foundation of the rest of GTK+? What seems attractive and promising about GTK to you, to be worth the trouble of porting MrEd? There seem to be several efforts underway to implement a GUI library for Scheme on the basis of GTK. Ypsilon, for example, seems to have a fairly complete binding. Have you considered pooling your efforts? -Tom Gordon p.s. As a Mac user, I wonder how long it will take for GTK+ to mature on the Mac platform. I haven't had much luck getting GTK+ applications to compile, let alone run. From noelwelsh at gmail.com Wed Aug 5 12:40:26 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Aug 5 12:40:45 2009 Subject: [plt-scheme] Reimplementation of MrEd in Cairo/GTK? In-Reply-To: References: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> Message-ID: On Wed, Aug 5, 2009 at 4:37 PM, Tom Gordon wrote: > Very interesting! ?Just Cairo, or also on the foundation of the rest of GTK+? > What seems attractive and promising about GTK to you, > to be worth the trouble of porting MrEd? As I understand it, Cairo and the native toolkit on each platform (GTK on Linux). Cairo offers capabilities not found in the current MrEd, such as arbitrary rotations of paths, and a true alpha channel. N. From jpc-ml at zenburn.net Wed Aug 5 14:52:26 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Wed Aug 5 14:58:33 2009 Subject: [plt-scheme] Byte Swapping Bitmap Performance In-Reply-To: <20090805122101.88B296500C6@mail-svr1.cs.utah.edu> References: <73b251310908031128qee2ede4s71a80794084aef68@mail.gmail.com> <20090805122101.88B296500C6@mail-svr1.cs.utah.edu> Message-ID: <4A79D4EA.1050402@zenburn.net> On 8/5/09 2:21 PM, Matthew Flatt wrote: > It looks like an implementation of `rgba->argb!' in C would be about 10 > times as fast as that last version. AFAIK the pygame community is using regexps to do this. Maybe a byte-regexp replace is worth a try also in PLT Scheme? -- regards, Jakub Piotr C?apa From emmanuel.delaborde at cimex.com Wed Aug 5 20:09:34 2009 From: emmanuel.delaborde at cimex.com (Emmanuel Delaborde) Date: Wed Aug 5 20:09:59 2009 Subject: [plt-scheme] CGI file upload Message-ID: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> Hello I am turning a small web application using web/server into a cgi script so far so good, but I got stuck when I tried rewriting my file upload function the form to upload an image was: (form ((action ,(make-url add-image)) (method "post") (enctype "multipart/form-data")) (input ((type "file")(name "image"))) (input ((type "submit")))) and the form handler was: (define (add-image request) (match (bindings-assq #"image" (request-bindings/raw request)) [(? binding:file? b) (let ([filename (bytes->string/utf-8 (binding:file- filename b))]) (save-image! (binding:file-content b) filename images-path) (portfolio-insert-image! a-portfolio filename)) ]) (admin (redirect/get))) this worked fine. I got the filename with: (binding:file-filename b) and the file content with: (binding:file-content b) Now I am trying to write the same function using what is provided by net/cgi, namely : (get-bindings) (extract-bindings key? bindings) (extract-binding/single key? bindings) It seems pretty straightforward when it comes to simple form values, but not so with a file upload... Can I get both the file name and the file content through the bindings functions ? Has anybody a simple cgi script dealing with file upload, laying around ? Thanks E. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090806/8f1048e5/attachment.htm From andrew-scheme at areilly.bpc-users.org Wed Aug 5 21:03:14 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Wed Aug 5 21:03:43 2009 Subject: [plt-scheme] Examples of subprocess use, for expect-like dialogs? In-Reply-To: <20090804092918.B95B8650102@mail-svr1.cs.utah.edu> References: <20090804035644.GA34599@duncan.reilly.home> <20090804092918.B95B8650102@mail-svr1.cs.utah.edu> Message-ID: <20090806010314.GA87647@duncan.reilly.home> Hi Matthew, Thanks for the feedback! On Tue, Aug 04, 2009 at 03:29:17AM -0600, Matthew Flatt wrote: > On my machine, `cat -n' doesn't respond immediately unless the output > is a terminal. `cat -n -u' responds immediately (but then the example > gets stuck in the loop, since no result line is ever "EOM"). Hmm. So it does. I had to write a script to cat -n to a file, and watch that with tail -f to see it happening. I doubt that the command-line interface to the program that I'm using does that kind of "special" processing, unless it's something in the C library that defaults that way... (which it does: see below) > Beware, also, that if the multi-line string is much larger, then your > example can get stuck due to the buffers between the processes. If you > send a lot of text to `cat' without reading its output, then eventually > `cat' will block writing output until your program reads some of it. If > your program keeps writing, meanwhile, then it will eventually get > stuck for the same reason, since `cat' is stuck and not reading the > data that you're sending it. I figured that one out, by putting the send part of my send/receive function into a thread: (define/contract (send-receive cmd receiver) (-> string? (-> any/c) any/c) (erlog "> " cmd) (let ((thr (thread (lambda () (display cmd) (newline) (flush-output))))) (begin0 (receiver) (thread-wait thr)))) That's pretty cool, I think. The least effort I've ever expended to make something useful happen in a thread! Your comment about "cat -n" having different behaviour reminded me that I'd read something along those lines as part of the normal C stdio library. On the Unix systems that I use, it does a similar thing by default: line buffered to console, but block buffered otherwise. Since I have the source for the application I'm talking to, I inserted a fflush(stdout) at the end of the while(fgets(...)) loop and now everything works beautifully! Cheers, -- Andrew From beratn at gmail.com Thu Aug 6 07:24:35 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Thu Aug 6 07:48:25 2009 Subject: [plt-scheme] an misunderstandable error Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: working-f1wae.scm Type: text/x-scheme Size: 22837 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090806/11070bf6/working-f1wae-0001.bin From jay.mccarthy at gmail.com Thu Aug 6 08:03:13 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 6 08:03:36 2009 Subject: [plt-scheme] an misunderstandable error In-Reply-To: References: Message-ID: The PLAI package is not a library that you require. It is a separate language. Put DrScheme in the module language and write #lang planet plai/plai:1:3 at the top of your file. This will allow you to write in the PLAI language. Refer to the documentation: http://planet.plt-scheme.org/package-source/plai/plai.plt/1/3/planet-docs/plai/index.html for more information. Jay PS. I know the instructions about the book [1] refer to the require line, but that it is only to install the package, not to use it regularly. Actually, starting your program with the require line or the #lang line will both result in the installation of the package. 1. http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ On Thu, Aug 6, 2009 at 5:24 AM, emre berat nebio?lu wrote: > Hey i am using drscheme 4.2 and my language mode Pretty big > and i am reading plai.Because of this i am using > (require (planet plai/plai:1:3)) > but when i try to debug my program to understand the function because almost > all function is from plai book. > I took this error > > compile: unbound identifier (and no #%top syntax transformer is bound) in: > num13 > > How can i fix this error.My program is excuted truly.I am sending an > attachment that involves the code. > > _________________________________________________ > ?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 beratn at gmail.com Thu Aug 6 08:17:04 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Thu Aug 6 08:17:26 2009 Subject: [plt-scheme] an misunderstandable error In-Reply-To: References: Message-ID: it is not necessary to write $lang plai.I choose language plai scheme.That fixed. On Thu, Aug 6, 2009 at 3:03 PM, Jay McCarthy wrote: > The PLAI package is not a library that you require. > > It is a separate language. > > Put DrScheme in the module language and write > > #lang planet plai/plai:1:3 > > at the top of your file. This will allow you to write in the PLAI > language. Refer to the documentation: > > > http://planet.plt-scheme.org/package-source/plai/plai.plt/1/3/planet-docs/plai/index.html > > for more information. > > Jay > > PS. I know the instructions about the book [1] refer to the require > line, but that it is only to install the package, not to use it > regularly. Actually, starting your program with the require line or > the #lang line will both result in the installation of the package. > > 1. http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ > > On Thu, Aug 6, 2009 at 5:24 AM, emre berat nebio?lu > wrote: > > Hey i am using drscheme 4.2 and my language mode Pretty big > > and i am reading plai.Because of this i am using > > (require (planet plai/plai:1:3)) > > but when i try to debug my program to understand the function because > almost > > all function is from plai book. > > I took this error > > > > compile: unbound identifier (and no #%top syntax transformer is bound) > in: > > num13 > > > > How can i fix this error.My program is excuted truly.I am sending an > > attachment that involves the code. > > > > _________________________________________________ > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090806/df9a0eb4/attachment.htm From jay.mccarthy at gmail.com Thu Aug 6 08:20:12 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 6 08:20:33 2009 Subject: [plt-scheme] an misunderstandable error In-Reply-To: References: Message-ID: Yes, both are options. (I mentioned the #lang one because I've had one or two reports of problems the other way.) Jay On Thu, Aug 6, 2009 at 6:17 AM, emre berat nebio?lu wrote: > it is not necessary to write $lang plai.I choose language plai scheme.That > fixed. > > On Thu, Aug 6, 2009 at 3:03 PM, Jay McCarthy wrote: >> >> The PLAI package is not a library that you require. >> >> It is a separate language. >> >> Put DrScheme in the module language and write >> >> #lang planet plai/plai:1:3 >> >> at the top of your file. This will allow you to write in the PLAI >> language. Refer to the documentation: >> >> >> http://planet.plt-scheme.org/package-source/plai/plai.plt/1/3/planet-docs/plai/index.html >> >> for more information. >> >> Jay >> >> PS. I know the instructions about the book [1] refer to the require >> line, but that it is only to install the package, not to use it >> regularly. Actually, starting your program with the require line or >> the #lang line will both result in the installation of the package. >> >> 1. http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ >> >> On Thu, Aug 6, 2009 at 5:24 AM, emre berat nebio?lu >> wrote: >> > Hey i am using drscheme 4.2 and my language mode Pretty big >> > and i am reading plai.Because of this i am using >> > (require (planet plai/plai:1:3)) >> > but when i try to debug my program to understand the function because >> > almost >> > all function is from plai book. >> > I took this error >> > >> > compile: unbound identifier (and no #%top syntax transformer is bound) >> > in: >> > num13 >> > >> > How can i fix this error.My program is excuted truly.I am sending an >> > attachment that involves the code. >> > >> > _________________________________________________ >> > ?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 > > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From gmarceau at gmail.com Wed Aug 5 10:13:33 2009 From: gmarceau at gmail.com (Guillaume Marceau) Date: Thu Aug 6 08:49:01 2009 Subject: [plt-scheme] Re: debugging [mini rant] In-Reply-To: <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> References: <20090728211256.GA999@mail.mac.com> <1248818355.16007.43.camel@drserver> <4072c51f0907281523u5eb44e63t48c4fb054dc13775@mail.gmail.com> <1248823047.16007.50.camel@drserver> <4072c51f0907290513ra45b00et82fba93c3e09986a@mail.gmail.com> <20090729121957.GF14493@mail.mac.com> <9bd8a08a0907290532p597ec463mcb59b4e8d4e8ce63@mail.gmail.com> <65e1d50c0907290748o333b5ae2v7b0efae26940600@mail.gmail.com> <9bd8a08a0907290759i62558ecdqe3df41436ba4e877@mail.gmail.com> Message-ID: <428ec724-6ed2-4869-9632-4376665f6d2c@w41g2000yqb.googlegroups.com> On Jul 29, 10:59?am, Elena Garrulo wrote: > > Could you provide some link, please? I have not found any reference in PLT docs. The graphical debugger is implemented in collects/gui-debugger/debug- tool.ss (1500 lines of code) The annotator that makes it possible to set breakpoints and inspect the stack is implemented in collects/gui-debugger/annotator.ss (400 lines) in concert with marks.ss (185 lines) From jay.mccarthy at gmail.com Thu Aug 6 12:43:58 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 6 12:44:21 2009 Subject: [plt-scheme] CGI file upload In-Reply-To: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> References: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> Message-ID: On Wed, Aug 5, 2009 at 6:09 PM, Emmanuel Delaborde wrote: > Hello > I am turning a small web application using web/server into a cgi script > so far so good, but I got stuck when I tried rewriting my file upload > ?function > the form to upload an image was: > (form ((action ,(make-url add-image)) > ?? ? ? ? ? ? ? ? ? ? ? ? ? (method "post") > ?? ? ? ? ? ? ? ? ? ? ? ? ? (enctype "multipart/form-data")) > ?? ? ? ? ? ? ? ? ? ? ? ? ?(input ((type "file")(name "image"))) > ?? ? ? ? ? ? ? ? ? ? ? ? ?(input ((type "submit")))) > > and the form handler was: > (define (add-image request) > ?? ? ? ? ? ?(match > ?? ? ? ? ? ? ? ?(bindings-assq?#"image"?(request-bindings/raw request)) > ?? ? ? ? ? ? ?[(? binding:file? b) > ?? ? ? ? ? ? ? (let ([filename (bytes->string/utf-8 (binding:file-filename > b))]) > ?? ? ? ? ? ? ? ? (save-image! (binding:file-content b)?filename?images-path) > ?? ? ? ? ? ? ? ? (portfolio-insert-image! a-portfolio filename)) > ?? ? ? ? ? ? ? ]) > ?? ? ? ? ? ?(admin (redirect/get))) > this worked fine. > I got the filename with: (binding:file-filename b) > and the file content with:?(binding:file-content b) > Now I am trying to write the same function?using what is provided by > net/cgi, namely : > (get-bindings) > (extract-bindings?key??bindings) > (extract-binding/single?key??bindings) > It seems pretty straightforward when it comes to simple form values, but not > so with a file upload... > Can I get both the file name and the file content through the bindings > functions ? > Has anybody a simple cgi script dealing with file upload, laying around ? > Thanks > E. You have discovered the reason to get rid of the extract-bindings API. I don't know of any work around for CGI scripts. Perhaps the file content is just on stdin after get-bindings... but I really don't know. You could try piping stdin to the web-server http request parser and use it's http structs, but from a cgi script, but I haven't tried it before. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From emmanuel.delaborde at cimex.com Thu Aug 6 12:55:15 2009 From: emmanuel.delaborde at cimex.com (emmanuel.delaborde) Date: Thu Aug 6 12:56:05 2009 Subject: [plt-scheme] CGI file upload In-Reply-To: References: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> Message-ID: <3238BDCE-3088-4691-92FD-7D04ED4E9D02@cimex.com> Hi Jay I thought it would be fairly straightforward, and that maybe I was missing something or else the CGI PLT docs had omitted this use case... Still, I'd like to make some progress, can you advise or give me some pointers on 1) how to read from stdin from my CGI script and 2) using the web-server http request parser ? Thanks in advance E.D On 6 Aug 2009, at 17:43, Jay McCarthy wrote: > On Wed, Aug 5, 2009 at 6:09 PM, Emmanuel > Delaborde wrote: >> Hello >> I am turning a small web application using web/server into a cgi >> script >> so far so good, but I got stuck when I tried rewriting my file upload >> function >> the form to upload an image was: >> (form ((action ,(make-url add-image)) >> (method "post") >> (enctype "multipart/form-data")) >> (input ((type "file")(name "image"))) >> (input ((type "submit")))) >> >> and the form handler was: >> (define (add-image request) >> (match >> (bindings-assq #"image" (request-bindings/raw >> request)) >> [(? binding:file? b) >> (let ([filename (bytes->string/utf-8 (binding:file- >> filename >> b))]) >> (save-image! (binding:file-content b) filename >> images-path) >> (portfolio-insert-image! a-portfolio filename)) >> ]) >> (admin (redirect/get))) >> this worked fine. >> I got the filename with: (binding:file-filename b) >> and the file content with: (binding:file-content b) >> Now I am trying to write the same function using what is provided by >> net/cgi, namely : >> (get-bindings) >> (extract-bindings key? bindings) >> (extract-binding/single key? bindings) >> It seems pretty straightforward when it comes to simple form >> values, but not >> so with a file upload... >> Can I get both the file name and the file content through the >> bindings >> functions ? >> Has anybody a simple cgi script dealing with file upload, laying >> around ? >> Thanks >> E. > > You have discovered the reason to get rid of the extract-bindings API. > > I don't know of any work around for CGI scripts. Perhaps the file > content is just on stdin after get-bindings... but I really don't > know. > > You could try piping stdin to the web-server http request parser and > use it's http structs, but from a cgi script, but I haven't tried it > before. > > Jay > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 -- Emmanuel Delaborde Web Technologist Cimex 53-55 Scrutton Street, London UK, EC2A 4PJ T: +44 (0)20 7324 7780 F: +44 (0)20 7324 7781 http://www.cimex.com ----------------------------------------------------------------------------------------------- This e-mail (and any attachments) is confidential and may contain personal views which are not the views of Cimex Media Ltd and any affiliated companies, unless specifically stated. It is intended for the use of the individual or group to whom it is addressed. If you have received it in error, please delete it from your system, do not use, copy or disclose the information in any way nor act in reliance on it and please notify postmaster@cimex.com A company registered in England Wales. Company Number 03765711 Registered Office : The Olde Bakehouse, 156 Watling Street East, Towcester, Northants NN12 6DB This email was scanned by Postini, the leading provider in Managed Email Security. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090806/2fca3ee9/attachment.html From chust at web.de Thu Aug 6 13:04:23 2009 From: chust at web.de (Thomas Chust) Date: Thu Aug 6 13:04:46 2009 Subject: [plt-scheme] CGI file upload In-Reply-To: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> References: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> Message-ID: <1c1a33bc0908061004v21dd438ehe3529524f92d0ca5@mail.gmail.com> 2009/8/6 Emmanuel Delaborde : > [...] > I am turning a small web application using web/server into a cgi script > [...] Just a sidenote: It is probably far easier and will run faster to leave the PLT Scheme application as is and simply instruct your other web server to proxy requests for it. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From emmanuel.delaborde at cimex.com Thu Aug 6 13:07:48 2009 From: emmanuel.delaborde at cimex.com (emmanuel.delaborde) Date: Thu Aug 6 13:08:25 2009 Subject: [plt-scheme] CGI file upload In-Reply-To: <1c1a33bc0908061004v21dd438ehe3529524f92d0ca5@mail.gmail.com> References: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> <1c1a33bc0908061004v21dd438ehe3529524f92d0ca5@mail.gmail.com> Message-ID: <2DE01CE8-1512-475D-84A1-EAA34503C732@cimex.com> Hi Thomas, Yes, but unfortunately I cannot proxy to another server withat hosting I should probably change hosting But still, I am curious about how to get this working with PLT Scheme now ! E.D On 6 Aug 2009, at 18:04, Thomas Chust wrote: > 2009/8/6 Emmanuel Delaborde : >> [...] >> I am turning a small web application using web/server into a cgi >> script >> [...] > > Just a sidenote: It is probably far easier and will run faster to > leave the PLT Scheme application as is and simply instruct your other > web server to proxy requests for it. > > cu, > Thomas > > > -- > When C++ is your hammer, every problem looks like your thumb. -- Emmanuel Delaborde Web Technologist Cimex 53-55 Scrutton Street, London UK, EC2A 4PJ T: +44 (0)20 7324 7780 F: +44 (0)20 7324 7781 http://www.cimex.com ----------------------------------------------------------------------------------------------- This e-mail (and any attachments) is confidential and may contain personal views which are not the views of Cimex Media Ltd and any affiliated companies, unless specifically stated. It is intended for the use of the individual or group to whom it is addressed. If you have received it in error, please delete it from your system, do not use, copy or disclose the information in any way nor act in reliance on it and please notify postmaster@cimex.com A company registered in England Wales. Company Number 03765711 Registered Office : The Olde Bakehouse, 156 Watling Street East, Towcester, Northants NN12 6DB This email was scanned by Postini, the leading provider in Managed Email Security. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090806/da2951f5/attachment.htm From jay.mccarthy at gmail.com Thu Aug 6 13:11:15 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 6 13:11:57 2009 Subject: [plt-scheme] CGI file upload In-Reply-To: <3238BDCE-3088-4691-92FD-7D04ED4E9D02@cimex.com> References: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> <3238BDCE-3088-4691-92FD-7D04ED4E9D02@cimex.com> Message-ID: Here's what you'd do: * Create a connection with http://svn.plt-scheme.org/plt/trunk/collects/web-server/private/connection-manager.ss where the i-port is (current-input-port) * Call read-request from http://svn.plt-scheme.org/plt/trunk/collects/web-server/http/request.ss with the connection * Now you have a web-server style http request. Jay On Thu, Aug 6, 2009 at 10:55 AM, emmanuel.delaborde wrote: > Hi Jay > I thought it would be fairly straightforward, and that maybe I was missing > something or else the CGI PLT docs had omitted this use case... > Still, I'd like to make some progress, can you advise or give me some > pointers on 1) how to?read from stdin from my CGI script > and 2) using the?web-server http request parser ? > Thanks in advance > E.D > > On 6 Aug 2009, at 17:43, Jay McCarthy wrote: > > On Wed, Aug 5, 2009 at 6:09 PM, Emmanuel > Delaborde wrote: > > Hello > > I am turning a small web application using web/server into a cgi script > > so far so good, but I got stuck when I tried rewriting my file upload > > ?function > > the form to upload an image was: > > (form ((action ,(make-url add-image)) > > ?? ? ? ? ? ? ? ? ? ? ? ? ? (method "post") > > ?? ? ? ? ? ? ? ? ? ? ? ? ? (enctype "multipart/form-data")) > > ?? ? ? ? ? ? ? ? ? ? ? ? ?(input ((type "file")(name "image"))) > > ?? ? ? ? ? ? ? ? ? ? ? ? ?(input ((type "submit")))) > > and the form handler was: > > (define (add-image request) > > ?? ? ? ? ? ?(match > > ?? ? ? ? ? ? ? ?(bindings-assq?#"image"?(request-bindings/raw request)) > > ?? ? ? ? ? ? ?[(? binding:file? b) > > ?? ? ? ? ? ? ? (let ([filename (bytes->string/utf-8 (binding:file-filename > > b))]) > > ?? ? ? ? ? ? ? ? (save-image! (binding:file-content b)?filename?images-path) > > ?? ? ? ? ? ? ? ? (portfolio-insert-image! a-portfolio filename)) > > ?? ? ? ? ? ? ? ]) > > ?? ? ? ? ? ?(admin (redirect/get))) > > this worked fine. > > I got the filename with: (binding:file-filename b) > > and the file content with:?(binding:file-content b) > > Now I am trying to write the same function?using what is provided by > > net/cgi, namely : > > (get-bindings) > > (extract-bindings?key??bindings) > > (extract-binding/single?key??bindings) > > It seems pretty straightforward when it comes to simple form values, but not > > so with a file upload... > > Can I get both the file name and the file content through the bindings > > functions ? > > Has anybody a simple cgi script dealing with file upload, laying around ? > > Thanks > > E. > > You have discovered the reason to get rid of the extract-bindings API. > > I don't know of any work around for CGI scripts. Perhaps the file > content is just on stdin after get-bindings... but I really don't > know. > > You could try piping stdin to the web-server http request parser and > use it's http structs, but from a cgi script, but I haven't tried it > before. > > Jay > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > > -- > Emmanuel Delaborde > Web Technologist > Cimex > 53-55 Scrutton Street, London UK, EC2A 4PJ > T: +44 (0)20 7324 7780 > F: +44 (0)20 7324 7781 > http://www.cimex.com > > ----------------------------------------------------------------------------------------------- > > This e-mail (and any attachments) is confidential and may contain > personal views which are not the views of Cimex Media Ltd and > any affiliated companies, unless specifically stated. It is intended > for the use of the individual or group to whom it is addressed. If > you have received it in error, please delete it from your system, > do not use, copy or disclose the information in any way nor act in > reliance on it and please notify postmaster@cimex.com > > A company registered in England Wales. Company Number 03765711 > Registered Office : The Olde Bakehouse, 156 Watling Street East, Towcester, > Northants NN12 6DB > > This email was scanned by Postini, the leading provider in Managed Email > Security. > > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From plt at synx.us.to Thu Aug 6 14:14:17 2009 From: plt at synx.us.to (Synx) Date: Thu Aug 6 14:14:46 2009 Subject: [plt-scheme] Unit won't Import Message-ID: <4A7B1D79.8010102@synx.us.to> I'm having trouble a unit that imports another. It errors out on an "unbound identifier" and I'm not sure what I'm doing wrong. I made a test case that illustrates my confusion regarding units. I'll attach the files here. The 'thing unit has a procedure to test and create a dummy struct, given funny names because I wasn't sure if the default struct bindings were exporting right. The 'test unit imports the 'thing unit, only has a test procedure, which creates and tests a dummy 'thing struct. And finally "test.ss" does a 'define-values/invoke-unit/infer on the test unit and attempts to apply the subsequently defined value 'test. I'm not sure if the signature is wrong, of if I don't understand something about units, or what needs to be done. If I comment out the commented lines in "test.ss" it works fine, but it seems like that rather defeats the purpose of units in the first place. In my larger project I have recursive dependencies between units and thus can't pick a particular order to 'define-values/invoke-unit/infer them in. If I have to pick an order I may as well be using modules instead, or maybe parameterizing all these procedures so calling procedures can change the behavior of called procedures. I'm a bit new to units, just trying to figure them out. Any help would be appreciated. Might end up trying a new strategy anyway, but I was curious what was wrong with my understanding here. -------------- next part -------------- #lang scheme/signature thingy? foo-thing -------------- next part -------------- #lang scheme/unit (require "thing-sig.ss") (import) (export thing^) (define-struct thing (foo bar)) (define (foo-thing foo bar) (make-thing foo bar)) (define (thingy? thing) (thing? thing)) -------------- next part -------------- #lang scheme/signature test -------------- next part -------------- #lang scheme/unit (require "test-sig.ss") (require "thing-sig.ss") (import thing^) (export test^) (define (test) (if (thingy? (foo-thing 23 42)) (display "Yea\n") (display "Nay\n"))) -------------- next part -------------- #lang scheme/base (require "test-unit.ss") ;(require "thing-unit.ss") (require scheme/unit) ;(define-values/invoke-unit/infer thing@) (define-values/invoke-unit/infer test@) (test) From chust at web.de Thu Aug 6 14:08:34 2009 From: chust at web.de (Thomas Chust) Date: Thu Aug 6 14:17:00 2009 Subject: [plt-scheme] CGI file upload In-Reply-To: References: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> <3238BDCE-3088-4691-92FD-7D04ED4E9D02@cimex.com> Message-ID: <1c1a33bc0908061108j50d4eadavc07ba5305f36597b@mail.gmail.com> 2009/8/6 Jay McCarthy : > [...] > * Create a connection with > http://svn.plt-scheme.org/plt/trunk/collects/web-server/private/connection-manager.ss > where the i-port is (current-input-port) > * Call read-request from > http://svn.plt-scheme.org/plt/trunk/collects/web-server/http/request.ss > with the connection > * Now you have a web-server style http request. > [...] Hello, I would never expect that approach to work, and a quick glance at the code seems to confirm my doubts: A CGI program gets all the HTTP header information passed via environment variables and can only read the request *body* from standard input. The read-request procedure expects to read the headers before the body, though, so that code would have to be replaced by a problem specific version that reconstructs the HTTP headers from the environment. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From sstrickl at ccs.neu.edu Thu Aug 6 14:35:14 2009 From: sstrickl at ccs.neu.edu (Stevie Strickland) Date: Thu Aug 6 14:36:12 2009 Subject: [plt-scheme] Unit won't Import In-Reply-To: <4A7B1D79.8010102@synx.us.to> References: <4A7B1D79.8010102@synx.us.to> Message-ID: <2BD4A82D-2FDA-4A78-9555-3E11016078E4@ccs.neu.edu> On Aug 6, 2009, at 2:14 PM, Synx wrote: > The 'thing unit has a procedure to test and create a dummy struct, > given > funny names because I wasn't sure if the default struct bindings were > exporting right. The 'test unit imports the 'thing unit, only has a > test > procedure, which creates and tests a dummy 'thing struct. And finally > "test.ss" does a 'define-values/invoke-unit/infer on the test unit and > attempts to apply the subsequently defined value 'test. The short answer to your problem is that you need to link together the thing@ and test@ units before invoking the result. You can do this by: (define-compound-unit/infer cmpd@ (import) (export test^) (link thing@ test@)) (define-values/invoke-unit/infer cmpd@) or, if available in the version of PLT Scheme you're using, (define-values/invoke-unit/infer (link thing@ test@)) ----- The longer answer to your problem is that test imports the thing^ _signature_. This doesn't automatically link it with the thing@ unit, but instead specifies that it expects to be linked in some way that fulfills this signature (whether it be the thing@ unit or another unit that exports the thing^ signature). When you call define-values/invoke-unit/infer with a unit that imports signatures, it attempts to satisfy those signatures with values from the current environment. For example, if we have a signature and unit: (define-signature print^ (print)) (define-unit print-one@ (import print^) (export) (print 1)) Then we can just define print locally: (define (print x) (display x)) and then use define-values/invoke-unit/infer to satisfy the imports for print-one@ from our local definitions: (define-values/invoke-unit/infer print-one@) So the "unbound identifier" errors you're getting are due to the fact that you don't have local definitions of the imported names. However, in your case, you aren't trying to import them from local definitions, but rather from the thing@ unit, and thus should follow the short answer above. Stevie From acowley at seas.upenn.edu Thu Aug 6 14:36:40 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Thu Aug 6 14:37:00 2009 Subject: [plt-scheme] Unit won't Import In-Reply-To: <4A7B1D79.8010102@synx.us.to> References: <4A7B1D79.8010102@synx.us.to> Message-ID: <81addec70908061136w2b09e36dle36848bb67094ecd@mail.gmail.com> On Thu, Aug 6, 2009 at 2:14 PM, Synx wrote: > I'm having trouble a unit that imports another. It errors out on an > "unbound identifier" and I'm not sure what I'm doing wrong. I made a > test case that illustrates my confusion regarding units. I'll attach the > files here. > ... > I'm not sure if the signature is wrong, of if I don't understand > something about units, or what needs to be done. If I comment out the > commented lines in "test.ss" it works fine, but it seems like that > rather defeats the purpose of units in the first place. I take it you meant, "If I uncomment the commented lines..."? The purpose of Units in the architecture you've developed is that test-unit.ss does not mention thing-unit.ss. test@ will happily work for any Unit that exports the thing^ signature. If you want to use a different thing^ implementation, then you pull that in at the test.ss level, and never touch test@ or test^. Anthony From jay.mccarthy at gmail.com Thu Aug 6 14:49:11 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 6 14:49:35 2009 Subject: [plt-scheme] CGI file upload In-Reply-To: <1c1a33bc0908061108j50d4eadavc07ba5305f36597b@mail.gmail.com> References: <5ABE7E5B-D361-44AE-9CC4-BDE827EC4991@cimex.com> <3238BDCE-3088-4691-92FD-7D04ED4E9D02@cimex.com> <1c1a33bc0908061108j50d4eadavc07ba5305f36597b@mail.gmail.com> Message-ID: Good point. Obviously I have not done this, but I'm sure everything is in that file to make it work once you get the CGI information. I'm happy to take patches to that file that make the job easier. Jay On Thu, Aug 6, 2009 at 12:08 PM, Thomas Chust wrote: > 2009/8/6 Jay McCarthy : >> [...] >> * Create a connection with >> http://svn.plt-scheme.org/plt/trunk/collects/web-server/private/connection-manager.ss >> where the i-port is (current-input-port) >> * Call read-request from >> http://svn.plt-scheme.org/plt/trunk/collects/web-server/http/request.ss >> with the connection >> * Now you have a web-server style http request. >> [...] > > Hello, > > I would never expect that approach to work, and a quick glance at the > code seems to confirm my doubts: A CGI program gets all the HTTP > header information passed via environment variables and can only read > the request *body* from standard input. > > The read-request procedure expects to read the headers before the > body, though, so that code would have to be replaced by a problem > specific version that reconstructs the HTTP headers from the > environment. > > cu, > Thomas > > > -- > When C++ is your hammer, every problem looks like your thumb. > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From acowley at seas.upenn.edu Thu Aug 6 14:56:01 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Thu Aug 6 14:56:19 2009 Subject: [plt-scheme] Unit won't Import In-Reply-To: <4A7B1D79.8010102@synx.us.to> References: <4A7B1D79.8010102@synx.us.to> Message-ID: <81addec70908061156v4ac2695cu4f3310138ce18d95@mail.gmail.com> On Thu, Aug 6, 2009 at 2:14 PM, Synx wrote: > In my larger > project I have recursive dependencies between units and thus can't pick > a particular order to 'define-values/invoke-unit/infer them in. I didn't address this point earlier. If your units are evaluating their dependencies as part of their top-level evaluation, then mutual recursion could be problematic, but this is not restricted to the Units mechanism. If, on the other hand, you are defining functions in terms of dependencies, then you probably do not have a problem. Here is a silly example... Anthony #lang scheme (define-signature even^ (my-even?)) (define-signature odd^ (my-odd?)) (define-unit even@ (import odd^) (export even^) (define (my-even? x) (if (= x 0) #t (my-odd? (- x 1))))) (define-unit odd@ (import even^) (export odd^) (define (my-odd? x) (if (= x 0) #f (my-even? (- x 1))))) (define-compound-unit/infer num-checker@ (import) (export E O) (link (((E : even^)) even@ O) (((O : odd^)) odd@ E))) (define-values/invoke-unit/infer num-checker@) (my-even? 12) (my-odd? 14) From plt at synx.us.to Thu Aug 6 15:42:41 2009 From: plt at synx.us.to (Synx) Date: Thu Aug 6 15:43:16 2009 Subject: [plt-scheme] Unit won't Import In-Reply-To: <81addec70908061136w2b09e36dle36848bb67094ecd@mail.gmail.com> References: <4A7B1D79.8010102@synx.us.to> <81addec70908061136w2b09e36dle36848bb67094ecd@mail.gmail.com> Message-ID: <4A7B3231.5010101@synx.us.to> Anthony Cowley wrote: > I take it you meant, "If I uncomment the commented lines..."? fffff > The > purpose of Units in the architecture you've developed is that > test-unit.ss does not mention thing-unit.ss. test@ will happily work > for any Unit that exports the thing^ signature. Stevie Strickland wrote: > (define-compound-unit/infer cmpd@ > (import) > (export test^) > (link thing@ test@)) Oh... right! So without linking the units together I can't assume that whatever implements the thing^ signature is actually in "thing-unit.ss" or not. Only by making a new unit that requires both "thing-unit.ss" and "test-unit.ss" and specifies the two of them in a single compound unit that imports nothing, then I can be sure that test@ is using thing@, instead of what I had done which just said test@ is using thing^, but not necessarily thing@. From yinso.chen at gmail.com Thu Aug 6 22:01:02 2009 From: yinso.chen at gmail.com (YC) Date: Thu Aug 6 22:01:21 2009 Subject: [plt-scheme] web-server: serving web server files within a servlet Message-ID: <779bf2730908061901u709ebf7eyb7c0d1729d664636@mail.gmail.com> Hi - is there an "official" way to re-dispatch the request from a servlet to serve static files that the web server have access to? As a example - say that I want to have the servlet to manage all of the dispatch from root path. And I want /images/ to point to a file path that web-server already knows how to handle. I could of course write my own custom function to test to see if the path exists, and if so, open up the file and serve it out, but I am wondering if there is a way for the servlet to pass the request back to the web-server to serve the static files. Since the path is managed by the servlet, then the servlet is responsible to translate into something that the server will find. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090806/c8c676de/attachment.html From jay.mccarthy at gmail.com Thu Aug 6 22:03:28 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 6 22:03:49 2009 Subject: [plt-scheme] web-server: serving web server files within a servlet In-Reply-To: <779bf2730908061901u709ebf7eyb7c0d1729d664636@mail.gmail.com> References: <779bf2730908061901u709ebf7eyb7c0d1729d664636@mail.gmail.com> Message-ID: Ya, call next-dispatcher. [1] 1. http://docs.plt-scheme.org/web-server-internal/dispatch_ss.html#(def._((lib._web-server/dispatchers/dispatch..ss)._next-dispatcher)) Jay On Thu, Aug 6, 2009 at 8:01 PM, YC wrote: > Hi - > > is there an "official" way to re-dispatch the request from a servlet to > serve static files that the web server have access to? > > As a example - say that I want to have the servlet to manage all of the > dispatch from root path.? And I want /images/ to point to a file path that > web-server already knows how to handle.? I could of course write my own > custom function to test to see if the path exists, and if so, open up the > file and serve it out, but I am wondering if there is a way for the servlet > to pass the request back to the web-server to serve the static files.? Since > the path is managed by the servlet, then the servlet is responsible to > translate into something that the server will find. > > Thanks, > yc > > > > > > > _________________________________________________ > ?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 yinso.chen at gmail.com Fri Aug 7 03:33:47 2009 From: yinso.chen at gmail.com (YC) Date: Fri Aug 7 03:34:07 2009 Subject: [plt-scheme] web-server: serving web server files within a servlet In-Reply-To: References: <779bf2730908061901u709ebf7eyb7c0d1729d664636@mail.gmail.com> <779bf2730908062032s3d73c886ted0376ab41b7b91e@mail.gmail.com> Message-ID: <779bf2730908070033r7bbb8a2nec2185b7b80bc818@mail.gmail.com> On Thu, Aug 6, 2009 at 9:02 PM, Jay McCarthy wrote: > If you call next-dispatcher, the "current" request will be delivered > to the next dispatcher (such as the static file handler.) If you want > a different one, you could create your own dispatcher with a similar > for that uses a different request (maybe I should do that...?) Another > option is to return a redirect response. It seems that I am not understanding dispatcher well enough to use it - can (next-dispatcher) be called from within a servlet? I am getting the following error: (file "C:\\Local\\PLT4.1.3\\collects\\web-server\\dispatchers\\dispatch-servlets.ss") broke the contract (-> url? exn? response?) on servlet-error-responder; expected , given: # What I did was basically test to see if this is a path I wanted to handle, and throw exn:dispatcher... is there another way of using it? (define (start request) (let ((path-list (map path/param-path (url-path (request-uri request))))) (cond ((equal? path-list '("test")) `(p "this is a test resopnse")) (else ;; let web-server handle the path. (next-dispatcher))))) The servlet is run through serve/servlet. ;; web.ss #lang scheme/base (require web-server/servlet web-server/servlet-env "servlet1.ss" ) ;; why did the current-directory get reset? (thread (lambda () (serve/servlet start #:port 8800 #:servlet-path "/" #:launch-browser? #f #:listen-ip #f #:servlet-namespace '( "servlet1.ss") #:servlets-root (current-directory) #:servlet-regexp #px".*" #:server-root-path (current-directory) #:extra-files-paths (map string->path '("c:\\data\\ajax")) ))) ;; servlet1.ss #lang scheme/base (require (only-in web-server/servlet current-servlet-continuation-expiration-handler) web-server/managers/lru web-server/http/request-structs web-server/dispatchers/dispatch net/url ) (define interface-version 'v2) (define manager (create-LRU-manager current-servlet-continuation-expiration-handler 60 3600 (lambda () #t) #:initial-count 1 #:inform-p (lambda _ (void)))) (define (start request) (let ((path-list (map path/param-path (url-path (request-uri request))))) (cond ((equal? path-list '("test")) `(p "this is a test resopnse")) (else (next-dispatcher))))) (provide (all-defined-out)) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090807/eb3cf5e2/attachment.htm From wimmersimon at googlemail.com Thu Aug 6 16:52:09 2009 From: wimmersimon at googlemail.com (SiWi) Date: Fri Aug 7 06:16:44 2009 Subject: [plt-scheme] Re: Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <7D0AECA4-2DB2-479D-A21B-50E9C129EB22@ccs.neu.edu> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> <4072c51f0908021235l147a7afeg788a4ba5df6cdcd8@mail.gmail.com> <7D0AECA4-2DB2-479D-A21B-50E9C129EB22@ccs.neu.edu> Message-ID: <3691a303-e56b-494d-957b-ed583c3a6e3d@n2g2000vba.googlegroups.com> Thank you for your hints and tips first of all. As I've been on holiday the last days, I had no internet access and couln't reply to your posts therefore. > Question is what is your goal? > ? -- functional programming per se (as a philosopher, I would have to ? > question if it exists) > ? -- Scheme programming in a functional way? > ? -- Scheme programming in the 'best' possible way? > ? ? ? ? -- best could mean 'fastest' (as you saw Eli's program is faster ? > than yours) > ? ? ? ? -- best could mean 'suitable for proving theorems automatically' > ? ? ? ? -- and many more things My goal is functional programming in genreral and Scheme programming in the 'best' way. I'd also be interested in where exactly the differences between 'best' Scheme programming( where 'best' would rever to a mixture between speed and idiomatic Scheme programming) and 'best' functional programming style can be found. On a sidenote, I want to use the primes code to try out a few project euler problems with Scheme to get started with the language. Therefore speed matters a bit, but of course it should not be the world's most efficient prime numbers generator. :) > So the last question is: > ? -- perhaps you really want to learn to program in PLT Scheme so ? > that you can see what > ? ? ? ?elegant lazy functional programmers do, > ? ? ? ?strict lazy programmers, > ? ? ? ?OO programmers, > ? ? ? ?logic programmers, > ? ? ? ?and imperative programmers > without ever leaving the language. My main goal is to learn something new, not only PLT-Schme, but also about programming styles in general. Therefore I want to learn coding in Scheme in general, but I'm also interested in strict lazy and logic programming. I've done enough OO and imperative programming in other languages so I'm not really interested in that at the moment, although I would like to learn about this in Scheme as well. From pbewig at gmail.com Fri Aug 7 06:35:05 2009 From: pbewig at gmail.com (Phil Bewig) Date: Fri Aug 7 06:35:28 2009 Subject: [plt-scheme] Re: Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <3691a303-e56b-494d-957b-ed583c3a6e3d@n2g2000vba.googlegroups.com> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> <4072c51f0908021235l147a7afeg788a4ba5df6cdcd8@mail.gmail.com> <7D0AECA4-2DB2-479D-A21B-50E9C129EB22@ccs.neu.edu> <3691a303-e56b-494d-957b-ed583c3a6e3d@n2g2000vba.googlegroups.com> Message-ID: When you are ready for more, you can look at the exercises on my blog http://programmingpraxis.com. All the solutions are given in Scheme. One of the exercises is a Sieve of Eratosthenes. On Thu, Aug 6, 2009 at 3:52 PM, SiWi wrote: > Thank you for your hints and tips first of all. As I've been on > holiday the last days, I had no internet access and couln't reply to > your posts therefore. > > Question is what is your goal? > > -- functional programming per se (as a philosopher, I would have to > > question if it exists) > > -- Scheme programming in a functional way? > > -- Scheme programming in the 'best' possible way? > > -- best could mean 'fastest' (as you saw Eli's program is faster > > > than yours) > > -- best could mean 'suitable for proving theorems automatically' > > -- and many more things > > My goal is functional programming in genreral and Scheme programming > in the 'best' way. I'd also be interested in where exactly the > differences between 'best' Scheme programming( where 'best' would > rever to a mixture between speed and idiomatic Scheme programming) and > 'best' functional programming style can be found. > On a sidenote, I want to use the primes code to try out a few project > euler problems with Scheme to get started with the language. > Therefore speed matters a bit, but of course it should not be the > world's most efficient prime numbers generator. :) > > So the last question is: > > -- perhaps you really want to learn to program in PLT Scheme so > > that you can see what > > elegant lazy functional programmers do, > > strict lazy programmers, > > OO programmers, > > logic programmers, > > and imperative programmers > > without ever leaving the language. > > My main goal is to learn something new, not only PLT-Schme, but also > about programming styles in general. > Therefore I want to learn coding in Scheme in general, but I'm also > interested in strict lazy and logic programming. > I've done enough OO and imperative programming in other languages so > I'm not really interested in that at the moment, although I would like > to learn about this in Scheme as well. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090807/b3046d5b/attachment.html From jay.mccarthy at gmail.com Fri Aug 7 10:10:26 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Aug 7 10:11:31 2009 Subject: [plt-scheme] web-server: serving web server files within a servlet In-Reply-To: <779bf2730908070033r7bbb8a2nec2185b7b80bc818@mail.gmail.com> References: <779bf2730908061901u709ebf7eyb7c0d1729d664636@mail.gmail.com> <779bf2730908062032s3d73c886ted0376ab41b7b91e@mail.gmail.com> <779bf2730908070033r7bbb8a2nec2185b7b80bc818@mail.gmail.com> Message-ID: Your program works as expected for me on 4.2.1. Jay On Fri, Aug 7, 2009 at 1:33 AM, YC wrote: > > On Thu, Aug 6, 2009 at 9:02 PM, Jay McCarthy wrote: >> >> If you call next-dispatcher, the "current" request will be delivered >> to the next dispatcher (such as the static file handler.) If you want >> a different one, you could create your own dispatcher with a similar >> for that uses a different request (maybe I should do that...?) Another >> option is to return a redirect response. > > It seems that I am not understanding dispatcher well enough to use it - can > (next-dispatcher) be called from within a servlet?? I am getting the > following error: > > (file > "C:\\Local\\PLT4.1.3\\collects\\web-server\\dispatchers\\dispatch-servlets.ss") > broke the contract?? (-> url? exn? response?) on servlet-error-responder; > expected , given: # > > What I did was basically test to see if this is a path I wanted to handle, > and throw exn:dispatcher... is there another way of using it? > > (define (start request) > ? (let ((path-list (map path/param-path (url-path (request-uri request))))) > ??? (cond ((equal? path-list '("test")) > ?????????? `(p "this is a test resopnse")) > ????????? (else ;; let web-server handle the path. > ?????????? (next-dispatcher))))) > > The servlet is run through serve/servlet. > > ;; web.ss > #lang scheme/base > > (require web-server/servlet > ???????? web-server/servlet-env > ???????? "servlet1.ss" > ???????? ) > ;; why did the current-directory get reset? > (thread (lambda () > ????????? (serve/servlet start #:port 8800 > ???????????????????????? #:servlet-path "/" > ???????????????????????? #:launch-browser? #f > ???????????????????????? #:listen-ip #f > ???????????????????????? #:servlet-namespace '( "servlet1.ss") > ???????????????????????? #:servlets-root (current-directory) > ???????????????????????? #:servlet-regexp #px".*" > ???????????????????????? #:server-root-path (current-directory) > ???????????????????????? #:extra-files-paths (map string->path > '("c:\\data\\ajax")) > ???????????????????????? ))) > > ;; servlet1.ss > #lang scheme/base > (require (only-in web-server/servlet > current-servlet-continuation-expiration-handler) > ???????? web-server/managers/lru > ???????? web-server/http/request-structs > ???????? web-server/dispatchers/dispatch > ???????? net/url > ???????? ) > > (define interface-version 'v2) > > (define manager > ? (create-LRU-manager current-servlet-continuation-expiration-handler > ????????????????????? 60 > ????????????????????? 3600 > ????????????????????? (lambda () #t) > ????????????????????? #:initial-count 1 > ????????????????????? #:inform-p (lambda _ (void)))) > > (define (start request) > ? (let ((path-list (map path/param-path (url-path (request-uri request))))) > ??? (cond ((equal? path-list '("test")) > ?????????? `(p "this is a test resopnse")) > ????????? (else > ?????????? (next-dispatcher))))) > > (provide (all-defined-out)) > > > > > -- 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 Fri Aug 7 11:04:17 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 7 11:05:14 2009 Subject: [plt-scheme] Re: Getting started with Scheme: How can I improve my code for generating prime numbers? In-Reply-To: <3691a303-e56b-494d-957b-ed583c3a6e3d@n2g2000vba.googlegroups.com> References: <022f4eef-ecd2-45fc-b380-f593b36dcade@c14g2000yqm.googlegroups.com> <4072c51f0908021235l147a7afeg788a4ba5df6cdcd8@mail.gmail.com> <7D0AECA4-2DB2-479D-A21B-50E9C129EB22@ccs.neu.edu> <3691a303-e56b-494d-957b-ed583c3a6e3d@n2g2000vba.googlegroups.com> Message-ID: <2FEC4735-F48D-499B-A7E9-3A1642FEC3E0@ccs.neu.edu> You may have misinterpreted my email a bit. If you learn to program well in PLT Scheme, you will learn MORE THAN if you just learn to program functionally in ANY OLD Scheme. Once again, PLT Scheme is to Scheme what Scheme is to LISP and Algol 60, its two acknowledged predecessor. Point blank: PLT Scheme is vastly more than Scheme. Just in case this isn't clear, your primes example demonstrates this point more than anything else. For sheer elegance, you should build your solution as a two-module program: sieve.ss #lang lazy ;; the truly functional solution (provide take-n-primes) ... see old mail main.ss #lang scheme (require "sieve.ss") ... now use the lazy stream in regular strict FP ... NO OTHER LANGUAGE (Scheme or other FP or scripting or whatever) can provide this kind of mixed service. BEST OF ALL, the entire thing is still shorter than your Python program. -- Matthias On Aug 6, 2009, at 4:52 PM, SiWi wrote: > Thank you for your hints and tips first of all. As I've been on > holiday the last days, I had no internet access and couln't reply to > your posts therefore. >> Question is what is your goal? >> -- functional programming per se (as a philosopher, I would have to >> question if it exists) >> -- Scheme programming in a functional way? >> -- Scheme programming in the 'best' possible way? >> -- best could mean 'fastest' (as you saw Eli's program is >> faster >> than yours) >> -- best could mean 'suitable for proving theorems >> automatically' >> -- and many more things > > My goal is functional programming in genreral and Scheme programming > in the 'best' way. I'd also be interested in where exactly the > differences between 'best' Scheme programming( where 'best' would > rever to a mixture between speed and idiomatic Scheme programming) and > 'best' functional programming style can be found. > On a sidenote, I want to use the primes code to try out a few project > euler problems with Scheme to get started with the language. > Therefore speed matters a bit, but of course it should not be the > world's most efficient prime numbers generator. :) >> So the last question is: >> -- perhaps you really want to learn to program in PLT Scheme so >> that you can see what >> elegant lazy functional programmers do, >> strict lazy programmers, >> OO programmers, >> logic programmers, >> and imperative programmers >> without ever leaving the language. > > My main goal is to learn something new, not only PLT-Schme, but also > about programming styles in general. > Therefore I want to learn coding in Scheme in general, but I'm also > interested in strict lazy and logic programming. > I've done enough OO and imperative programming in other languages so > I'm not really interested in that at the moment, although I would like > to learn about this in Scheme as well. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From beratn at gmail.com Fri Aug 7 11:46:13 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Fri Aug 7 11:46:33 2009 Subject: [plt-scheme] definition-time repository Message-ID: Hey i read plai chapter 6 page 46.We define a new datatype FAE-Value.There i,s a new concept "definition-time" repository. Sentence said "we define new datatype that attaches definition time-repository to every function value" i cannot understand this concept.What is it ? Can someone explain thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090807/28c611f9/attachment.htm From sk at cs.brown.edu Fri Aug 7 11:51:01 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Aug 7 11:51:28 2009 Subject: [plt-scheme] definition-time repository In-Reply-To: References: Message-ID: You should consider asking your professor and TAs for help! On Aug 7, 2009 11:46 AM, "emre berat nebio?lu" wrote: Hey i read plai chapter 6 page 46.We define a new datatype FAE-Value.There i,s a new concept "definition-time" repository. Sentence said "we define new datatype that attaches definition time-repository to every function value" i cannot understand this concept.What is it ? Can someone explain thanks _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090807/dff059b2/attachment.html From lists.amitsaha at gmail.com Fri Aug 7 14:02:22 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Fri Aug 7 14:02:55 2009 Subject: [plt-scheme] Exploring Literate Programming in Scheme Message-ID: <4A7C6C2E.708@gmail.com> Hello, So, I used the scribble/lp module to write my first literate program: #lang scribble/lp (require scribble/lp) <> @chunk[ (define (f x) (* x x))] Nothing useful there, of course. (Now I am sort of wondering OT, atleast at the surface, why would I just not use plain comments, instead of literate programming constructs. Any opinions welcome) Best, Amit -- Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From matthias at ccs.neu.edu Fri Aug 7 14:25:26 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 7 14:26:07 2009 Subject: [plt-scheme] Exploring Literate Programming in Scheme In-Reply-To: <4A7C6C2E.708@gmail.com> References: <4A7C6C2E.708@gmail.com> Message-ID: Because this is _not_ how you use literate programming. I recommend you start with the docs and then you read Knuth's original article (or the other way around). On Aug 7, 2009, at 2:02 PM, Amit Saha wrote: > Hello, > > So, I used the scribble/lp module to write my first literate program: > > > > #lang scribble/lp > (require scribble/lp) > > <> > > @chunk[ > (define (f x) > (* x x))] > > > > Nothing useful there, of course. > > (Now I am sort of wondering OT, atleast at the surface, why would I > just not use plain comments, instead of literate programming > constructs. Any opinions welcome) > > Best, > Amit > > -- > Journal: http://amitksaha.wordpress.com > ?-blog: http://twitter.com/amitsaha > IRC: cornucopic on #scheme, #lisp, #math, #linux > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From lists.amitsaha at gmail.com Fri Aug 7 14:39:33 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Fri Aug 7 14:40:08 2009 Subject: [plt-scheme] Exploring Literate Programming in Scheme In-Reply-To: References: <4A7C6C2E.708@gmail.com> Message-ID: <4A7C74E5.102@gmail.com> Hello, Matthias Felleisen wrote: > > Because this is _not_ how you use literate programming. I recommend you > start with the docs and then you read Knuth's original article (or the > other way around). Yes, I can always do that and have scratched the surface, but somehow I am not really convinced, not that it matters. It would be really great if some one who have probably had more exposure/exp. with it to possibly give a more intuitive explanation of the differences between well documented code and code written using Literate programming constructs. So, this is going [OT]. Pls. feel free to end the thread here. Thanks, Amit > > > On Aug 7, 2009, at 2:02 PM, Amit Saha wrote: > >> Hello, >> >> So, I used the scribble/lp module to write my first literate program: >> >> >> >> #lang scribble/lp >> (require scribble/lp) >> >> <> >> >> @chunk[ >> (define (f x) >> (* x x))] >> >> >> >> Nothing useful there, of course. >> >> (Now I am sort of wondering OT, atleast at the surface, why would I >> just not use plain comments, instead of literate programming >> constructs. Any opinions welcome) >> >> Best, >> Amit >> >> -- >> Journal: http://amitksaha.wordpress.com >> ?-blog: http://twitter.com/amitsaha >> IRC: cornucopic on #scheme, #lisp, #math, #linux >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From jensaxel at soegaard.net Fri Aug 7 15:06:40 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Fri Aug 7 15:07:02 2009 Subject: [plt-scheme] Infix Expressions Message-ID: <4072c51f0908071206h63c8051akc8224024dc6700a0@mail.gmail.com> Hi All, I have written a little naive parser for infix expressions. The syntax is: @${ 1+2*3 } There are lots of examples in the documentation. http://planet.plt-scheme.org/package-source/soegaard/infix.plt/1/0/planet-docs/manual/index.html Don't hesitate to send comments, Jens Axel S?gaard From yinso.chen at gmail.com Fri Aug 7 15:01:29 2009 From: yinso.chen at gmail.com (YC) Date: Fri Aug 7 15:08:30 2009 Subject: [plt-scheme] web-server: serving web server files within a servlet In-Reply-To: References: <779bf2730908061901u709ebf7eyb7c0d1729d664636@mail.gmail.com> <779bf2730908062032s3d73c886ted0376ab41b7b91e@mail.gmail.com> <779bf2730908070033r7bbb8a2nec2185b7b80bc818@mail.gmail.com> Message-ID: <779bf2730908071201x67e0f01u5d396d7e947d1b49@mail.gmail.com> Okay - I'll download 4.2.1. Thanks. yc On Fri, Aug 7, 2009 at 7:10 AM, Jay McCarthy wrote: > Your program works as expected for me on 4.2.1. > > Jay > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090807/7e9bc8ee/attachment.htm From jmj at fellowhuman.com Sat Aug 8 02:57:22 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sat Aug 8 03:23:32 2009 Subject: [plt-scheme] a snip copy/paste puzzle Message-ID: Hi all, I've been working on a snip implementation (representing an annotated expression) and am getting a mysterious error. I'd be grateful for any help the community can offer in solving the problem. The error: Currently when I attempt to copy and paste my snip, I get the error set-editor method of editor-snip%: expects argument of type ; given #f ...and the editor-snip% in question is apparently not any of the snips I've defined, which I've verified by overriding their set-editor method. This error is coming from somewhere deep in MrEd, and (after embarrassingly many hours of reading internal code and probing/ rewriting) I don't see the cause. Below is a version I've pared down to just what's necessary to see the structure and exercise the bug. To reproduce the error: run it, evaluate (test-w/text%), and attempt to copy and paste the editor-snip % you see in the frame it created. Any observations? Thanks, jmj ;;;;;;; code-desc-simplified.ss #lang scheme/gui (require framework embedded-gui) (provide anno-snip%) ;;;;;;;;;; Snipclassery (for cut/paste) ;;;;;;;;;;; ;; Design follows framework/private/comment-box.ss lines 23-31 (define anno-snipclass% (class decorated-editor-snipclass% (define/override (make-snip stream-in) (new anno-snip%)) (define/override (read in) (let ([pb (new anno-pb%)]) (let ([code-ed (send pb get-code-editor)] [anno-ed (send pb get-anno-editor)]) (send code-ed read-from-file in 'start) (send anno-ed read-from-file in 'start)))) (super-new))) (define snipclass (make-object anno-snipclass%)) (send snipclass set-version 1) (send snipclass set-classname "code-desc-snip.ss") (send (get-the-snip-class-list) add snipclass) ;;;; Snip representing an annotated chunk of code. (define anno-snip% (class decorated-editor-snip% (define/override (make-editor) (new anno-pb%)) (define/override (make-snip) (new anno-snip%)) ;; copy/paste: (inherit get-editor) (define/override (write stream-out) (let ([pb (get-editor)]) (let ([code (send pb get-code-editor)] [anno (send pb get-anno-editor)]) (send code write-to-file stream-out) (send anno write-to-file stream-out)))) (define/override (copy) ;; -> anno-snip% ;; return a copy of this snip (let ([s (new anno-snip%)]) (send s set-editor (send (get-editor) copy-self)) s)) (super-new) )) (define anno-pb% (let () (define (find-owner-snip ed) ;; editor<%> -> (union #f editor-snip %) (let ([admin (send ed get-admin)]) (and admin (admin . is-a? . editor-snip-editor-admin<%>) (send admin get-snip)))) (define scheme+copy-self% ;; class for the code editor (class scheme:text% ;; (from framework/private/comment- box.ss) (inherit copy-self-to) (init-field [kind 'default]) (define/override (copy-self) (let ([ed (new scheme+copy-self%)]) (copy-self-to ed) ed)) (super-new) (inherit set-max-undo-history) (set-max-undo-history 'forever))) (class aligned-pasteboard% (super-new) ;;;;;;; Component editors: ;; code-editor and anno-editor are the two text%s that contain the ;; code and annotation, respectively. ;; -> (union #f text%) (define/public (get-code-editor) code-editor) (define/public (make-code-editor) (new scheme+copy-self% [kind 'code])) ;; -> (union #f text%) (define/public (get-anno-editor) anno-editor) (define/public (make-anno-editor) (new text%)) (define code-editor (make-code-editor)) ;; code box's editor (define anno-editor (make-anno-editor)) ;; annotation box's ;;;;;;; Container snips for the text editors: (define val (new vertical-alignment% [parent this])) ;; Container for the code box. I'm using this for the ability to ;; show/hide the box: (define code-view (new vertical-alignment% [parent val] [show? #t])) ;; Installs stretchable editor snips, if none are already installed, ;; to contain the code and anno editors. ;; (Does nothing if they already are installed, and returns #f.) ;; Returns #t if successful. (define (init-snips) (and (not (or (find-owner-snip code-editor) (find-owner-snip anno-editor))) (let ([code-snip (new stretchable-editor-snip% [editor code-editor] [with-border? #t] [min-width 50])] [anno-snip (new stretchable-editor-snip% [editor anno-editor] [with-border? #f] [min-width 50])]) (make-object snip-wrapper% code-view code-snip) (make-object hline% code-view) (make-object snip-wrapper% val anno-snip) #t))) (init-snips) ;;;;;;;;; copy+paste ;;;;;;;;; (define/override (copy-self) (let ([ed (new anno-pb%)]) (let ([ed-code (send ed get-code-editor)] [ed-anno (send ed get-anno-editor)]) (send (get-code-editor) copy-self-to ed-code) (send (get-anno-editor) copy-self-to ed-anno) ed))) ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (test-w/text%) (define test-snip (new anno-snip%)) (define test-pb (send test-snip get-editor)) (define txt (new scheme:text%)) (define f (mk-test-frame)) (define c (new editor-canvas% [parent f][editor txt])) (send txt insert "\n(* x 3)\n4))" 0) (send txt insert test-snip 0) (send txt insert "(define (f x)\n(+ " 0) (send txt tabify-all) (send f show #t) ) (define (mk-test-frame) (new frame% [label "ah"] [width 500] [height 300] [alignment '(center center)])) From yinso.chen at gmail.com Sat Aug 8 04:50:57 2009 From: yinso.chen at gmail.com (YC) Date: Sat Aug 8 04:51:17 2009 Subject: [plt-scheme] error building plt-4.2.1 Message-ID: <779bf2730908080150v29f6a5a7q3f1f49a78ed9fdf4@mail.gmail.com> Hi - I am encountering error of building plt 4.2.1 that says the following in the make install step: omitted-paths: given directory path is not in any collection root: # === context === /../tmp/plt-4.2.1/collects/setup/private/omitted-paths.ss:84:0: omitted-paths* /../tmp/plt-4.2.1/collects/scheme/private/more-scheme.ss:396:13: hash-ref! /../tmp/plt-4.2.1/collects/setup/setup-unit.ss:233:2: planet->cc /../tmp/plt-4.2.1/collects/scheme/list.ss:243:4: loop It seems that the setup-plt tries to build my development linked packages, and since they are linked packages they do not belong in a collection root. How should I get around this issue? I am on CentOS5.1 if that makes a difference. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090808/018cc687/attachment.htm From gabor.lists at mndl.hu Sat Aug 8 10:06:41 2009 From: gabor.lists at mndl.hu (gabor papp) Date: Sat Aug 8 10:12:13 2009 Subject: [plt-scheme] keywords with C API Message-ID: <4A7D8671.9070503@mndl.hu> Hi all, I'm trying to write a 3m function that can take keyword arguments, but I'm not sure how to do it. I create the function like this: scheme_add_global("test-function", scheme_make_prim_w_arity(test_function, "test-function", 0, -1), env); trying to get the keyword as a string: Scheme_Object *test_function(int argc, Scheme_Object **argv) { MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, argv); MZ_GC_REG(); char *keyword = SCHEME_KEYWORD_VAL(argv[0]); MZ_GC_UNREG(); return scheme_void; } when I try to call the function from scheme by typing (test-function #:test 0), I receive the following error: test-function: does not accept keyword arguments; arguments were: #:test 0 Is there another way to register these kind of funtions? Thanks, Gabor From czhu at cs.utah.edu Sat Aug 8 10:36:49 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Sat Aug 8 10:37:17 2009 Subject: [plt-scheme] keywords with C API In-Reply-To: <4A7D8671.9070503@mndl.hu> References: <4A7D8671.9070503@mndl.hu> Message-ID: <4A7D8D81.6080400@cs.utah.edu> I would suggest to do it in two steps, i.e., to use a Scheme function as a wrap that takes keyword arguments, which pass everything to the actual C function (with no keyword arguments). Chongkai gabor papp wrote: > Hi all, > > I'm trying to write a 3m function that can take keyword arguments, but > I'm not sure how to do it. > > I create the function like this: > > scheme_add_global("test-function", > scheme_make_prim_w_arity(test_function, "test-function", 0, -1), env); > > trying to get the keyword as a string: > > Scheme_Object *test_function(int argc, Scheme_Object **argv) > { > MZ_GC_DECL_REG(1); > MZ_GC_VAR_IN_REG(0, argv); > MZ_GC_REG(); > > char *keyword = SCHEME_KEYWORD_VAL(argv[0]); > MZ_GC_UNREG(); > return scheme_void; > } > > when I try to call the function from scheme by typing (test-function > #:test 0), I receive the following error: > test-function: does not accept keyword arguments; arguments were: > #:test 0 > > Is there another way to register these kind of funtions? > > Thanks, > Gabor > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From cwarren89 at gmail.com Sat Aug 8 11:27:00 2009 From: cwarren89 at gmail.com (Curtis Warren) Date: Sat Aug 8 11:27:24 2009 Subject: [plt-scheme] Infix Expressions In-Reply-To: <4072c51f0908071206h63c8051akc8224024dc6700a0@mail.gmail.com> References: <4072c51f0908071206h63c8051akc8224024dc6700a0@mail.gmail.com> Message-ID: <178725880908080827v3d77d6b6q80e06ecdcba500f0@mail.gmail.com> On Fri, Aug 7, 2009 at 2:06 PM, Jens Axel S?gaard wrote: > Hi All, > > I have written a little naive parser for infix expressions. > The syntax is: > > ? @${ 1+2*3 } > > There are lots of examples in the documentation. > > http://planet.plt-scheme.org/package-source/soegaard/infix.plt/1/0/planet-docs/manual/index.html > > Don't hesitate to send comments, > Jens Axel S?gaard > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme Nifty. From toddobryan at gmail.com Sat Aug 8 12:05:22 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 8 12:05:40 2009 Subject: [plt-scheme] typed teaching languages Message-ID: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> Can somebody explain how the structure of the HtDP teaching languages works? I'm interested in, as an experiment, having my students write type annotations for their programs, just to see whether it clears up their type confusions or makes it even harder for them to get things right. I've received advice from several people stating that this is a bad idea and that I am going to create a great deal of pain for myself, so I've been forewarned. Realize, however, that I'll spend probably two months dealing with simple functions and structures before I ever get to lists, so the problems of polymorphism that rear their heads so early in a typical college class won't bother me until Halloween or so. I'm willing to risk the pain, and I'm even willing to accept the laughing and pointing that are likely to occur when I give up and tell everyone that I now accept that this was just a bad idea. But I can't even get things to begin to work, because I can't grok how the teaching languages are structured. How would I go about adding types and type checking (provided by Typed Scheme) to the language constructs of Beginning Student? I tried obvious things like changing scheme/base to typed-scheme in the htdp-beginner files, but I end up not being able to make the colon type annotation available and when I try to run programs I get errors saying that there are type annotations missing. David Van Horn provided me with some work he started on in this vein, but he was working with Advanced Student rather than Beginning and the internal structure of each of the teaching languages is so complicated that I can't tell which htdp-advanced's I can just replace with htdp-beginner's and which ones I have to reconstruct. Is there a document anywhere that describes how the teaching languages are built or is it all just in the code? Parenthetically, it's really hard to figure out where things are coming from as I'm trying to read through Scheme code without running Check Syntax and using Jump to Definition. Is this the normal state of Scheme coding or am I missing something that would make figuring out how the pieces fit together easier? Thanks, Todd From matthias at ccs.neu.edu Sat Aug 8 12:22:57 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Aug 8 12:23:44 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> Message-ID: The languages are located in collects/lang/htdp*. The primitives come from private/ and are obviously labeled as such. Create copies and introduce type checking at your leisure. ;; --- WARNING: If you really believe that type checking should be an integral part of the first few weeks, you do NOT need to use Typed Scheme for this purpose. The type system of Typed Scheme is designed so that programmers can easily port existing Scheme code, programmed in an idiomatic manner, into a typed setting -- with little more effort than annotating all binding occurrences of variables and fields (aka declarations). It isn't perfect in this manner but it's the best such practical effort out there. Since your programming novices are NOT porting code and you DO NOT wish to program in the specific idioms of Scheme, I recommend that you spare yourself the rather large implementation effort for now and experiment with OCAML instead. The language is quite similar to Scheme but comes with a native type system. (I strongly recommend always using type annotations and to shunt type inference as much as possible.) Use only those constructs that are close to the ones in HtDP teaching languages. While this doesn't give you the teaching languages, it restricts the potential for truly weird syntax errors. ;; --- IN GENERAL, we have not thought through the exact nature of the type system that is appropriate for novice programmers. We do know, however, that we can build a contract system that supports dynamic checking. Doing so will be our next step. The DEIN PROGRAM sister project in Germany (included in the core distribution) has beaten us this time and has already done so. I suspect our solution will be similar to theirs. ;; --- Good luck -- Matthias On Aug 8, 2009, at 12:05 PM, Todd O'Bryan wrote: > Can somebody explain how the structure of the HtDP teaching > languages works? > > I'm interested in, as an experiment, having my students write type > annotations for their programs, just to see whether it clears up their > type confusions or makes it even harder for them to get things right. > I've received advice from several people stating that this is a bad > idea and that I am going to create a great deal of pain for myself, so > I've been forewarned. Realize, however, that I'll spend probably two > months dealing with simple functions and structures before I ever get > to lists, so the problems of polymorphism that rear their heads so > early in a typical college class won't bother me until Halloween or > so. I'm willing to risk the pain, and I'm even willing to accept the > laughing and pointing that are likely to occur when I give up and tell > everyone that I now accept that this was just a bad idea. > > But I can't even get things to begin to work, because I can't grok how > the teaching languages are structured. How would I go about adding > types and type checking (provided by Typed Scheme) to the language > constructs of Beginning Student? I tried obvious things like changing > scheme/base to typed-scheme in the htdp-beginner files, but I end up > not being able to make the colon type annotation available and when I > try to run programs I get errors saying that there are type > annotations missing. > > David Van Horn provided me with some work he started on in this vein, > but he was working with Advanced Student rather than Beginning and the > internal structure of each of the teaching languages is so complicated > that I can't tell which htdp-advanced's I can just replace with > htdp-beginner's and which ones I have to reconstruct. > > Is there a document anywhere that describes how the teaching languages > are built or is it all just in the code? > > Parenthetically, it's really hard to figure out where things are > coming from as I'm trying to read through Scheme code without running > Check Syntax and using Jump to Definition. Is this the normal state of > Scheme coding or am I missing something that would make figuring out > how the pieces fit together easier? > > Thanks, > Todd > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From toddobryan at gmail.com Sat Aug 8 13:17:43 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 8 13:18:06 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> Message-ID: <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> I guess the big problem I'm having dealing with the primitives in places like beginner-funs.ss and teachprims.ss is that they use a lot of macros--provide-and-document and define-teach--to name two. Is it safe to just change the languages in those files to typed-scheme and stick in a type annotation, or will that have some kind of weird interaction with the macro-provided definitions and the later renaming? I really need to get a good handle on macros and I just don't have it yet. I considered trying OCaml, but currying of functions, the lack of warnings about function arguments not appearing in application positions, and the wealth of other stuff that the teaching languages do convinced me it was just a bad idea. Todd On Sat, Aug 8, 2009 at 12:22 PM, Matthias Felleisen wrote: > > The languages are located in collects/lang/htdp*. The primitives come from > private/ and are obviously labeled as such. Create copies and introduce type > checking at your leisure. > > ;; --- > > WARNING: If you really believe that type checking should be an integral part > of the first few weeks, you do NOT need to use Typed Scheme for this > purpose. The type system of Typed Scheme is designed so that programmers can > easily port existing Scheme code, programmed in an idiomatic manner, into a > typed setting -- with little more effort than annotating all binding > occurrences of variables and fields (aka declarations). It isn't perfect in > this manner but it's the best such practical effort out there. > > Since your programming novices are NOT porting code and you DO NOT wish to > program in the specific idioms of Scheme, I recommend that you spare > yourself the rather large implementation effort for now and experiment with > OCAML instead. The language is quite similar to Scheme but comes with a > native type system. (I strongly recommend always using type annotations and > to shunt type inference as much as possible.) Use only those constructs that > are close to the ones in HtDP teaching languages. While this doesn't give > you the teaching languages, it restricts the potential for truly weird > syntax errors. > > ;; --- > > IN GENERAL, we have not thought through the exact nature of the type system > that is appropriate for novice programmers. We do know, however, that we can > build a contract system that supports dynamic checking. Doing so will be our > next step. > > The DEIN PROGRAM sister project in Germany (included in the core > distribution) has beaten us this time and has already done so. I suspect our > solution will be similar to theirs. > > ;; --- > > Good luck -- Matthias > > > > > > On Aug 8, 2009, at 12:05 PM, Todd O'Bryan wrote: > >> Can somebody explain how the structure of the HtDP teaching languages >> works? >> >> I'm interested in, as an experiment, having my students write type >> annotations for their programs, just to see whether it clears up their >> type confusions or makes it even harder for them to get things right. >> I've received advice from several people stating that this is a bad >> idea and that I am going to create a great deal of pain for myself, so >> I've been forewarned. Realize, however, that I'll spend probably two >> months dealing with simple functions and structures before I ever get >> to lists, so the problems of polymorphism that rear their heads so >> early in a typical college class won't bother me until Halloween or >> so. I'm willing to risk the pain, and I'm even willing to accept the >> laughing and pointing that are likely to occur when I give up and tell >> everyone that I now accept that this was just a bad idea. >> >> But I can't even get things to begin to work, because I can't grok how >> the teaching languages are structured. How would I go about adding >> types and type checking (provided by Typed Scheme) to the language >> constructs of Beginning Student? I tried obvious things like changing >> scheme/base to typed-scheme in the htdp-beginner files, but I end up >> not being able to make the colon type annotation available and when I >> try to run programs I get errors saying that there are type >> annotations missing. >> >> David Van Horn provided me with some work he started on in this vein, >> but he was working with Advanced Student rather than Beginning and the >> internal structure of each of the teaching languages is so complicated >> that I can't tell which htdp-advanced's I can just replace with >> htdp-beginner's and which ones I have to reconstruct. >> >> Is there a document anywhere that describes how the teaching languages >> are built or is it all just in the code? >> >> Parenthetically, it's really hard to figure out where things are >> coming from as I'm trying to read through Scheme code without running >> Check Syntax and using Jump to Definition. Is this the normal state of >> Scheme coding or am I missing something that would make figuring out >> how the pieces fit together easier? >> >> Thanks, >> Todd >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From egarrulo at gmail.com Sat Aug 8 14:54:53 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Sat Aug 8 14:55:12 2009 Subject: [plt-scheme] Installing Planet packages: documentation not merged with PLT docs? Message-ID: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> Hello, after installing a few Planet packages, I was surprised by the fact that their generated documentation is not merged with main PLT docs, and I have to dig into .planet directory. Am I missing something or that's the way things are designed to work? Thanks From toddobryan at gmail.com Sat Aug 8 15:01:11 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 8 15:01:33 2009 Subject: [plt-scheme] Installing Planet packages: documentation not merged with PLT docs? In-Reply-To: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> References: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> Message-ID: <904774730908081201x66ef45a7me2edc02e960c1c0f@mail.gmail.com> I think you have to run setup-plt to get everything linked correctly. Run it with --help to see the options. On Sat, Aug 8, 2009 at 2:54 PM, Elena Garrulo wrote: > Hello, > > after installing a few Planet packages, I was surprised by the fact > that their generated documentation is not merged with main PLT docs, > and I have to dig into .planet directory. Am I missing something or > that's the way things are designed to work? > > Thanks > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From carl.eastlund at gmail.com Sat Aug 8 15:12:44 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sat Aug 8 15:13:25 2009 Subject: [plt-scheme] Installing Planet packages: documentation not merged with PLT docs? In-Reply-To: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> References: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> Message-ID: <990e0c030908081212u6a31df9byff4de1cc5bf37390@mail.gmail.com> Elena, In my experience most Planet packages' documentation is merged into the main help page you get by running plt-help or pressing F1 or Help -> Help Desk in DrScheme. However, some packages may be misconfigured, and even more commonly some packages may be using the older 'doc.txt' style documentation that is no longer included in Help Desk. Can you tell us which packages you are having this problem with, what version of them and of DrScheme you are using, and how you installed them? That information might help us reproduce and diagnose your problem. Carl Eastlund On Sat, Aug 8, 2009 at 2:54 PM, Elena Garrulo wrote: > Hello, > > after installing a few Planet packages, I was surprised by the fact > that their generated documentation is not merged with main PLT docs, > and I have to dig into .planet directory. Am I missing something or > that's the way things are designed to work? > > Thanks From noelwelsh at gmail.com Sat Aug 8 15:21:10 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sat Aug 8 15:21:30 2009 Subject: [plt-scheme] Installing Planet packages: documentation not merged with PLT docs? In-Reply-To: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> References: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> Message-ID: You might be looking at the wrong index file for the main docs. There are two: one for the system wide install, which won't have Planet docs, and one for your local install which includes Planet packages. I don't recall off-hand the different directory locations, but I'm sure accessing Help from within DrScheme will go to the correct file. N. On Sat, Aug 8, 2009 at 7:54 PM, Elena Garrulo wrote: > Hello, > > after installing a few Planet packages, I was surprised by the fact > that their generated documentation is not merged with main PLT docs, From neil at neilvandyke.org Sat Aug 8 15:22:44 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat Aug 8 15:23:15 2009 Subject: [plt-scheme] Installing Planet packages: documentation not merged with PLT docs? In-Reply-To: <990e0c030908081212u6a31df9byff4de1cc5bf37390@mail.gmail.com> References: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> <990e0c030908081212u6a31df9byff4de1cc5bf37390@mail.gmail.com> Message-ID: <4A7DD084.8030001@neilvandyke.org> > > On Sat, Aug 8, 2009 at 2:54 PM, Elena Garrulo wrote: > >> after installing a few Planet packages, I was surprised by the fact >> that their generated documentation is not merged with main PLT docs, >> and I have to dig into .planet directory. Am I missing something or >> that's the way things are designed to work? >> By the way, it seems that, after your first PLaneT package is installed, DrScheme starts sending you to the documentation in your "~/.planet" directory, rather than to the one in the DrScheme install tree. For example, initially DrScheme's "Help Desk" menu item sends me to: file:///usr/local/plt-4.2.1/share/plt/doc/index.html But later to: file:///home/neil/.plt-scheme/4.2.1/doc/index.html If I bookmarked the first one in my Web browser, and thereafter use my bookmark rather than DrScheme to get to the PLT documentation, I'll never see the documentation for installed PLaneT packages. -- http://www.neilvandyke.org/ From egarrulo at gmail.com Sat Aug 8 19:26:54 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Sat Aug 8 19:27:12 2009 Subject: [plt-scheme] Installing Planet packages: documentation not merged with PLT docs? In-Reply-To: <4A7DD084.8030001@neilvandyke.org> References: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> <990e0c030908081212u6a31df9byff4de1cc5bf37390@mail.gmail.com> <4A7DD084.8030001@neilvandyke.org> Message-ID: <9bd8a08a0908081626p3ced22ffka381e90fdd47eada@mail.gmail.com> 2009/8/8 Neil Van Dyke : > By the way, it seems that, after your first PLaneT package is installed, > DrScheme starts sending you to the documentation in your "~/.planet" > directory, rather than to the one in the DrScheme install tree. > > For example, initially DrScheme's "Help Desk" menu item sends me to: > > ? file:///usr/local/plt-4.2.1/share/plt/doc/index.html > > But later to: > > ? file:///home/neil/.plt-scheme/4.2.1/doc/index.html > > If I bookmarked the first one in my Web browser, and thereafter use my > bookmark rather than DrScheme to get to the PLT documentation, I'll never > see the documentation for installed PLaneT packages. Indeed, that's what happened" I was accessing the main installation's documentation tree. Accessing the documentation from the Help Desk sends me to "~/.planet", and I can see the installed packages. Thanks. From neil at neilvandyke.org Sat Aug 8 19:34:13 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat Aug 8 19:34:42 2009 Subject: [plt-scheme] Installing Planet packages: documentation not merged with PLT docs? In-Reply-To: <9bd8a08a0908081626p3ced22ffka381e90fdd47eada@mail.gmail.com> References: <9bd8a08a0908081154k6d73307el94cb08f696c83e3@mail.gmail.com> <990e0c030908081212u6a31df9byff4de1cc5bf37390@mail.gmail.com> <4A7DD084.8030001@neilvandyke.org> <9bd8a08a0908081626p3ced22ffka381e90fdd47eada@mail.gmail.com> Message-ID: <4A7E0B75.6020805@neilvandyke.org> Oops, for the record, I meant "~/.plt-scheme". >> DrScheme starts sending you to the documentation in your "~/.planet" >> From robby at eecs.northwestern.edu Sat Aug 8 19:52:29 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Aug 8 19:52:52 2009 Subject: [plt-scheme] a snip copy/paste puzzle In-Reply-To: References: Message-ID: <932b2f1f0908081652u591b41e6ld0610cb8554c3287@mail.gmail.com> Do you get a stacktrace with the error message? Robby On Sat, Aug 8, 2009 at 1:57 AM, Jordan Johnson wrote: > Hi all, > > I've been working on a snip implementation (representing an annotated > expression) and am getting a mysterious error. ?I'd be grateful for any help > the community can offer in solving the problem. > > The error: ?Currently when I attempt to copy and paste my snip, I get the > error > > ? ? ? ?set-editor method of editor-snip%: expects argument of type > ; given #f > > ...and the editor-snip% in question is apparently not any of the snips I've > defined, which I've verified by overriding their set-editor method. ?This > error is coming from somewhere deep in MrEd, and (after embarrassingly many > hours of reading internal code and probing/rewriting) I don't see the cause. > > Below is a version I've pared down to just what's necessary to see the > structure and exercise the bug. ?To reproduce the error: ?run it, evaluate > (test-w/text%), and attempt to copy and paste the editor-snip% you see in > the frame it created. > > Any observations? > > Thanks, > jmj > > ;;;;;;; code-desc-simplified.ss > > #lang scheme/gui > > (require framework embedded-gui) > (provide anno-snip%) > > ;;;;;;;;;; Snipclassery (for cut/paste) ;;;;;;;;;;; > ;; Design follows framework/private/comment-box.ss lines 23-31 > (define anno-snipclass% > ?(class decorated-editor-snipclass% > ? ?(define/override (make-snip stream-in) (new anno-snip%)) > ? ?(define/override (read in) > ? ? ?(let ([pb (new anno-pb%)]) > ? ? ? ?(let ([code-ed (send pb get-code-editor)] > ? ? ? ? ? ? ?[anno-ed (send pb get-anno-editor)]) > ? ? ? ? ?(send code-ed read-from-file in 'start) > ? ? ? ? ?(send anno-ed read-from-file in 'start)))) > > ? ?(super-new))) > > (define snipclass (make-object anno-snipclass%)) > (send snipclass set-version 1) > (send snipclass set-classname "code-desc-snip.ss") > (send (get-the-snip-class-list) add snipclass) > > > ;;;; Snip representing an annotated chunk of code. > (define anno-snip% > ?(class decorated-editor-snip% > > ? ?(define/override (make-editor) (new anno-pb%)) > ? ?(define/override (make-snip) (new anno-snip%)) > > ? ?;; copy/paste: > ? ?(inherit get-editor) > ? ?(define/override (write stream-out) > ? ? ?(let ([pb (get-editor)]) > ? ? ? ?(let ([code (send pb get-code-editor)] > ? ? ? ? ? ? ?[anno (send pb get-anno-editor)]) > ? ? ? ? ?(send code write-to-file stream-out) > ? ? ? ? ?(send anno write-to-file stream-out)))) > > ? ?(define/override (copy) ;; -> anno-snip% > ? ? ?;; return a copy of this snip > ? ? ?(let ([s (new anno-snip%)]) > ? ? ? ?(send s set-editor (send (get-editor) copy-self)) > ? ? ? ?s)) > > ? ?(super-new) > ? ?)) > > (define anno-pb% > ?(let () > ? ?(define (find-owner-snip ed) ;; editor<%> -> (union #f editor-snip%) > ? ? ?(let ([admin (send ed get-admin)]) > ? ? ? ?(and admin > ? ? ? ? ? ? (admin . is-a? . editor-snip-editor-admin<%>) > ? ? ? ? ? ? (send admin get-snip)))) > ? ?(define scheme+copy-self% ? ?;; class for the code editor > ? ? ?(class scheme:text% ? ? ? ?;; (from framework/private/comment-box.ss) > ? ? ? ?(inherit copy-self-to) > ? ? ? ?(init-field [kind 'default]) > ? ? ? ?(define/override (copy-self) > ? ? ? ? ?(let ([ed (new scheme+copy-self%)]) > ? ? ? ? ? ?(copy-self-to ed) > ? ? ? ? ? ?ed)) > ? ? ? ?(super-new) > ? ? ? ?(inherit set-max-undo-history) > ? ? ? ?(set-max-undo-history 'forever))) > ? ?(class aligned-pasteboard% > ? ? ?(super-new) > > ? ? ?;;;;;;; Component editors: > ? ? ?;; code-editor and anno-editor are the two text%s that contain the > ? ? ?;; code and annotation, respectively. > ? ? ?;; -> (union #f text%) > ? ? ?(define/public (get-code-editor) code-editor) > ? ? ?(define/public (make-code-editor) (new scheme+copy-self% > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [kind 'code])) > ? ? ?;; -> (union #f text%) > ? ? ?(define/public (get-anno-editor) anno-editor) > ? ? ?(define/public (make-anno-editor) (new text%)) > > ? ? ?(define code-editor (make-code-editor)) ?;; code box's editor > ? ? ?(define anno-editor (make-anno-editor)) ?;; annotation box's > > ? ? ?;;;;;;; Container snips for the text editors: > > ? ? ?(define val (new vertical-alignment% [parent this])) > ? ? ?;; Container for the code box. ?I'm using this for the ability to > ? ? ?;; show/hide the box: > ? ? ?(define code-view (new vertical-alignment% > ? ? ? ? ? ? ? ? ? ? ? ? ? ? [parent val] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? [show? #t])) > > ? ? ?;; Installs stretchable editor snips, if none are already installed, > ? ? ?;; to contain the code and anno editors. > ? ? ?;; (Does nothing if they already are installed, and returns #f.) > ? ? ?;; Returns #t if successful. > ? ? ?(define (init-snips) > ? ? ? ?(and (not (or (find-owner-snip code-editor) > ? ? ? ? ? ? ? ? ? ? ?(find-owner-snip anno-editor))) > ? ? ? ? ? ? (let ([code-snip (new stretchable-editor-snip% > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [editor code-editor] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [with-border? #t] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [min-width 50])] > ? ? ? ? ? ? ? ? ? [anno-snip (new stretchable-editor-snip% > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [editor anno-editor] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [with-border? #f] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [min-width 50])]) > ? ? ? ? ? ? ? (make-object snip-wrapper% code-view code-snip) > ? ? ? ? ? ? ? (make-object hline% code-view) > ? ? ? ? ? ? ? (make-object snip-wrapper% val anno-snip) > ? ? ? ? ? ? ? #t))) > > ? ? ?(init-snips) > > ? ? ?;;;;;;;;; copy+paste ;;;;;;;;; > > ? ? ?(define/override (copy-self) > ? ? ? ?(let ([ed (new anno-pb%)]) > ? ? ? ? ?(let ([ed-code (send ed get-code-editor)] > ? ? ? ? ? ? ? ?[ed-anno (send ed get-anno-editor)]) > ? ? ? ? ? ?(send (get-code-editor) copy-self-to ed-code) > ? ? ? ? ? ?(send (get-anno-editor) copy-self-to ed-anno) > ? ? ? ? ? ?ed))) > ? ?))) > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > (define (test-w/text%) > ?(define test-snip (new anno-snip%)) > ?(define test-pb (send test-snip get-editor)) > ?(define txt (new scheme:text%)) > ?(define f (mk-test-frame)) > ?(define c (new editor-canvas% [parent f][editor txt])) > ?(send txt insert "\n(* x 3)\n4))" 0) > ?(send txt insert test-snip 0) > ?(send txt insert "(define (f x)\n(+ " 0) > ?(send txt tabify-all) > ?(send f show #t) > ?) > (define (mk-test-frame) > ?(new frame% [label "ah"] [width 500] [height 300] > ? ? ? [alignment '(center center)])) > > > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jmj at fellowhuman.com Sat Aug 8 20:00:00 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sat Aug 8 20:00:29 2009 Subject: [plt-scheme] a snip copy/paste puzzle In-Reply-To: <932b2f1f0908081652u591b41e6ld0610cb8554c3287@mail.gmail.com> References: <932b2f1f0908081652u591b41e6ld0610cb8554c3287@mail.gmail.com> Message-ID: On Aug 8, 2009, at 4:52 PM, Robby Findler wrote: > Do you get a stacktrace with the error message? Not in the test frame. But I do if I attempt to paste it into the Interactions REPL. See below. I'd been kind of wondering how I might figure out where a #f is being passed in place of an editor, without making changes to the private code -- tricky (or at least tedious) given all the callbacks involved, and didn't seem worth it for an uncertain payoff before inquiring here. jmj ------- set-editor method of editor-snip%: expects argument of type ; given #f === context === /Applications/PLT Scheme v4.2/collects/mred/private/wxme/editor- snip.ss:125:2: set-editor method in editor-snip% /Applications/PLT Scheme v4.2/collects/mred/private/wxme/snip.ss: 1178:2: read method in editor-snip-class% for-loop /Applications/PLT Scheme v4.2/collects/mred/private/wxme/editor.ss: 600:2: read-snips-from-file method in editor% /Applications/PLT Scheme v4.2/collects/mred/private/wxme/editor.ss: 1034:2: do-buffer-paste method in editor% /Applications/PLT Scheme v4.2/collects/mred/private/wxme/text.ss: 2055:2: do-paste method in text% /Applications/PLT Scheme v4.2/collects/mred/private/wxme/text.ss: 2087:2: core /Applications/PLT Scheme v4.2/collects/framework/private/standard- menus.ss:382:4: edit-menu:paste-callback method in ...te/standard- menus.ss:179:2 /Applications/PLT Scheme v4.2/collects/mred/private/wxme/keymap.ss: 485:2: chain-handle-key-event method in keymap% for-loop /Applications/PLT Scheme v4.2/collects/mred/private/wxme/keymap.ss: 485:2: chain-handle-key-event method in keymap% for-loop /Applications/PLT Scheme v4.2/collects/mred/private/wxme/keymap.ss: 485:2: chain-handle-key-event method in keymap% /Applications/PLT Scheme v4.2/collects/mred/private/wxme/keymap.ss: 441:2: handle-key-event method in keymap% /Applications/PLT Scheme v4.2/collects/mred/private/wxmenu.ss:56:23 /Applications/PLT Scheme v4.2/collects/scheme/private/more-scheme.ss: 155:2: call-with-break-parameterization ... ----------- > > > > Robby > > On Sat, Aug 8, 2009 at 1:57 AM, Jordan Johnson > wrote: >> Hi all, >> >> I've been working on a snip implementation (representing an annotated >> expression) and am getting a mysterious error. I'd be grateful for >> any help >> the community can offer in solving the problem. >> >> The error: Currently when I attempt to copy and paste my snip, I >> get the >> error >> >> set-editor method of editor-snip%: expects argument of type >> ; given #f >> >> ...and the editor-snip% in question is apparently not any of the >> snips I've >> defined, which I've verified by overriding their set-editor >> method. This >> error is coming from somewhere deep in MrEd, and (after >> embarrassingly many >> hours of reading internal code and probing/rewriting) I don't see >> the cause. >> >> Below is a version I've pared down to just what's necessary to see >> the >> structure and exercise the bug. To reproduce the error: run it, >> evaluate >> (test-w/text%), and attempt to copy and paste the editor-snip% you >> see in >> the frame it created. >> >> Any observations? >> >> Thanks, >> jmj >> >> ;;;;;;; code-desc-simplified.ss >> >> #lang scheme/gui >> >> (require framework embedded-gui) >> (provide anno-snip%) >> >> ;;;;;;;;;; Snipclassery (for cut/paste) ;;;;;;;;;;; >> ;; Design follows framework/private/comment-box.ss lines 23-31 >> (define anno-snipclass% >> (class decorated-editor-snipclass% >> (define/override (make-snip stream-in) (new anno-snip%)) >> (define/override (read in) >> (let ([pb (new anno-pb%)]) >> (let ([code-ed (send pb get-code-editor)] >> [anno-ed (send pb get-anno-editor)]) >> (send code-ed read-from-file in 'start) >> (send anno-ed read-from-file in 'start)))) >> >> (super-new))) >> >> (define snipclass (make-object anno-snipclass%)) >> (send snipclass set-version 1) >> (send snipclass set-classname "code-desc-snip.ss") >> (send (get-the-snip-class-list) add snipclass) >> >> >> ;;;; Snip representing an annotated chunk of code. >> (define anno-snip% >> (class decorated-editor-snip% >> >> (define/override (make-editor) (new anno-pb%)) >> (define/override (make-snip) (new anno-snip%)) >> >> ;; copy/paste: >> (inherit get-editor) >> (define/override (write stream-out) >> (let ([pb (get-editor)]) >> (let ([code (send pb get-code-editor)] >> [anno (send pb get-anno-editor)]) >> (send code write-to-file stream-out) >> (send anno write-to-file stream-out)))) >> >> (define/override (copy) ;; -> anno-snip% >> ;; return a copy of this snip >> (let ([s (new anno-snip%)]) >> (send s set-editor (send (get-editor) copy-self)) >> s)) >> >> (super-new) >> )) >> >> (define anno-pb% >> (let () >> (define (find-owner-snip ed) ;; editor<%> -> (union #f editor- >> snip%) >> (let ([admin (send ed get-admin)]) >> (and admin >> (admin . is-a? . editor-snip-editor-admin<%>) >> (send admin get-snip)))) >> (define scheme+copy-self% ;; class for the code editor >> (class scheme:text% ;; (from framework/private/comment- >> box.ss) >> (inherit copy-self-to) >> (init-field [kind 'default]) >> (define/override (copy-self) >> (let ([ed (new scheme+copy-self%)]) >> (copy-self-to ed) >> ed)) >> (super-new) >> (inherit set-max-undo-history) >> (set-max-undo-history 'forever))) >> (class aligned-pasteboard% >> (super-new) >> >> ;;;;;;; Component editors: >> ;; code-editor and anno-editor are the two text%s that contain >> the >> ;; code and annotation, respectively. >> ;; -> (union #f text%) >> (define/public (get-code-editor) code-editor) >> (define/public (make-code-editor) (new scheme+copy-self% >> [kind 'code])) >> ;; -> (union #f text%) >> (define/public (get-anno-editor) anno-editor) >> (define/public (make-anno-editor) (new text%)) >> >> (define code-editor (make-code-editor)) ;; code box's editor >> (define anno-editor (make-anno-editor)) ;; annotation box's >> >> ;;;;;;; Container snips for the text editors: >> >> (define val (new vertical-alignment% [parent this])) >> ;; Container for the code box. I'm using this for the ability >> to >> ;; show/hide the box: >> (define code-view (new vertical-alignment% >> [parent val] >> [show? #t])) >> >> ;; Installs stretchable editor snips, if none are already >> installed, >> ;; to contain the code and anno editors. >> ;; (Does nothing if they already are installed, and returns #f.) >> ;; Returns #t if successful. >> (define (init-snips) >> (and (not (or (find-owner-snip code-editor) >> (find-owner-snip anno-editor))) >> (let ([code-snip (new stretchable-editor-snip% >> [editor code-editor] >> [with-border? #t] >> [min-width 50])] >> [anno-snip (new stretchable-editor-snip% >> [editor anno-editor] >> [with-border? #f] >> [min-width 50])]) >> (make-object snip-wrapper% code-view code-snip) >> (make-object hline% code-view) >> (make-object snip-wrapper% val anno-snip) >> #t))) >> >> (init-snips) >> >> ;;;;;;;;; copy+paste ;;;;;;;;; >> >> (define/override (copy-self) >> (let ([ed (new anno-pb%)]) >> (let ([ed-code (send ed get-code-editor)] >> [ed-anno (send ed get-anno-editor)]) >> (send (get-code-editor) copy-self-to ed-code) >> (send (get-anno-editor) copy-self-to ed-anno) >> ed))) >> ))) >> >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> (define (test-w/text%) >> (define test-snip (new anno-snip%)) >> (define test-pb (send test-snip get-editor)) >> (define txt (new scheme:text%)) >> (define f (mk-test-frame)) >> (define c (new editor-canvas% [parent f][editor txt])) >> (send txt insert "\n(* x 3)\n4))" 0) >> (send txt insert test-snip 0) >> (send txt insert "(define (f x)\n(+ " 0) >> (send txt tabify-all) >> (send f show #t) >> ) >> (define (mk-test-frame) >> (new frame% [label "ah"] [width 500] [height 300] >> [alignment '(center center)])) >> >> >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090808/a9ef7b74/attachment-0001.html From krustev.svilen at googlemail.com Sun Aug 9 07:51:41 2009 From: krustev.svilen at googlemail.com (Svilen) Date: Sun Aug 9 07:57:20 2009 Subject: [plt-scheme] Autotools integration Message-ID: <4A7EB84D.9050403@googlemail.com> Hi guys, I'm not a plt programmer - sorry if my question sounds stupid. I have an .ss source which has to be included in a bigger C++ project which uses autotools. My understanding is that I have to create a Makefile.am file with the corresponding rules for compilation and installation. So here is the question - are there any examples for such kind of Makefile? I've tried to search the web, but couldn't find much. Or maybe I'm missing the whole idea? Your help will be appreciated. Regards Svilen From lists.amitsaha at gmail.com Sun Aug 9 10:05:18 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Aug 9 10:06:22 2009 Subject: [plt-scheme] Scheme implementation of Fisher-Yates shuffle Message-ID: <4A7ED79E.50207@gmail.com> Hello all, Here is my Scheme implementation of the "modern" version of the "Fisher Yates Shuffle" (http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). I am sharing this with the hope that it may be useful to someone in the community. #lang scheme ;; Fisher-Yates shuffling algorithm in Scheme (plt-scheme) ;; Amit Saha (http://amitksaha.wordpress.com; amitsaha.in@gmail.com) ;; Useful to obtain a random shuffle of a list ;; call with (shuffle ) (define (shuffle deck) (let loop ((n (length deck)) (shuff_deck (list->vector deck))) (if (<= n 1) shuff_deck (begin (set! n (- n 1)) (let* ([rand (random (+ 1 n))] [tmp (vector-ref shuff_deck rand)] ) (vector-set! shuff_deck rand (vector-ref shuff_deck n)) (vector-set! shuff_deck n tmp)) (loop n shuff_deck))))) At the same time, I would appreciate any feedback on the implementation. Best Regards, Amit -- Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From mflatt at cs.utah.edu Sun Aug 9 10:05:47 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun Aug 9 10:06:26 2009 Subject: [plt-scheme] a snip copy/paste puzzle In-Reply-To: References: Message-ID: <20090809140551.0C1E66500CB@mail-svr1.cs.utah.edu> At Fri, 7 Aug 2009 23:57:22 -0700, Jordan Johnson wrote: > I've been working on a snip implementation (representing an annotated > expression) and am getting a mysterious error. I'd be grateful for > any help the community can offer in solving the problem. There are two layers of problems --- one yours and one mine: * You need to set the snipclass for each instance of `anno-snip%' by ending the initialization with (inherit set-snipclass) (set-snipclass snipclass) Also, the `read' method of your snipclass needs to create and return a snip: (define/override (read in) (let* ([s (new anno-snip%)] [pb (send s get-editor)]) (let ([code-ed (send pb get-code-editor)] [anno-ed (send pb get-anno-editor)]) (send code-ed read-from-file in 'start) (send anno-ed read-from-file in 'start)) s)) With those changes, you code works in 4.1.5. * There's a problem in `embedded-gui' where it registers two different snip classes name "make-line-snip". The editor-classes rewrite for v4.2 did not correctly handle multiple registrations of the same name. I've fixed both of those problems in SVN, but it means that even your revised code won't work in 4.2 or 4.2.1. Of course, there's also the problem (mine) that error messages are bad when you get part of the complicated snip machinery wrong. That will take more work, eventually. From lists.amitsaha at gmail.com Sun Aug 9 10:09:55 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Aug 9 10:10:25 2009 Subject: [plt-scheme] Re: Scheme implementation of Fisher-Yates shuffle In-Reply-To: <4A7ED79E.50207@gmail.com> References: <4A7ED79E.50207@gmail.com> Message-ID: <4A7ED8B3.1060904@gmail.com> Amit Saha wrote: > Hello all, > > Here is my Scheme implementation of the "modern" version of the "Fisher > Yates Shuffle" > (http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). I am > sharing this with the hope that it may be useful to someone in the > community. > > > #lang scheme > > ;; Fisher-Yates shuffling algorithm in Scheme (plt-scheme) > ;; Amit Saha (http://amitksaha.wordpress.com; amitsaha.in@gmail.com) > > ;; Useful to obtain a random shuffle of a list > ;; call with (shuffle ) > > (define (shuffle deck) > (let loop ((n (length deck)) (shuff_deck (list->vector deck))) > (if (<= n 1) > shuff_deck > (begin > (set! n (- n 1)) > (let* ([rand (random (+ 1 n))] > [tmp (vector-ref shuff_deck rand)] > ) > (vector-set! shuff_deck rand (vector-ref shuff_deck n)) > (vector-set! shuff_deck n tmp)) > (loop n shuff_deck))))) > > > > At the same time, I would appreciate any feedback on the implementation. Was also interested in the background of the implementation of 'shuffle-list' in 'games/cards'. I checked the 'utils.ss' file, but didn't find any references. Best Regards, Amit -- Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From beratn at gmail.com Sun Aug 9 10:53:06 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Sun Aug 9 10:53:26 2009 Subject: [plt-scheme] Question chapter 10 box issue Message-ID: Hey I have a problem with box.We wrote function called cyclically-bind-and-interp i understand that function.I mean we have to create cyclic environment for doing some recursion but i dont understand why we use "box".Function like that. (define (cyclically-bind-and-interp bound-id named-expr env) (local ([define value-holder (box (numV 1729)) ] [define new-env ( aRecSub bound-id value-holder env)] [define named-expr-val (interp named-expr new-env)]) ? ? ?)) some who knows box issue,can explain me thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090809/fb7cae53/attachment.htm From toddobryan at gmail.com Sun Aug 9 12:21:35 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 9 12:21:57 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> Message-ID: <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> OK, I've dug into teachprims.ss, but immediately hit a problem. I changed the language to #lang typed-scheme but if I try to run the file, I get an immediate error before I make anymore changes: compile: unbound identifier in the transformer environment (and no #%app syntax transformer is bound) in: syntax-case Does Typed Scheme interact strangely with macros so that I'd have to unpack all the define-teach definitions in the teachprims file, or am I just doing something stupid? Todd On Sat, Aug 8, 2009 at 1:17 PM, Todd O'Bryan wrote: > I guess the big problem I'm having dealing with the primitives in > places like beginner-funs.ss and teachprims.ss is that they use a lot > of macros--provide-and-document and define-teach--to name two. Is it > safe to just change the languages in those files to typed-scheme and > stick in a type annotation, or will that have some kind of weird > interaction with the macro-provided definitions and the later > renaming? I really need to get a good handle on macros and I just > don't have it yet. > > I considered trying OCaml, but currying of functions, the lack of > warnings about function arguments not appearing in application > positions, and the wealth of other stuff that the teaching languages > do convinced me it was just a bad idea. > > Todd > > On Sat, Aug 8, 2009 at 12:22 PM, Matthias Felleisen wrote: >> >> The languages are located in collects/lang/htdp*. The primitives come from >> private/ and are obviously labeled as such. Create copies and introduce type >> checking at your leisure. >> >> ;; --- >> >> WARNING: If you really believe that type checking should be an integral part >> of the first few weeks, you do NOT need to use Typed Scheme for this >> purpose. The type system of Typed Scheme is designed so that programmers can >> easily port existing Scheme code, programmed in an idiomatic manner, into a >> typed setting -- with little more effort than annotating all binding >> occurrences of variables and fields (aka declarations). It isn't perfect in >> this manner but it's the best such practical effort out there. >> >> Since your programming novices are NOT porting code and you DO NOT wish to >> program in the specific idioms of Scheme, I recommend that you spare >> yourself the rather large implementation effort for now and experiment with >> OCAML instead. The language is quite similar to Scheme but comes with a >> native type system. (I strongly recommend always using type annotations and >> to shunt type inference as much as possible.) Use only those constructs that >> are close to the ones in HtDP teaching languages. While this doesn't give >> you the teaching languages, it restricts the potential for truly weird >> syntax errors. >> >> ;; --- >> >> IN GENERAL, we have not thought through the exact nature of the type system >> that is appropriate for novice programmers. We do know, however, that we can >> build a contract system that supports dynamic checking. Doing so will be our >> next step. >> >> The DEIN PROGRAM sister project in Germany (included in the core >> distribution) has beaten us this time and has already done so. I suspect our >> solution will be similar to theirs. >> >> ;; --- >> >> Good luck -- Matthias >> >> >> >> >> >> On Aug 8, 2009, at 12:05 PM, Todd O'Bryan wrote: >> >>> Can somebody explain how the structure of the HtDP teaching languages >>> works? >>> >>> I'm interested in, as an experiment, having my students write type >>> annotations for their programs, just to see whether it clears up their >>> type confusions or makes it even harder for them to get things right. >>> I've received advice from several people stating that this is a bad >>> idea and that I am going to create a great deal of pain for myself, so >>> I've been forewarned. Realize, however, that I'll spend probably two >>> months dealing with simple functions and structures before I ever get >>> to lists, so the problems of polymorphism that rear their heads so >>> early in a typical college class won't bother me until Halloween or >>> so. I'm willing to risk the pain, and I'm even willing to accept the >>> laughing and pointing that are likely to occur when I give up and tell >>> everyone that I now accept that this was just a bad idea. >>> >>> But I can't even get things to begin to work, because I can't grok how >>> the teaching languages are structured. How would I go about adding >>> types and type checking (provided by Typed Scheme) to the language >>> constructs of Beginning Student? I tried obvious things like changing >>> scheme/base to typed-scheme in the htdp-beginner files, but I end up >>> not being able to make the colon type annotation available and when I >>> try to run programs I get errors saying that there are type >>> annotations missing. >>> >>> David Van Horn provided me with some work he started on in this vein, >>> but he was working with Advanced Student rather than Beginning and the >>> internal structure of each of the teaching languages is so complicated >>> that I can't tell which htdp-advanced's I can just replace with >>> htdp-beginner's and which ones I have to reconstruct. >>> >>> Is there a document anywhere that describes how the teaching languages >>> are built or is it all just in the code? >>> >>> Parenthetically, it's really hard to figure out where things are >>> coming from as I'm trying to read through Scheme code without running >>> Check Syntax and using Jump to Definition. Is this the normal state of >>> Scheme coding or am I missing something that would make figuring out >>> how the pieces fit together easier? >>> >>> Thanks, >>> Todd >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > From rafkind at cs.utah.edu Sun Aug 9 13:39:20 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Sun Aug 9 13:41:01 2009 Subject: [plt-scheme] Scheme implementation of Fisher-Yates shuffle In-Reply-To: <4A7ED79E.50207@gmail.com> References: <4A7ED79E.50207@gmail.com> Message-ID: <4A7F09C8.1000307@cs.utah.edu> Amit Saha wrote: > Hello all, > > Here is my Scheme implementation of the "modern" version of the > "Fisher Yates Shuffle" > (http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). I am > sharing this with the hope that it may be useful to someone in the > community. > > > #lang scheme > > ;; Fisher-Yates shuffling algorithm in Scheme (plt-scheme) > ;; Amit Saha (http://amitksaha.wordpress.com; amitsaha.in@gmail.com) > > ;; Useful to obtain a random shuffle of a list > ;; call with (shuffle ) > > (define (shuffle deck) > (let loop ((n (length deck)) (shuff_deck (list->vector deck))) > (if (<= n 1) > shuff_deck > (begin > (set! n (- n 1)) > (let* ([rand (random (+ 1 n))] > [tmp (vector-ref shuff_deck rand)] > ) > (vector-set! shuff_deck rand (vector-ref shuff_deck n)) > (vector-set! shuff_deck n tmp)) > (loop n shuff_deck))))) > > Heres the one I wrote a while ago (define (randomize lst) (let ((v (list->vector lst))) (let loop ((max (sub1 (vector-length v)))) (if (= 0 max) (vector->list v) (begin (let ((place (random max))) (let ((tmp (vector-ref v place))) (vector-set! v place (vector-ref v max)) (vector-set! v max tmp))) (loop (sub1 max))))))) Notable differences are I don't set! the index variable, nor do I pass along the vector in the loop. Otherwise I guess they are about the same. From pbewig at gmail.com Sun Aug 9 13:56:58 2009 From: pbewig at gmail.com (Phil Bewig) Date: Sun Aug 9 13:57:20 2009 Subject: [plt-scheme] Scheme implementation of Fisher-Yates shuffle In-Reply-To: <4A7F09C8.1000307@cs.utah.edu> References: <4A7ED79E.50207@gmail.com> <4A7F09C8.1000307@cs.utah.edu> Message-ID: I asked for the best way to shuffle a list on comp.lang.scheme a few years ago. The discussion went wild; you can see it on Google Groups if you want. After that, I wrote this summary: It is easy to shuffle a vector by stepping through the vector, swapping each element with a forward element (including possibly the element itself) until the next-to-last element is reached. The classic description is given by Knuth in AoCP, Volume 2, Section 3.4.2, Algorithm P: (define (shuffle v) (do ((n (length x) (- n 1))) ((zero? n) v)) (let* ((r (random n)) (t (vector-ref v r))) (vector-set! v r (vector-ref v (- n 1))) (vector-set! v (- n 1) t)))) But shuffling a list is harder, because lists don't permit O(1) access to any element except the first. Joe Marshall provides this method of shuffling a list by partitioning it into two pieces deterministically, shuffling them recursively, then merging them randomly: (define (shuffle xs) (if (or (null? xs) (null? (cdr xs))) xs (let split ((xs xs) (odd '()) (even '())) (if (pair? xs) (split (cdr xs) (cons (car xs) even) odd) (let merge ((odd (shuffle odd)) (even (shuffle even))) (cond ((null? odd) even) ((null? even) odd) ((zero? (random 2)) (cons (car odd) (merge (cdr odd) even))) (else (cons (car even) (merge odd (cdr even)))))))))) Al Petrofsky proposes this somewhat faster code that first partitions the list randomly, then randomly merges them: (define (shuffle xs) (let shuffle ((xs xs) (acc '())) (if (null? xs) acc (if (null? (cdr xs)) (cons (car xs) acc) (let split ((xs xs) (x1 '()) (x2 '())) (if (null? xs) (if (null? x1) (split x2 '() '()) (shuffle x1 (shuffle x2 acc))) (if (zero? (random 2)) (split (cdr xs) (cons (car xs) x1) x2) (split (cdr xs) x1 (cons (car xs) x2))))))))) If you want, you can always do Perl's omigod Schwartzian transform: (define (shuffle xs) (map cdr (sort (lambda (x y) (< (car x) (car y))) (map (lambda (x) (cons (random 1.0) x)) xs)))) But the fastest method of shuffling a list is to convert it to a vector, use Knuth's algorithm to shuffle the vector, then convert it back to a list; this algorithm operates in linear time (all the others are n log n), and is very fast despite the two type conversions: (define (shuffle x) (do ((v (list->vector x)) (n (length x) (- n 1))) ((zero? n) (vector->list v)) (let* ((r (random n)) (t (vector-ref v r))) (vector-set! v r (vector-ref v (- n 1))) (vector-set! v (- n 1) t)))) On Sun, Aug 9, 2009 at 12:39 PM, Jon Rafkind wrote: > Amit Saha wrote: > >> Hello all, >> >> Here is my Scheme implementation of the "modern" version of the "Fisher >> Yates Shuffle" (http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). >> I am sharing this with the hope that it may be useful to someone in the >> community. >> >> >> #lang scheme >> >> ;; Fisher-Yates shuffling algorithm in Scheme (plt-scheme) >> ;; Amit Saha (http://amitksaha.wordpress.com; amitsaha.in@gmail.com) >> >> ;; Useful to obtain a random shuffle of a list >> ;; call with (shuffle ) >> >> (define (shuffle deck) >> (let loop ((n (length deck)) (shuff_deck (list->vector deck))) >> (if (<= n 1) >> shuff_deck >> (begin >> (set! n (- n 1)) >> (let* ([rand (random (+ 1 n))] >> [tmp (vector-ref shuff_deck rand)] >> ) >> (vector-set! shuff_deck rand (vector-ref shuff_deck n)) >> (vector-set! shuff_deck n tmp)) >> (loop n shuff_deck))))) >> >> >> Heres the one I wrote a while ago > (define (randomize lst) > (let ((v (list->vector lst))) > (let loop ((max (sub1 (vector-length v)))) > (if (= 0 max) > (vector->list v) > (begin > (let ((place (random max))) > (let ((tmp (vector-ref v place))) > (vector-set! v place (vector-ref v max)) > (vector-set! v max tmp))) > (loop (sub1 max))))))) > > Notable differences are I don't set! the index variable, nor do I pass > along the vector in the loop. Otherwise I guess they are about the same. > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090809/6216aa05/attachment.html From robby at eecs.northwestern.edu Sun Aug 9 14:29:07 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Aug 9 14:29:29 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> Message-ID: <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> You probably want (require (for-syntax scheme/base)) and then a whole bunch of other changes too :) Robby On Sun, Aug 9, 2009 at 11:21 AM, Todd O'Bryan wrote: > OK, I've dug into teachprims.ss, but immediately hit a problem. > > I changed the language to > > #lang typed-scheme > > but if I try to run the file, I get an immediate error before I make > anymore changes: > > compile: unbound identifier in the transformer environment (and no > #%app syntax transformer is bound) in: syntax-case > > Does Typed Scheme interact strangely with macros so that I'd have to > unpack all the define-teach definitions in the teachprims file, or am > I just doing something stupid? > > Todd > > On Sat, Aug 8, 2009 at 1:17 PM, Todd O'Bryan wrote: >> I guess the big problem I'm having dealing with the primitives in >> places like beginner-funs.ss and teachprims.ss is that they use a lot >> of macros--provide-and-document and define-teach--to name two. Is it >> safe to just change the languages in those files to typed-scheme and >> stick in a type annotation, or will that have some kind of weird >> interaction with the macro-provided definitions and the later >> renaming? I really need to get a good handle on macros and I just >> don't have it yet. >> >> I considered trying OCaml, but currying of functions, the lack of >> warnings about function arguments not appearing in application >> positions, and the wealth of other stuff that the teaching languages >> do convinced me it was just a bad idea. >> >> Todd >> >> On Sat, Aug 8, 2009 at 12:22 PM, Matthias Felleisen wrote: >>> >>> The languages are located in collects/lang/htdp*. The primitives come from >>> private/ and are obviously labeled as such. Create copies and introduce type >>> checking at your leisure. >>> >>> ;; --- >>> >>> WARNING: If you really believe that type checking should be an integral part >>> of the first few weeks, you do NOT need to use Typed Scheme for this >>> purpose. The type system of Typed Scheme is designed so that programmers can >>> easily port existing Scheme code, programmed in an idiomatic manner, into a >>> typed setting -- with little more effort than annotating all binding >>> occurrences of variables and fields (aka declarations). It isn't perfect in >>> this manner but it's the best such practical effort out there. >>> >>> Since your programming novices are NOT porting code and you DO NOT wish to >>> program in the specific idioms of Scheme, I recommend that you spare >>> yourself the rather large implementation effort for now and experiment with >>> OCAML instead. The language is quite similar to Scheme but comes with a >>> native type system. (I strongly recommend always using type annotations and >>> to shunt type inference as much as possible.) Use only those constructs that >>> are close to the ones in HtDP teaching languages. While this doesn't give >>> you the teaching languages, it restricts the potential for truly weird >>> syntax errors. >>> >>> ;; --- >>> >>> IN GENERAL, we have not thought through the exact nature of the type system >>> that is appropriate for novice programmers. We do know, however, that we can >>> build a contract system that supports dynamic checking. Doing so will be our >>> next step. >>> >>> The DEIN PROGRAM sister project in Germany (included in the core >>> distribution) has beaten us this time and has already done so. I suspect our >>> solution will be similar to theirs. >>> >>> ;; --- >>> >>> Good luck -- Matthias >>> >>> >>> >>> >>> >>> On Aug 8, 2009, at 12:05 PM, Todd O'Bryan wrote: >>> >>>> Can somebody explain how the structure of the HtDP teaching languages >>>> works? >>>> >>>> I'm interested in, as an experiment, having my students write type >>>> annotations for their programs, just to see whether it clears up their >>>> type confusions or makes it even harder for them to get things right. >>>> I've received advice from several people stating that this is a bad >>>> idea and that I am going to create a great deal of pain for myself, so >>>> I've been forewarned. Realize, however, that I'll spend probably two >>>> months dealing with simple functions and structures before I ever get >>>> to lists, so the problems of polymorphism that rear their heads so >>>> early in a typical college class won't bother me until Halloween or >>>> so. I'm willing to risk the pain, and I'm even willing to accept the >>>> laughing and pointing that are likely to occur when I give up and tell >>>> everyone that I now accept that this was just a bad idea. >>>> >>>> But I can't even get things to begin to work, because I can't grok how >>>> the teaching languages are structured. How would I go about adding >>>> types and type checking (provided by Typed Scheme) to the language >>>> constructs of Beginning Student? I tried obvious things like changing >>>> scheme/base to typed-scheme in the htdp-beginner files, but I end up >>>> not being able to make the colon type annotation available and when I >>>> try to run programs I get errors saying that there are type >>>> annotations missing. >>>> >>>> David Van Horn provided me with some work he started on in this vein, >>>> but he was working with Advanced Student rather than Beginning and the >>>> internal structure of each of the teaching languages is so complicated >>>> that I can't tell which htdp-advanced's I can just replace with >>>> htdp-beginner's and which ones I have to reconstruct. >>>> >>>> Is there a document anywhere that describes how the teaching languages >>>> are built or is it all just in the code? >>>> >>>> Parenthetically, it's really hard to figure out where things are >>>> coming from as I'm trying to read through Scheme code without running >>>> Check Syntax and using Jump to Definition. Is this the normal state of >>>> Scheme coding or am I missing something that would make figuring out >>>> how the pieces fit together easier? >>>> >>>> Thanks, >>>> Todd >>>> _________________________________________________ >>>> ?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 jmarshall at alum.mit.edu Sun Aug 9 14:41:42 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Sun Aug 9 14:42:24 2009 Subject: [plt-scheme] Scheme implementation of Fisher-Yates shuffle In-Reply-To: References: <4A7ED79E.50207@gmail.com> <4A7F09C8.1000307@cs.utah.edu> Message-ID: Alas, my technique doesn't create a uniform distribution. On Sun, Aug 9, 2009 at 10:56 AM, Phil Bewig wrote: > I asked for the best way to shuffle a list on comp.lang.scheme a few years > ago.? The discussion went wild; you can see it on Google Groups if you > want.? After that, I wrote this summary: > > It is easy to shuffle a vector by stepping through the vector, swapping each > element with a forward element (including possibly the element itself) until > the next-to-last element is reached. The classic description is given by > Knuth in AoCP, Volume 2, Section 3.4.2, Algorithm P: > > (define (shuffle v) > (do ((n (length x) (- n 1))) ((zero? n) v)) > (let* ((r (random n)) (t (vector-ref v r))) > (vector-set! v r (vector-ref v (- n 1))) > > (vector-set! v (- n 1) t)))) > > But shuffling a list is harder, because lists don't permit O(1) access to > any element except the first. Joe Marshall provides this method of shuffling > a list by partitioning it into two pieces deterministically, shuffling them > recursively, then merging them randomly: > > (define (shuffle xs) > (if (or (null? xs) (null? (cdr xs))) xs > (let split ((xs xs) (odd '()) (even '())) > (if (pair? xs) > > (split (cdr xs) (cons (car xs) even) odd) > (let merge ((odd (shuffle odd)) (even (shuffle even))) > (cond ((null? odd) even) > ((null? even) odd) > ((zero? (random 2)) (cons (car odd) (merge (cdr odd) > even))) > > (else (cons (car even) (merge odd (cdr even)))))))))) > > Al Petrofsky proposes this somewhat faster code that first partitions the > list randomly, then randomly merges them: > > (define (shuffle xs) > (let shuffle ((xs xs) (acc '())) > (if (null? xs) acc > (if (null? (cdr xs)) (cons (car xs) acc) > > (let split ((xs xs) (x1 '()) (x2 '())) > (if (null? xs) > (if (null? x1) > (split x2 '() '()) > (shuffle x1 (shuffle x2 acc))) > > (if (zero? (random 2)) > (split (cdr xs) (cons (car xs) x1) x2) > (split (cdr xs) x1 (cons (car xs) x2))))))))) > > If you want, you can always do Perl's omigod Schwartzian transform: > > (define (shuffle xs) > (map cdr > (sort (lambda (x y) (< (car x) (car y))) > (map (lambda (x) (cons (random 1.0) x)) xs)))) > > But the fastest method of shuffling a list is to convert it to a vector, use > Knuth's algorithm to shuffle the vector, then convert it back to a list; > this algorithm operates in linear time (all the others are n log n), and is > very fast despite the two type conversions: > > (define (shuffle x) > (do ((v (list->vector x)) (n (length x) (- n 1))) > ((zero? n) (vector->list v)) > > (let* ((r (random n)) (t (vector-ref v r))) > (vector-set! v r (vector-ref v (- n 1))) > (vector-set! v (- n 1) t)))) > > > On Sun, Aug 9, 2009 at 12:39 PM, Jon Rafkind wrote: >> >> Amit Saha wrote: >>> >>> Hello all, >>> >>> Here is my Scheme implementation of the "modern" version of the "Fisher >>> Yates Shuffle" (http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). >>> I am sharing this with the hope that it may be useful to someone in the >>> community. >>> >>> >>> #lang scheme >>> >>> ;; Fisher-Yates shuffling algorithm in Scheme (plt-scheme) >>> ;; Amit Saha (http://amitksaha.wordpress.com; amitsaha.in@gmail.com) >>> >>> ;; Useful to obtain a random shuffle of a list >>> ;; call with (shuffle ) >>> >>> (define (shuffle deck) >>> ? (let loop ((n (length deck)) (shuff_deck (list->vector deck))) >>> ? ? (if (<= n 1) >>> ? ? ? shuff_deck >>> ? ? ? (begin >>> ? ? (set! n (- n 1)) >>> ? ? (let* ([rand (random (+ 1 n))] >>> ? ? ? ? ? [tmp (vector-ref shuff_deck rand)] >>> ? ? ? ? ?) >>> ? ? ? (vector-set! shuff_deck rand (vector-ref shuff_deck n)) >>> ? ? ? (vector-set! shuff_deck n tmp)) >>> ? ? ? (loop n shuff_deck))))) >>> >>> >> Heres the one I wrote a while ago >> (define (randomize lst) >> ?(let ((v (list->vector lst))) >> ? (let loop ((max (sub1 (vector-length v)))) >> ? ? (if (= 0 max) >> ? ? ? (vector->list v) >> ? ? ? (begin >> ? ? ? ? (let ((place (random max))) >> ? ? ? ? ? (let ((tmp (vector-ref v place))) >> ? ? ? ? ? ? (vector-set! v place (vector-ref v max)) >> ? ? ? ? ? ? (vector-set! v max tmp))) >> ? ? ? ? (loop (sub1 max))))))) >> >> Notable differences are I don't set! the index variable, nor do I pass >> along the vector in the loop. Otherwise I guess they are about the same. >> _________________________________________________ >> ?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 > > -- ~jrm From eli at barzilay.org Sun Aug 9 14:44:42 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sun Aug 9 14:45:03 2009 Subject: [plt-scheme] Scheme implementation of Fisher-Yates shuffle In-Reply-To: References: <4A7ED79E.50207@gmail.com> <4A7F09C8.1000307@cs.utah.edu> Message-ID: <19071.6426.15540.846234@winooski.ccs.neu.edu> On Aug 9, Phil Bewig wrote: > > If you want, you can always do Perl's omigod Schwartzian transform: > > (define (shuffle xs) > (map cdr > (sort (lambda (x y) (< (car x) (car y))) > (map (lambda (x) (cons (random 1.0) x)) xs)))) * In PLT, this is a one-liner: (sort xs < #:key (lambda (_) (random)) #:cache-keys? #t) * I think that many Lispers (and therefore Schemers) inlcuding myself view the "Schwartzian transform" term as a borderline insult. It has been in use for decades, well before Perl existed. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From feberman08 at gmail.com Sun Aug 9 08:03:24 2009 From: feberman08 at gmail.com (=?ISO-8859-1?Q?Erman_Ers=F6zl=FC?=) Date: Sun Aug 9 15:00:11 2009 Subject: [plt-scheme] reference to undefined identifier Message-ID: <9fa69a83-e82b-4ab0-90ed-a9bd3c5e608d@h30g2000vbr.googlegroups.com> hi, i am new and i have a problem.i couldn't find any solution :( i am sure it is a basic and an easy problem.. i saw these codes in a scheme book but they didn't work.it gives this problem: reference to undefined identifier: accumulate. i don't know what that means.what can i do to fix? i use pretty big language. (define (acronym phrase) (accumulate word (every first phrase))) > (acronym '(american civil liberties union)) From grettke at acm.org Sun Aug 9 17:51:04 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Aug 9 17:51:22 2009 Subject: [plt-scheme] reference to undefined identifier In-Reply-To: <9fa69a83-e82b-4ab0-90ed-a9bd3c5e608d@h30g2000vbr.googlegroups.com> References: <9fa69a83-e82b-4ab0-90ed-a9bd3c5e608d@h30g2000vbr.googlegroups.com> Message-ID: <756daca50908091451s5650eccdjf94b6697d9b3dc7a@mail.gmail.com> On Sun, Aug 9, 2009 at 7:03 AM, Erman Ers?zl? wrote: > hi, i am new and i have a problem.i couldn't find any solution :( i am > sure it is a basic and an easy problem.. > i saw these codes in a scheme book but they didn't work.it gives this > problem: reference to undefined identifier: accumulate. i don't know > what that means.what can i do to fix? i use pretty big language. If I write a program like this: > (define a 1) > (define b 2) > (+ a b c) The interpreter will tell me: reference to undefined identifier: c From toddobryan at gmail.com Sun Aug 9 18:28:58 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 9 18:29:19 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> Message-ID: <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> Thank you. I'm now making progress... However, I've hit a Typed Scheme hiccup. (define (positive-real? v) (and (real? v) (>= v 0))) won't type check because it thinks the second v is just an Any. I tried adding a type annotation (ann v Number) with a begin around the second part of the and, but that didn't help. Anybody know how to give Typed Scheme the hint it needs here? Todd On Sun, Aug 9, 2009 at 2:29 PM, Robby Findler wrote: > You probably want > > (require (for-syntax scheme/base)) > > and then a whole bunch of other changes too :) > > Robby > > On Sun, Aug 9, 2009 at 11:21 AM, Todd O'Bryan wrote: >> OK, I've dug into teachprims.ss, but immediately hit a problem. >> >> I changed the language to >> >> #lang typed-scheme >> >> but if I try to run the file, I get an immediate error before I make >> anymore changes: >> >> compile: unbound identifier in the transformer environment (and no >> #%app syntax transformer is bound) in: syntax-case >> >> Does Typed Scheme interact strangely with macros so that I'd have to >> unpack all the define-teach definitions in the teachprims file, or am >> I just doing something stupid? >> >> Todd >> >> On Sat, Aug 8, 2009 at 1:17 PM, Todd O'Bryan wrote: >>> I guess the big problem I'm having dealing with the primitives in >>> places like beginner-funs.ss and teachprims.ss is that they use a lot >>> of macros--provide-and-document and define-teach--to name two. Is it >>> safe to just change the languages in those files to typed-scheme and >>> stick in a type annotation, or will that have some kind of weird >>> interaction with the macro-provided definitions and the later >>> renaming? I really need to get a good handle on macros and I just >>> don't have it yet. >>> >>> I considered trying OCaml, but currying of functions, the lack of >>> warnings about function arguments not appearing in application >>> positions, and the wealth of other stuff that the teaching languages >>> do convinced me it was just a bad idea. >>> >>> Todd >>> >>> On Sat, Aug 8, 2009 at 12:22 PM, Matthias Felleisen wrote: >>>> >>>> The languages are located in collects/lang/htdp*. The primitives come from >>>> private/ and are obviously labeled as such. Create copies and introduce type >>>> checking at your leisure. >>>> >>>> ;; --- >>>> >>>> WARNING: If you really believe that type checking should be an integral part >>>> of the first few weeks, you do NOT need to use Typed Scheme for this >>>> purpose. The type system of Typed Scheme is designed so that programmers can >>>> easily port existing Scheme code, programmed in an idiomatic manner, into a >>>> typed setting -- with little more effort than annotating all binding >>>> occurrences of variables and fields (aka declarations). It isn't perfect in >>>> this manner but it's the best such practical effort out there. >>>> >>>> Since your programming novices are NOT porting code and you DO NOT wish to >>>> program in the specific idioms of Scheme, I recommend that you spare >>>> yourself the rather large implementation effort for now and experiment with >>>> OCAML instead. The language is quite similar to Scheme but comes with a >>>> native type system. (I strongly recommend always using type annotations and >>>> to shunt type inference as much as possible.) Use only those constructs that >>>> are close to the ones in HtDP teaching languages. While this doesn't give >>>> you the teaching languages, it restricts the potential for truly weird >>>> syntax errors. >>>> >>>> ;; --- >>>> >>>> IN GENERAL, we have not thought through the exact nature of the type system >>>> that is appropriate for novice programmers. We do know, however, that we can >>>> build a contract system that supports dynamic checking. Doing so will be our >>>> next step. >>>> >>>> The DEIN PROGRAM sister project in Germany (included in the core >>>> distribution) has beaten us this time and has already done so. I suspect our >>>> solution will be similar to theirs. >>>> >>>> ;; --- >>>> >>>> Good luck -- Matthias >>>> >>>> >>>> >>>> >>>> >>>> On Aug 8, 2009, at 12:05 PM, Todd O'Bryan wrote: >>>> >>>>> Can somebody explain how the structure of the HtDP teaching languages >>>>> works? >>>>> >>>>> I'm interested in, as an experiment, having my students write type >>>>> annotations for their programs, just to see whether it clears up their >>>>> type confusions or makes it even harder for them to get things right. >>>>> I've received advice from several people stating that this is a bad >>>>> idea and that I am going to create a great deal of pain for myself, so >>>>> I've been forewarned. Realize, however, that I'll spend probably two >>>>> months dealing with simple functions and structures before I ever get >>>>> to lists, so the problems of polymorphism that rear their heads so >>>>> early in a typical college class won't bother me until Halloween or >>>>> so. I'm willing to risk the pain, and I'm even willing to accept the >>>>> laughing and pointing that are likely to occur when I give up and tell >>>>> everyone that I now accept that this was just a bad idea. >>>>> >>>>> But I can't even get things to begin to work, because I can't grok how >>>>> the teaching languages are structured. How would I go about adding >>>>> types and type checking (provided by Typed Scheme) to the language >>>>> constructs of Beginning Student? I tried obvious things like changing >>>>> scheme/base to typed-scheme in the htdp-beginner files, but I end up >>>>> not being able to make the colon type annotation available and when I >>>>> try to run programs I get errors saying that there are type >>>>> annotations missing. >>>>> >>>>> David Van Horn provided me with some work he started on in this vein, >>>>> but he was working with Advanced Student rather than Beginning and the >>>>> internal structure of each of the teaching languages is so complicated >>>>> that I can't tell which htdp-advanced's I can just replace with >>>>> htdp-beginner's and which ones I have to reconstruct. >>>>> >>>>> Is there a document anywhere that describes how the teaching languages >>>>> are built or is it all just in the code? >>>>> >>>>> Parenthetically, it's really hard to figure out where things are >>>>> coming from as I'm trying to read through Scheme code without running >>>>> Check Syntax and using Jump to Definition. Is this the normal state of >>>>> Scheme coding or am I missing something that would make figuring out >>>>> how the pieces fit together easier? >>>>> >>>>> Thanks, >>>>> Todd >>>>> _________________________________________________ >>>>> ?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 toddobryan at gmail.com Sun Aug 9 18:35:47 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 9 18:36:44 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> Message-ID: <904774730908091535s376daedbp6723a2d50a2e7c4c@mail.gmail.com> As so often happens, just after sending this message I realized that I needed to convince Typed Scheme that real? is a predicate for Number, so I added (require/typed scheme [real? (Any -> Boolean : Number)]) at the top, and it now works. On Sun, Aug 9, 2009 at 6:28 PM, Todd O'Bryan wrote: > Thank you. I'm now making progress... > > However, I've hit a Typed Scheme hiccup. > > (define (positive-real? v) > ?(and (real? v) (>= v 0))) > > won't type check because it thinks the second v is just an Any. > > I tried adding a type annotation (ann v Number) with a begin around > the second part of the and, but that didn't help. > > Anybody know how to give Typed Scheme the hint it needs here? > > Todd > > On Sun, Aug 9, 2009 at 2:29 PM, Robby > Findler wrote: >> You probably want >> >> (require (for-syntax scheme/base)) >> >> and then a whole bunch of other changes too :) >> >> Robby >> >> On Sun, Aug 9, 2009 at 11:21 AM, Todd O'Bryan wrote: >>> OK, I've dug into teachprims.ss, but immediately hit a problem. >>> >>> I changed the language to >>> >>> #lang typed-scheme >>> >>> but if I try to run the file, I get an immediate error before I make >>> anymore changes: >>> >>> compile: unbound identifier in the transformer environment (and no >>> #%app syntax transformer is bound) in: syntax-case >>> >>> Does Typed Scheme interact strangely with macros so that I'd have to >>> unpack all the define-teach definitions in the teachprims file, or am >>> I just doing something stupid? >>> >>> Todd >>> >>> On Sat, Aug 8, 2009 at 1:17 PM, Todd O'Bryan wrote: >>>> I guess the big problem I'm having dealing with the primitives in >>>> places like beginner-funs.ss and teachprims.ss is that they use a lot >>>> of macros--provide-and-document and define-teach--to name two. Is it >>>> safe to just change the languages in those files to typed-scheme and >>>> stick in a type annotation, or will that have some kind of weird >>>> interaction with the macro-provided definitions and the later >>>> renaming? I really need to get a good handle on macros and I just >>>> don't have it yet. >>>> >>>> I considered trying OCaml, but currying of functions, the lack of >>>> warnings about function arguments not appearing in application >>>> positions, and the wealth of other stuff that the teaching languages >>>> do convinced me it was just a bad idea. >>>> >>>> Todd >>>> >>>> On Sat, Aug 8, 2009 at 12:22 PM, Matthias Felleisen wrote: >>>>> >>>>> The languages are located in collects/lang/htdp*. The primitives come from >>>>> private/ and are obviously labeled as such. Create copies and introduce type >>>>> checking at your leisure. >>>>> >>>>> ;; --- >>>>> >>>>> WARNING: If you really believe that type checking should be an integral part >>>>> of the first few weeks, you do NOT need to use Typed Scheme for this >>>>> purpose. The type system of Typed Scheme is designed so that programmers can >>>>> easily port existing Scheme code, programmed in an idiomatic manner, into a >>>>> typed setting -- with little more effort than annotating all binding >>>>> occurrences of variables and fields (aka declarations). It isn't perfect in >>>>> this manner but it's the best such practical effort out there. >>>>> >>>>> Since your programming novices are NOT porting code and you DO NOT wish to >>>>> program in the specific idioms of Scheme, I recommend that you spare >>>>> yourself the rather large implementation effort for now and experiment with >>>>> OCAML instead. The language is quite similar to Scheme but comes with a >>>>> native type system. (I strongly recommend always using type annotations and >>>>> to shunt type inference as much as possible.) Use only those constructs that >>>>> are close to the ones in HtDP teaching languages. While this doesn't give >>>>> you the teaching languages, it restricts the potential for truly weird >>>>> syntax errors. >>>>> >>>>> ;; --- >>>>> >>>>> IN GENERAL, we have not thought through the exact nature of the type system >>>>> that is appropriate for novice programmers. We do know, however, that we can >>>>> build a contract system that supports dynamic checking. Doing so will be our >>>>> next step. >>>>> >>>>> The DEIN PROGRAM sister project in Germany (included in the core >>>>> distribution) has beaten us this time and has already done so. I suspect our >>>>> solution will be similar to theirs. >>>>> >>>>> ;; --- >>>>> >>>>> Good luck -- Matthias >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On Aug 8, 2009, at 12:05 PM, Todd O'Bryan wrote: >>>>> >>>>>> Can somebody explain how the structure of the HtDP teaching languages >>>>>> works? >>>>>> >>>>>> I'm interested in, as an experiment, having my students write type >>>>>> annotations for their programs, just to see whether it clears up their >>>>>> type confusions or makes it even harder for them to get things right. >>>>>> I've received advice from several people stating that this is a bad >>>>>> idea and that I am going to create a great deal of pain for myself, so >>>>>> I've been forewarned. Realize, however, that I'll spend probably two >>>>>> months dealing with simple functions and structures before I ever get >>>>>> to lists, so the problems of polymorphism that rear their heads so >>>>>> early in a typical college class won't bother me until Halloween or >>>>>> so. I'm willing to risk the pain, and I'm even willing to accept the >>>>>> laughing and pointing that are likely to occur when I give up and tell >>>>>> everyone that I now accept that this was just a bad idea. >>>>>> >>>>>> But I can't even get things to begin to work, because I can't grok how >>>>>> the teaching languages are structured. How would I go about adding >>>>>> types and type checking (provided by Typed Scheme) to the language >>>>>> constructs of Beginning Student? I tried obvious things like changing >>>>>> scheme/base to typed-scheme in the htdp-beginner files, but I end up >>>>>> not being able to make the colon type annotation available and when I >>>>>> try to run programs I get errors saying that there are type >>>>>> annotations missing. >>>>>> >>>>>> David Van Horn provided me with some work he started on in this vein, >>>>>> but he was working with Advanced Student rather than Beginning and the >>>>>> internal structure of each of the teaching languages is so complicated >>>>>> that I can't tell which htdp-advanced's I can just replace with >>>>>> htdp-beginner's and which ones I have to reconstruct. >>>>>> >>>>>> Is there a document anywhere that describes how the teaching languages >>>>>> are built or is it all just in the code? >>>>>> >>>>>> Parenthetically, it's really hard to figure out where things are >>>>>> coming from as I'm trying to read through Scheme code without running >>>>>> Check Syntax and using Jump to Definition. Is this the normal state of >>>>>> Scheme coding or am I missing something that would make figuring out >>>>>> how the pieces fit together easier? >>>>>> >>>>>> Thanks, >>>>>> Todd >>>>>> _________________________________________________ >>>>>> ?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 carl.eastlund at gmail.com Sun Aug 9 18:35:55 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sun Aug 9 18:36:49 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> Message-ID: <990e0c030908091535m7233b23sb3dbd5557f45194f@mail.gmail.com> Todd, The following program should work: #lang typed-scheme (: positive-real? (Any -> Boolean)) (define (positive-real? v) (and (number? v) (real? v) (>= v 0))) Currently >= expects inputs of type Number, and number? is the predicate for the Number type. I do not believe there is a Real type, and real? is not recognized as a type predicate. Carl Eastlund On Sun, Aug 9, 2009 at 6:28 PM, Todd O'Bryan wrote: > Thank you. I'm now making progress... > > However, I've hit a Typed Scheme hiccup. > > (define (positive-real? v) > ?(and (real? v) (>= v 0))) > > won't type check because it thinks the second v is just an Any. > > I tried adding a type annotation (ann v Number) with a begin around > the second part of the and, but that didn't help. > > Anybody know how to give Typed Scheme the hint it needs here? > > Todd From carl.eastlund at gmail.com Sun Aug 9 18:39:11 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sun Aug 9 18:39:49 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908091535s376daedbp6723a2d50a2e7c4c@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> <904774730908091535s376daedbp6723a2d50a2e7c4c@mail.gmail.com> Message-ID: <990e0c030908091539q30955674r1588d0e39011338c@mail.gmail.com> Todd, I believe the ability to put predicate types in require/typed is unsound and soon to be unsupported. Sam can probably say more on that subject if need be. I recommend using number? to point Typed Scheme in the right direction (as in the email I sent a few seconds ago, which you likely had not received when you sent the below). Carl Eastlund On Sun, Aug 9, 2009 at 6:35 PM, Todd O'Bryan wrote: > As so often happens, just after sending this message I realized that I > needed to convince Typed Scheme that real? is a predicate for Number, > so I added > > (require/typed scheme [real? (Any -> Boolean : Number)]) > > at the top, and it now works. > > On Sun, Aug 9, 2009 at 6:28 PM, Todd O'Bryan wrote: >> Thank you. I'm now making progress... >> >> However, I've hit a Typed Scheme hiccup. >> >> (define (positive-real? v) >> ?(and (real? v) (>= v 0))) >> >> won't type check because it thinks the second v is just an Any. >> >> I tried adding a type annotation (ann v Number) with a begin around >> the second part of the and, but that didn't help. >> >> Anybody know how to give Typed Scheme the hint it needs here? >> >> Todd From toddobryan at gmail.com Sun Aug 9 20:00:23 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 9 20:00:43 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <990e0c030908091539q30955674r1588d0e39011338c@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> <904774730908091535s376daedbp6723a2d50a2e7c4c@mail.gmail.com> <990e0c030908091539q30955674r1588d0e39011338c@mail.gmail.com> Message-ID: <904774730908091700q2bfa3f24i456518b3f115d597@mail.gmail.com> Thanks. I'll do it the way you suggested... On Sun, Aug 9, 2009 at 6:39 PM, Carl Eastlund wrote: > Todd, > > I believe the ability to put predicate types in require/typed is > unsound and soon to be unsupported. ?Sam can probably say more on that > subject if need be. ?I recommend using number? to point Typed Scheme > in the right direction (as in the email I sent a few seconds ago, > which you likely had not received when you sent the below). > > Carl Eastlund > > On Sun, Aug 9, 2009 at 6:35 PM, Todd O'Bryan wrote: >> As so often happens, just after sending this message I realized that I >> needed to convince Typed Scheme that real? is a predicate for Number, >> so I added >> >> (require/typed scheme [real? (Any -> Boolean : Number)]) >> >> at the top, and it now works. >> >> On Sun, Aug 9, 2009 at 6:28 PM, Todd O'Bryan wrote: >>> Thank you. I'm now making progress... >>> >>> However, I've hit a Typed Scheme hiccup. >>> >>> (define (positive-real? v) >>> ?(and (real? v) (>= v 0))) >>> >>> won't type check because it thinks the second v is just an Any. >>> >>> I tried adding a type annotation (ann v Number) with a begin around >>> the second part of the and, but that didn't help. >>> >>> Anybody know how to give Typed Scheme the hint it needs here? >>> >>> Todd > From toddobryan at gmail.com Sun Aug 9 20:07:12 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 9 20:07:30 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908091700q2bfa3f24i456518b3f115d597@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> <904774730908091535s376daedbp6723a2d50a2e7c4c@mail.gmail.com> <990e0c030908091539q30955674r1588d0e39011338c@mail.gmail.com> <904774730908091700q2bfa3f24i456518b3f115d597@mail.gmail.com> Message-ID: <904774730908091707q47f84c22i6c8b4aaedbbbd2c9@mail.gmail.com> OK. Any idea what to do about vector? which apparently isn't the predicate for (Vectorof Any). On Sun, Aug 9, 2009 at 8:00 PM, Todd O'Bryan wrote: > Thanks. I'll do it the way you suggested... > > On Sun, Aug 9, 2009 at 6:39 PM, Carl Eastlund wrote: >> Todd, >> >> I believe the ability to put predicate types in require/typed is >> unsound and soon to be unsupported. ?Sam can probably say more on that >> subject if need be. ?I recommend using number? to point Typed Scheme >> in the right direction (as in the email I sent a few seconds ago, >> which you likely had not received when you sent the below). >> >> Carl Eastlund >> >> On Sun, Aug 9, 2009 at 6:35 PM, Todd O'Bryan wrote: >>> As so often happens, just after sending this message I realized that I >>> needed to convince Typed Scheme that real? is a predicate for Number, >>> so I added >>> >>> (require/typed scheme [real? (Any -> Boolean : Number)]) >>> >>> at the top, and it now works. >>> >>> On Sun, Aug 9, 2009 at 6:28 PM, Todd O'Bryan wrote: >>>> Thank you. I'm now making progress... >>>> >>>> However, I've hit a Typed Scheme hiccup. >>>> >>>> (define (positive-real? v) >>>> ?(and (real? v) (>= v 0))) >>>> >>>> won't type check because it thinks the second v is just an Any. >>>> >>>> I tried adding a type annotation (ann v Number) with a begin around >>>> the second part of the and, but that didn't help. >>>> >>>> Anybody know how to give Typed Scheme the hint it needs here? >>>> >>>> Todd >> > From toddobryan at gmail.com Sun Aug 9 21:40:24 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 9 21:40:48 2009 Subject: [plt-scheme] typed teaching languages In-Reply-To: <904774730908091707q47f84c22i6c8b4aaedbbbd2c9@mail.gmail.com> References: <904774730908080905w7d707fb0pca50fc5777832d44@mail.gmail.com> <904774730908081017s2c89cdeat298397f36124edfd@mail.gmail.com> <904774730908090921i1421b1dahaca8197147140bdb@mail.gmail.com> <932b2f1f0908091129i16efa715n14806a2c3c9e9bc1@mail.gmail.com> <904774730908091528h1832466bu104edb5d31b8023d@mail.gmail.com> <904774730908091535s376daedbp6723a2d50a2e7c4c@mail.gmail.com> <990e0c030908091539q30955674r1588d0e39011338c@mail.gmail.com> <904774730908091700q2bfa3f24i456518b3f115d597@mail.gmail.com> <904774730908091707q47f84c22i6c8b4aaedbbbd2c9@mail.gmail.com> Message-ID: <904774730908091840h7c6b048bv76e5c342501dcd7f@mail.gmail.com> OK. I've made great progress, at least by my standards. I've gone through the entire lang/private/teachprims.ss file and clarified all the types with appropriate annotations, so that I don't get anymore type errors. However, I now get this error: match: no matching clause for (Unknown Type: #(struct:top-arr 51 #f)) Unfortunately, there's no line highlighting and there's not even a match statement in the file. I've uploaded what I've got to a page on my class wiki: https://www.dupontmanual.org/wikis/spectops/TypedScheme If anyone has time to take a look or a process I could undertake to start figuring out where the error is, I'd appreciate any insight! Thanks, Todd On Sun, Aug 9, 2009 at 8:07 PM, Todd O'Bryan wrote: > OK. Any idea what to do about vector? which apparently isn't the > predicate for (Vectorof Any). > > On Sun, Aug 9, 2009 at 8:00 PM, Todd O'Bryan wrote: >> Thanks. I'll do it the way you suggested... >> >> On Sun, Aug 9, 2009 at 6:39 PM, Carl Eastlund wrote: >>> Todd, >>> >>> I believe the ability to put predicate types in require/typed is >>> unsound and soon to be unsupported. ?Sam can probably say more on that >>> subject if need be. ?I recommend using number? to point Typed Scheme >>> in the right direction (as in the email I sent a few seconds ago, >>> which you likely had not received when you sent the below). >>> >>> Carl Eastlund >>> >>> On Sun, Aug 9, 2009 at 6:35 PM, Todd O'Bryan wrote: >>>> As so often happens, just after sending this message I realized that I >>>> needed to convince Typed Scheme that real? is a predicate for Number, >>>> so I added >>>> >>>> (require/typed scheme [real? (Any -> Boolean : Number)]) >>>> >>>> at the top, and it now works. >>>> >>>> On Sun, Aug 9, 2009 at 6:28 PM, Todd O'Bryan wrote: >>>>> Thank you. I'm now making progress... >>>>> >>>>> However, I've hit a Typed Scheme hiccup. >>>>> >>>>> (define (positive-real? v) >>>>> ?(and (real? v) (>= v 0))) >>>>> >>>>> won't type check because it thinks the second v is just an Any. >>>>> >>>>> I tried adding a type annotation (ann v Number) with a begin around >>>>> the second part of the and, but that didn't help. >>>>> >>>>> Anybody know how to give Typed Scheme the hint it needs here? >>>>> >>>>> Todd >>> >> > From jmj at fellowhuman.com Mon Aug 10 01:56:51 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Mon Aug 10 01:57:42 2009 Subject: [plt-scheme] a snip copy/paste puzzle In-Reply-To: <20090809140551.0C1E66500CB@mail-svr1.cs.utah.edu> References: <20090809140551.0C1E66500CB@mail-svr1.cs.utah.edu> Message-ID: On Aug 9, 2009, at 7:05 AM, Matthew Flatt wrote: > There are two layers of problems --- one yours and one mine: > [...] > With those changes, you code works in 4.1.5. > > * There's a problem in `embedded-gui' where it registers two different > snip classes name "make-line-snip". The editor-classes rewrite for > v4.2 did not correctly handle multiple registrations of the same > name. > > I've fixed both of those problems in SVN, but it means that even > your revised code won't work in 4.2 or 4.2.1. OK, so if I understand correctly, I can use the fixes you described and either use 4.1.5, or wait until the next release (or the next pre- release build that contains it)? The behavior I currently see in 4.2 and 4.2.1.5-svn9aug2009 (which I'm assuming doesn't have today's fixes) is that nothing happens on copy. In any case, thanks for your helpful response! I'll likely post here about the working code sometime soon, in case it's of interest to the community. Best, jmj From plt at synx.us.to Mon Aug 10 02:15:04 2009 From: plt at synx.us.to (Synx) Date: Mon Aug 10 02:15:32 2009 Subject: [plt-scheme] compound unit duplicate names...prefix? Message-ID: <4A7FBAE8.2020203@synx.us.to> I've been trying to figure out units and I'm puzzled about the naming between units. I made for instance a "keys" unit that exports a few procedures, a procedure named 'save' and a procedure named 'load' for saving and loading keys. A "basic" unit that also exports a different save and load procedure, and a "decider" unit that also exports a different save and load procedure. The trouble comes when I make a compound unit with (define-compound-unit/infer). It can link together the above units just fine, and export decider^ perfectly well, but if I were to say export keys^ and decider^ it would fail, because both keys^ and decider^ signatures have a "save" procedure and a "load" procedure. I would export (except keys^ save load) since the keys unit has useful procedures besides that save and load, or I would export (prefix keys: keys^) so anyone importing my compound unit could use key:load when they wanted specifically to load a key. But neither of those methods work, because the export syntax for define-compound-unit/infer will not allow (except ...) or (prefix ...) only the signature IDs as they are named. My solution has been to use names such as keys:load-key and basic:load-basic, but that seems redundant to me. I much prefer putting a prefix on to avoid namespace conflict, than to have a required -X suffix that I write into the unit definition itself. Is there a more elegant method? Or is that just what I have to do, for the name of every load or save procedure append a special suffix indicating what unit it's in? I'll attach an example... when I try to run test.ss I predictably get the error "define-values/invoke-unit/core: duplicate binding for foo in: (define-values/invoke-unit/core both@ a^ b^)" -------------- next part -------------- #lang scheme/signature foo -------------- next part -------------- #lang scheme/unit (require "a-sig.ss") (import) (export a^) (define (foo) 42) -------------- next part -------------- #lang scheme/signature foo -------------- next part -------------- #lang scheme/unit (require "b-sig.ss") (import) (export b^) (define (foo) 23) -------------- next part -------------- #lang scheme/base (require "a-sig.ss" "b-sig.ss" "a-unit.ss" "b-unit.ss") (require scheme/unit) (define-compound-unit/infer both@ (import) (export a^ b^) (link a@ b@)) (provide both@) -------------- next part -------------- #lang scheme/base (require "c.ss") (require scheme/unit) (define-values/invoke-unit/infer both@) From mflatt at cs.utah.edu Mon Aug 10 08:46:42 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Aug 10 08:47:04 2009 Subject: [plt-scheme] a snip copy/paste puzzle In-Reply-To: References: <20090809140551.0C1E66500CB@mail-svr1.cs.utah.edu> Message-ID: <20090810124644.E4A036500C7@mail-svr1.cs.utah.edu> At Sun, 9 Aug 2009 22:56:51 -0700, Jordan Johnson wrote: > > On Aug 9, 2009, at 7:05 AM, Matthew Flatt wrote: > > There are two layers of problems --- one yours and one mine: > > [...] > > With those changes, you code works in 4.1.5. > > > > * There's a problem in `embedded-gui' where it registers two different > > snip classes name "make-line-snip". The editor-classes rewrite for > > v4.2 did not correctly handle multiple registrations of the same > > name. > > > > I've fixed both of those problems in SVN, but it means that even > > your revised code won't work in 4.2 or 4.2.1. > > OK, so if I understand correctly, I can use the fixes you described > and either use 4.1.5, or wait until the next release (or the next pre- > release build that contains it)? The behavior I currently see in 4.2 > and 4.2.1.5-svn9aug2009 (which I'm assuming doesn't have today's > fixes) is that nothing happens on copy. Right. But the nightly build that's now available (4.2.1.5-svn10aug2009) should work. From plragde at uwaterloo.ca Mon Aug 10 09:16:38 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Mon Aug 10 09:41:49 2009 Subject: [plt-scheme] Scheme implementation of Fisher-Yates shuffle Message-ID: <4A801DB6.6020105@uwaterloo.ca> Phil Bewig writes: > Joe Marshall provides this method of shuffling > a list by partitioning it into two pieces deterministically, shuffling them > recursively, then merging them randomly: > (define (shuffle xs) > (if (or (null? xs) (null? (cdr xs))) xs > (let split ((xs xs) (odd '()) (even '())) > (if (pair? xs) > (split (cdr xs) (cons (car xs) even) odd) > (let merge ((odd (shuffle odd)) (even (shuffle even))) > (cond ((null? odd) even) > ((null? even) odd) > ((zero? (random 2)) (cons (car odd) (merge (cdr odd) even))) > (else (cons (car even) (merge odd (cdr even)))))))))) This code will not give a distribution where all permutations of the list are equally likely. The easiest way to see this is to consider the input '(0 1 2). 1 will be in the odd list by itself, and it has probability 1/2 of being first in the result, instead of the required 1/3. > Al Petrofsky proposes this somewhat faster code that first partitions the > list randomly, then randomly merges them: > (define (shuffle xs) > (let shuffle ((xs xs) (acc '())) > (if (null? xs) acc > (if (null? (cdr xs)) (cons (car xs) acc) > (let split ((xs xs) (x1 '()) (x2 '())) > (if (null? xs) > (if (null? x1) > (split x2 '() '()) > (shuffle x1 (shuffle x2 acc))) > (if (zero? (random 2)) > (split (cdr xs) (cons (car xs) x1) x2) > (split (cdr xs) x1 (cons (car xs) x2))))))))) This does give the right distribution, but the running time is not O(n log n) in the worst case. A similar analysis to that of quicksort on a random permutation will show that it is O(n log n) on average (or with high probability) but O(n^2) in the worst case. Can we ensure the right distribution and O(n log n) worst-case running time? Yes, by fixing Joe's code so that in a random merge, the probability of taking from one of the two lists is proportional to the length of that list. (define (shuffle xs) (if (or (null? xs) (null? (cdr xs))) xs (let split ((xs xs) (odd '()) (even '()) (len 0)) (if (pair? xs) (split (cdr xs) (cons (car xs) even) odd (add1 len)) (let merge ((odd (shuffle odd)) (oddl (length odd)) (even (shuffle even)) (len len)) (cond ((= len oddl) odd) ((zero? oddl) even) ((< (random len) oddl) (cons (car odd) (merge (cdr odd) (sub1 oddl) even (sub1 len)))) (else (cons (car even) (merge odd oddl (cdr even) (sub1 len)))))))))) If desired, we can incorporate the accumulator idea from Al's code. --PR From dyoo at cs.wpi.edu Mon Aug 10 13:50:07 2009 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Mon Aug 10 13:55:43 2009 Subject: [plt-scheme] reference to undefined identifier In-Reply-To: <9fa69a83-e82b-4ab0-90ed-a9bd3c5e608d@h30g2000vbr.googlegroups.com> References: <9fa69a83-e82b-4ab0-90ed-a9bd3c5e608d@h30g2000vbr.googlegroups.com> Message-ID: > hi, i am new and i have a problem.i couldn't find any solution :( i am > sure it is a basic and an easy problem.. > i saw these codes in a scheme book but they didn't work.it gives this > problem: reference to undefined identifier: accumulate. i don't know > what that means.what can i do to fix? i use pretty big language. I'm assuming you're looking at the Simply Scheme textbook. Is that right? If so, you need to do one more thing: the Simply Scheme texbook assumes that you're loaded some special definitions that aren't built-in. Those definitions are available from Brian Harvey's website, but you may more easily grab those definitions from the Simply Scheme package on PLaneT. See: http://hkn.eecs.berkeley.edu/~dyoo/cs3/simply-scheme/ for installation instructions. From beratn at gmail.com Mon Aug 10 14:17:29 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Mon Aug 10 14:17:49 2009 Subject: [plt-scheme] lambda calculus Message-ID: if the issue of this mail is off topic for this mail group i am sorry.But i am searching a source for lambda calculus).I dont know anything about lambda calculus at least i am beginner.Can someone suggest me a source for lambda calculus that explain normal form,reduction,Y operator,Z operator etc. Thanks. Notes : I am reading wikipedia. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090810/fa04ae34/attachment.htm From noelwelsh at gmail.com Mon Aug 10 14:28:57 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Aug 10 14:29:20 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: Message-ID: You might try the "Lambda Calculus with PLT Redex" linked from http://telefonica.net/web2/koot/ N. On Mon, Aug 10, 2009 at 7:17 PM, emre berat nebio?lu wrote: > if the issue of this mail is off topic for this mail group i am sorry.But i > am searching a source for lambda calculus).I dont know anything about lambda > calculus at least i am beginner.Can someone suggest me a source for lambda > calculus that explain normal form,reduction,Y operator,Z operator etc. > Thanks. > > Notes : I am reading wikipedia. From plt at synx.us.to Mon Aug 10 14:55:52 2009 From: plt at synx.us.to (Synx) Date: Mon Aug 10 14:56:35 2009 Subject: [plt-scheme] compound unit duplicate names...prefix? In-Reply-To: <4A7FBAE8.2020203@synx.us.to> References: <4A7FBAE8.2020203@synx.us.to> Message-ID: <4A806D38.70908@synx.us.to> I think I got it. I'll just take the code that would use the compound unit, and instead put it into a unit, itself. That way the test thingy only has to use regular syntax for importing and exporting and can assign prefixes. I'll just make a test^ signature it can export, and that's all the compound unit has to export too. I'll attach my example with that strategy applied. Any better strategies are welcome of course. -------------- next part -------------- #lang scheme/signature foo -------------- next part -------------- #lang scheme/unit (require "a-sig.ss") (import) (export a^) (define (foo) 42) -------------- next part -------------- #lang scheme/signature foo -------------- next part -------------- #lang scheme/unit (require "b-sig.ss") (import) (export b^) (define (foo) 23) -------------- next part -------------- #lang scheme/signature test -------------- next part -------------- #lang scheme/unit (require "a-sig.ss" "b-sig.ss" "test-sig.ss") (import (prefix a: a^) (prefix b: b^)) (export test^) (define (test) (display (format "Using both foo in a: ~a and foo in b: ~a becomes ~a~n" (a:foo) (b:foo) (- (a:foo) (b:foo))))) -------------- next part -------------- #lang scheme/base (require "a-unit.ss" "b-unit.ss" "test-sig.ss" "test-unit.ss") (require scheme/unit) (define-compound-unit/infer all@ (import) (export test^) (link a@ b@ test@)) (define-values/invoke-unit/infer all@) (test) From egarrulo at gmail.com Mon Aug 10 16:22:57 2009 From: egarrulo at gmail.com (Elena Garrulo) Date: Mon Aug 10 16:23:22 2009 Subject: [plt-scheme] Re: "unwind-protect" for PLT Scheme? In-Reply-To: <19024.16173.892585.74046@winooski.ccs.neu.edu> References: <9bd8a08a0907020253s197833efq90e3402f39f44c4f@mail.gmail.com> <877hyqwpu0.fsf@delenn.lan> <937E4CFB-E0D4-453B-98A5-4F66B43B3AFC@ccs.neu.edu> <3182b469-0fec-41f4-8e90-9857a9fba088@c9g2000yqm.googlegroups.com> <19024.16173.892585.74046@winooski.ccs.neu.edu> Message-ID: <9bd8a08a0908101322t36362c8dw86e6d956a1df30ed@mail.gmail.com> I've found this documents which could be of interest: Dorai Sitaram. "Unwind-protect in portable Scheme". Scheme Workshop 2003. November 2003: http://repository.readscheme.org/ftp/papers/sw2003/Unwind.pdf Here is a critique from Kent Pitman about the lack of a proper "unwind-protect" in Scheme: http://www.nhplace.com/kent/PFAQ/unwind-protect-vs-continuations-update-2003.html 2009/7/5 Eli Barzilay : > On Jul ?4, Shriram Krishnamurthi wrote: >> You only need the before-thunk argument to do something if you have >> continuations somewhere deep within the body expression. ?(But note >> that even if you don't use continuations, you just might use a >> library function that does.) ?As long as neither you nor a library >> does, you can pass something trivial as before-thunk, such as void. >> That reduces to being the same as Lisp's unwind-protect. > > Sorry to add another post on this, but I'll try to make a quick > summary of this whole thing in plain English (as much as I can call > what *I* write "plain English"): > > * When no continuations are involved, `dynamic-wind' is perfectly fine > ?as is, and you can set up the resource either in the before thunk, > ?or before the whole call: > > ? ?(let ([foo (open-output-file ...)]) > ? ? ?(dynamic-wind void > ? ? ? ? ? ? ? ? ? ?(lambda () ...do stuff with foo...) > ? ? ? ? ? ? ? ? ? ?(lambda () ...close foo...))) > > ?or > > ? ?(let ([foo #f]) > ? ? ?(dynamic-wind (lambda () (set! foo (open-output-file ...))) > ? ? ? ? ? ? ? ? ? ?(lambda () ...do stuff with foo...) > ? ? ? ? ? ? ? ? ? ?(lambda () ...close foo...))) > > * When continuations are involved, then control can jump into or out > ?of the main thunk, and you have several options to choose from. > ?Here the before thunk becomes important since it can be called not > ?just once, but several times -- once when it starts, and a pair of > ?after-before calls for each jump out of and back into the main > ?thunk. > > ?Just ignoring this makes it possible for your code to run into > ?problems that are similar in nature to writing code that is not > ?thread-safe: in both cases the problem is not in your own code, but > ?in the way it is being called or in the way library calls it > ?performs behave. ?And this analogy carries over to how people deal > ?with it: lots of user code just ignores the whole issue, but you > ?need to be more careful if you're writing some library, or parts of > ?the core language. ?[`call/cc' is notorious in exposing all kinds of > ?things about how things are implemented (for example, IIRC there was > ?a point in the (distant?) past where you could squeeze two different > ?behaviors out of mzscheme's `map' function because the > ?implementation was optimizing uses with a few functions).] > > * Options for dealing with this are: > > ?- Ignore the whole thing, and use the first form above. > > ?- Arrange for the resource to be properly opened and closed on the > ? ?before/after thunks -- which means that you need to make sure > ? ?that, for example, you open the file in `append' mode so when > ? ?jumping out and back in the resource will be recreated. ?Of > ? ?course, this depends on the code doing something simple, like just > ? ?writing to the file. > > ?- Forbid re-entry: you make a before thunk that remembers if it was > ? ?already called -- if that's the case, then you know that somehow > ? ?control went out and back in, and you make it throw an appropriate > ? ?error. ?This can be convenient if, for example, it is meaningless > ? ?to use the resource after it was already released. > > ?- Intentionally avoid creating and releasing the resource in a > ? ?`dynamic-wind', so it will only be released when control leaves > ? ?normally. ?An example for this would be: > > ? ? ?(let ([foo (open-output-file ...)]) > ? ? ? ?(begin0 (...do stuff with foo...) > ? ? ? ? ?(...close foo...))) > > ? ?or better: > > ? ? ?(let ([foo (open-output-file ...)]) > ? ? ? ?(define (close-foo) ...close foo...) > ? ? ? ?(with-handlers ([(lambda (x) #t) > ? ? ? ? ? ? ? ? ? ? ? ? (lambda (e) (close-foo) (raise e))]) > ? ? ? ? ?(begin0 (...do stuff with foo...) > ? ? ? ? ? ?(close-foo)))) > > ? ?This works if when control happens to go out, it will also go back > ? ?in, so eventually control leaves as usual. > > ?- There's a number of variants on these and subtle points involved > ? ?etc. > > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ? ?http://barzilay.org/ ? ? ? ? ? ? ? ? ? Maze is Life! > From matthias at ccs.neu.edu Mon Aug 10 17:20:16 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Aug 10 17:22:23 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: Message-ID: Barendregt, The Lambda Calculus, 1980 is the source of all things LC for a logician. Don't let the prerequisites turn you off. On Aug 10, 2009, at 2:28 PM, Noel Welsh wrote: > You might try the "Lambda Calculus with PLT Redex" linked from > > http://telefonica.net/web2/koot/ > > N. > > On Mon, Aug 10, 2009 at 7:17 PM, emre berat > nebio?lu wrote: >> if the issue of this mail is off topic for this mail group i am >> sorry.But i >> am searching a source for lambda calculus).I dont know anything >> about lambda >> calculus at least i am beginner.Can someone suggest me a source >> for lambda >> calculus that explain normal form,reduction,Y operator,Z operator >> etc. >> Thanks. >> >> Notes : I am reading wikipedia. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jmj at fellowhuman.com Mon Aug 10 18:05:40 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Mon Aug 10 18:06:03 2009 Subject: [plt-scheme] Evaluate text% contents Message-ID: <000E918C-038A-47F6-A3BD-AB4A340DD8CB@fellowhuman.com> Hi all, How can I read and evaluate the contents of a text% in the same manner as DrScheme's Definitions window? Context: In the snip implementation I'm working on, I ultimately want to be able to use this snip as a piece of a program in DrScheme. Right now I'm just creating a scheme:text% (as in my recent post); is there a more appropriate class? Possibly a better question: what approach was used for testing the snip classes that are now integrated with DrScheme (e.g., matrix-snip, number-snip, cache-image-snip), or what approach would now be best? Thanks, jmj From toddobryan at gmail.com Mon Aug 10 18:21:49 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Aug 10 18:22:11 2009 Subject: [plt-scheme] Typed Scheme error -- how to debug? Message-ID: <904774730908101521p7fbe30cfrc729ed1ac96a08d8@mail.gmail.com> I'm reposting this as its own thread hoping that people who stopped reading the other thread may respond to this one. I went through lang/htdp/private/teachprims.ss and added type annotations to everything. I've killed all of the type errors I had, but now I get this error: match: no matching clause for (Unknown Type: #(struct:top-arr 51 #f)) I don't get line highlighting of the error and I don't even know which file is causing the error. Any pointers as to how I can go about fixing this? Or what it is? Todd P.S. I posted the code on my class wiki at https://www.dupontmanual.org/wikis/spectops/TypedScheme in case anyone has time to run the code and see what's going wrong. From samth at ccs.neu.edu Mon Aug 10 19:10:11 2009 From: samth at ccs.neu.edu (Sam TH) Date: Mon Aug 10 19:10:33 2009 Subject: [plt-scheme] Typed Scheme error -- how to debug? In-Reply-To: <904774730908101521p7fbe30cfrc729ed1ac96a08d8@mail.gmail.com> References: <904774730908101521p7fbe30cfrc729ed1ac96a08d8@mail.gmail.com> Message-ID: <63bb19ae0908101610o1087151byf8d612c9f9a1eb7d@mail.gmail.com> This is a bug in Typed Scheme. If you can distill it to a small example, that would be great, but either way, please submit a bug report. Thanks, sam th On Mon, Aug 10, 2009 at 6:21 PM, Todd O'Bryan wrote: > I'm reposting this as its own thread hoping that people who stopped > reading the other thread may respond to this one. > > I went through lang/htdp/private/teachprims.ss and added type > annotations to everything. I've killed all of the type errors I had, > but now I get this error: > > match: no matching clause for (Unknown Type: #(struct:top-arr 51 #f)) > > I don't get line highlighting of the error and I don't even know which > file is causing the error. > > Any pointers as to how I can go about fixing this? Or what it is? > > Todd > > P.S. I posted the code on my class wiki at > > https://www.dupontmanual.org/wikis/spectops/TypedScheme > > in case anyone has time to run the code and see what's going wrong. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From plt at synx.us.to Mon Aug 10 19:19:55 2009 From: plt at synx.us.to (Synx) Date: Mon Aug 10 19:20:34 2009 Subject: [plt-scheme] Parameterize and the GUI Message-ID: <4A80AB1B.1070605@synx.us.to> Anyone know how to change parameters, while using the GUI? Because when I try to do it I'm like... (parameterize ((foo something-new)) (um...) (kill all the GUI windows) (shut down everything) (start up a new GUI)) Or else I just say (foo something-new) and treat the parameter like a global. I'm not sure (parameterize) can be used right with an asynchronous event loop type framework. You could nest event loops, but... Maybe I'm just not thinking with the right structure. How would you structure a GUI program, where you called something that never returned but put the GUI into a different state based on the new parameter settings? From lspector at hampshire.edu Mon Aug 10 19:19:01 2009 From: lspector at hampshire.edu (Lee Spector) Date: Mon Aug 10 19:24:24 2009 Subject: [plt-scheme] arglist-on-space? Message-ID: Is there any way to get "arglist-on-space" behavior in DrScheme or any editor working with PLT scheme? What I mean by this is that when you type the name of a function and then a space the argument list for the function appears in a mini-buffer (or anywhere -- I just want to see it). I'd be happy to have this functionality either in an editor (e.g. the DrScheme definitions pane) or listener (e.g. the DrScheme interactions pane) or both. I am a DrScheme/PLT newbie, adopting it for a course I'm teaching in the fall, but I'm a long-time Common Lisper and this is one of things I miss most from my favorite CL environments. Next on my list would be a way to get from a function name to the definition of the function with a couple of key strokes, rather than searching in files. Both of these things require the runtime environment to keep information around that maybe PLT isn't keeping around... but I don't know. Thanks, -Lee -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From matthias at ccs.neu.edu Mon Aug 10 19:40:49 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Aug 10 19:41:33 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: References: Message-ID: cmd / on the mac On Aug 10, 2009, at 7:19 PM, Lee Spector wrote: > > Is there any way to get "arglist-on-space" behavior in DrScheme or > any editor working with PLT scheme? What I mean by this is that > when you type the name of a function and then a space the argument > list for the function appears in a mini-buffer (or anywhere -- I > just want to see it). I'd be happy to have this functionality > either in an editor (e.g. the DrScheme definitions pane) or > listener (e.g. the DrScheme interactions pane) or both. > > I am a DrScheme/PLT newbie, adopting it for a course I'm teaching > in the fall, but I'm a long-time Common Lisper and this is one of > things I miss most from my favorite CL environments. Next on my > list would be a way to get from a function name to the definition > of the function with a couple of key strokes, rather than searching > in files. Both of these things require the runtime environment to > keep information around that maybe PLT isn't keeping around... but > I don't know. > > Thanks, > > -Lee > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From carl.eastlund at gmail.com Mon Aug 10 19:41:48 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Mon Aug 10 19:42:26 2009 Subject: [plt-scheme] Parameterize and the GUI In-Reply-To: <4A80AB1B.1070605@synx.us.to> References: <4A80AB1B.1070605@synx.us.to> Message-ID: <990e0c030908101641y673237b6v17af72995ec26851@mail.gmail.com> Synx, The parameterize macro sets a parameter for an intermediate part of computation. If you want to set it persistently instead, just apply the parameter as a setter function like so: (foo something-new) That will set the parameter foo to the value something-new for the duration of the current thread (at least until something else changes it again). To set it for a GUI callback thread, just make sure to call it from inside any GUI callback. Carl Eastlund On Mon, Aug 10, 2009 at 7:19 PM, Synx wrote: > > Anyone know how to change parameters, while using the GUI? Because when > I try to do it I'm like... > > (parameterize > ?((foo something-new)) > ?(um...) > ?(kill all the GUI windows) > ?(shut down everything) > ?(start up a new GUI)) > > Or else I just say (foo something-new) and treat the parameter like a > global. I'm not sure (parameterize) can be used right with an > asynchronous event loop type framework. You could nest event loops, but... > > Maybe I'm just not thinking with the right structure. How would you > structure a GUI program, where you called something that never returned > but put the GUI into a different state based on the new parameter settings? From mikeegg1 at me.com Mon Aug 10 20:16:58 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Mon Aug 10 20:17:17 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: References: Message-ID: <20090811001658.GB159@mail.me.com> On Mon, 10 Aug 2009, Lee Spector might have said: > I am a DrScheme/PLT newbie, ... > > Thanks, > > -Lee A newbie here, but I've read your posts for a long time about genetic programming. Mike From robby at eecs.northwestern.edu Mon Aug 10 20:36:06 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Aug 10 20:36:28 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: Message-ID: <932b2f1f0908101736t756e8b9ai8ffc20481de3d624@mail.gmail.com> Also, (but only if you want to spend actual money): check out _Semantics Engineering with PLT Redex_. The prologue is online here: http://redex.plt-scheme.org/ Robby 2009/8/10 Noel Welsh : > You might try the "Lambda Calculus with PLT Redex" linked from > > ?http://telefonica.net/web2/koot/ > > N. > > On Mon, Aug 10, 2009 at 7:17 PM, emre berat nebio?lu wrote: >> if the issue of this mail is off topic for this mail group i am sorry.But i >> am searching a source for lambda calculus).I dont know anything about lambda >> calculus at least i am beginner.Can someone suggest me a source for lambda >> calculus that explain normal form,reduction,Y operator,Z operator etc. >> Thanks. >> >> Notes : I am reading wikipedia. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at eecs.northwestern.edu Mon Aug 10 20:50:41 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Aug 10 20:51:05 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: References: Message-ID: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> For the arguments, DrScheme doesn't really do that (altho, as always, patches are welcome), but th next best thing is to hit f1. That'll send you to the docs, searching for whatever is around the insertion point in the editor. For the other, you have to run check syntax first and then you can jump directly to the definition of any function (no matter where it is defined-- check syntax re-uses the compiler to get its lexical information so you can be sure you're jumping precisely). Robby On Mon, Aug 10, 2009 at 6:19 PM, Lee Spector wrote: > > Is there any way to get "arglist-on-space" behavior in DrScheme or any > editor working with PLT scheme? What I mean by this is that when you type > the name of a function and then a space the argument list for the function > appears in a mini-buffer (or anywhere -- I just want to see it). I'd be > happy to have this functionality either in an editor (e.g. the DrScheme > definitions pane) or listener (e.g. the DrScheme interactions pane) or both. > > I am a DrScheme/PLT newbie, adopting it for a course I'm teaching in the > fall, but I'm a long-time Common Lisper and this is one of things I miss > most from my favorite CL environments. Next on my list would be a way to get > from a function name to the definition of the function with a couple of key > strokes, rather than searching in files. Both of these things require the > runtime environment to keep information around that maybe PLT isn't keeping > around... but I don't know. > > Thanks, > > ?-Lee > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From lspector at hampshire.edu Mon Aug 10 22:50:36 2009 From: lspector at hampshire.edu (Lee Spector) Date: Mon Aug 10 22:55:58 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> Message-ID: <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> Thanks for the speedy and helpful responses. F1, which I didn't know about previously, will help a lot. It doesn't show the arglist right in the programming environment, and it only helps for built-in definitions, but within these limits it provides pretty quick access to the arglist and documentation. "cmd /" (yes, I'm on a mac) provides symbol completion -- not what I had asked about, but also handy. Getting to definitions from Check Syntax -> control-click -> Jump to Definition also seems to be useful, although I'm having a hard time experimenting with it at the moment because I haven't yet fully grokked PLT namespaces, so my cross-file definitions aren't working as I expect. ("#lang scheme/load" makes file loading work in the way that I expect but then Check Syntax no longer provides the arrows/menus... I know I need to read about namespaces.) In any event I'll keep this in mind as I move forward. Thanks again, and if anyone knows of a way to get more complete arglist-on-space behavior (that is, in the programming environment and for all functions) I'd love to hear about it. -Lee PS Mike: glad to hear you've seen the GP stuff, some of which will inevitably migrate to Scheme as I spend more time writing Scheme code... On Aug 10, 2009, at 8:50 PM, Robby Findler wrote: > For the arguments, DrScheme doesn't really do that (altho, as always, > patches are welcome), but th next best thing is to hit f1. That'll > send you to the docs, searching for whatever is around the insertion > point in the editor. > > For the other, you have to run check syntax first and then you can > jump directly to the definition of any function (no matter where it is > defined-- check syntax re-uses the compiler to get its lexical > information so you can be sure you're jumping precisely). > > Robby > > On Mon, Aug 10, 2009 at 6:19 PM, Lee Spector > wrote: >> >> Is there any way to get "arglist-on-space" behavior in DrScheme or >> any >> editor working with PLT scheme? What I mean by this is that when >> you type >> the name of a function and then a space the argument list for the >> function >> appears in a mini-buffer (or anywhere -- I just want to see it). >> I'd be >> happy to have this functionality either in an editor (e.g. the >> DrScheme >> definitions pane) or listener (e.g. the DrScheme interactions pane) >> or both. >> >> I am a DrScheme/PLT newbie, adopting it for a course I'm teaching >> in the >> fall, but I'm a long-time Common Lisper and this is one of things I >> miss >> most from my favorite CL environments. Next on my list would be a >> way to get >> from a function name to the definition of the function with a >> couple of key >> strokes, rather than searching in files. Both of these things >> require the >> runtime environment to keep information around that maybe PLT isn't >> keeping >> around... but I don't know. >> >> Thanks, >> >> -Lee >> >> -- >> Lee Spector, Professor of Computer Science >> School of Cognitive Science, Hampshire College >> 893 West Street, Amherst, MA 01002-3359 >> lspector@hampshire.edu, http://hampshire.edu/lspector/ >> Phone: 413-559-5352, Fax: 413-559-5438 >> >> Check out Genetic Programming and Evolvable Machines: >> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From robby at eecs.northwestern.edu Mon Aug 10 23:23:57 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Aug 10 23:24:19 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> Message-ID: <932b2f1f0908102023l382c9fcekc7f7d9f90a093430@mail.gmail.com> You probably want "#lang scheme" at the top of each file and "(provide f g h)" for exported functions and "(require "fn.ss")" to load files. This setup is what works best for PLT Scheme, for a variety of reasons. Robby On Mon, Aug 10, 2009 at 9:50 PM, Lee Spector wrote: > > Thanks for the speedy and helpful responses. > > F1, which I didn't know about previously, will help a lot. It doesn't show > the arglist right in the programming environment, and it only helps for > built-in definitions, but within these limits it provides pretty quick > access to the arglist and documentation. > > "cmd /" (yes, I'm on a mac) provides symbol completion -- not what I had > asked about, but also handy. > > Getting to definitions from Check Syntax -> control-click -> Jump to > Definition also seems to be useful, although I'm having a hard time > experimenting with it at the moment because I haven't yet fully grokked PLT > namespaces, so my cross-file definitions aren't working as I expect. ("#lang > scheme/load" makes file loading work in the way that I expect but then Check > Syntax no longer provides the arrows/menus... I know I need to read about > namespaces.) In any event I'll keep this in mind as I move forward. > > Thanks again, and if anyone knows of a way to get more complete > arglist-on-space behavior (that is, in the programming environment and for > all functions) I'd love to hear about it. > > ?-Lee > > PS Mike: glad to hear you've seen the GP stuff, some of which will > inevitably migrate to Scheme as I spend more time writing Scheme code... > > > On Aug 10, 2009, at 8:50 PM, Robby Findler wrote: > >> For the arguments, DrScheme doesn't really do that (altho, as always, >> patches are welcome), but th next best thing is to hit f1. That'll >> send you to the docs, searching for whatever is around the insertion >> point in the editor. >> >> For the other, you have to run check syntax first and then you can >> jump directly to the definition of any function (no matter where it is >> defined-- check syntax re-uses the compiler to get its lexical >> information so you can be sure you're jumping precisely). >> >> Robby >> >> On Mon, Aug 10, 2009 at 6:19 PM, Lee Spector >> wrote: >>> >>> Is there any way to get "arglist-on-space" behavior in DrScheme or any >>> editor working with PLT scheme? What I mean by this is that when you type >>> the name of a function and then a space the argument list for the >>> function >>> appears in a mini-buffer (or anywhere -- I just want to see it). I'd be >>> happy to have this functionality either in an editor (e.g. the DrScheme >>> definitions pane) or listener (e.g. the DrScheme interactions pane) or >>> both. >>> >>> I am a DrScheme/PLT newbie, adopting it for a course I'm teaching in the >>> fall, but I'm a long-time Common Lisper and this is one of things I miss >>> most from my favorite CL environments. Next on my list would be a way to >>> get >>> from a function name to the definition of the function with a couple of >>> key >>> strokes, rather than searching in files. Both of these things require the >>> runtime environment to keep information around that maybe PLT isn't >>> keeping >>> around... but I don't know. >>> >>> Thanks, >>> >>> ?-Lee >>> >>> -- >>> Lee Spector, Professor of Computer Science >>> School of Cognitive Science, Hampshire College >>> 893 West Street, Amherst, MA 01002-3359 >>> lspector@hampshire.edu, http://hampshire.edu/lspector/ >>> Phone: 413-559-5352, Fax: 413-559-5438 >>> >>> Check out Genetic Programming and Evolvable Machines: >>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > > From ryanc at ccs.neu.edu Mon Aug 10 23:41:46 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Mon Aug 10 23:42:01 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> Message-ID: <4A80E87A.3090205@ccs.neu.edu> Lee Spector wrote: > > Thanks for the speedy and helpful responses. > > F1, which I didn't know about previously, will help a lot. It doesn't > show the arglist right in the programming environment, and it only helps > for built-in definitions, but within these limits it provides pretty > quick access to the arglist and documentation. Depends on what you mean by "built-in definitions". It shows documentation for anything for which there are Scribble docs, including the core language, the standard library collections (see "collections" in the Guide), and installed PLaneT packages. It's possible to build documentation for standalone projects using the scribble command-line tool, but it requires more effort and the resulting docs are not quite integrated with the main docs. Another solution is to make PLT Scheme treat your standalone project as a special kind of locally-hosted PLaneT package (search "development link"). Then your project's Scribble docs will get integrated into the main documentation. You'll have to run setup-plt whenever you want to rebuild your docs, though. Just wanted to expand on the possibilities of the documentation system. > "cmd /" (yes, I'm on a mac) provides symbol completion -- not what I had > asked about, but also handy. > > Getting to definitions from Check Syntax -> control-click -> Jump to > Definition also seems to be useful, although I'm having a hard time > experimenting with it at the moment because I haven't yet fully grokked > PLT namespaces, so my cross-file definitions aren't working as I expect. > ("#lang scheme/load" makes file loading work in the way that I expect > but then Check Syntax no longer provides the arrows/menus... I know I > need to read about namespaces.) In any event I'll keep this in mind as I > move forward. It's probably not namespaces you should read about so much as modules. "#lang " makes a module out of a whole file. The scheme/load language just interprets all of its contents as data to be dynamically eval'd at runtime, so there's no information available to tools like Check Syntax. As Robby suggests, you'll get more information if you use the scheme or scheme/base language. Modules are for writing programs. Namespaces are for writing programs that run other programs (like DrSchemes and web-servers). Roughly. Ryan > Thanks again, and if anyone knows of a way to get more complete > arglist-on-space behavior (that is, in the programming environment and > for all functions) I'd love to hear about it. > > -Lee > > PS Mike: glad to hear you've seen the GP stuff, some of which will > inevitably migrate to Scheme as I spend more time writing Scheme code... > > > On Aug 10, 2009, at 8:50 PM, Robby Findler wrote: > >> For the arguments, DrScheme doesn't really do that (altho, as always, >> patches are welcome), but th next best thing is to hit f1. That'll >> send you to the docs, searching for whatever is around the insertion >> point in the editor. >> >> For the other, you have to run check syntax first and then you can >> jump directly to the definition of any function (no matter where it is >> defined-- check syntax re-uses the compiler to get its lexical >> information so you can be sure you're jumping precisely). >> >> Robby >> >> On Mon, Aug 10, 2009 at 6:19 PM, Lee Spector >> wrote: >>> >>> Is there any way to get "arglist-on-space" behavior in DrScheme or any >>> editor working with PLT scheme? What I mean by this is that when you >>> type >>> the name of a function and then a space the argument list for the >>> function >>> appears in a mini-buffer (or anywhere -- I just want to see it). I'd be >>> happy to have this functionality either in an editor (e.g. the DrScheme >>> definitions pane) or listener (e.g. the DrScheme interactions pane) >>> or both. >>> >>> I am a DrScheme/PLT newbie, adopting it for a course I'm teaching in the >>> fall, but I'm a long-time Common Lisper and this is one of things I miss >>> most from my favorite CL environments. Next on my list would be a way >>> to get >>> from a function name to the definition of the function with a couple >>> of key >>> strokes, rather than searching in files. Both of these things require >>> the >>> runtime environment to keep information around that maybe PLT isn't >>> keeping >>> around... but I don't know. >>> >>> Thanks, >>> >>> -Lee >>> >>> -- >>> Lee Spector, Professor of Computer Science >>> School of Cognitive Science, Hampshire College >>> 893 West Street, Amherst, MA 01002-3359 >>> lspector@hampshire.edu, http://hampshire.edu/lspector/ >>> Phone: 413-559-5352, Fax: 413-559-5438 >>> >>> Check out Genetic Programming and Evolvable Machines: >>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From lspector at hampshire.edu Mon Aug 10 23:45:28 2009 From: lspector at hampshire.edu (Lee Spector) Date: Mon Aug 10 23:50:53 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <932b2f1f0908102023l382c9fcekc7f7d9f90a093430@mail.gmail.com> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> <932b2f1f0908102023l382c9fcekc7f7d9f90a093430@mail.gmail.com> Message-ID: That was exactly what I needed on the namespaces/modules. I had tried pieces of this but not all of them at the same time (I guess because I was lazily dipping into the documentation instead of reading that section all the way through). Now the Check Syntax -> control-click -> Jump to Definition trick works across files, which is quite nice, and I can also do other multi-file things that I didn't know how to do previously. I should note, however, that there's a bit of a catch 22 using this in the situation for which I usually want it -- which is when I know the name of a function but don't remember what arguments it takes. Check Syntax fails and doesn't give me access to the definition if haven't completed the expression (because I don't know the syntax) or if it is otherwise badly malformed. I do see that it will still provide the links if my error was just to provide the wrong number of arguments, so that's useful. Thanks, -Lee On Aug 10, 2009, at 11:23 PM, Robby Findler wrote: > You probably want "#lang scheme" at the top of each file and "(provide > f g h)" for exported functions and "(require "fn.ss")" to load files. > > This setup is what works best for PLT Scheme, for a variety of > reasons. > > Robby > > On Mon, Aug 10, 2009 at 9:50 PM, Lee Spector > wrote: >> >> Thanks for the speedy and helpful responses. >> >> F1, which I didn't know about previously, will help a lot. It >> doesn't show >> the arglist right in the programming environment, and it only helps >> for >> built-in definitions, but within these limits it provides pretty >> quick >> access to the arglist and documentation. >> >> "cmd /" (yes, I'm on a mac) provides symbol completion -- not what >> I had >> asked about, but also handy. >> >> Getting to definitions from Check Syntax -> control-click -> Jump to >> Definition also seems to be useful, although I'm having a hard time >> experimenting with it at the moment because I haven't yet fully >> grokked PLT >> namespaces, so my cross-file definitions aren't working as I >> expect. ("#lang >> scheme/load" makes file loading work in the way that I expect but >> then Check >> Syntax no longer provides the arrows/menus... I know I need to read >> about >> namespaces.) In any event I'll keep this in mind as I move forward. >> >> Thanks again, and if anyone knows of a way to get more complete >> arglist-on-space behavior (that is, in the programming environment >> and for >> all functions) I'd love to hear about it. >> >> -Lee >> >> PS Mike: glad to hear you've seen the GP stuff, some of which will >> inevitably migrate to Scheme as I spend more time writing Scheme >> code... >> >> >> On Aug 10, 2009, at 8:50 PM, Robby Findler wrote: >> >>> For the arguments, DrScheme doesn't really do that (altho, as >>> always, >>> patches are welcome), but th next best thing is to hit f1. That'll >>> send you to the docs, searching for whatever is around the insertion >>> point in the editor. >>> >>> For the other, you have to run check syntax first and then you can >>> jump directly to the definition of any function (no matter where >>> it is >>> defined-- check syntax re-uses the compiler to get its lexical >>> information so you can be sure you're jumping precisely). >>> >>> Robby >>> >>> On Mon, Aug 10, 2009 at 6:19 PM, Lee Spector >>> wrote: >>>> >>>> Is there any way to get "arglist-on-space" behavior in DrScheme >>>> or any >>>> editor working with PLT scheme? What I mean by this is that when >>>> you type >>>> the name of a function and then a space the argument list for the >>>> function >>>> appears in a mini-buffer (or anywhere -- I just want to see it). >>>> I'd be >>>> happy to have this functionality either in an editor (e.g. the >>>> DrScheme >>>> definitions pane) or listener (e.g. the DrScheme interactions >>>> pane) or >>>> both. >>>> >>>> I am a DrScheme/PLT newbie, adopting it for a course I'm teaching >>>> in the >>>> fall, but I'm a long-time Common Lisper and this is one of things >>>> I miss >>>> most from my favorite CL environments. Next on my list would be a >>>> way to >>>> get >>>> from a function name to the definition of the function with a >>>> couple of >>>> key >>>> strokes, rather than searching in files. Both of these things >>>> require the >>>> runtime environment to keep information around that maybe PLT isn't >>>> keeping >>>> around... but I don't know. >>>> >>>> Thanks, >>>> >>>> -Lee >>>> >>>> -- >>>> Lee Spector, Professor of Computer Science >>>> School of Cognitive Science, Hampshire College >>>> 893 West Street, Amherst, MA 01002-3359 >>>> lspector@hampshire.edu, http://hampshire.edu/lspector/ >>>> Phone: 413-559-5352, Fax: 413-559-5438 >>>> >>>> Check out Genetic Programming and Evolvable Machines: >>>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >> >> -- >> Lee Spector, Professor of Computer Science >> School of Cognitive Science, Hampshire College >> 893 West Street, Amherst, MA 01002-3359 >> lspector@hampshire.edu, http://hampshire.edu/lspector/ >> Phone: 413-559-5352, Fax: 413-559-5438 >> >> Check out Genetic Programming and Evolvable Machines: >> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >> >> -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From lspector at hampshire.edu Mon Aug 10 23:57:02 2009 From: lspector at hampshire.edu (Lee Spector) Date: Tue Aug 11 00:03:19 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <4A80E87A.3090205@ccs.neu.edu> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> <4A80E87A.3090205@ccs.neu.edu> Message-ID: <5A6CA8F7-81DC-44B4-B067-F8A54F49171D@hampshire.edu> Thanks for expanding on the documentation possibilities -- probably not the path I want to go down right now but good to know. I guess the easy access to documentation in Common Lisp comes from the way that definitions can include doc-strings which, under the right compiler options, remain linked to the symbols at runtime. Robbie's note straightened me out on modules enough for now, but I'll have to look into this more. Many of my programs run other programs (e.g. because they are programs for evolving programs), and I'll have to think about what this means in the PLT context. FWIW Common Lisp's module mechanisms never do what I want either, but I've learned how to avoid them :-) -Lee On Aug 10, 2009, at 11:41 PM, Ryan Culpepper wrote: > Lee Spector wrote: >> Thanks for the speedy and helpful responses. >> F1, which I didn't know about previously, will help a lot. It >> doesn't show the arglist right in the programming environment, and >> it only helps for built-in definitions, but within these limits it >> provides pretty quick access to the arglist and documentation. > > Depends on what you mean by "built-in definitions". It shows > documentation for anything for which there are Scribble docs, > including the core language, the standard library collections (see > "collections" in the Guide), and installed PLaneT packages. > > It's possible to build documentation for standalone projects using > the scribble command-line tool, but it requires more effort and the > resulting docs are not quite integrated with the main docs. Another > solution is to make PLT Scheme treat your standalone project as a > special kind of locally-hosted PLaneT package (search "development > link"). Then your project's Scribble docs will get integrated into > the main documentation. You'll have to run setup-plt whenever you > want to rebuild your docs, though. > > Just wanted to expand on the possibilities of the documentation > system. > >> "cmd /" (yes, I'm on a mac) provides symbol completion -- not what >> I had asked about, but also handy. >> Getting to definitions from Check Syntax -> control-click -> Jump >> to Definition also seems to be useful, although I'm having a hard >> time experimenting with it at the moment because I haven't yet >> fully grokked PLT namespaces, so my cross-file definitions aren't >> working as I expect. ("#lang scheme/load" makes file loading work >> in the way that I expect but then Check Syntax no longer provides >> the arrows/menus... I know I need to read about namespaces.) In any >> event I'll keep this in mind as I move forward. > > It's probably not namespaces you should read about so much as > modules. "#lang " makes a module out of a whole file. The > scheme/load language just interprets all of its contents as data to > be dynamically eval'd at runtime, so there's no information > available to tools like Check Syntax. As Robby suggests, you'll get > more information if you use the scheme or scheme/base language. > > Modules are for writing programs. Namespaces are for writing > programs that run other programs (like DrSchemes and web-servers). > Roughly. > > Ryan > >> Thanks again, and if anyone knows of a way to get more complete >> arglist-on-space behavior (that is, in the programming environment >> and for all functions) I'd love to hear about it. >> -Lee >> PS Mike: glad to hear you've seen the GP stuff, some of which will >> inevitably migrate to Scheme as I spend more time writing Scheme >> code... >> On Aug 10, 2009, at 8:50 PM, Robby Findler wrote: >>> For the arguments, DrScheme doesn't really do that (altho, as >>> always, >>> patches are welcome), but th next best thing is to hit f1. That'll >>> send you to the docs, searching for whatever is around the insertion >>> point in the editor. >>> >>> For the other, you have to run check syntax first and then you can >>> jump directly to the definition of any function (no matter where >>> it is >>> defined-- check syntax re-uses the compiler to get its lexical >>> information so you can be sure you're jumping precisely). >>> >>> Robby >>> >>> On Mon, Aug 10, 2009 at 6:19 PM, Lee >>> Spector wrote: >>>> >>>> Is there any way to get "arglist-on-space" behavior in DrScheme >>>> or any >>>> editor working with PLT scheme? What I mean by this is that when >>>> you type >>>> the name of a function and then a space the argument list for the >>>> function >>>> appears in a mini-buffer (or anywhere -- I just want to see it). >>>> I'd be >>>> happy to have this functionality either in an editor (e.g. the >>>> DrScheme >>>> definitions pane) or listener (e.g. the DrScheme interactions >>>> pane) or both. >>>> >>>> I am a DrScheme/PLT newbie, adopting it for a course I'm teaching >>>> in the >>>> fall, but I'm a long-time Common Lisper and this is one of things >>>> I miss >>>> most from my favorite CL environments. Next on my list would be a >>>> way to get >>>> from a function name to the definition of the function with a >>>> couple of key >>>> strokes, rather than searching in files. Both of these things >>>> require the >>>> runtime environment to keep information around that maybe PLT >>>> isn't keeping >>>> around... but I don't know. >>>> >>>> Thanks, >>>> >>>> -Lee >>>> >>>> -- >>>> Lee Spector, Professor of Computer Science >>>> School of Cognitive Science, Hampshire College >>>> 893 West Street, Amherst, MA 01002-3359 >>>> lspector@hampshire.edu, http://hampshire.edu/lspector/ >>>> Phone: 413-559-5352, Fax: 413-559-5438 >>>> >>>> Check out Genetic Programming and Evolvable Machines: >>>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >> -- >> Lee Spector, Professor of Computer Science >> School of Cognitive Science, Hampshire College >> 893 West Street, Amherst, MA 01002-3359 >> lspector@hampshire.edu, http://hampshire.edu/lspector/ >> Phone: 413-559-5352, Fax: 413-559-5438 >> Check out Genetic Programming and Evolvable Machines: >> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From andrew-scheme at areilly.bpc-users.org Tue Aug 11 00:22:25 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Tue Aug 11 00:22:51 2009 Subject: [plt-scheme] Embarrasingly basic GUI question Message-ID: <20090811042225.GA32202@duncan.reilly.home> Hi there, I'm not much of a GUI coder: I've managed to avoid it for thirty years so far, but I felt comfortable enough with PLT scheme (and the DrScheme environment) that I thought I'd give it a go. Things seemed to be going swimmingly. My GUI is a control-panel for some functionality that lives at the end of a TCP session. I've got the data model and IO sorted. I've got a frame% filled with horizontal and vertical panels, each with collections of message%s, button%s and slider%s and what-not. Lovely! But I can't find a "main-loop" function or method that I'd assumed would be there. My "GUI" function gets to the (send frame show #t) and just falls off the end. The gui stays there, on the screen, but my data model and communications protocol have cleaned themselves up and gone home, so when I touch one of the GUI widgets, and the callback tries to write to the control port, the port is closed. I tried to build my own wait-until-exit function, with a channel (blocking on a channel-get until a channel-put is triggered by a widget callback), but that seems to hang the whole window, including the window-manager close button. Not all that surprising, but it just emphasises the main lesson: Clearly I'm missing some bigger-picture information about how to handle exit conditions, window-closes, and so on. I've looked all through the Graphics Toolkit manual, but can't see it. Can someone please point me to a hello-world #lang scheme/gui example that includes close/quit functionality? Also: I'm going to need a File->open... dialog at some stage. Should I be using the "PLT GUI Application Framework" instead of the "PLT Graphics Toolkit"? Cheers, -- Andrew From eli at barzilay.org Tue Aug 11 00:29:56 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Aug 11 00:30:17 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <5A6CA8F7-81DC-44B4-B067-F8A54F49171D@hampshire.edu> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> <4A80E87A.3090205@ccs.neu.edu> <5A6CA8F7-81DC-44B4-B067-F8A54F49171D@hampshire.edu> Message-ID: <19072.62404.156981.464820@winooski.ccs.neu.edu> On Aug 10, Lee Spector wrote: > > Thanks for expanding on the documentation possibilities -- probably > not the path I want to go down right now but good to know. I guess > the easy access to documentation in Common Lisp comes from the way > that definitions can include doc-strings which, under the right > compiler options, remain linked to the symbols at runtime. The problem is more substantial than that. In PLT, the arguments are not as straightforward as they are in CL. There was some discussion about this not too long ago, see the thread around this message: http://list.cs.brown.edu/pipermail/plt-scheme/2009-April/032237.html Also, you might want to look at using the Geiser thing. > Robbie's note straightened me out on modules enough for now, but > I'll have to look into this more. Many of my programs run other > programs (e.g. because they are programs for evolving programs), and > I'll have to think about what this means in the PLT context. FWIW > Common Lisp's module mechanisms never do what I want either, but > I've learned how to avoid them :-) 1. PLT has a module system -- that's quite different than packages in Common Lisp. 2. If your goal is something like genetic programming, then you might need to use namespaces after all -- with some form of `eval' to translate source code into executable code. Another thing that might be relevant here is the scheme/sandbox library (see the documentation for that.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From andrew-scheme at areilly.bpc-users.org Tue Aug 11 00:37:50 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Tue Aug 11 00:38:13 2009 Subject: [plt-scheme] Embarrasingly basic GUI question In-Reply-To: <20090811042225.GA32202@duncan.reilly.home> References: <20090811042225.GA32202@duncan.reilly.home> Message-ID: <20090811043750.GA36451@duncan.reilly.home> On Tue, Aug 11, 2009 at 02:22:25PM +1000, Andrew Reilly wrote: > Clearly I'm missing some bigger-picture information about how to > handle exit conditions, window-closes, and so on. I've looked > all through the Graphics Toolkit manual, but can't see it. > Can someone please point me to a hello-world #lang scheme/gui > example that includes close/quit functionality? That'd be right. Just post a question like this and bingo: I think I've found it. I want (yield 'wait), don't I? I'll try that. If anyone can point to some neat examples, I'd still be keen to see 'em. Cheers, -- Andrew From eli at barzilay.org Tue Aug 11 00:39:10 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Aug 11 00:39:32 2009 Subject: [plt-scheme] Embarrasingly basic GUI question In-Reply-To: <20090811042225.GA32202@duncan.reilly.home> References: <20090811042225.GA32202@duncan.reilly.home> Message-ID: <19072.62958.599181.466978@winooski.ccs.neu.edu> On Aug 11, Andrew Reilly wrote: > > But I can't find a "main-loop" function or method that I'd assumed > would be there. My "GUI" function gets to the (send frame show #t) > and just falls off the end. The gui stays there, on the screen, but > my data model and communications protocol have cleaned themselves up > and gone home, so when I touch one of the GUI widgets, and the > callback tries to write to the control port, the port is closed. Looks like what you're missing is a (yield 'wait). > Clearly I'm missing some bigger-picture information about how to > handle exit conditions, window-closes, and so on. I've looked all > through the Graphics Toolkit manual, but can't see it. Can someone > please point me to a hello-world #lang scheme/gui example that > includes close/quit functionality? The main thing to learn is that an "eventspace" is basically wrapping a single gui thread, and something like (yield 'wait) will wait until the thread has nothing else to do (no more windows etc). Based on this you can see why you need two eventspaces if you want two independent gui elements, and you can also see why it's bad to have threads do work in a gui code (you're likely to get race conditions) and instead a utility thread uses `queue-callback' to register a thunk that the main thread will use to do the work in the usual gui-serializable way. > Also: I'm going to need a File->open... dialog at some stage. > Should I be using the "PLT GUI Application Framework" instead of the > "PLT Graphics Toolkit"? IIRC, the framework's dialogs are not doing anything more than the basic mred functions (eg, `get-file'). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Tue Aug 11 00:43:48 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Aug 11 00:44:10 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <4A80E87A.3090205@ccs.neu.edu> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> <4A80E87A.3090205@ccs.neu.edu> Message-ID: <19072.63236.893170.576003@winooski.ccs.neu.edu> On Aug 10, Ryan Culpepper wrote: > > It's possible to build documentation for standalone projects using > the scribble command-line tool, but it requires more effort and the > resulting docs are not quite integrated with the main docs. I'll bite: why? (My first thought would be the local index, but you later suggest using planet.) > Another solution is to make PLT Scheme treat your standalone project > as a special kind of locally-hosted PLaneT package (search > "development link"). Then your project's Scribble docs will get > integrated into the main documentation. You'll have to run setup-plt > whenever you want to rebuild your docs, though. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From andrew-scheme at areilly.bpc-users.org Tue Aug 11 01:28:33 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Tue Aug 11 01:29:01 2009 Subject: [plt-scheme] Embarrasingly basic GUI question In-Reply-To: <19072.62958.599181.466978@winooski.ccs.neu.edu> References: <20090811042225.GA32202@duncan.reilly.home> <19072.62958.599181.466978@winooski.ccs.neu.edu> Message-ID: <20090811052833.GB36451@duncan.reilly.home> Hi Eli, Thanks for answering so promptly! On Tue, Aug 11, 2009 at 12:39:10AM -0400, Eli Barzilay wrote: > Looks like what you're missing is a (yield 'wait). Yes, that looks like the main part of the puzzle. Now I need to figure out how to attach a callback to (or otherwise notice) the window being closed. The yield isn't exiting when my window closes because I have a timer active. > The main thing to learn is that an "eventspace" is basically wrapping > a single gui thread, and something like (yield 'wait) will wait until > the thread has nothing else to do (no more windows etc). Based on > this you can see why you need two eventspaces if you want two > independent gui elements, and you can also see why it's bad to have > threads do work in a gui code (you're likely to get race conditions) > and instead a utility thread uses `queue-callback' to register a thunk > that the main thread will use to do the work in the usual > gui-serializable way. Yes. I need to study eventspaces more thoroughly. I don't think that I need queue-callback yet, thankfully. > IIRC, the framework's dialogs are not doing anything more than the > basic mred functions (eg, `get-file'). Thanks! I was scanning the "Windowing Classes" hierarchy backwards and forwards and hadn't noticed the "Windowing Functions" section that followed... Cheers, -- Andrew From eli at barzilay.org Tue Aug 11 01:31:56 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Aug 11 01:32:16 2009 Subject: [plt-scheme] Embarrasingly basic GUI question In-Reply-To: <20090811052833.GB36451@duncan.reilly.home> References: <20090811042225.GA32202@duncan.reilly.home> <19072.62958.599181.466978@winooski.ccs.neu.edu> <20090811052833.GB36451@duncan.reilly.home> Message-ID: <19073.588.80922.941036@winooski.ccs.neu.edu> On Aug 11, Andrew Reilly wrote: > Hi Eli, > > Thanks for answering so promptly! > > On Tue, Aug 11, 2009 at 12:39:10AM -0400, Eli Barzilay wrote: > > Looks like what you're missing is a (yield 'wait). > > Yes, that looks like the main part of the puzzle. > > Now I need to figure out how to attach a callback to (or otherwise > notice) the window being closed. The yield isn't exiting when my > window closes because I have a timer active. Probably something like (define/augment (on-close) ... kill your timer here ...) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From cs at cs.bilgi.edu.tr Tue Aug 11 02:07:41 2009 From: cs at cs.bilgi.edu.tr (Chris Stephenson) Date: Tue Aug 11 02:08:09 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: Message-ID: <4A810AAD.5020105@cs.bilgi.edu.tr> Matthias Felleisen wrote: > > > Barendregt, The Lambda Calculus, 1980 is the source of all things LC for > a logician. Don't let the prerequisites turn you off. For a student with an exam at the end of the week (the situation of the original enquirer) Barendregt's own short version, available on the web, may be an easier starting point (and it is on the reading list of the course in question). ftp://ftp.cs.ru.nl/pub/CompMath.Found/lambda.pdf But Barendregt's trick of renaming all bound variables to have different names from all free variables simplifies some proofs, but obscures the issue of scope for those who interested in Lambda calculus as a model for programming languages. -- Chris Stephenson ?stanbul Bilgi ?niversitesi Bilgisayar Bilimleri B?l?m Ba?kan? From matthias at ccs.neu.edu Tue Aug 11 07:23:55 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 07:24:42 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: <4A810AAD.5020105@cs.bilgi.edu.tr> References: <4A810AAD.5020105@cs.bilgi.edu.tr> Message-ID: On Aug 11, 2009, at 2:07 AM, Chris Stephenson wrote: (Your student asks general questions, so he's getting general answers.) > But Barendregt's trick of renaming all bound variables to have > different > names from all free variables simplifies some proofs, but obscures the > issue of scope for those who interested in Lambda calculus as a model > for programming languages. The phrase you're alluding to has been misunderstood by many many computer scientists. Due to copying it isn't enough to distinguish free/bound variables in the original term. You have to do so at every step of the reduction. Barendregt knows this as the Yellow book shows. Computer science papers seem to not understand this on occasion. So yes, you're right :-) Use de Bruijn indices. -- Matthias From beratn at gmail.com Tue Aug 11 08:04:42 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Tue Aug 11 08:05:04 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: <4A810AAD.5020105@cs.bilgi.edu.tr> Message-ID: By the way i need to say something.I ask some source to learn lambda calculus,it is true i have an exam but it is not the situation of the original enquirer.Because i have some wish to write functional programming to learn lambda calculus.? am sorry but i have to meantion.This is not necessary to say ((the situation of the original enquirer) .I a? student who make some computer science.I have a long way but in a day future i become computer scientist !!! Sorry for that mail. On Tue, Aug 11, 2009 at 2:23 PM, Matthias Felleisen wrote: > > On Aug 11, 2009, at 2:07 AM, Chris Stephenson wrote: > > (Your student asks general questions, so he's getting general answers.) > > > But Barendregt's trick of renaming all bound variables to have different >> names from all free variables simplifies some proofs, but obscures the >> issue of scope for those who interested in Lambda calculus as a model >> for programming languages. >> > > The phrase you're alluding to has been misunderstood by many many computer > scientists. Due to copying it isn't enough to distinguish free/bound > variables in the original term. You have to do so at every step of the > reduction. Barendregt knows this as the Yellow book shows. Computer science > papers seem to not understand this on occasion. So yes, you're right :-) Use > de Bruijn indices. > > -- Matthias > > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090811/c4365bf5/attachment.htm From matthias at ccs.neu.edu Tue Aug 11 08:39:19 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 08:40:16 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: <4A810AAD.5020105@cs.bilgi.edu.tr> Message-ID: <71A9F616-27EB-4236-B2E3-B85A184B25F3@ccs.neu.edu> On lambda calculus for computer scientists: don't study the logician's version. It's misleading, inappropriate, has generated a ton of misunderstandings in computer scientists who don't keep the context in mind, and as a result has wasted years and decades in PL research. (Some people to this day don't know that LC normal forms are nearly entirely irrelevant for the study of PL.) In sum, the study of LC is only useful for picking up mathematical techniques that you need to establish and validate properties of languages. The specifics are irrelevant. -- Matthias On Aug 11, 2009, at 8:04 AM, emre berat nebio?lu wrote: > By the way i need to say something.I ask some source to learn > lambda calculus,it is true i have an exam but it is not the > situation of the original enquirer.Because i have some wish to > write functional programming to learn lambda calculus.? am sorry > but i have to meantion.This is not necessary to say ((the situation > of the original enquirer) .I a? student who make some computer > science.I have a long way but in a day future i become computer > scientist !!! Sorry for that mail. > > On Tue, Aug 11, 2009 at 2:23 PM, Matthias Felleisen > wrote: > > On Aug 11, 2009, at 2:07 AM, Chris Stephenson wrote: > > (Your student asks general questions, so he's getting general > answers.) > > > > But Barendregt's trick of renaming all bound variables to have > different > names from all free variables simplifies some proofs, but obscures the > issue of scope for those who interested in Lambda calculus as a model > for programming languages. > > The phrase you're alluding to has been misunderstood by many many > computer scientists. Due to copying it isn't enough to distinguish > free/bound variables in the original term. You have to do so at > every step of the reduction. Barendregt knows this as the Yellow > book shows. Computer science papers seem to not understand this on > occasion. So yes, you're right :-) Use de Bruijn indices. > > -- Matthias > > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090811/d98f12a6/attachment.html From cs at cs.bilgi.edu.tr Tue Aug 11 08:39:56 2009 From: cs at cs.bilgi.edu.tr (Chris Stephenson) Date: Tue Aug 11 08:41:44 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: <4A810AAD.5020105@cs.bilgi.edu.tr> Message-ID: <4A81669C.2070403@cs.bilgi.edu.tr> Matthias Felleisen wrote: > > The phrase you're alluding to has been misunderstood by many many > computer scientists. Due to copying it isn't enough to distinguish > free/bound variables in the original term. You have to do so at every > step of the reduction. Barendregt knows this as the Yellow book shows. > Computer science papers seem to not understand this on occasion. So yes, > you're right :-) Use de Bruijn indices. > But isn't it the case that even with de Bruijn indices the "problem" does not go away? You still have to check one thing at every substitution: if a term containing an instance free in the term (dB number greater than its lexical depth in the term) is substituted into another term and that instance is bound in some scope enclosing both the substituted and substituted-into terms (again you can define that in terms of dB number and lexical depth), then you have to do a trickyish calculation to change the dB number for that instance so that it "works" in its new position. So, whether you rename or number, there is no free lunch. -- Chris Stephenson ?stanbul Bilgi ?niversitesi Bilgisayar Bilimleri B?l?m Ba?kan? From matthias at ccs.neu.edu Tue Aug 11 09:07:44 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 09:08:33 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: <4A81669C.2070403@cs.bilgi.edu.tr> References: <4A810AAD.5020105@cs.bilgi.edu.tr> <4A81669C.2070403@cs.bilgi.edu.tr> Message-ID: <7189F59D-765D-4C5E-B4CA-469F0750E710@ccs.neu.edu> Yeap!! On Aug 11, 2009, at 8:39 AM, Chris Stephenson wrote: > Matthias Felleisen wrote: >> >> The phrase you're alluding to has been misunderstood by many many >> computer scientists. Due to copying it isn't enough to distinguish >> free/bound variables in the original term. You have to do so at every >> step of the reduction. Barendregt knows this as the Yellow book >> shows. >> Computer science papers seem to not understand this on occasion. >> So yes, >> you're right :-) Use de Bruijn indices. >> > > But isn't it the case that even with de Bruijn indices the "problem" > does not go away? You still have to check one thing at every > substitution: if a term containing an instance free in the term (dB > number greater than its lexical depth in the term) is substituted into > another term and that instance is bound in some scope enclosing > both the > substituted and substituted-into terms (again you can define that in > terms of dB number and lexical depth), then you have to do a trickyish > calculation to change the dB number for that instance so that it > "works" > in its new position. > > So, whether you rename or number, there is no free lunch. > > -- > Chris Stephenson > > ?stanbul Bilgi ?niversitesi > Bilgisayar Bilimleri B?l?m Ba?kan? From noelwelsh at gmail.com Tue Aug 11 09:20:22 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Aug 11 09:20:44 2009 Subject: [plt-scheme] Autotools integration In-Reply-To: <4A7EB84D.9050403@googlemail.com> References: <4A7EB84D.9050403@googlemail.com> Message-ID: Just typing makefile.am into Google returns a load of examples. My understanding is that Makefile.am is turned in Makefile.in by automake. The Makefile.in used by PLT Scheme is here: http://svn.plt-scheme.org/plt/trunk/src/Makefile.in Maybe that will help, but I think your question is more about including Scheme source in a C++ project. You don't have to do any compilation on the source code, and installation is just copying to the correct directory (where correct is determined by how the code is require'd) so your Make rules should be very simple. HTH, N. On Sun, Aug 9, 2009 at 12:51 PM, Svilen wrote: > Hi guys, > > I'm not a plt programmer - sorry if my question sounds stupid. > I have an .ss source which has to be included in a bigger C++ project which > uses autotools. My understanding is that I have to create a Makefile.am file > with the corresponding rules for compilation and installation. > So here is the question - are there any examples for such kind of Makefile? > I've tried to search the web, but couldn't find much. Or maybe I'm missing > the whole idea? > > Your help will be appreciated. > > Regards > Svilen From krustev.svilen at googlemail.com Tue Aug 11 09:53:16 2009 From: krustev.svilen at googlemail.com (krustev.svilen@googlemail.com) Date: Tue Aug 11 09:53:41 2009 Subject: [plt-scheme] Autotools integration In-Reply-To: Message-ID: <0016364d29e140a6fe0470de0607@google.com> Hi Noel, The Scheme source I have is just a separate utility which has to be packed together with the main project. Initially I've gon the impression, that it has to be compiled and the produced executable should get into the package. If I read you properly - the source should not be compiled, but rather distributed as a script? Svilen On Aug 11, 2009 2:20pm, Noel Welsh wrote: > Just typing makefile.am into Google returns a load of examples. My > understanding is that Makefile.am is turned in Makefile.in by > automake. The Makefile.in used by PLT Scheme is here: > http://svn.plt-scheme.org/plt/trunk/src/Makefile.in > Maybe that will help, but I think your question is more about > including Scheme source in a C++ project. You don't have to do any > compilation on the source code, and installation is just copying to > the correct directory (where correct is determined by how the code is > require'd) so your Make rules should be very simple. > HTH, > N. > On Sun, Aug 9, 2009 at 12:51 PM, Svilenkrustev.svilen@googlemail.com> > wrote: > > Hi guys, > > > > I'm not a plt programmer - sorry if my question sounds stupid. > > I have an .ss source which has to be included in a bigger C++ project > which > > uses autotools. My understanding is that I have to create a Makefile.am > file > > with the corresponding rules for compilation and installation. > > So here is the question - are there any examples for such kind of > Makefile? > > I've tried to search the web, but couldn't find much. Or maybe I'm > missing > > the whole idea? > > > > Your help will be appreciated. > > > > Regards > > Svilen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090811/fe4a35d7/attachment.htm From noelwelsh at gmail.com Tue Aug 11 10:08:36 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Aug 11 10:08:55 2009 Subject: [plt-scheme] Autotools integration In-Reply-To: <0016364d29e140a6fe0470de0607@google.com> References: <0016364d29e140a6fe0470de0607@google.com> Message-ID: Ah, in that case you probably want to use the mzc tool with the --exe flag to build an executable. I think you need to find out from whoever created the project exactly how you are supposed to package it, as there are many options and without precision it is difficult to provide advice. N. On Tue, Aug 11, 2009 at 2:53 PM, wrote: > Hi Noel, > > The Scheme source I have is just a separate utility which has to be packed > together with the main project. > Initially I've gon the impression, that it has to be compiled and the > produced executable should get into the package. > > If I read you properly - the source should not be compiled, but rather > distributed as a script? > > Svilen From stephen.degabrielle at acm.org Tue Aug 11 10:05:44 2009 From: stephen.degabrielle at acm.org (Stephen De Gabrielle) Date: Tue Aug 11 10:13:44 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: Message-ID: <595b9ab20908110705m4615f98ck63b1461d71c07b5c@mail.gmail.com> there is also this; http://worrydream.com/AlligatorEggs/ :) On Monday, August 10, 2009, emre berat nebio?lu wrote: > if the issue of this mail is off topic for this mail group i am sorry.But i am searching a source for lambda calculus).I dont know anything about lambda calculus at least i am beginner.Can someone suggest me a source for lambda calculus that explain normal form,reduction,Y operator,Z operator etc. Thanks. > > Notes : I am reading wikipedia. > > -- -- Stephen De Gabrielle stephen.degabrielle@acm.org Telephone +44 (0)20 85670911 Mobile +44 (0)79 85189045 http://www.degabrielle.name/stephen From juniorscheme at hotmail.com Tue Aug 11 11:11:13 2009 From: juniorscheme at hotmail.com (junior schemer) Date: Tue Aug 11 11:11:35 2009 Subject: [plt-scheme] too easy question: local/global parameter set! Message-ID: hello, i just started scheming, and i still got a lot of beginner-questions. with this one, i'm blocked for a while, so is there someone who can help me out? at first, i present my basic code, at the end, you can see what it should do (and what it doesn't). my problem is the global set! of a variable (here = item-index) and correctly store this in a list. is there someone who can make me see the light? thank you in advance! ; i'm using R5RS (define item-index 0) (define new-item (vector item-index 'new-item)) (define (index item) (vector-ref item 0)) (define list-of-items '()) (define (add-item item-name) (if (empty? list-of-items) (begin (set! item-index (+ item-index 1)) (set! list-of-items (list item-name))) (begin (set! item-index (+ item-index 1)) (vector-set! item-name 0 item-index) (set! list-of-items (append list-of-items (list item-name)))))) (add-item new-item) (add-item new-item) (add-item new-item) (add-item new-item) list-of-items item-index ; should be ; > (#(1 new-item) #(2 new-item) #(3 new-item) #(4 new-item)) ; > 4 ; but results in ; > (#(4 new-item) #(4 new-item) #(4 new-item) #(4 new-item)) ; > 4 _________________________________________________________________ Voeg vrienden toe van LinkedIn & Facebook aan je Windows Live http://profile.live.com/connect -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090811/799d3128/attachment.html From grettke at acm.org Tue Aug 11 11:31:05 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Aug 11 11:31:27 2009 Subject: [plt-scheme] arglist-on-space? In-Reply-To: <19072.62404.156981.464820@winooski.ccs.neu.edu> References: <932b2f1f0908101750p347c7269t6d05048689a14188@mail.gmail.com> <65D2B32B-EB48-4365-A69F-11658A7F8DB7@hampshire.edu> <4A80E87A.3090205@ccs.neu.edu> <5A6CA8F7-81DC-44B4-B067-F8A54F49171D@hampshire.edu> <19072.62404.156981.464820@winooski.ccs.neu.edu> Message-ID: <756daca50908110831h16f4e8f9nf220524842dfebe7@mail.gmail.com> On Mon, Aug 10, 2009 at 11:29 PM, Eli Barzilay wrote: > On Aug 10, Lee Spector wrote: >> >> Thanks for expanding on the documentation possibilities -- probably >> not the path I want to go down right now but good to know. I guess >> the easy access to documentation in Common Lisp comes from the way >> that definitions can include doc-strings which, under the right >> compiler options, remain linked to the symbols at runtime. > > The problem is more substantial than that. ?In PLT, the arguments are > not as straightforward as they are in CL. ?There was some discussion > about this not too long ago, see the thread around this message: > > ?http://list.cs.brown.edu/pipermail/plt-scheme/2009-April/032237.html > > Also, you might want to look at using the Geiser thing. http://programming-musings.org/2009/05/14/geiser/ From jay.mccarthy at gmail.com Tue Aug 11 11:55:24 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Aug 11 11:55:47 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: <932b2f1f0908101736t756e8b9ai8ffc20481de3d624@mail.gmail.com> References: <932b2f1f0908101736t756e8b9ai8ffc20481de3d624@mail.gmail.com> Message-ID: I just realized the acronym is SEwPR and I love it! Jay On Mon, Aug 10, 2009 at 6:36 PM, Robby Findler wrote: > Also, (but only if you want to spend actual money): check out > _Semantics Engineering with PLT Redex_. The prologue is online here: > > ?http://redex.plt-scheme.org/ > > Robby > > 2009/8/10 Noel Welsh : >> You might try the "Lambda Calculus with PLT Redex" linked from >> >> ?http://telefonica.net/web2/koot/ >> >> N. >> >> On Mon, Aug 10, 2009 at 7:17 PM, emre berat nebio?lu wrote: >>> if the issue of this mail is off topic for this mail group i am sorry.But i >>> am searching a source for lambda calculus).I dont know anything about lambda >>> calculus at least i am beginner.Can someone suggest me a source for lambda >>> calculus that explain normal form,reduction,Y operator,Z operator etc. >>> Thanks. >>> >>> Notes : I am reading wikipedia. >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From robby at eecs.northwestern.edu Tue Aug 11 12:05:34 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Aug 11 12:05:55 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: References: <932b2f1f0908101736t756e8b9ai8ffc20481de3d624@mail.gmail.com> Message-ID: <932b2f1f0908110905n53d84959p58e893350fb70190@mail.gmail.com> And as John C. pointed out, good thing we included "PLT" in the title, eh? :) Robby On Tue, Aug 11, 2009 at 10:55 AM, Jay McCarthy wrote: > I just realized the acronym is SEwPR and I love it! > > Jay > > On Mon, Aug 10, 2009 at 6:36 PM, Robby > Findler wrote: >> Also, (but only if you want to spend actual money): check out >> _Semantics Engineering with PLT Redex_. The prologue is online here: >> >> ?http://redex.plt-scheme.org/ >> >> Robby >> >> 2009/8/10 Noel Welsh : >>> You might try the "Lambda Calculus with PLT Redex" linked from >>> >>> ?http://telefonica.net/web2/koot/ >>> >>> N. >>> >>> On Mon, Aug 10, 2009 at 7:17 PM, emre berat nebio?lu wrote: >>>> if the issue of this mail is off topic for this mail group i am sorry.But i >>>> am searching a source for lambda calculus).I dont know anything about lambda >>>> calculus at least i am beginner.Can someone suggest me a source for lambda >>>> calculus that explain normal form,reduction,Y operator,Z operator etc. >>>> Thanks. >>>> >>>> Notes : I am reading wikipedia. >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jmarshall at alum.mit.edu Tue Aug 11 13:19:19 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Tue Aug 11 13:26:53 2009 Subject: [plt-scheme] Scheme at Google Message-ID: http://googleresearch.blogspot.com/2009/08/under-hood-of-app-inventor-for-android.html It's not Dr Scheme, but I thought you'd be interested. -- ~jrm From chust at web.de Tue Aug 11 14:38:22 2009 From: chust at web.de (Thomas Chust) Date: Tue Aug 11 14:38:41 2009 Subject: [plt-scheme] too easy question: local/global parameter set! In-Reply-To: References: Message-ID: <1c1a33bc0908111138u274a881ep7bc4b236816221c6@mail.gmail.com> 2009/8/11 junior schemer : > [...] > (define new-item (vector item-index 'new-item)) > [...] > (add-item new-item) > (add-item new-item) > [...] Hello, you call add-item with the *same* item multiple times, therefore you end up with a list that contains several references to the same item that has been mutated several times. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From jason.lillywhite at gmail.com Tue Aug 11 17:26:38 2009 From: jason.lillywhite at gmail.com (Jason) Date: Tue Aug 11 17:26:57 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab Message-ID: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Anyone out there heard of someone using drscheme as an alternative to matlab? With some libraries and plotting ability, it seems it could work. I'll be starting an engineering programming class with a lab that uses matlab. I might try doing some of the assignments in DrScheme... From matthias at ccs.neu.edu Tue Aug 11 17:43:51 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 17:46:02 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> You'd need quite a few libraries. Matlab's libraries are wide and varied. Then again, this would be a really neat open source project for DrScheme. Do Matlab assignments and create DrScheme analogues. I bet some people on the list might wish to help -- Matthias On Aug 11, 2009, at 5:26 PM, Jason wrote: > Anyone out there heard of someone using drscheme as an alternative to > matlab? With some libraries and plotting ability, it seems it could > work. I'll be starting an engineering programming class with a lab > that uses matlab. I might try doing some of the assignments in > DrScheme... > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Tue Aug 11 18:29:04 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Aug 11 18:29:45 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> Message-ID: <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> On Tue, Aug 11, 2009 at 10:43 PM, Matthias Felleisen wrote: > > You'd need quite a few libraries. Matlab's libraries are wide and varied. > Then again, this would be a really neat open source project for DrScheme. Do > Matlab assignments and create DrScheme analogues. I bet some people on the > list might wish to help -- Matthias > I reiterate what Matthias said and suggest to Jason that as he goes along with Matlab in his classes create a webpage of the datastructures and functions over those that would be required (a technical todo list). This would be a simple way of someone picking up one of these items and implementing it quickly to add it to the project. Since matlab is, I guess, a big language, it is better the burden with the community than thinking of doing it as a whole in a go. I would guess that some of the items of that todo list would be just importing and reexporting particular functions already available in portage. > > > On Aug 11, 2009, at 5:26 PM, Jason wrote: > >> Anyone out there heard of someone using drscheme as an alternative to >> matlab? With some libraries and plotting ability, it seems it could >> work. I'll be starting an engineering programming class with a lab >> that uses matlab. I might try doing some of the assignments in >> DrScheme... >> _________________________________________________ >> ?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 > -- Paulo Jorge Matos - pocmatos at gmail.com http://www.pmatos.net From yminsky at janestcapital.com Tue Aug 11 17:53:27 2009 From: yminsky at janestcapital.com (Yaron Minsky) Date: Tue Aug 11 18:38:33 2009 Subject: [plt-scheme] Jane Street is hiring (as if you didn't already know) Message-ID: <1250027607.4019.128.camel@nyc-qws-007.delacy.com> This is my periodic reminder to the FP world that Jane Street is looking to hire functional programmers. I've started getting the occasional inquiry coming in from people who are clearly unsure if our previous hiring announcements still apply, and I wanted to make it clear that they do. Also, I wanted to mention that I will be at parts of ICFP, CUFP and DEFUN this year, so if you're interested, come and talk to me there. Without further ado, and at the risk of boring longtime residents of the list to tears: Despite the problems besetting much of the financial industry, we have grown strongly in the last few years in our people, our technology, the scope of our business and its profitability. We now have over 30 OCaml developers, and we are actively looking to hire more in Tokyo, London and New York. For someone who cares about functional programming, Jane Street is an interesting place to consider. Jane Street has invested deeply in OCaml, to the point where we now have the largest team of OCaml programmers in any industrial setting, and probably the world's largest OCaml codebase--over a million lines. We really believe in functional programming, and use OCaml for everything from research to systems adminstration to trading systems. The atmosphere is informal and intellectual, with a focus on learning. The work itself is deeply challenging, and you get to see the practical impact of your efforts in quick and dramatic terms. Jane Street is also a small enough place that people have the freedom to get involved in many different areas of the business. Unlike many financial firms, software and technology are considered a core part of what we do, not some segmented-off cost center that the people who run the business don't think about. Jane Street is a place where people really care about the quality of the software, to the point that several of the most senior members of the firm, who do not have technology backgrounds, nonetheless review critical portions of the codebase before they can go into production. If you'd like to learn more, here are some links. First, there are a couple of papers we've written about our experiences here. http://www.janestreet.com/technology/articles.php We also have a technically-oriented blog: http://ocaml.janestreet.com For a (recruiting-oriented) overview of Jane Street, here's the firm website: http://janestreet.com If you're interested, send me a resume and cover letter. y From jason.lillywhite at gmail.com Tue Aug 11 18:49:05 2009 From: jason.lillywhite at gmail.com (Jason) Date: Tue Aug 11 18:58:31 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> Message-ID: > > > You'd need quite a few libraries. Matlab's libraries are wide and varied. I just assumed the Gnu scientific library was comparable to matlab numeric libraries, but I guess I could be wrong... gnuplot seems pretty powerful... From jason.lillywhite at gmail.com Tue Aug 11 19:01:16 2009 From: jason.lillywhite at gmail.com (Jason) Date: Tue Aug 11 19:01:44 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> Message-ID: ...and isn't it also true that lisp/scheme is a good place for symbolic algebra? From matthias at ccs.neu.edu Tue Aug 11 19:21:56 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 19:22:48 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> Message-ID: <5E419F38-A3DF-4EDF-9602-4FCA913E4BF2@ccs.neu.edu> On Aug 11, 2009, at 7:01 PM, Jason wrote: > ...and isn't it also true that lisp/scheme is a good place for > symbolic algebra? Lisp was used as an implementation language for several widely known symbolic-algebra packages. You could even use Lisp to 'script' (that wasn't the term then) these packages. BUT the packages were languages in their own right and lived at a different level. As Mathematica and Mathcad and Matlab demonstrate, there is no inherent connection, it just makes life simpler. (Now you may ask why people switched to different implementation languages. One answer is people's ignore and preference for difficult lives.) -- Matthias From npt11tpn at googlemail.com Tue Aug 11 19:34:19 2009 From: npt11tpn at googlemail.com (N T) Date: Tue Aug 11 19:34:41 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> Message-ID: <6a395fd2-173d-4294-9246-e5ca67e9bc84@c29g2000yqd.googlegroups.com> icas is a symbolic algebra system written in bigloo scheme; perhaps possible to port to plt ... http://www.decom.ufop.br/prof/romildo/icas/ On Aug 12, 12:01?am, Jason wrote: > ...and isn't it also true that lisp/scheme is a good place for > symbolic algebra? > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Tue Aug 11 20:03:37 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 20:04:30 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: <6a395fd2-173d-4294-9246-e5ca67e9bc84@c29g2000yqd.googlegroups.com> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> <6a395fd2-173d-4294-9246-e5ca67e9bc84@c29g2000yqd.googlegroups.com> Message-ID: <63076884-BA5E-4841-8F20-15D0625AFD4B@ccs.neu.edu> Now there's a starting point. On Aug 11, 2009, at 7:34 PM, N T wrote: > icas is a symbolic algebra system written in bigloo scheme; perhaps > possible to port to plt ... > > http://www.decom.ufop.br/prof/romildo/icas/ > > On Aug 12, 12:01 am, Jason wrote: >> ...and isn't it also true that lisp/scheme is a good place for >> symbolic algebra? >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at eecs.northwestern.edu Tue Aug 11 20:24:46 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Aug 11 20:25:22 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: <63076884-BA5E-4841-8F20-15D0625AFD4B@ccs.neu.edu> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> <6a395fd2-173d-4294-9246-e5ca67e9bc84@c29g2000yqd.googlegroups.com> <63076884-BA5E-4841-8F20-15D0625AFD4B@ccs.neu.edu> Message-ID: <932b2f1f0908111724r674b106erd26f699e6711b38e@mail.gmail.com> FWIW, I think that finding some way to script matlab would be really great for PLT Scheme. I've seen what some people around the department here do using python's REPL to script matlab and it is a very effective tool for them. (Of course, it will be hard to displace python for these people.) Robby On Tue, Aug 11, 2009 at 7:03 PM, Matthias Felleisen wrote: > > Now there's a starting point. > > > > On Aug 11, 2009, at 7:34 PM, N T wrote: > >> icas is a symbolic algebra system written in bigloo scheme; perhaps >> possible to port to plt ... >> >> http://www.decom.ufop.br/prof/romildo/icas/ >> >> On Aug 12, 12:01 am, Jason wrote: >>> >>> ...and isn't it also true that lisp/scheme is a good place for >>> symbolic algebra? >>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From m.douglas.williams at gmail.com Tue Aug 11 20:57:33 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Tue Aug 11 20:57:56 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: We actually do a lot of analysis work in Scheme - migrating from Python and Matlab. The science collection ( http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams) and PLot (that comes with PLT Scheme) are the basis for this. We also have some additional plotting and animation capabilities that aren't (yet) on PLaneT. I had hoped to mature the science collection into something I was calling Schemelab, which would be more MatLab-like, but work has gotten me back over on the agent-based simulation side again. Anyway, depending on what you're looking to do, much of the framework is there. I do wish it was more integrated, but it takes time. Doug On Tue, Aug 11, 2009 at 3:26 PM, Jason wrote: > Anyone out there heard of someone using drscheme as an alternative to > matlab? With some libraries and plotting ability, it seems it could > work. I'll be starting an engineering programming class with a lab > that uses matlab. I might try doing some of the assignments in > DrScheme... > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090811/9ea9c192/attachment.htm From toddobryan at gmail.com Tue Aug 11 21:11:05 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Aug 11 21:11:27 2009 Subject: [plt-scheme] lambda calculus In-Reply-To: <595b9ab20908110705m4615f98ck63b1461d71c07b5c@mail.gmail.com> References: <595b9ab20908110705m4615f98ck63b1461d71c07b5c@mail.gmail.com> Message-ID: <904774730908111811l4682cc47pcf4b378b6b1d9fae@mail.gmail.com> "The game *would* consist of a series of puzzles, challenging the player to devise a family that, when fed X, produces Y." I want the game!!! Anybody have any good puzzles that I could use in class? On Tue, Aug 11, 2009 at 10:05 AM, Stephen De Gabrielle wrote: > there is also this; > http://worrydream.com/AlligatorEggs/ > :) > > On Monday, August 10, 2009, emre berat nebio?lu wrote: >> if the issue of this mail is off topic for this mail group i am sorry.But i am searching a source for lambda calculus).I dont know anything about lambda calculus at least i am beginner.Can someone suggest me a source for lambda calculus that explain normal form,reduction,Y operator,Z operator etc. Thanks. >> >> Notes : I am reading wikipedia. >> >> > > -- > > -- > Stephen De Gabrielle > stephen.degabrielle@acm.org > Telephone +44 (0)20 85670911 > Mobile ? ? ? ?+44 (0)79 85189045 > http://www.degabrielle.name/stephen > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From lspector at hampshire.edu Tue Aug 11 21:31:19 2009 From: lspector at hampshire.edu (Lee Spector) Date: Tue Aug 11 21:36:44 2009 Subject: [plt-scheme] macros that expand into top-level definitions with computed names Message-ID: I'm still transitioning from Common Lisp (thanks for all of the pointers so far) and I'm having trouble doing something that I could easily do with a CL macro. I'd like to write a macro (or whatever) that takes two strings and defines a function named with the symbol formed from interning the concatenation of the strings. For example if the arguments have the values "my-" and "function" in a particular call then I'd like the effect of the call to be the same as something like (define my- function ). This is straightforward using defmacro in CL, but looking through the section of the PLT reference on macros I don't see where to start. In CL if I didn't know about defmacro, and if I didn't mind having my definitions evaluated in a null lexical environment, then I could hack it with eval. So with my new (but still minimal) understanding of eval and namespaces in PLT I tried this: ------- #lang scheme (define-namespace-anchor nsa) (define ns (namespace-anchor->namespace nsa)) (eval `(define ,(string->symbol (string-append "my-" "function")) (lambda () 'runs)) ns) (my-function) ------- This doesn't work -- expand: unbound identifier in module in: my- function -- although if I get rid of the call to my-function in the definitions pane then it does compile and allow me to call my-function (which then does the right thing) in the interactions pane. But that's not good enough for my purposes. Of course this hack with eval is probably the wrong approach anyway -- it would be a bad way to do it in CL and I'm guessing that a completely different approach would be appropriate in PLT. And I think I'm just not seeing the right part of the PLT docs because of the differences in terminology. Can someone point me in the right direction on this? Thanks, -Lee -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From spamme at innerpaths.net Tue Aug 11 21:56:11 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Tue Aug 11 21:56:28 2009 Subject: [plt-scheme] Re: Embarrasingly basic GUI question In-Reply-To: <20090811043750.GA36451@duncan.reilly.home> References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> Message-ID: <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> > If anyone can point to some neat examples, I'd still be keen to > see 'em. As another newbie, I second this. I've been searching the web for GUI- based Scheme source code and haven't found much. I have the source code for DrScheme, but it's such a large project that I have difficulty making sense of it. I remember a thread on this mailing list where someone talked about a community effort to create example programs showing GUI code in context. I believe it would be a real benefit to the community to create such a resource. Maybe the lack of such a resource is the cause for my inability to find GUI-based Scheme source code in the first place. I have an extensive background as a technology writer/editor (BYTE magazine, Apple Computer) and would be interested in writing documentation to explain GUI code that someone else has written. It would be great for someone to devise a list of sample programs that, together, would get a beginner up and started writing GUI-based Scheme programs. Then various people could commit to writing individual programs and documenting them. If anybody's interested in this idea, please let me know. From andrew-scheme at areilly.bpc-users.org Tue Aug 11 21:58:26 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Tue Aug 11 21:58:53 2009 Subject: [plt-scheme] Embarrasingly basic GUI question In-Reply-To: <19073.588.80922.941036@winooski.ccs.neu.edu> References: <20090811042225.GA32202@duncan.reilly.home> <19072.62958.599181.466978@winooski.ccs.neu.edu> <20090811052833.GB36451@duncan.reilly.home> <19073.588.80922.941036@winooski.ccs.neu.edu> Message-ID: <20090812015826.GA43675@duncan.reilly.home> On Tue, Aug 11, 2009 at 01:31:56AM -0400, Eli Barzilay wrote: > On Aug 11, Andrew Reilly wrote: > > Hi Eli, > > > > Thanks for answering so promptly! > > > > On Tue, Aug 11, 2009 at 12:39:10AM -0400, Eli Barzilay wrote: > > > Looks like what you're missing is a (yield 'wait). > > > > Yes, that looks like the main part of the puzzle. > > > > Now I need to figure out how to attach a callback to (or otherwise > > notice) the window being closed. The yield isn't exiting when my > > window closes because I have a timer active. > > Probably something like > > (define/augment (on-close) > ... kill your timer here ...) For the benefit of posterity, this augmentation to the frame% class seems to do what I need: (define my-frame% (class frame% (init close) (define close-hook close) (define/augment (on-close) (close-hook)) (super-new))) Now my main code instantiates a my-frame% instead of a frame% as the top-level window, and passes (lambda () (send heartbeat stop)) as the argument to the "close" initializer. Seems to work nicely! Does this look reasonable? I guess that the lack of this sort of initialization-time hookability is an indicator to me that I should really be building my whole GUI through class refinement and inheritance, rather than procedurally hooking together and parameterizing existing classes. I had made it so far with the latter approach, though... Thanks again for your help! Cheer,s -- Andrew From matthias at ccs.neu.edu Tue Aug 11 22:15:31 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 22:16:34 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: <6A10A948-6A9E-418B-958C-269BF5D6288A@ccs.neu.edu> Doug, can you describe to someone like Jason how he can assist you? On Aug 11, 2009, at 8:57 PM, Doug Williams wrote: > We actually do a lot of analysis work in Scheme - migrating from > Python and Matlab. The science collection (http://planet.plt- > scheme.org/display.ss?package=science.plt&owner=williams) and PLot > (that comes with PLT Scheme) are the basis for this. We also have > some additional plotting and animation capabilities that aren't > (yet) on PLaneT. I had hoped to mature the science collection into > something I was calling Schemelab, which would be more MatLab-like, > but work has gotten me back over on the agent-based simulation side > again. > > Anyway, depending on what you're looking to do, much of the > framework is there. I do wish it was more integrated, but it takes > time. > > Doug > > On Tue, Aug 11, 2009 at 3:26 PM, Jason > wrote: > Anyone out there heard of someone using drscheme as an alternative to > matlab? With some libraries and plotting ability, it seems it could > work. I'll be starting an engineering programming class with a lab > that uses matlab. I might try doing some of the assignments in > DrScheme... > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090811/5fa79a53/attachment.html From matthias at ccs.neu.edu Tue Aug 11 22:27:14 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 11 22:28:02 2009 Subject: [plt-scheme] macros that expand into top-level definitions with computed names In-Reply-To: References: Message-ID: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> Do you mean this kind of thing: #lang scheme (define-syntax (def stx) (syntax-case stx () [(_ f x body ...) (identifier? (syntax f)) (let* ([f:sym (syntax-e (syntax f))] [my-f:str (string-append "my-" (symbol->string f:sym))] [my-f:sym (string->symbol my-f:str)] [my-f:id (datum->syntax stx my-f:sym)]) #`(define #,my-f:id (lambda (x) body ...)))])) (def yours x (sqrt x)) (my-yours 4) I recommend creating a module in your personal collects that provides for adding prefixes and suffixes and importing it when needed. It's in my standard collection -- Matthias On Aug 11, 2009, at 9:31 PM, Lee Spector wrote: > > I'm still transitioning from Common Lisp (thanks for all of the > pointers so far) and I'm having trouble doing something that I > could easily do with a CL macro. > > I'd like to write a macro (or whatever) that takes two strings and > defines a function named with the symbol formed from interning the > concatenation of the strings. For example if the arguments have the > values "my-" and "function" in a particular call then I'd like the > effect of the call to be the same as something like (define my- > function ). > > This is straightforward using defmacro in CL, but looking through > the section of the PLT reference on macros I don't see where to > start. In CL if I didn't know about defmacro, and if I didn't mind > having my definitions evaluated in a null lexical environment, then > I could hack it with eval. So with my new (but still minimal) > understanding of eval and namespaces in PLT I tried this: > > ------- > #lang scheme > > (define-namespace-anchor nsa) > (define ns (namespace-anchor->namespace nsa)) > > (eval `(define ,(string->symbol (string-append "my-" "function")) > (lambda () 'runs)) > ns) > > (my-function) > ------- > > This doesn't work -- expand: unbound identifier in module in: my- > function -- although if I get rid of the call to my-function in the > definitions pane then it does compile and allow me to call my- > function (which then does the right thing) in the interactions > pane. But that's not good enough for my purposes. > > Of course this hack with eval is probably the wrong approach anyway > -- it would be a bad way to do it in CL and I'm guessing that a > completely different approach would be appropriate in PLT. And I > think I'm just not seeing the right part of the PLT docs because of > the differences in terminology. > > Can someone point me in the right direction on this? > > Thanks, > > -Lee > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Tue Aug 11 23:28:00 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Tue Aug 11 23:28:38 2009 Subject: [plt-scheme] Question chapter 10 box issue In-Reply-To: References: Message-ID: Emre, PLAI uses a box for several reasons. One useful reason is because, in Part VI, we do mutable structures (a la boxes) before we do mutable variables. There is a reason for that ordering in the book, which you can divine once you have read those sections. Anyway, given that, from the book's perspective mutable boxes are "simpler" than mutable variables, so that's one good reason to use boxes. Shriram From lspector at hampshire.edu Tue Aug 11 23:39:18 2009 From: lspector at hampshire.edu (Lee Spector) Date: Tue Aug 11 23:44:59 2009 Subject: [plt-scheme] macros that expand into top-level definitions with computed names In-Reply-To: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> Message-ID: Thanks Matthias, That certainly is a different approach than defmacro! But it does seem to get me most of the way there and I think I could get the rest of the way (and maybe understand and appreciate more of what I've been reading in the Macros section of the reference) if I could see how to modify your example so that it evaluated its first argument, as in: (define partial-name "yours") (def partial-name x (sqrt x)) (my-yours 4) => 2 BTW this isn't for prefixing or suffixing per se -- it's for a version of a stack based language in which there are a bunch of types, a bunch of instructions that work the same way on all types but with different names and accessing different stacks, and I want to generate functions by looping over the two lists and executing a definition for each type/ instruction pair. (These aren't PLT types, they're types in my language -- http://hampshire.edu/lspector/push.html -- and I'm not interested at the moment in doing this in any way that depends on PLT types... I just want to be able to generate and execute definitions with computed names and bodies, which is something I often find handy in CL.) Thanks, -Lee On Aug 11, 2009, at 10:27 PM, Matthias Felleisen wrote: > > Do you mean this kind of thing: > > #lang scheme > > (define-syntax (def stx) > (syntax-case stx () > [(_ f x body ...) > (identifier? (syntax f)) > (let* ([f:sym (syntax-e (syntax f))] > [my-f:str (string-append "my-" (symbol->string f:sym))] > [my-f:sym (string->symbol my-f:str)] > [my-f:id (datum->syntax stx my-f:sym)]) > #`(define #,my-f:id (lambda (x) body ...)))])) > > (def yours x (sqrt x)) > > (my-yours 4) > > I recommend creating a module in your personal collects that > provides for adding prefixes and suffixes and importing it when > needed. It's in my standard collection > > -- Matthias > > > > On Aug 11, 2009, at 9:31 PM, Lee Spector wrote: > >> >> I'm still transitioning from Common Lisp (thanks for all of the >> pointers so far) and I'm having trouble doing something that I >> could easily do with a CL macro. >> >> I'd like to write a macro (or whatever) that takes two strings and >> defines a function named with the symbol formed from interning the >> concatenation of the strings. For example if the arguments have the >> values "my-" and "function" in a particular call then I'd like the >> effect of the call to be the same as something like (define my- >> function ). >> >> This is straightforward using defmacro in CL, but looking through >> the section of the PLT reference on macros I don't see where to >> start. In CL if I didn't know about defmacro, and if I didn't mind >> having my definitions evaluated in a null lexical environment, then >> I could hack it with eval. So with my new (but still minimal) >> understanding of eval and namespaces in PLT I tried this: >> >> ------- >> #lang scheme >> >> (define-namespace-anchor nsa) >> (define ns (namespace-anchor->namespace nsa)) >> >> (eval `(define ,(string->symbol (string-append "my-" "function")) >> (lambda () 'runs)) >> ns) >> >> (my-function) >> ------- >> >> This doesn't work -- expand: unbound identifier in module in: my- >> function -- although if I get rid of the call to my-function in the >> definitions pane then it does compile and allow me to call my- >> function (which then does the right thing) in the interactions >> pane. But that's not good enough for my purposes. >> >> Of course this hack with eval is probably the wrong approach anyway >> -- it would be a bad way to do it in CL and I'm guessing that a >> completely different approach would be appropriate in PLT. And I >> think I'm just not seeing the right part of the PLT docs because of >> the differences in terminology. >> >> Can someone point me in the right direction on this? >> >> Thanks, >> >> -Lee >> >> -- >> Lee Spector, Professor of Computer Science >> School of Cognitive Science, Hampshire College >> 893 West Street, Amherst, MA 01002-3359 >> lspector@hampshire.edu, http://hampshire.edu/lspector/ >> Phone: 413-559-5352, Fax: 413-559-5438 >> >> Check out Genetic Programming and Evolvable Machines: >> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From michele.simionato at gmail.com Wed Aug 12 00:39:31 2009 From: michele.simionato at gmail.com (Michele Simionato) Date: Wed Aug 12 00:39:52 2009 Subject: [plt-scheme] Re: macros that expand into top-level definitions with computed names In-Reply-To: References: Message-ID: <4d4fc393-5aa1-426a-b058-6d214676ab4b@k19g2000yqn.googlegroups.com> On Aug 12, 3:31?am, Lee Spector wrote: > I'm still transitioning from Common Lisp (thanks for all of the ? > pointers so far) and I'm having trouble doing something that I could ? > easily do with a CL macro. You may want to read part V of my Adventures, the chapter about breaking hygiene: http://www.phyast.pitt.edu/~micheles/scheme/TheAdventuresofaPythonistainSchemeland.pdf From noelwelsh at gmail.com Wed Aug 12 01:42:26 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Aug 12 01:42:48 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: On Wed, Aug 12, 2009 at 1:57 AM, Doug Williams wrote: > Anyway, depending on what you're looking to do, much of the framework is > there. I do wish it was more integrated, but it takes time. +1 GSL bindings are here: http://github.com/noelwelsh/ I'll try to put some of my other code online today. N. From yinso.chen at gmail.com Wed Aug 12 02:06:36 2009 From: yinso.chen at gmail.com (YC) Date: Wed Aug 12 02:06:57 2009 Subject: [plt-scheme] Re: macros that expand into top-level definitions with computed names In-Reply-To: <4d4fc393-5aa1-426a-b058-6d214676ab4b@k19g2000yqn.googlegroups.com> References: <4d4fc393-5aa1-426a-b058-6d214676ab4b@k19g2000yqn.googlegroups.com> Message-ID: <779bf2730908112306h5cdf5811w7aed019e5f1da43b@mail.gmail.com> Cool - where was this doc when I was learning scheme? ;) On Tue, Aug 11, 2009 at 9:39 PM, Michele Simionato < michele.simionato@gmail.com> wrote: > > > On Aug 12, 3:31 am, Lee Spector wrote: > > I'm still transitioning from Common Lisp (thanks for all of the > > pointers so far) and I'm having trouble doing something that I could > > easily do with a CL macro. > > You may want to read part V of my Adventures, the chapter about > breaking hygiene: > > http://www.phyast.pitt.edu/~micheles/scheme/TheAdventuresofaPythonistainSchemeland.pdf > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090811/a2f1eb55/attachment.htm From stephen.degabrielle at acm.org Wed Aug 12 03:03:10 2009 From: stephen.degabrielle at acm.org (Stephen De Gabrielle) Date: Wed Aug 12 03:03:33 2009 Subject: [plt-scheme] Embarrasingly basic GUI question In-Reply-To: <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> Message-ID: <595b9ab20908120003l14bef4d0raa9a88240270f431@mail.gmail.com> There is a wiki with a set of Gui programs, but the are mostly pre v4, and no longer work from memory. As a starting point they may be ok if you remember they complemented the v3 'help desk', and are not comprehensive in their scope. (schemewiki I think - I don't have the address on hand) A good section would be subclassing the various primary objects; frame, editor-canvas, snip. I should be able to find some simple examples If you need them. Stephen On Wednesday, August 12, 2009, Gregg Williams wrote: >> If anyone can point to some neat examples, I'd still be keen to >> see 'em. > > As another newbie, I second this. I've been searching the web for GUI- > based Scheme source code and haven't found much. I have the source > code for DrScheme, but it's such a large project that I have > difficulty making sense of it. > > I remember a thread on this mailing list where someone talked about a > community effort to create example programs showing GUI code in > context. I believe it would be a real benefit to the community to > create such a resource. Maybe the lack of such a resource is the cause > for my inability to find GUI-based Scheme source code in the first > place. > > I have an extensive background as a technology writer/editor (BYTE > magazine, Apple Computer) and would be interested in writing > documentation to explain GUI code that someone else has written. It > would be great for someone to devise a list of sample programs that, > together, would get a beginner up and started writing GUI-based Scheme > programs. Then various people could commit to writing individual > programs and documenting them. If anybody's interested in this idea, > please let me know. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- -- Stephen De Gabrielle stephen.degabrielle@acm.org Telephone +44 (0)20 85670911 Mobile +44 (0)79 85189045 http://www.degabrielle.name/stephen From noelwelsh at gmail.com Wed Aug 12 04:54:31 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Aug 12 04:54:51 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: Ok, my numeric library on github has an extensive vector library and some other misc. numeric functions. N. On Wed, Aug 12, 2009 at 6:42 AM, Noel Welsh wrote: > > I'll try to put some of my other code online today. > > N. > From mflatt at cs.utah.edu Wed Aug 12 08:20:05 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Aug 12 08:20:30 2009 Subject: [plt-scheme] Re: Embarrasingly basic GUI question In-Reply-To: <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> Message-ID: <20090812122006.F24FE6500AE@mail-svr1.cs.utah.edu> At Tue, 11 Aug 2009 18:56:11 -0700 (PDT), Gregg Williams wrote: > > If anyone can point to some neat examples, I'd still be keen to > > see 'em. > > As another newbie, I second this. I've been searching the web for GUI- > based Scheme source code and haven't found much. I have the source > code for DrScheme, but it's such a large project that I have > difficulty making sense of it. The games in plt/collects/games may be a better place to start. The "minesweeper" game was originally intended as an example GUI program. The games are heavy on canvas drawing, though, and the card games are not good general examples, since they rely mostly on the playing-card library. But many of the games have little preference dialogs that are ok as general GUI examples. See also the "GUI" chapter the Scheme Cookbook: http://schemecookbook.org/Cookbook/GUIChapter > I remember a thread on this mailing list where someone talked about a > community effort to create example programs showing GUI code in > context. I believe it would be a real benefit to the community to > create such a resource. Maybe the lack of such a resource is the cause > for my inability to find GUI-based Scheme source code in the first > place. > > I have an extensive background as a technology writer/editor (BYTE > magazine, Apple Computer) and would be interested in writing > documentation to explain GUI code that someone else has written. It > would be great for someone to devise a list of sample programs that, > together, would get a beginner up and started writing GUI-based Scheme > programs. Then various people could commit to writing individual > programs and documenting them. If anybody's interested in this idea, > please let me know. That would be really great. From m.douglas.williams at gmail.com Wed Aug 12 09:28:40 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Wed Aug 12 09:29:45 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: <6A10A948-6A9E-418B-958C-269BF5D6288A@ccs.neu.edu> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <6A10A948-6A9E-418B-958C-269BF5D6288A@ccs.neu.edu> Message-ID: The most important thing is to get the underlying multi-dimensional array structure and associated syntax for slicing, etc. These should allow me to do things like adding the elements of the third dimension of A to the vector B and storing the results in the third row of X. This should be done by efficiently striding through the referenced array structures without needing any temporary vectors, etc. Matlab and Numpy (the Python numeric package) are good places to look. Originally, my thought was to also allow the specification of an underlying representation (I was using u8, u16, u32, u64, s8, s16, s32, s64, f32, f64, c64, and c128 for various unsigned and signed integers, and single and double precision floats and complexes). I have this code running and will put in up on the Schematics site and post a reference later. It works fine, but I was disappointed in it's performance relative to just plain Scheme vectors. [It uses the SRFI 4 vector representations underneath, which I think map to definitions in the foreign function interface (FFI). We could work with Matthew and see if there are something we can do to improve the efficiency.] I still think that giving the user the option to specify the representation is the right thing to do from a numerical analysis perspective. I'll put some more time into writing up my own thoughts on the multi-dimensional array structure and the syntax for referencing slices, etc. Doug On Tue, Aug 11, 2009 at 8:15 PM, Matthias Felleisen wrote: > > Doug, can you describe to someone like Jason how he can assist you? > > > On Aug 11, 2009, at 8:57 PM, Doug Williams wrote: > > We actually do a lot of analysis work in Scheme - migrating from Python and > Matlab. The science collection ( > http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams) > and PLot (that comes with PLT Scheme) are the basis for this. We also have > some additional plotting and animation capabilities that aren't (yet) on > PLaneT. I had hoped to mature the science collection into something I was > calling Schemelab, which would be more MatLab-like, but work has gotten me > back over on the agent-based simulation side again. > > Anyway, depending on what you're looking to do, much of the framework is > there. I do wish it was more integrated, but it takes time. > > Doug > > On Tue, Aug 11, 2009 at 3:26 PM, Jason wrote: > >> Anyone out there heard of someone using drscheme as an alternative to >> matlab? With some libraries and plotting ability, it seems it could >> work. I'll be starting an engineering programming class with a lab >> that uses matlab. I might try doing some of the assignments in >> DrScheme... >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090812/6e015049/attachment.html From m.douglas.williams at gmail.com Wed Aug 12 09:31:09 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Wed Aug 12 09:31:32 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: Noel, are you using github exclusively now? Should I move there from Schematics? Doug On Wed, Aug 12, 2009 at 2:54 AM, Noel Welsh wrote: > Ok, my numeric library on github has an extensive vector library and > some other misc. numeric functions. > > N. > > On Wed, Aug 12, 2009 at 6:42 AM, Noel Welsh wrote: > > > > I'll try to put some of my other code online today. > > > > N. > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090812/d54e9759/attachment.htm From noelwelsh at gmail.com Wed Aug 12 09:38:45 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Aug 12 09:39:04 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: No, I'm still keeping stuff on Schematics. The stuff on Github is code I think others might find interesting but I don't expect to develop to the state where I'd release on Planet. Git is a much better system than Subversion for this kind of thing. Were I starting a project today I think Github would be a more compelling platform than Sourceforge. It's much lighter weight. However SF is fine for what we use it for, and there is no reason to leave. I've enabled the Git and Mercurial options at SF if anyone wants to use them. N. On Wed, Aug 12, 2009 at 2:31 PM, Doug Williams wrote: > Noel, are you using github exclusively now? Should I move there from > Schematics? > > Doug From anh at cs.rit.edu Wed Aug 12 09:55:06 2009 From: anh at cs.rit.edu (Arthur Nunes-Harwit) Date: Wed Aug 12 10:02:06 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> Message-ID: On Tue, 11 Aug 2009, Jason wrote: > ...and isn't it also true that lisp/scheme is a good place for > symbolic algebra? Matlab was designed to do floating point calculations. Any symbolic algebra was an afterthought. -Arthur From noelwelsh at gmail.com Wed Aug 12 10:36:01 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Aug 12 10:36:21 2009 Subject: [plt-scheme] Re: Embarrasingly basic GUI question In-Reply-To: <20090812122006.F24FE6500AE@mail-svr1.cs.utah.edu> References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> <20090812122006.F24FE6500AE@mail-svr1.cs.utah.edu> Message-ID: On Wed, Aug 12, 2009 at 1:20 PM, Matthew Flatt wrote: > At Tue, 11 Aug 2009 18:56:11 -0700 (PDT), Gregg Williams wrote: >> As another newbie, I second this. My stuff is 99% drawing code. >> I have an extensive background as a technology writer/editor (BYTE >> magazine, Apple Computer) and would be interested in writing >> documentation to explain GUI code that someone else has written. It >> would be great for someone to devise a list of sample programs that, >> together, would get a beginner up and started writing GUI-based Scheme >> programs. Then various people could commit to writing individual >> programs and documenting them. If anybody's interested in this idea, >> please let me know. > > That would be really great. +1. I say just start it, and see what happens. The Scheme Cookbook is quite a good system, but it doesn't really work for large documents. Editing text in a browser text box just doesn't scale. If what you have in mind is a coherent document rather than a collection of short recipes, as in the Cookbook, my suggestions are: 1) use Scribble and 2) put the source on Github (yeah, I'm on a bit of Github streak today). Git makes it easy... Ok Git makes nothing easy. Git makes it possible for other people to branch and modify your text, and you can selectively choose which parts to merge in. Very nice for this sort of thing. If you don't like Git I hear good things about Mercurial and Bazaar. N. From matthias at ccs.neu.edu Wed Aug 12 10:42:07 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Aug 12 10:43:01 2009 Subject: [plt-scheme] macros that expand into top-level definitions with computed names In-Reply-To: References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> Message-ID: <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> On Aug 11, 2009, at 11:39 PM, Lee Spector wrote: > > Thanks Matthias, > > That certainly is a different approach than defmacro! But it does > seem to get me most of the way there and I think I could get the > rest of the way (and maybe understand and appreciate more of what > I've been reading in the Macros section of the reference) if I > could see how to modify your example so that it evaluated its first > argument, as in: > > (define partial-name "yours") > > (def partial-name x (sqrt x)) > > (my-yours 4) => 2 > > BTW this isn't for prefixing or suffixing per se -- it's for a > version of a stack based language in which there are a bunch of > types, a bunch of instructions that work the same way on all types > but with different names and accessing different stacks, and I want > to generate functions by looping over the two lists and executing a > definition for each type/instruction pair. (These aren't PLT types, > they're types in my language -- http://hampshire.edu/lspector/ > push.html -- and I'm not interested at the moment in doing this in > any way that depends on PLT types... I just want to be able to > generate and execute definitions with computed names and bodies, > which is something I often find handy in CL.) The above conflates two different things: -- partial-name is a variable that maps to the run-time value "yours" -- def is new syntax, which like definitions in mathematics, is removed before run-time We call these phases. Now, if you happen to know the value of partial-name when you expand, this is no problem. Just refer to partial-name in the macro (roughly speaking). If you are figuring out these names at run-time, you're looking at an extremely dynamic problem and macros may not be your friend. (Indeed, I don't know how CL would cope with this issue. When you compile the code, macros go away, too.) -- Matthias > > Thanks, > > -Lee > > On Aug 11, 2009, at 10:27 PM, Matthias Felleisen wrote: > >> >> Do you mean this kind of thing: >> >> #lang scheme >> >> (define-syntax (def stx) >> (syntax-case stx () >> [(_ f x body ...) >> (identifier? (syntax f)) >> (let* ([f:sym (syntax-e (syntax f))] >> [my-f:str (string-append "my-" (symbol->string f:sym))] >> [my-f:sym (string->symbol my-f:str)] >> [my-f:id (datum->syntax stx my-f:sym)]) >> #`(define #,my-f:id (lambda (x) body ...)))])) >> >> (def yours x (sqrt x)) >> >> (my-yours 4) >> >> I recommend creating a module in your personal collects that >> provides for adding prefixes and suffixes and importing it when >> needed. It's in my standard collection >> >> -- Matthias >> >> >> >> On Aug 11, 2009, at 9:31 PM, Lee Spector wrote: >> >>> >>> I'm still transitioning from Common Lisp (thanks for all of the >>> pointers so far) and I'm having trouble doing something that I >>> could easily do with a CL macro. >>> >>> I'd like to write a macro (or whatever) that takes two strings >>> and defines a function named with the symbol formed from >>> interning the concatenation of the strings. For example if the >>> arguments have the values "my-" and "function" in a particular >>> call then I'd like the effect of the call to be the same as >>> something like (define my-function ). >>> >>> This is straightforward using defmacro in CL, but looking through >>> the section of the PLT reference on macros I don't see where to >>> start. In CL if I didn't know about defmacro, and if I didn't >>> mind having my definitions evaluated in a null lexical >>> environment, then I could hack it with eval. So with my new (but >>> still minimal) understanding of eval and namespaces in PLT I >>> tried this: >>> >>> ------- >>> #lang scheme >>> >>> (define-namespace-anchor nsa) >>> (define ns (namespace-anchor->namespace nsa)) >>> >>> (eval `(define ,(string->symbol (string-append "my-" "function")) >>> (lambda () 'runs)) >>> ns) >>> >>> (my-function) >>> ------- >>> >>> This doesn't work -- expand: unbound identifier in module in: my- >>> function -- although if I get rid of the call to my-function in >>> the definitions pane then it does compile and allow me to call my- >>> function (which then does the right thing) in the interactions >>> pane. But that's not good enough for my purposes. >>> >>> Of course this hack with eval is probably the wrong approach >>> anyway -- it would be a bad way to do it in CL and I'm guessing >>> that a completely different approach would be appropriate in PLT. >>> And I think I'm just not seeing the right part of the PLT docs >>> because of the differences in terminology. >>> >>> Can someone point me in the right direction on this? >>> >>> Thanks, >>> >>> -Lee >>> >>> -- >>> Lee Spector, Professor of Computer Science >>> School of Cognitive Science, Hampshire College >>> 893 West Street, Amherst, MA 01002-3359 >>> lspector@hampshire.edu, http://hampshire.edu/lspector/ >>> Phone: 413-559-5352, Fax: 413-559-5438 >>> >>> Check out Genetic Programming and Evolvable Machines: >>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From m.douglas.williams at gmail.com Wed Aug 12 10:56:25 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Wed Aug 12 10:56:51 2009 Subject: [plt-scheme] Re: Embarrasingly basic GUI question In-Reply-To: References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> <20090812122006.F24FE6500AE@mail-svr1.cs.utah.edu> Message-ID: I think we all stumbled through getting our graphics code working initially. Anymore, most of my programs are graphical in nature. I pretty much have a set structure for my graphical applications and stick with it. I think it would be great if the Application Framework were easier to use. I'm not sure if there are any other gray-haired ex-Symbolics and CLOS developers like me on the mailing list, but the define-application macro and presentations made it much easy to code graphical applications. There are a few graphical elements I've developed that I thought were generally usable and I've packaged them up and put them on PLaneT - for example, animated-canvas and table-panel. But most of the useful things are really design patterns more than reusable code and probably should be in the Scheme Cookbook. But, as Noel pointed out, it isn't that convenient for large, application level design patterns. That's where I think a simpler framework would help. Doug On Wed, Aug 12, 2009 at 8:36 AM, Noel Welsh wrote: > On Wed, Aug 12, 2009 at 1:20 PM, Matthew Flatt wrote: > > At Tue, 11 Aug 2009 18:56:11 -0700 (PDT), Gregg Williams wrote: > >> As another newbie, I second this. > > My stuff is 99% drawing code. > > >> I have an extensive background as a technology writer/editor (BYTE > >> magazine, Apple Computer) and would be interested in writing > >> documentation to explain GUI code that someone else has written. It > >> would be great for someone to devise a list of sample programs that, > >> together, would get a beginner up and started writing GUI-based Scheme > >> programs. Then various people could commit to writing individual > >> programs and documenting them. If anybody's interested in this idea, > >> please let me know. > > > > That would be really great. > > +1. I say just start it, and see what happens. > > The Scheme Cookbook is quite a good system, but it doesn't really work > for large documents. Editing text in a browser text box just doesn't > scale. If what you have in mind is a coherent document rather than a > collection of short recipes, as in the Cookbook, my suggestions are: > 1) use Scribble and 2) put the source on Github (yeah, I'm on a bit of > Github streak today). Git makes it easy... Ok Git makes nothing easy. > Git makes it possible for other people to branch and modify your text, > and you can selectively choose which parts to merge in. Very nice for > this sort of thing. If you don't like Git I hear good things about > Mercurial and Bazaar. > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090812/e9e47ae9/attachment.htm From lspector at hampshire.edu Wed Aug 12 11:26:23 2009 From: lspector at hampshire.edu (Lee Spector) Date: Wed Aug 12 11:31:44 2009 Subject: [plt-scheme] macros that expand into top-level definitions with computed names In-Reply-To: <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> Message-ID: > The above conflates two different things: > -- partial-name is a variable that maps to the run-time value "yours" > -- def is new syntax, which like definitions in mathematics, is > removed before run-time > We call these phases. > > Now, if you happen to know the value of partial-name when you > expand, this is no problem. Just refer to partial-name in the macro > (roughly speaking). If you are figuring out these names at run-time, > you're looking at an extremely dynamic problem and macros may not be > your friend. > > (Indeed, I don't know how CL would cope with this issue. When you > compile the code, macros go away, too.) > My mistake -- after some of the recommended reading I remembered macro- related issues that I had forgotten about and realized that my imagined defmacro solution in Common Lisp wouldn't work either! Thanks for your clarification on why this is, and for your patience. But whether or not there's a CL macro-based solution (I'm still not sure) the eval-based approach does indeed do the sort of thing I want in CL. Here I define def as a function and quote the other arguments in the call to def, which is fine for my purposes: (defun def (name arg body) (eval `(defun ,(intern (concatenate 'string "MY-" name)) (,arg) ,body))) (setq partial-name "YOURS") (def partial-name 'x '(sqrt x)) (MY-YOURS 4) => 2 Again, in PLT I can use eval in a similar way to make definitions of functions with computed names work for subsequent calls in the interactions pane, but not for calls in the same file. I thought this was a clue that I might try putting the definitions in another file/ module, but then I see problems producing the necessary (provide ...) form. Is there a way around this? In fact I DO know partial-name at compile time, or at least at what should be compile time for the code that will call the resulting functions. That is, I'm not going to be doing things like taking input from the user that gets turned into function names. But I want to do some computation to produce the function names and definition bodies since these will be combinatorial products of lists of symbols. Is there a way to do this either using PLT macros or module instantiation phases? I realize that I could write one program that creates all of the definitions (along with module-related forms) and writes them to a file, and then used the resulting file as source code. But it would be nice to avoid that. Thanks again, -Lee On Aug 12, 2009, at 10:42 AM, Matthias Felleisen wrote: > > On Aug 11, 2009, at 11:39 PM, Lee Spector wrote: > >> >> Thanks Matthias, >> >> That certainly is a different approach than defmacro! But it does >> seem to get me most of the way there and I think I could get the >> rest of the way (and maybe understand and appreciate more of what >> I've been reading in the Macros section of the reference) if I >> could see how to modify your example so that it evaluated its first >> argument, as in: >> >> (define partial-name "yours") >> >> (def partial-name x (sqrt x)) >> >> (my-yours 4) => 2 >> >> BTW this isn't for prefixing or suffixing per se -- it's for a >> version of a stack based language in which there are a bunch of >> types, a bunch of instructions that work the same way on all types >> but with different names and accessing different stacks, and I want >> to generate functions by looping over the two lists and executing a >> definition for each type/instruction pair. (These aren't PLT types, >> they're types in my language -- http://hampshire.edu/lspector/push.html >> -- and I'm not interested at the moment in doing this in any way >> that depends on PLT types... I just want to be able to generate and >> execute definitions with computed names and bodies, which is >> something I often find handy in CL.) > > > The above conflates two different things: > -- partial-name is a variable that maps to the run-time value "yours" > -- def is new syntax, which like definitions in mathematics, is > removed before run-time > We call these phases. > > Now, if you happen to know the value of partial-name when you > expand, this is no problem. Just refer to partial-name in the macro > (roughly speaking). If you are figuring out these names at run-time, > you're looking at an extremely dynamic problem and macros may not be > your friend. > > (Indeed, I don't know how CL would cope with this issue. When you > compile the code, macros go away, too.) > > -- Matthias > > > > > > > > > > > > > >> >> Thanks, >> >> -Lee >> >> On Aug 11, 2009, at 10:27 PM, Matthias Felleisen wrote: >> >>> >>> Do you mean this kind of thing: >>> >>> #lang scheme >>> >>> (define-syntax (def stx) >>> (syntax-case stx () >>> [(_ f x body ...) >>> (identifier? (syntax f)) >>> (let* ([f:sym (syntax-e (syntax f))] >>> [my-f:str (string-append "my-" (symbol->string f:sym))] >>> [my-f:sym (string->symbol my-f:str)] >>> [my-f:id (datum->syntax stx my-f:sym)]) >>> #`(define #,my-f:id (lambda (x) body ...)))])) >>> >>> (def yours x (sqrt x)) >>> >>> (my-yours 4) >>> >>> I recommend creating a module in your personal collects that >>> provides for adding prefixes and suffixes and importing it when >>> needed. It's in my standard collection >>> >>> -- Matthias >>> >>> >>> >>> On Aug 11, 2009, at 9:31 PM, Lee Spector wrote: >>> >>>> >>>> I'm still transitioning from Common Lisp (thanks for all of the >>>> pointers so far) and I'm having trouble doing something that I >>>> could easily do with a CL macro. >>>> >>>> I'd like to write a macro (or whatever) that takes two strings >>>> and defines a function named with the symbol formed from >>>> interning the concatenation of the strings. For example if the >>>> arguments have the values "my-" and "function" in a particular >>>> call then I'd like the effect of the call to be the same as >>>> something like (define my-function ). >>>> >>>> This is straightforward using defmacro in CL, but looking through >>>> the section of the PLT reference on macros I don't see where to >>>> start. In CL if I didn't know about defmacro, and if I didn't >>>> mind having my definitions evaluated in a null lexical >>>> environment, then I could hack it with eval. So with my new (but >>>> still minimal) understanding of eval and namespaces in PLT I >>>> tried this: >>>> >>>> ------- >>>> #lang scheme >>>> >>>> (define-namespace-anchor nsa) >>>> (define ns (namespace-anchor->namespace nsa)) >>>> >>>> (eval `(define ,(string->symbol (string-append "my-" "function")) >>>> (lambda () 'runs)) >>>> ns) >>>> >>>> (my-function) >>>> ------- >>>> >>>> This doesn't work -- expand: unbound identifier in module in: my- >>>> function -- although if I get rid of the call to my-function in >>>> the definitions pane then it does compile and allow me to call my- >>>> function (which then does the right thing) in the interactions >>>> pane. But that's not good enough for my purposes. >>>> >>>> Of course this hack with eval is probably the wrong approach >>>> anyway -- it would be a bad way to do it in CL and I'm guessing >>>> that a completely different approach would be appropriate in PLT. >>>> And I think I'm just not seeing the right part of the PLT docs >>>> because of the differences in terminology. >>>> >>>> Can someone point me in the right direction on this? >>>> >>>> Thanks, >>>> >>>> -Lee >>>> >>>> -- >>>> Lee Spector, Professor of Computer Science >>>> School of Cognitive Science, Hampshire College >>>> 893 West Street, Amherst, MA 01002-3359 >>>> lspector@hampshire.edu, http://hampshire.edu/lspector/ >>>> Phone: 413-559-5352, Fax: 413-559-5438 >>>> >>>> Check out Genetic Programming and Evolvable Machines: >>>> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> -- >> Lee Spector, Professor of Computer Science >> School of Cognitive Science, Hampshire College >> 893 West Street, Amherst, MA 01002-3359 >> lspector@hampshire.edu, http://hampshire.edu/lspector/ >> Phone: 413-559-5352, Fax: 413-559-5438 >> >> Check out Genetic Programming and Evolvable Machines: >> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From jason.lillywhite at gmail.com Wed Aug 12 11:28:58 2009 From: jason.lillywhite at gmail.com (Jason Lillywhite) Date: Wed Aug 12 11:37:33 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: <408616110908120828r5a429046r6b5576a99d41bca9@mail.gmail.com> I'm confused about how libraries are publicized. Do you first post drafts in Github/Schematics, then as it matures, you put it in PlaneT? On Wed, Aug 12, 2009 at 7:38 AM, Noel Welsh wrote: > No, I'm still keeping stuff on Schematics. The stuff on Github is code > I think others might find interesting but I don't expect to develop to > the state where I'd release on Planet. Git is a much better system > than Subversion for this kind of thing. > > Were I starting a project today I think Github would be a more > compelling platform than Sourceforge. It's much lighter weight. > However SF is fine for what we use it for, and there is no reason to > leave. > > I've enabled the Git and Mercurial options at SF if anyone wants to use them. > > N. > > On Wed, Aug 12, 2009 at 2:31 PM, Doug > Williams wrote: >> Noel, are you using github exclusively now? Should I move there from >> Schematics? >> >> Doug > From sshickey at qwest.net Wed Aug 12 11:33:34 2009 From: sshickey at qwest.net (Scott Hickey) Date: Wed Aug 12 11:40:34 2009 Subject: [plt-scheme] problem running clock example for FrTime Message-ID: <864094.90097.qm@web62503.mail.re1.yahoo.com> am working through the paper from 2004 on FrTime. There is a clock demo with sample source which doesn't run in version 4.2. I think there are two problems. First, the syntax for match has changed. I tried to update it but I still get the following error. match: date does not refer to a structure definition in: date Second, seconds->date won't work with seconds as an argument. Calling value-now gets pass the error but I'm guessing that's not going to make the demo run correctly? (require scheme/match) (define clock (match (seconds->date (value-now seconds)) [(struct date (sec min hr day mon yr _ _ _ _)) (format " ?a: ?a: ?a ?a- ?a- ?a" hr (pad min) (pad sec) day (pad mon) (pad (modulo yr 100)))])) ;; pads a number to two digits (define (pad n) (if (< n 10) (format "0 ?a" n) (number!string n))) Thanks, Scott Hickey Senior Consultant Object Partners, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090812/f19ae31c/attachment.htm From m.douglas.williams at gmail.com Wed Aug 12 11:40:51 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Wed Aug 12 11:41:11 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: <408616110908120828r5a429046r6b5576a99d41bca9@mail.gmail.com> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <408616110908120828r5a429046r6b5576a99d41bca9@mail.gmail.com> Message-ID: That's pretty much how it works. Although, we tend to be isolated groups who don't do as much of the posting of drafts as we should. Noel, is there a Scheme numerics mailing list associated with Schematics? On Wed, Aug 12, 2009 at 9:28 AM, Jason Lillywhite < jason.lillywhite@gmail.com> wrote: > I'm confused about how libraries are publicized. Do you first post > drafts in Github/Schematics, then as it matures, you put it in PlaneT? > > On Wed, Aug 12, 2009 at 7:38 AM, Noel Welsh wrote: > > No, I'm still keeping stuff on Schematics. The stuff on Github is code > > I think others might find interesting but I don't expect to develop to > > the state where I'd release on Planet. Git is a much better system > > than Subversion for this kind of thing. > > > > Were I starting a project today I think Github would be a more > > compelling platform than Sourceforge. It's much lighter weight. > > However SF is fine for what we use it for, and there is no reason to > > leave. > > > > I've enabled the Git and Mercurial options at SF if anyone wants to use > them. > > > > N. > > > > On Wed, Aug 12, 2009 at 2:31 PM, Doug > > Williams wrote: > >> Noel, are you using github exclusively now? Should I move there from > >> Schematics? > >> > >> Doug > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090812/1fd5bff1/attachment.html From matthias at ccs.neu.edu Wed Aug 12 12:25:25 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Aug 12 12:26:18 2009 Subject: [plt-scheme] macros that expand into top-level definitions with computed names In-Reply-To: References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> Message-ID: <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> On Aug 12, 2009, at 11:26 AM, Lee Spector wrote: > > In fact I DO know partial-name at compile time, or at least at what > should be compile time for the code that will call the resulting > functions. That is, I'm not going to be doing things like taking > input from the user that gets turned into function names. But I > want to do some computation to produce the function names and > definition bodies since these will be combinatorial products of > lists of symbols. Is there a way to do this either using PLT macros > or module instantiation phases? Here is a macro that computes with partial name? Is this good enough? #lang scheme/load (module c scheme (define partial-name "yours") (provide partial-name)) (module a scheme (require (for-template 'c) (for-syntax 'c)) (define-syntax (def stx) (syntax-case stx () [(_ f x body ...) (let* ([f:sym (syntax-e (syntax f))] [my-f:str (string-append "my-" partial-name (number- >string (string-length partial-name)) (symbol->string f:sym))] [my-f:sym (string->symbol my-f:str)] [my-f:id (datum->syntax stx my-f:sym)]) (printf "~a\n" my-f:sym) #`(define #,my-f:id (lambda (x) body ...)))])) (provide def)) (module b scheme (require 'a) (def f x (sqrt x)) (printf "~a\n" (my-yours5f 4)) (def yours x (sqrt x)) (printf "~a\n" (my-yours5yours 4))) (require 'b) From jay.mccarthy at gmail.com Wed Aug 12 13:23:08 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Wed Aug 12 13:23:31 2009 Subject: [plt-scheme] problem running clock example for FrTime In-Reply-To: <864094.90097.qm@web62503.mail.re1.yahoo.com> References: <864094.90097.qm@web62503.mail.re1.yahoo.com> Message-ID: First, it looks like you copied code from the PDF that contains weird unicode display glyphs. In general, this will not work in DrScheme, MzScheme, or any other PL environment. I'm not sure why match doesn't work, but here is code that does.... (require scheme/match) (define d (seconds->date seconds)) (define sec (date-second d)) (define min (date-minute d)) (define hr (date-hour d)) (define day (date-day d)) (define mon (date-month d)) (define yr (date-year d)) (define (pad n) (if (< n 10) (format "0~a" n) (number->string n))) (define clock (format "~a:~a:~a ~a-~a-~a" hr (pad min) (pad sec) day (pad mon) (pad (modulo yr 100)))) Jay On Wed, Aug 12, 2009 at 9:33 AM, Scott Hickey wrote: > am working through the paper from 2004 on FrTime. There is a clock demo with > sample source which doesn't run in version 4.2. > I think there are two problems. > > First, the syntax for match has changed. I tried to update it but I still > get the following error. > match: date does not refer to a structure definition in: date > > Second, seconds->date won't work with seconds as an argument. Calling > value-now gets pass the error but I'm guessing that's not going to make the > demo run correctly? > > > (require scheme/match) > (define clock > ? (match (seconds->date (value-now seconds)) > ??? [(struct date (sec min hr day mon yr _ _ _ _)) > ???? (format " ?a: ?a: ?a? ?a- ?a- ?a" > ???????????? hr (pad min) (pad sec) > ???????????? day (pad mon) (pad (modulo yr 100)))])) > > ;; pads a number to two digits > (define (pad n) > ? (if (< n 10) > ????? (format "0 ?a" n) > ????? (number!string n))) > > Thanks, > > Scott Hickey > Senior Consultant > Object Partners, Inc. > _________________________________________________ > ?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 noelwelsh at gmail.com Wed Aug 12 14:20:58 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Aug 12 14:21:28 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <408616110908120828r5a429046r6b5576a99d41bca9@mail.gmail.com> Message-ID: On Wed, Aug 12, 2009 at 4:40 PM, Doug Williams wrote: > That's pretty much how it works. Although, we tend to be isolated groups who > don't do as much of the posting of drafts as we should. > > Noel, is there a Scheme numerics mailing list associated with Schematics? There are two mailing lists at Sourceforge, schematics-dev and schematics-users. Both are inactive, and I've thought about disabling them. I think it is best to keep discussion on this list till it reaches a level where it is annoying to other users. Another mailing list would a) be obscure -- who'd think of looking for it? and b) be more maintenance for some sucker (me :) N. From jason.lillywhite at gmail.com Wed Aug 12 14:31:18 2009 From: jason.lillywhite at gmail.com (Jason Lillywhite) Date: Wed Aug 12 14:32:01 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <408616110908120828r5a429046r6b5576a99d41bca9@mail.gmail.com> Message-ID: <408616110908121131j34cdc85ew8cbe665277bf2abf@mail.gmail.com> Any way to have something like this for Scheme? http://www.ruby-forum.com/ where you can have multiple places under one roof? On Wed, Aug 12, 2009 at 12:20 PM, Noel Welsh wrote: > On Wed, Aug 12, 2009 at 4:40 PM, Doug > Williams wrote: >> That's pretty much how it works. Although, we tend to be isolated groups who >> don't do as much of the posting of drafts as we should. >> >> Noel, is there a Scheme numerics mailing list associated with Schematics? > > There are two mailing lists at Sourceforge, schematics-dev and > schematics-users. Both are inactive, and I've thought about disabling > them. I think it is best to keep discussion on this list till it > reaches a level where it is annoying to other users. Another mailing > list would a) be obscure -- who'd think of looking for it? and b) be > more maintenance for some sucker (me :) > N. > From ghcooper at gmail.com Wed Aug 12 14:38:34 2009 From: ghcooper at gmail.com (Gregory Cooper) Date: Wed Aug 12 14:38:53 2009 Subject: [plt-scheme] problem running clock example for FrTime In-Reply-To: References: <864094.90097.qm@web62503.mail.re1.yahoo.com> Message-ID: <65e1d50c0908121138x4dbb5d27p8d92cfbd4d110a71@mail.gmail.com> > I'm not sure why match doesn't work, but here is code that does.... > > (require scheme/match) A Scheme library (like scheme/match) won't work automatically with FrTime. If the library can itself be evaluated meaningfully in FrTime (i.e., it's pure), then it should be possible to use it, but I haven't looked into making this sort of reuse work seamlessly. Greg From praimon at gmail.com Wed Aug 12 18:44:03 2009 From: praimon at gmail.com (praimon) Date: Wed Aug 12 18:50:44 2009 Subject: [plt-scheme] Re: Embarrasingly basic GUI question In-Reply-To: <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> Message-ID: <4acd8930908121544h49fe2f63ub63ef7e57d7f3437@mail.gmail.com> I recommend MrEd Designer http://hexahedron.hu/personal/peteri/mreddesigner/index.html I'm a beginner, but had no trouble building up a gui with it. Then export the source code and study it. With what I learned, I've been able to create some reasonably complicated gui's. One limitation I noticed: it has only a generic canvas%. So if you need an editor-canvas% (e.g.), you'll have to do some minimal source editing. regards, praimon On Tue, Aug 11, 2009 at 9:56 PM, Gregg Williams wrote: >> If anyone can point to some neat examples, I'd still be keen to >> see 'em. > > As another newbie, I second this. I've been searching the web for GUI- > based Scheme source code and haven't found much. I have the source > code for DrScheme, but it's such a large project that I have > difficulty making sense of it. From skeptic2000 at hotmail.com Wed Aug 12 22:13:57 2009 From: skeptic2000 at hotmail.com (Skeptic .) Date: Wed Aug 12 22:14:36 2009 Subject: [plt-scheme] how to have #\u03BB (lambda) working in htdp languages Message-ID: Hi, What would be the best way to add support for the #\u03BB (lambda) character to htdp advanced student language ? (of course by support I mean to define procedures) Thanks _________________________________________________________________ Avec Windows Live, vous gardez le contact avec tous vos amis au m?me endroit. http://go.microsoft.com/?linkid=9660830 From plt at synx.us.to Thu Aug 13 00:01:16 2009 From: plt at synx.us.to (Synx) Date: Thu Aug 13 00:02:03 2009 Subject: [plt-scheme] Units with 1 piece missing Message-ID: <4A83900C.40407@synx.us.to> So I've got units working, but as I write various programs using these units, I find myself duplicating a lot of code. Forming the compound unit for each program is exactly the same, except for that 1 unit that changes, according to which program it is. So I end up with a bunch of modules defining compound units that are exactly alike except for the unit that implements (run). I tried making a general procedure where I pass a runner as a lambda, but it ended up looking like this: --- (require "foo-unit.ss" "foo-sig.ss" "bar-unit.ss" "bar-sig.ss" "baz-unit.ss" "baz-sig.ss" "blech-unit.ss" "blech-sig.ss" "beep-unit.ss" "beep-sig.ss" "feep-unit.ss" "feep-sig.ss" "run-sig.ss") (define-compound-unit/infer common@ (import) (export foo^ bar^ baz^ blech^ beep^ feep^) (link foo@ bar@ baz@ blech@ beep@ feep@)) (define (do runner) (define running@ (compound-unit (import) (export RUN) (link [((RUN : run^)) runner FOO BAR BAZ BLECH BEEP FEEP] [((FOO : foo^) (BAR : bar^) (BLECH : blech^) (BEEP : beep^) (FEEP : feep^)) common@ RUN]))) (define-values/invoke-unit running@ (import) (export run^)) (run)) --- Besides being full of redundancy, there are a few problems with that code. First off, the documentation says "The right-hand side of a link declaration specifies the imports to be supplied to the unit produced by the corresponding unit-expr." But the syntax only allows one import to be supplied to the unit. So my "runner FOO BAR BAZ BLECH ..." thing errors out, and the docs sure don't offer any suggestion how to specify "imports" that it claims are possible. Secondly, I have to require all the signatures from all those modules, to explicitly export them in the compound unit. When I make a compound unit definition thing for every time I want to swap out a run^, I only have to require "run-sig.ss". What I'm basically saying is I want something like this: --- (require "foo-unit.ss" "bar-unit.ss" "baz-unit.ss" "blech-unit.ss" "beep-unit.ss" "feep-unit.ss" "run-sig.ss") (define (do runner) (define-compound-unit combined@ (import) (export run^) (link foo@ bar@ baz@ blech@ beep@ feep@ runner))) (provide do) --- And of course that doesn't work. I can't figure out how to make something nearly as elegant as that when supplying a procedure that lets me plug the 1 "missing piece" into place with the rest of the units. From spamme at innerpaths.net Thu Aug 13 00:22:52 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Thu Aug 13 00:23:12 2009 Subject: [plt-scheme] Re: Embarrasingly basic GUI question In-Reply-To: <20090812122006.F24FE6500AE@mail-svr1.cs.utah.edu> References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> <20090812122006.F24FE6500AE@mail-svr1.cs.utah.edu> Message-ID: <742c4167-8893-4405-b0d7-adb18f4f0308@l35g2000pra.googlegroups.com> On Aug 12, 5:20?am, Matthew Flatt wrote: > The games in plt/collects/games may be a better place to start. The > "minesweeper" game was originally intended as an example GUI program. I looked at the example games. However, what I want to do is display (but not edit) text in multiple windows. After reading the "PLT Graphics Toolkit" document, though, I'm unsure whether I need to learn all of the Editor subsystem just to *display* static text in a scrolling window. Any pointers on how to do that? Thanks. From plt at synx.us.to Thu Aug 13 02:05:31 2009 From: plt at synx.us.to (Synx) Date: Thu Aug 13 02:06:30 2009 Subject: [plt-scheme] Re: Embarrasingly basic GUI question In-Reply-To: <742c4167-8893-4405-b0d7-adb18f4f0308@l35g2000pra.googlegroups.com> References: <20090811042225.GA32202@duncan.reilly.home> <20090811043750.GA36451@duncan.reilly.home> <3470bd61-f41d-426c-a3f6-b25c0b6e94b3@m3g2000pri.googlegroups.com> <20090812122006.F24FE6500AE@mail-svr1.cs.utah.edu> <742c4167-8893-4405-b0d7-adb18f4f0308@l35g2000pra.googlegroups.com> Message-ID: <4A83AD2B.6020007@synx.us.to> Gregg Williams wrote: > just to *display* static text in a > scrolling window. I made the width and height of the window kind of small, so you could see the scrolling. Warning, dherman's widgets library is kind of buggy. PLT mysteriously stopped being able to read BMP files for some reason. -------------- next part -------------- #lang scheme/base (require scheme/gui/base) (require scheme/class) (define (scrolled-text-box text-class insert input) (define frame (new frame% (label "something") (width 100) (height 100))) (define text (new text-class)) (define canvas (new editor-canvas% (style '(auto-hscroll auto-vscroll)) (parent frame) (editor text))) (define hbox (new horizontal-pane% (stretchable-height #f) (alignment '(center top)) (parent frame))) (define close (new button% (parent hbox) (label "Close") (callback (?? (btn event) (send frame show #f))))) (send-generic text insert input 0) (send frame show #t)) (scrolled-text-box text% (generic text% insert) "1 This is a test. 2 This is a test. 3 This is a test. 4 This is a test. 5 This is a test. 6 This is a test. 7 This is a test. 8 This is a test. 9 This is a test.") (require (prefix-in widget: (planet dherman/widgets:2/widgets))) (scrolled-text-box widget:read-only-text% (generic widget:read-only-text% insert/programmatic) "This is a test. This is a test. This is a test. This is a test. This is a test. That is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. That is a test. This is a test. This is a test. This is a test. This is a test.") From mflatt at cs.utah.edu Thu Aug 13 07:13:43 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Aug 13 07:14:04 2009 Subject: [plt-scheme] how to have #\u03BB (lambda) working in htdp languages In-Reply-To: References: Message-ID: <20090813111345.01F5B650064@mail-svr1.cs.utah.edu> At Wed, 12 Aug 2009 22:13:57 -0400, "Skeptic ." wrote: > What would be the best way to add support for the #\u03BB (lambda) > character to htdp advanced student language ? You could add it through a teachpack implemented as #lang scheme/base (require lang/htdp-advanced) (provide (rename-out [lambda ?])) I'm not sure why `?' isn't already bound in the HtDP languages. I'm sure that some of us have discussed it, but I don't remember the conclusion (i.e., whether we decided that it was a bad idea or that we just didn't get around to adding it). From noelwelsh at gmail.com Thu Aug 13 08:21:26 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Aug 13 08:21:45 2009 Subject: [plt-scheme] Units with 1 piece missing In-Reply-To: <4A83900C.40407@synx.us.to> References: <4A83900C.40407@synx.us.to> Message-ID: On Thu, Aug 13, 2009 at 5:01 AM, Synx wrote: > Besides being full of redundancy, there are a few problems with that > code. First off, the documentation says "The right-hand side of a link > declaration specifies the imports to be supplied to the unit produced by > the corresponding unit-expr." But the syntax only allows one import to > be supplied to the unit. So my "runner FOO BAR BAZ BLECH ..." thing > errors out, and the docs sure don't offer any suggestion how to specify > "imports" that it claims are possible. Here's the content of an email I sent some time ago which I think addresses this question: The documentation is, I think, incorrect. It states, for compound-unit/infer: (link infer-linkage-decl ...)) ... infer-linkage-decl = ((link-binding ...) unit-id tagged-link-id) | unit-id where tagged-link-id (defined at compound-unit) is: tagged-link-id = (tag id link-id) | link-id I think there should be ellipses after tagged-link-id. So: infer-linkage-decl = ((link-binding ...) unit-id tagged-link-id ...) | unit-id for both compound-unit and compound-unit/infer ... On Fri, Jun 5, 2009 at 2:26 AM, Matthias Felleisen wrote: > (define link@ > (compound-unit > (import) > (export) > (link (((A : cluster^)) cluster@) > (((C : cluster^)) binary-cluster@ (tag a A) (tag b A)) > (((B : mt^)) client@ C)))) > Secondly, I have to require all the signatures from all those modules, > to explicitly export them in the compound unit. When I make a compound > unit definition thing for every time I want to swap out a run^, I only > have to require "run-sig.ss". > > What I'm basically saying is I want something like this: > --- Inferred linking does 1/2 of this I believe. The other 1/2, requiring all those signatures... just put them all in one file if you don't like writing long require expresssions. N. From gremio at csail.mit.edu Thu Aug 13 08:50:00 2009 From: gremio at csail.mit.edu (Gregory Marton) Date: Thu Aug 13 08:50:21 2009 Subject: [plt-scheme] plot's keyword arguments Message-ID: Hi folks, This may be a newbie error. I'm in the Pretty Big language, and say require 'plot' then copy-paste the example from http://docs.plt-scheme.org/plot/Quick_Start.html#%28part._.Basic_.Plotting%29 (plot (line (lambda (x) (sin x))) #:x-min -1 #:x-max 1 #:title "Sin(x)") and get the error procedure plot: expects 1 argument plus optional arguments with keywords #:bgcolor, #:fgcolor, #:height, #:lncolor, #:out-file, #:title, #:width, #:x-label, #:x-max, #:x-min, #:y-label, #:y-max, and #:y-min, given 7: # #:x-min -1 #:x-max 1 #:title "Sin(x)" (version) "4.2" Am I doing something wrong? Thanks, Grem -- ------ __@ Gregory A. Marton http://csail.mit.edu/~gremio --- _`\<,_ 617-775-3005 -- (*)/ (*) Guns cause crime like matches cause arson. ~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~ From noelwelsh at gmail.com Thu Aug 13 09:43:31 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Aug 13 09:43:53 2009 Subject: [plt-scheme] plot's keyword arguments In-Reply-To: References: Message-ID: Change language to module. N. On Thu, Aug 13, 2009 at 1:50 PM, Gregory Marton wrote: > Hi folks, > > This may be a newbie error. ?I'm in the Pretty Big language, and say > ? require 'plot' > then copy-paste the example from > ?http://docs.plt-scheme.org/plot/Quick_Start.html#%28part._.Basic_.Plotting%29 > > ? (plot (line (lambda (x) (sin x))) > ? ? ? ? #:x-min -1 #:x-max 1 #:title "Sin(x)") > > and get the error > ? procedure plot: expects 1 argument plus optional arguments with keywords > ? #:bgcolor, #:fgcolor, #:height, #:lncolor, #:out-file, #:title, #:width, > ? #:x-label, #:x-max, #:x-min, #:y-label, #:y-max, and #:y-min, given 7: > ? # #:x-min -1 #:x-max 1 #:title "Sin(x)" > From ifl2009 at shu.edu Thu Aug 13 10:12:58 2009 From: ifl2009 at shu.edu (IFL 2009) Date: Thu Aug 13 10:13:25 2009 Subject: [plt-scheme] IFL 2009: Final Call for Papers and Participation Message-ID: An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090813/9a2a6a45/attachment.htm From jensaxel at soegaard.net Wed Aug 12 13:41:49 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Thu Aug 13 11:14:52 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <408616110908120828r5a429046r6b5576a99d41bca9@mail.gmail.com> Message-ID: <4072c51f0908121041g2510a682ne8a7e1e5fbdce277@mail.gmail.com> 2009/8/12 Doug Williams : > That's pretty much how it works. Although, we tend to be isolated groups who > don't do as much of the posting of drafts as we should. > > Noel, is there a Scheme numerics mailing list associated with Schematics? I believe not, but if such a list is created, count me in. -- Jens Axel S?gaard From dyrueta at gmail.com Wed Aug 12 21:57:36 2009 From: dyrueta at gmail.com (David Yrueta) Date: Thu Aug 13 12:00:01 2009 Subject: [plt-scheme] non-Scheme; Edible HtDP, or; PLT Scheme is good; HtDP is just the icing on the cake! Message-ID: <186df66b0908121857p20b4db0fk697df086ee68a0ca@mail.gmail.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: HtDP (4).jpg Type: image/jpeg Size: 2370009 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090812/c9501a49/HtDP4-0001.jpg -------------- next part -------------- A non-text attachment was scrubbed... Name: HtDP.jpg Type: image/jpeg Size: 1550004 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090812/c9501a49/HtDP-0001.jpg From wookiz at hotmail.com Thu Aug 13 12:04:43 2009 From: wookiz at hotmail.com (wooks) Date: Thu Aug 13 12:05:05 2009 Subject: [plt-scheme] Re: DrScheme as alternative to Matlab In-Reply-To: <5E419F38-A3DF-4EDF-9602-4FCA913E4BF2@ccs.neu.edu> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <3F435686-05AF-48E4-B9A0-77D525C71F80@ccs.neu.edu> <11b141710908111529w3bd74b14if868089b0ba3e599@mail.gmail.com> <5E419F38-A3DF-4EDF-9602-4FCA913E4BF2@ccs.neu.edu> Message-ID: On Aug 11, 4:21?pm, Matthias Felleisen wrote: > On Aug 11, 2009, at 7:01 PM, Jason wrote: > (Now you may ask why people switched to ? > different implementation languages. One answer is people's ignore and ? > preference for difficult lives.) > A fascinating historical account by someone who was involved. http://www.math.utexas.edu/pipermail/maxima/2003/005861.html From grettke at acm.org Thu Aug 13 12:14:23 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Aug 13 12:22:24 2009 Subject: [plt-scheme] non-Scheme; Edible HtDP, or; PLT Scheme is good; HtDP is just the icing on the cake! In-Reply-To: <186df66b0908121857p20b4db0fk697df086ee68a0ca@mail.gmail.com> References: <186df66b0908121857p20b4db0fk697df086ee68a0ca@mail.gmail.com> Message-ID: <756daca50908130914u73da6ebck1f29c3a9d14a9a6d@mail.gmail.com> On Wed, Aug 12, 2009 at 8:57 PM, David Yrueta wrote: > Photos of my groom's cake attached.... really. > "If you can't beat 'em, eat 'em! ?-- The Bride > "HtDeliciousP!" -- The Groom > This attached materials are definitely not protected by copyright :) Thanks for sharing and congratulations! :) From toddobryan at gmail.com Thu Aug 13 16:07:14 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Aug 13 16:07:36 2009 Subject: [plt-scheme] how to have #\u03BB (lambda) working in htdp languages In-Reply-To: <20090813111345.01F5B650064@mail-svr1.cs.utah.edu> References: <20090813111345.01F5B650064@mail-svr1.cs.utah.edu> Message-ID: <904774730908131307n458c7e2fnf4ab8681afdd392e@mail.gmail.com> I think I provided a patch, which you applied, but it was probably just for Intermediate with Lambda, not Advanced. Sorry about that. On Thu, Aug 13, 2009 at 7:13 AM, Matthew Flatt wrote: > At Wed, 12 Aug 2009 22:13:57 -0400, "Skeptic ." wrote: >> What would be the best way to add support for the #\u03BB (lambda) >> character to htdp advanced student language ? > > You could add it through a teachpack implemented as > > ?#lang scheme/base > ?(require lang/htdp-advanced) > ?(provide (rename-out [lambda ?])) > > > I'm not sure why `?' isn't already bound in the HtDP languages. I'm > sure that some of us have discussed it, but I don't remember the > conclusion (i.e., whether we decided that it was a bad idea or that we > just didn't get around to adding it). > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Thu Aug 13 16:09:49 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Aug 13 16:10:12 2009 Subject: [plt-scheme] how to have #\u03BB (lambda) working in htdp languages In-Reply-To: <904774730908131307n458c7e2fnf4ab8681afdd392e@mail.gmail.com> References: <20090813111345.01F5B650064@mail-svr1.cs.utah.edu> <904774730908131307n458c7e2fnf4ab8681afdd392e@mail.gmail.com> Message-ID: <20090813200949.CC0216500B7@mail-svr1.cs.utah.edu> Ah, no --- `?' already is in the Advanced level, probably because I generalized your patch (or maybe your patch included it after all). The docs are even correct. I must have just been confused when I looked/tried this morning. At Thu, 13 Aug 2009 16:07:14 -0400, "Todd O'Bryan" wrote: > I think I provided a patch, which you applied, but it was probably > just for Intermediate with Lambda, not Advanced. Sorry about that. > > On Thu, Aug 13, 2009 at 7:13 AM, Matthew Flatt wrote: > > At Wed, 12 Aug 2009 22:13:57 -0400, "Skeptic ." wrote: > >> What would be the best way to add support for the #\u03BB (lambda) > >> character to htdp advanced student language ? > > > > You could add it through a teachpack implemented as > > > > ?#lang scheme/base > > ?(require lang/htdp-advanced) > > ?(provide (rename-out [lambda ?])) > > > > > > I'm not sure why `?' isn't already bound in the HtDP languages. I'm > > sure that some of us have discussed it, but I don't remember the > > conclusion (i.e., whether we decided that it was a bad idea or that we > > just didn't get around to adding it). > > > > _________________________________________________ > > ?For list-related administrative tasks: > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at eecs.northwestern.edu Thu Aug 13 16:43:24 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Aug 13 16:43:45 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> Message-ID: <932b2f1f0908131343w284764ccr1ebad9f275984848@mail.gmail.com> As a related question: is there fft support for PLT Scheme somewhere? Thanks, Robby On Tue, Aug 11, 2009 at 4:26 PM, Jason wrote: > Anyone out there heard of someone using drscheme as an alternative to > matlab? With some libraries and plotting ability, it seems it could > work. I'll be starting an engineering programming class with a lab > that uses matlab. I might try doing some of the assignments in > DrScheme... > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From m.douglas.williams at gmail.com Thu Aug 13 22:30:00 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Aug 13 22:30:24 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab Message-ID: This is a continuation of the' DrScheme as alternative to Matlab' thread and back on track to the original question. Some time ago I began thinking about a project I was calling Schemelab, which is exactly what the original question in the thread was addressing - PLT Scheme as an alternative to Matlab (or Python/NumPy/SciPy). Matlab (and NumPy/SciPy in Python) is primarily a numeric processing for data analysis. At its heart is an efficient multidimensional array representation that facilitates this numeric processing. On top of this is the cool graphics and specialized numeric processing libraries. I think the first thing we need to do is to define such a multidimensional array representation for PLT Scheme. I have put up some prototype code on GitHub (http://github.com/DrDoug/numeric/tree/master) with the very beginnings of such a representation. Currently, it just shows creating arrays (make-array and arange), referenceing elements (array-ref), and some basic (but interesting) operations (reshape and transpose). Arrays have a shape, which is specified as a list of exact nonnegative integers. For example: (make-array '(3 4)) makes a two-dimensional array with 3 rows and 4 columns and (make-array '(3 4 5)) makes a three-dimensional array that is a 3 x 4 x 5 array. Arrays have a type. The types are object, u8, u16, u32, u64, s8, s16, s32, s64, f32, f64, c64, and c128. Implementationally, this specified the underlying vector type that stores the actual data for the array, where object is a standard Scheme vector and the others are unsigned integer, signed integer, floating-point, and complex representations based on SRFI 4 vectors. This lets the user specify the fundamental numerical representation. The default is object. Finally, arrays have an order, which may be 'row or 'column. This specifies whether the array is stored in row-major or column-major format. The default is row-major. For example: (make-array '(3 4)) creates a 3 x 4 row-major array whose elements can hold any Scheme object; (make-array '(3 4 5) #:type f32) creates a 3 x 4 x 5 row-major array whose elements are single-precision floats; and (make-array '(3 4) #:type s32 #:order 'column) creates a 3 x 4 column-major array whose elements are 32-bit signed integers. A fill value can also be specified when creating an array. If not fill is specified, the underlying data vector is initialized using whatever method the primitive make vector functions use. So, (make-vector '(3 4) #:type f32 #:fill 0.0) creates a 3 x 4 row-major array while single-precision flot elements are initialized to 0.0. The function arange creates a one-dimensional array of a specified size that is initialized with the natural numbers 0 ... size-1. The type can also be specified. For example, (arange 12 #:type f32) creates a 12 element one-dimensional array (i.e., a vector) whose elements are single-precision floats 0.0, 1.0, 2.0, ..., 11.0. Note that array order doesn't matter for one-dimensional arrays (although it will be set to row-major). Array elements are referenced using array-ref. For example, (array-ref a '(1 2)) returns a[1, 2]. For the prototype code, the reference must be fully specified and will return the referenced element. In the future, array-ref will also allow slicing operations such as (array-ref a '(* 3)) would return the 4th column (with index 3) of a as a one-dimensional array. I'll get those in the prototype soon. The function reshape changes the shape of an array. The size of the new shape must be size of the original shape. Note that the original array is not changed nor is it copied, a new array reference is created that shares data with the original. For example, (reshape (arange 12) '(3 4)) creates a 3 x 4 row-major array whose elements are ((0 1 2 3) (4 5 6 7) (8 9 10 11)). The function transpose transposes an array (obviously). Note that the original array is not changed nor is it copied. This makes use of the fact that the column-major representatio of a row-major array is its transpose and vice versa. For example, (transpose (reshape (arange 12) '(3 4))) creates a 4 x 3 column-major array whose elements are ((0 4 8) (1 5 9) (2 6 10) (3 7 11)), which is the transpose of ((0 1 2 3) (4 5 6 7) (8 9 10 11)). Anyway, if you're interested, please download the code from GitHub and run array-test.ss to see some of the above capabilities. The output describes the array structure for various examples. Please let me know if you have trouble getting the code using the above link. I'm new to GitHub and may have done something wrong. For the PLT implementors. I'm using SRFI 4 as the underlying representation for storing the arrays. They store the data in the formats we want, but don't seem to be processed efficiently. Although efficiency isn't a real concern at this stage, it will be for some people at some point. Any idea of what we can do better is more than welcome. Thanks, Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090813/5b022403/attachment.htm From eli at barzilay.org Thu Aug 13 22:59:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Aug 13 22:59:31 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: Message-ID: <19076.54013.636689.300854@winooski.ccs.neu.edu> On Aug 13, Doug Williams wrote: > > For the PLT implementors. I'm using SRFI 4 as the underlying > representation for storing the arrays. They store the data in the > formats we want, but don't seem to be processed efficiently. > Although efficiency isn't a real concern at this stage, it will be > for some people at some point. Any idea of what we can do better is > more than welcome. The srfi-4 representation can be more efficient in some cases, and less in other cases... The basic idea is that the vector is saved directly as the C vector, so memory is more efficient than plain Scheme values. For example, a floating point number in Scheme is (usually) a boxed object, so the machine representation is a pointer to the value. Here's a quick list of things that are relevant. * If you're dealing with external code a lot (for example, and interface to some algebra library), then you save a lot of translation overhead since the data is (usually) in a format that the external library can use as is. * However, if you're doing a lot of work *inside* Scheme, then things can become very inefficient. For example, say that you want to loop over a floating point array and multiply all of the values by a given factor. What will happen in this case is: each time you read a value, you allocate a Scheme object for the fp number, multiplying that allocates a new one, then saving it copies the result back to the array, leaving the two allocated values to be GCed. (There are some JIT-level optimizations for fp numbers, I don't know if it can save one of these allocations in this case.) So the bottom line is: using the srfi-4 representation can work well if you usually operate on the data as an opaque blob of values, and only get back the Scheme values at the end. * Another issue here is with mutation -- if the external call changes values, then the changes will be visible on the Scheme side with no further work. * However, you should be careful as usual with C code: - If you deal with a library that can allocate such a vector and hand it back to you -- then this memory will not be visible to the GC and will need an explicit `free'. - srfi-4 vectors are allocated as usual, which means that the 3m GC will move them around. This can be important if the C code might retain a pointer to such a vector -- when a later call to the C code is done, the block is likely to be in a different place, with the usual C response (segfault in the best case, complete mess in the worst case). * Another point to consider is huge arrays -- if you expect to have such arrays, then it might be better to do the allocation explicitly outside of the GC -- using `malloc' in 'raw mode. This will require registering finalizers to free them, but the benefits are: - You can have a huge array without worrying about the 3m GC that usually requires double the space that you're using. - Dealing with an external library that allocates an array becomes easy, since it's dealt with in the same way. - No issues with arrays moving around, for external code that keeps pointers to it. (I can imagine this being a real benefit if there are libraries that can use multiple cores and calling a callback function when the operation is done.) * Finally, it sounds like it might be more convenient to use the `cvector' representation from the foreign interface: this is very similar to the srfi-4 representation, except that the type is stored in the cvector rather than having a separate type for each kind of vector. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From m.douglas.williams at gmail.com Thu Aug 13 23:24:34 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Aug 13 23:24:54 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <19076.54013.636689.300854@winooski.ccs.neu.edu> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> Message-ID: Eli, Thanks for the info. It's all useful and I put some trivial comments in-line below. Doug * However, if you're doing a lot of work *inside* Scheme, then things > can become very inefficient. For example, say that you want to loop > over a floating point array and multiply all of the values by a > given factor. What will happen in this case is: each time you read > a value, you allocate a Scheme object for the fp number, multiplying > that allocates a new one, then saving it copies the result back to > the array, leaving the two allocated values to be GCed. (There are > some JIT-level optimizations for fp numbers, I don't know if it can > save one of these allocations in this case.) My plan would be to do the work inside of Scheme - at least for now. It would be interesting to see if there are some JIT optimizations planned for the future that could help. > * Another point to consider is huge arrays -- if you expect to have > such arrays, then it might be better to do the allocation explicitly > outside of the GC -- using `malloc' in 'raw mode. This will require > registering finalizers to free them, but the benefits are: > - You can have a huge array without worrying about the 3m GC that > usually requires double the space that you're using. > - Dealing with an external library that allocates an array becomes > easy, since it's dealt with in the same way. > - No issues with arrays moving around, for external code that keeps > pointers to it. (I can imagine this being a real benefit if there > are libraries that can use multiple cores and calling a callback > function when the operation is done.) Some applications would use large arrays. > * Finally, it sounds like it might be more convenient to use the > `cvector' representation from the foreign interface: this is very > similar to the srfi-4 representation, except that the type is stored > in the cvector rather than having a separate type for each kind of > vector. I'll look into it. I already wrote a typed-vector abstraction on top of SFRI 4 (and normal Scheme vectors), so that isn't an issue for now. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090813/63f3d780/attachment.html From robby at eecs.northwestern.edu Thu Aug 13 23:35:45 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Aug 13 23:36:07 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> Message-ID: <932b2f1f0908132035r345134b2g69f76dc60aa0b61f@mail.gmail.com> If you were careful to allocate these big blobs in special places, could you use the address itself as a tag (I think that's what the bebob collectors do) and avoid the extra boxing? Robby On Thu, Aug 13, 2009 at 10:24 PM, Doug Williams wrote: > Eli, > > Thanks for the info. It's all useful and I put some trivial comments in-line > below. > > Doug > >> * However, if you're doing a lot of work *inside* Scheme, then things >> ?can become very inefficient. ?For example, say that you want to loop >> ?over a floating point array and multiply all of the values by a >> ?given factor. ?What will happen in this case is: each time you read >> ?a value, you allocate a Scheme object for the fp number, multiplying >> ?that allocates a new one, then saving it copies the result back to >> ?the array, leaving the two allocated values to be GCed. ?(There are >> ?some JIT-level optimizations for fp numbers, I don't know if it can >> ?save one of these allocations in this case.) > > My plan would be to do the work inside of Scheme - at least for now. It > would be interesting to see if there are some JIT optimizations planned for > the future that could help. > >> >> * Another point to consider is huge arrays -- if you expect to have >> ?such arrays, then it might be better to do the allocation explicitly >> ?outside of the GC -- using `malloc' in 'raw mode. ?This will require >> ?registering finalizers to free them, but the benefits are: >> ?- You can have a huge array without worrying about the 3m GC that >> ? ?usually requires double the space that you're using. >> ?- Dealing with an external library that allocates an array becomes >> ? ?easy, since it's dealt with in the same way. >> ?- No issues with arrays moving around, for external code that keeps >> ? ?pointers to it. ?(I can imagine this being a real benefit if there >> ? ?are libraries that can use multiple cores and calling a callback >> ? ?function when the operation is done.) > > Some applications would use large arrays. > >> >> * Finally, it sounds like it might be more convenient to use the >> ?`cvector' representation from the foreign interface: this is very >> ?similar to the srfi-4 representation, except that the type is stored >> ?in the cvector rather than having a separate type for each kind of >> ?vector. > > I'll look into it. I already wrote a typed-vector abstraction on top of SFRI > 4 (and normal Scheme vectors), so that isn't an issue for now. > > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From m.douglas.williams at gmail.com Thu Aug 13 23:47:38 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Aug 13 23:48:03 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <932b2f1f0908132035r345134b2g69f76dc60aa0b61f@mail.gmail.com> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <932b2f1f0908132035r345134b2g69f76dc60aa0b61f@mail.gmail.com> Message-ID: Unfortunately, the automatic garbage collection is important because of the shared structure - slices, transposes, reshapes, etc. share the content vector with the parent. They should never be circular, so a reference count method might work. But, it may not worth it. At some point we would have to do the boxing to get results to/from Scheme code. On Thu, Aug 13, 2009 at 9:35 PM, Robby Findler wrote: > If you were careful to allocate these big blobs in special places, > could you use the address itself as a tag (I think that's what the > bebob collectors do) and avoid the extra boxing? > > Robby > > On Thu, Aug 13, 2009 at 10:24 PM, Doug > Williams wrote: > > Eli, > > > > Thanks for the info. It's all useful and I put some trivial comments > in-line > > below. > > > > Doug > > > >> * However, if you're doing a lot of work *inside* Scheme, then things > >> can become very inefficient. For example, say that you want to loop > >> over a floating point array and multiply all of the values by a > >> given factor. What will happen in this case is: each time you read > >> a value, you allocate a Scheme object for the fp number, multiplying > >> that allocates a new one, then saving it copies the result back to > >> the array, leaving the two allocated values to be GCed. (There are > >> some JIT-level optimizations for fp numbers, I don't know if it can > >> save one of these allocations in this case.) > > > > My plan would be to do the work inside of Scheme - at least for now. It > > would be interesting to see if there are some JIT optimizations planned > for > > the future that could help. > > > >> > >> * Another point to consider is huge arrays -- if you expect to have > >> such arrays, then it might be better to do the allocation explicitly > >> outside of the GC -- using `malloc' in 'raw mode. This will require > >> registering finalizers to free them, but the benefits are: > >> - You can have a huge array without worrying about the 3m GC that > >> usually requires double the space that you're using. > >> - Dealing with an external library that allocates an array becomes > >> easy, since it's dealt with in the same way. > >> - No issues with arrays moving around, for external code that keeps > >> pointers to it. (I can imagine this being a real benefit if there > >> are libraries that can use multiple cores and calling a callback > >> function when the operation is done.) > > > > Some applications would use large arrays. > > > >> > >> * Finally, it sounds like it might be more convenient to use the > >> `cvector' representation from the foreign interface: this is very > >> similar to the srfi-4 representation, except that the type is stored > >> in the cvector rather than having a separate type for each kind of > >> vector. > > > > I'll look into it. I already wrote a typed-vector abstraction on top of > SFRI > > 4 (and normal Scheme vectors), so that isn't an issue for now. > > > > > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090813/b216eca5/attachment.htm From eli at barzilay.org Thu Aug 13 23:50:40 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Aug 13 23:51:03 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> Message-ID: <19076.57104.529453.418733@winooski.ccs.neu.edu> On Aug 13, Doug Williams wrote: > >* However, if you're doing a lot of work *inside* Scheme, then > > things can become very inefficient. For example, say that you > > want to loop over a floating point array and multiply all of the > > values by a given factor. What will happen in this case is: each > > time you read a value, you allocate a Scheme object for the fp > > number, multiplying that allocates a new one, then saving it > > copies the result back to the array, leaving the two allocated > > values to be GCed. (There are some JIT-level optimizations for > > fp numbers, I don't know if it can save one of these allocations > > in this case.) > > My plan would be to do the work inside of Scheme - at least for > now. It would be interesting to see if there are some JIT > optimizations planned for the future that could help. In this case going with a Scheme vector will be faster. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From robby at eecs.northwestern.edu Thu Aug 13 23:52:09 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Aug 13 23:52:30 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <932b2f1f0908132035r345134b2g69f76dc60aa0b61f@mail.gmail.com> Message-ID: <932b2f1f0908132052s32368895taa1b039fb750ed62@mail.gmail.com> My question shouldn't be taken to mean that garbage collection would be avoided. It would be a way to avoid copying the floats in and out of the (current) mzscheme representation. Robby On Thu, Aug 13, 2009 at 10:47 PM, Doug Williams wrote: > Unfortunately, the automatic garbage collection is important because of the > shared structure - slices, transposes, reshapes, etc. share the content > vector with the parent. They should never be circular, so a reference count > method might work. But, it may not worth it. > > At some point we would have to do the boxing to get results to/from Scheme > code. > > On Thu, Aug 13, 2009 at 9:35 PM, Robby Findler > wrote: >> >> If you were careful to allocate these big blobs in special places, >> could you use the address itself as a tag (I think that's what the >> bebob collectors do) and avoid the extra boxing? >> >> Robby >> >> On Thu, Aug 13, 2009 at 10:24 PM, Doug >> Williams wrote: >> > Eli, >> > >> > Thanks for the info. It's all useful and I put some trivial comments >> > in-line >> > below. >> > >> > Doug >> > >> >> * However, if you're doing a lot of work *inside* Scheme, then things >> >> ?can become very inefficient. ?For example, say that you want to loop >> >> ?over a floating point array and multiply all of the values by a >> >> ?given factor. ?What will happen in this case is: each time you read >> >> ?a value, you allocate a Scheme object for the fp number, multiplying >> >> ?that allocates a new one, then saving it copies the result back to >> >> ?the array, leaving the two allocated values to be GCed. ?(There are >> >> ?some JIT-level optimizations for fp numbers, I don't know if it can >> >> ?save one of these allocations in this case.) >> > >> > My plan would be to do the work inside of Scheme - at least for now. It >> > would be interesting to see if there are some JIT optimizations planned >> > for >> > the future that could help. >> > >> >> >> >> * Another point to consider is huge arrays -- if you expect to have >> >> ?such arrays, then it might be better to do the allocation explicitly >> >> ?outside of the GC -- using `malloc' in 'raw mode. ?This will require >> >> ?registering finalizers to free them, but the benefits are: >> >> ?- You can have a huge array without worrying about the 3m GC that >> >> ? ?usually requires double the space that you're using. >> >> ?- Dealing with an external library that allocates an array becomes >> >> ? ?easy, since it's dealt with in the same way. >> >> ?- No issues with arrays moving around, for external code that keeps >> >> ? ?pointers to it. ?(I can imagine this being a real benefit if there >> >> ? ?are libraries that can use multiple cores and calling a callback >> >> ? ?function when the operation is done.) >> > >> > Some applications would use large arrays. >> > >> >> >> >> * Finally, it sounds like it might be more convenient to use the >> >> ?`cvector' representation from the foreign interface: this is very >> >> ?similar to the srfi-4 representation, except that the type is stored >> >> ?in the cvector rather than having a separate type for each kind of >> >> ?vector. >> > >> > I'll look into it. I already wrote a typed-vector abstraction on top of >> > SFRI >> > 4 (and normal Scheme vectors), so that isn't an issue for now. >> > >> > >> > >> > _________________________________________________ >> > ?For list-related administrative tasks: >> > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > >> > > > From m.douglas.williams at gmail.com Thu Aug 13 23:52:44 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Aug 13 23:53:06 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <19076.57104.529453.418733@winooski.ccs.neu.edu> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> Message-ID: That is the default. But, we want to user to be able to control the representation for numerical analysis reasons, too. So, we're allowing both. On Thu, Aug 13, 2009 at 9:50 PM, Eli Barzilay wrote: > On Aug 13, Doug Williams wrote: > > >* However, if you're doing a lot of work *inside* Scheme, then > > > things can become very inefficient. For example, say that you > > > want to loop over a floating point array and multiply all of the > > > values by a given factor. What will happen in this case is: each > > > time you read a value, you allocate a Scheme object for the fp > > > number, multiplying that allocates a new one, then saving it > > > copies the result back to the array, leaving the two allocated > > > values to be GCed. (There are some JIT-level optimizations for > > > fp numbers, I don't know if it can save one of these allocations > > > in this case.) > > > > My plan would be to do the work inside of Scheme - at least for > > now. It would be interesting to see if there are some JIT > > optimizations planned for the future that could help. > > In this case going with a Scheme vector will be faster. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://barzilay.org/ Maze is Life! > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090813/f946ad0d/attachment.html From eli at barzilay.org Thu Aug 13 23:55:02 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Aug 13 23:55:22 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> Message-ID: <19076.57366.179037.812730@winooski.ccs.neu.edu> On Aug 13, Doug Williams wrote: > That is the default. But, we want to user to be able to control the > representation for numerical analysis reasons, too. So, we're > allowing both. But if you don't use external libraries, then you're better off just checking the inputs, but use Scheme values directly. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From robby at eecs.northwestern.edu Fri Aug 14 00:01:01 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Aug 14 00:01:59 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <19076.57366.179037.812730@winooski.ccs.neu.edu> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> Message-ID: <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> I think Doug is saying that the user might want, say, 128 bits of precision in their floating point numbers and asking what to do if mzscheme's floats don't support that. (Or do mz's floats support all those different sizes?) Robby On Thu, Aug 13, 2009 at 10:55 PM, Eli Barzilay wrote: > On Aug 13, Doug Williams wrote: >> That is the default. But, we want to user to be able to control the >> representation for numerical analysis reasons, too. So, we're >> allowing both. > > But if you don't use external libraries, then you're better off just > checking the inputs, but use Scheme values directly. > > -- > ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ? ?http://barzilay.org/ ? ? ? ? ? ? ? ? ? Maze is Life! > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From eli at barzilay.org Fri Aug 14 00:06:00 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Aug 14 00:06:46 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: <19076.58024.447247.961806@winooski.ccs.neu.edu> On Aug 13, Robby Findler wrote: > I think Doug is saying that the user might want, say, 128 bits of > precision in their floating point numbers and asking what to do if > mzscheme's floats don't support that. (Or do mz's floats support all > those different sizes?) If the intention is to do the operations in Scheme, then you can't go with anything that mzscheme doesn't support. (For exmaple, you can't do 128-bit floating point arithmetics.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From m.douglas.williams at gmail.com Fri Aug 14 00:06:08 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 14 00:06:52 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: As far as I know, PLT Scheme currently does all of its calculations in double-precision. But, I can control the stored representation of the underlying representation now. It's that structure than can allow us to code efficient butterfly addressing for ffts, etc for the numerical analysis code. We can worry about compiler efficiency in the future. On Thu, Aug 13, 2009 at 10:01 PM, Robby Findler wrote: > I think Doug is saying that the user might want, say, 128 bits of > precision in their floating point numbers and asking what to do if > mzscheme's floats don't support that. (Or do mz's floats support all > those different sizes?) > > Robby > > On Thu, Aug 13, 2009 at 10:55 PM, Eli Barzilay wrote: > > On Aug 13, Doug Williams wrote: > >> That is the default. But, we want to user to be able to control the > >> representation for numerical analysis reasons, too. So, we're > >> allowing both. > > > > But if you don't use external libraries, then you're better off just > > checking the inputs, but use Scheme values directly. > > > > -- > > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > > http://barzilay.org/ Maze is Life! > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090813/09ed65c2/attachment.htm From m.douglas.williams at gmail.com Fri Aug 14 00:09:03 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 14 00:09:27 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: My hope would be that he we do some of this groundwork and get the semantics right, you could try for grants to fund the compiler speedups. On Thu, Aug 13, 2009 at 10:06 PM, Doug Williams < m.douglas.williams@gmail.com> wrote: > As far as I know, PLT Scheme currently does all of its calculations in > double-precision. But, I can control the stored representation of the > underlying representation now. It's that structure than can allow us to code > efficient butterfly addressing for ffts, etc for the numerical analysis > code. We can worry about compiler efficiency in the future. > > > On Thu, Aug 13, 2009 at 10:01 PM, Robby Findler < > robby@eecs.northwestern.edu> wrote: > >> I think Doug is saying that the user might want, say, 128 bits of >> precision in their floating point numbers and asking what to do if >> mzscheme's floats don't support that. (Or do mz's floats support all >> those different sizes?) >> >> Robby >> >> On Thu, Aug 13, 2009 at 10:55 PM, Eli Barzilay wrote: >> > On Aug 13, Doug Williams wrote: >> >> That is the default. But, we want to user to be able to control the >> >> representation for numerical analysis reasons, too. So, we're >> >> allowing both. >> > >> > But if you don't use external libraries, then you're better off just >> > checking the inputs, but use Scheme values directly. >> > >> > -- >> > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >> > http://barzilay.org/ Maze is Life! >> > _________________________________________________ >> > For list-related administrative tasks: >> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090813/3900d596/attachment.html From noelwelsh at gmail.com Fri Aug 14 04:38:04 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Aug 14 04:44:11 2009 Subject: [plt-scheme] DrScheme as alternative to Matlab In-Reply-To: <932b2f1f0908131343w284764ccr1ebad9f275984848@mail.gmail.com> References: <8badcf90-5039-4c36-96b9-949bbaf172af@t13g2000yqt.googlegroups.com> <932b2f1f0908131343w284764ccr1ebad9f275984848@mail.gmail.com> Message-ID: On Thu, Aug 13, 2009 at 9:43 PM, Robby Findler wrote: > As a related question: is there fft support for PLT Scheme somewhere? I've just added bindings for the GSL real FFT functions at: http://github.com/noelwelsh/mzgsl/tree/master Code is low-level/gsl-fft.ss. N. From noelwelsh at gmail.com Fri Aug 14 05:50:36 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Aug 14 05:51:00 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: On Fri, Aug 14, 2009 at 5:09 AM, Doug Williams wrote: > My hope would be that he we do some of this groundwork and get the semantics > right, you could try for grants to fund the compiler speedups. This is one hell of an interesting project. I noticed you have no array-set!, and I think this is good. I was going to write a long spiel about compiler technology, but if Matlab is fast enough with copy on write I'm sure Scheme will be. The current best example of a functional language w/ good numeric performance is SAC http://www.sac-home.org/ Stealing their array comprehensions (with loops) is probably a good idea. Alternatively the work in Haskell on nested data parallelism might provide some inspiration. N. From jpc-ml at zenburn.net Fri Aug 14 06:51:49 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Fri Aug 14 06:52:18 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: Message-ID: <4A8541C5.7040609@zenburn.net> Regarding efficient numeric computation the CorePy project [1] is quite interesting. For a start Noel Welsh has some nice sample code for generating x86 instruction streams dynamicaly [2]. Maybe such a specialised thing would be better than stuffing to much into the mzscheme JIT. As far as array indexing is concerned the NumPy matrix manipulation is quite nice but I find the multi-dimensional arrays to be difficult to grasp. OTOH it is just about next-column increment and next-row stride so you cannot use it to for example vectorize image algorithms operating on multiple image tiles (like 8x8 tiles of JPEG or image segmentation in DjVu). Specialized JITing of iterations would allow for doing more fancy algorithms without multiple-dimensions. [1]: http://www.corepy.org/ [2]: http://github.com/noelwelsh/assembler/tree/master -- regards, Jakub Piotr C?apa From m.douglas.williams at gmail.com Fri Aug 14 08:54:26 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 14 08:54:48 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: You give me more credit for forward thinking than I deserve. I was planning on having array-set!. I'm not sure how to avoid it at the primitive level - I just won't have enough information at the time I create the underlying vectors to make them immutable (and there are no immutable SRFI vectors that I'm aware of). Of course, that doesn't mean I have to expose the underlying vectors or array-set! in the interface. That would make them logically immutable, but not in a manner than helps the GC system, for example. On Fri, Aug 14, 2009 at 3:50 AM, Noel Welsh wrote: > On Fri, Aug 14, 2009 at 5:09 AM, Doug > Williams wrote: > > My hope would be that he we do some of this groundwork and get the > semantics > > right, you could try for grants to fund the compiler speedups. > > This is one hell of an interesting project. I noticed you have no > array-set!, and I think this is good. I was going to write a long > spiel about compiler technology, but if Matlab is fast enough with > copy on write I'm sure Scheme will be. > > The current best example of a functional language w/ good numeric > performance is SAC http://www.sac-home.org/ Stealing their array > comprehensions (with loops) is probably a good idea. Alternatively the > work in Haskell on nested data parallelism might provide some > inspiration. > > N. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090814/d32e3fa9/attachment.htm From m.douglas.williams at gmail.com Fri Aug 14 08:58:01 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 14 08:58:26 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <4A8541C5.7040609@zenburn.net> References: <4A8541C5.7040609@zenburn.net> Message-ID: My plan was to have (like NumPy) a subset that is optimized for for matrix (two-dimensional) operations. On Fri, Aug 14, 2009 at 4:51 AM, Jakub Piotr C?apa wrote: > Regarding efficient numeric computation the CorePy project [1] is quite > interesting. For a start Noel Welsh has some nice sample code for generating > x86 instruction streams dynamicaly [2]. Maybe such a specialised thing would > be better than stuffing to much into the mzscheme JIT. > > As far as array indexing is concerned the NumPy matrix manipulation is > quite nice but I find the multi-dimensional arrays to be difficult to grasp. > OTOH it is just about next-column increment and next-row stride so you > cannot use it to for example vectorize image algorithms operating on > multiple image tiles (like 8x8 tiles of JPEG or image segmentation in DjVu). > Specialized JITing of iterations would allow for doing more fancy algorithms > without multiple-dimensions. > > [1]: http://www.corepy.org/ > [2]: http://github.com/noelwelsh/assembler/tree/master > > -- > regards, > Jakub Piotr C?apa > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090814/03bdaf8f/attachment.html From noelwelsh at gmail.com Fri Aug 14 09:32:07 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Aug 14 09:32:27 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: Certainly there has to be mutation at some level. Immutability at the user's level means no arrays can alias. Given this a compiler can reorder array traversals to take advantage of the cache and multiple cores. This is, AFAIK, the key to high performance on modern machines, and the key optimisation SAC does on its comprehensions. OTOH it does require quite some compiler machinery to exploit. N. On Fri, Aug 14, 2009 at 1:54 PM, Doug Williams wrote: > You give me more credit for forward thinking than I deserve. I was planning > on having array-set!. I'm not sure how to avoid it at the primitive level - > I just won't have enough information at the time I create the underlying > vectors to make them immutable (and there are no immutable SRFI vectors that > I'm aware of). Of course, that doesn't mean I have to expose the underlying > vectors or array-set! in the interface. That would make them logically > immutable, but not in a manner than helps the GC system, for example. From m.douglas.williams at gmail.com Fri Aug 14 09:42:40 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 14 09:43:01 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: My philosophy at the moment is to provide the semantics we want to the user - for example, logical immutability, if that's what we want. So a user facing view with a reference implementation (that is useful) for the moment. Then, we'll work with the compile guys with a view towards efficiency. If the immutability is what we think will get us to that ultimate goal, then that's what the user view should encompass. There are other places (for example my inference collection rewrite) where I'm focusing on immutability with the hope of getting multicore benefits some time in the future. Doug On Fri, Aug 14, 2009 at 7:32 AM, Noel Welsh wrote: > Certainly there has to be mutation at some level. Immutability at the > user's level means no arrays can alias. Given this a compiler can > reorder array traversals to take advantage of the cache and multiple > cores. This is, AFAIK, the key to high performance on modern machines, > and the key optimisation SAC does on its comprehensions. OTOH it does > require quite some compiler machinery to exploit. > > N. > > On Fri, Aug 14, 2009 at 1:54 PM, Doug > Williams wrote: > > You give me more credit for forward thinking than I deserve. I was > planning > > on having array-set!. I'm not sure how to avoid it at the primitive level > - > > I just won't have enough information at the time I create the underlying > > vectors to make them immutable (and there are no immutable SRFI vectors > that > > I'm aware of). Of course, that doesn't mean I have to expose the > underlying > > vectors or array-set! in the interface. That would make them logically > > immutable, but not in a manner than helps the GC system, for example. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090814/9187bbd4/attachment.htm From mflatt at cs.utah.edu Fri Aug 14 09:48:23 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri Aug 14 09:48:46 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> Message-ID: <20090814134826.3780D6500AE@mail-svr1.cs.utah.edu> At Thu, 13 Aug 2009 21:24:34 -0600, Doug Williams wrote: > * However, if you're doing a lot of work *inside* Scheme, then things > > can become very inefficient. For example, say that you want to loop > > over a floating point array and multiply all of the values by a > > given factor. What will happen in this case is: each time you read > > a value, you allocate a Scheme object for the fp number, multiplying > > that allocates a new one, then saving it copies the result back to > > the array, leaving the two allocated values to be GCed. (There are > > some JIT-level optimizations for fp numbers, I don't know if it can > > save one of these allocations in this case.) My guess is that the GC-allocation issue is now not as important as the lack of inlining for SRFI-4 vector accesses and updates. It may be worthwhile to shift those operations into the core where the JIT can easily improve them. > My plan would be to do the work inside of Scheme - at least for now. It > would be interesting to see if there are some JIT optimizations planned for > the future that could help. As soon as I get enough time, I plan to finally experiment with unsafe operations, like `vector-ref', `car', and `fl+' that don't check their arguments. Longer term, I think we'll need better supprot for SRFI-4 vectors combined with some way of unboxing floating-point arithmetic. Those are very rough plans, I know. From eli at barzilay.org Fri Aug 14 10:29:34 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Aug 14 10:29:56 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <20090814134826.3780D6500AE@mail-svr1.cs.utah.edu> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <20090814134826.3780D6500AE@mail-svr1.cs.utah.edu> Message-ID: <19077.29902.704127.527151@winooski.ccs.neu.edu> On Aug 14, Matthew Flatt wrote: > > As soon as I get enough time, I plan to finally experiment with > unsafe operations, like `vector-ref', `car', and `fl+' that don't > check their arguments. > > Longer term, I think we'll need better supprot for SRFI-4 vectors > combined with some way of unboxing floating-point arithmetic. At least in its current form as just a library, I think that optimizing srfi-4 vectors seems rather arbitrary. But if you expose unsafe operations, then perhaps a better way for dealing with than adding the whole thing into the core would be to expose (in addition to operations like `fl+') referencing a floating point number directly from a given address? If this is also done for integers, then a whole bunch of things (the gzip code, md5sum, and other crypto-related functionality) can become very fast. But since this is now second-level speculation, I have no idea how that might look -- but maybe something like the pidigits benchmark with my ridiculous gmp hack? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From grettke at acm.org Fri Aug 14 10:58:32 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Aug 14 10:58:51 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: <756daca50908140758k5fce3381i268c337f22e3a0e1@mail.gmail.com> On Thu, Aug 13, 2009 at 11:06 PM, Doug Williams wrote: > As far as I know, PLT Scheme currently does all of its calculations in > double-precision. But, I can control the stored representation of the > underlying representation now. It's that structure than can allow us to code > efficient butterfly addressing for ffts, etc for the numerical analysis > code. We can worry about compiler efficiency in the future. What is butterfly addressing? There are some search results for it, but nothing obvious stands out. From m.douglas.williams at gmail.com Fri Aug 14 11:12:47 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 14 11:13:07 2009 Subject: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: <756daca50908140758k5fce3381i268c337f22e3a0e1@mail.gmail.com> References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> <756daca50908140758k5fce3381i268c337f22e3a0e1@mail.gmail.com> Message-ID: It's the addressing scheme that generates the successive indices for processing an array (typically a complex vector) when performing an fft. That's the only use I know of for it, but there may be others. On Fri, Aug 14, 2009 at 8:58 AM, Grant Rettke wrote: > On Thu, Aug 13, 2009 at 11:06 PM, Doug > Williams wrote: > > As far as I know, PLT Scheme currently does all of its calculations in > > double-precision. But, I can control the stored representation of the > > underlying representation now. It's that structure than can allow us to > code > > efficient butterfly addressing for ffts, etc for the numerical analysis > > code. We can worry about compiler efficiency in the future. > > What is butterfly addressing? > > There are some search results for it, but nothing obvious stands out. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090814/9ef5593f/attachment.html From lspector at hampshire.edu Fri Aug 14 11:15:24 2009 From: lspector at hampshire.edu (Lee Spector) Date: Fri Aug 14 11:20:46 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> Message-ID: On Aug 12, 2009, at 12:25 PM, Matthias Felleisen wrote: > > Here is a macro that computes with partial name? Is this good enough? This does indeed do what I asked, and has taught me something about PLT macros, but it raises a new issue relative to my actual problem: Is there a straightforward way to iteratively construct a PLT macro expansion? As I mentioned in one of my replies my goal here is to be able to loop over lists of items and perform definitions for each (defining names that are computed from each). To be more explicit, my code currently includes things like this, where pusher is a procedure that returns a procedure and exec, integer, float, etc. are types in my embedded language: --- (define exec.push (pusher 'exec)) (register-instruction 'exec.push) (define integer.push (pusher 'integer)) (register-instruction 'integer.push) (define float.push (pusher 'float)) (register-instruction 'float.push) (define code.push (pusher 'code)) (register-instruction 'code.push) (define boolean.push (pusher 'boolean)) (register-instruction 'boolean.push) --- Since I have to do this for lots of instructions (not just push), and potentially many more types, and since I'll sometimes want to exclude some of the instructions and/or types from particular runs, it'd be nicer to define a single a list of all the types (exec, integer, float, ...) and then define a particular instruction for all of those types by saying something like: (define-all-types 'push '(pusher type)) The code you sent me shows me how to produce a macro that expands into something like "(define exec.push ..." -- which was not obvious and I'm glad to know how to do that now -- but not how to perform an iteration in producing the expansion, which in this case should end up being something like "(begin (define exec.push (pusher 'exec)) (register-instruction 'exec.push) (define integer.push... " I made a couple of stabs at including iteration forms in the define- syntax call but all failed for one reason or another. Is there a way to do this that will work? I can easily construct the appropriate expansion as a list and pass it to eval, but then I still have the problem of how to "provide" the resulting computed names to another module. Of course I can also generate a source code file to be used in a manual second compilation, but that's not so nice. And of course I can also just type in the definitions manually for each type/instruction pair, which is probably what I'll do for now. Thanks, -Lee On Aug 12, 2009, at 12:25 PM, Matthias Felleisen wrote: > > On Aug 12, 2009, at 11:26 AM, Lee Spector wrote: > >> >> In fact I DO know partial-name at compile time, or at least at what >> should be compile time for the code that will call the resulting >> functions. That is, I'm not going to be doing things like taking >> input from the user that gets turned into function names. But I >> want to do some computation to produce the function names and >> definition bodies since these will be combinatorial products of >> lists of symbols. Is there a way to do this either using PLT macros >> or module instantiation phases? > > Here is a macro that computes with partial name? Is this good enough? > > > #lang scheme/load > > (module c scheme > (define partial-name "yours") > (provide partial-name)) > > > (module a scheme > (require (for-template 'c) (for-syntax 'c)) > > (define-syntax (def stx) > (syntax-case stx () > [(_ f x body ...) > (let* ([f:sym (syntax-e (syntax f))] > [my-f:str (string-append "my-" partial-name (number- > >string (string-length partial-name)) (symbol->string f:sym))] > [my-f:sym (string->symbol my-f:str)] > [my-f:id (datum->syntax stx my-f:sym)]) > (printf "~a\n" my-f:sym) > #`(define #,my-f:id (lambda (x) body ...)))])) > > (provide def)) > > (module b scheme > (require 'a) > > (def f x (sqrt x)) > > (printf "~a\n" (my-yours5f 4)) > > (def yours x (sqrt x)) > > (printf "~a\n" (my-yours5yours 4))) > > (require 'b) -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From matthias at ccs.neu.edu Fri Aug 14 11:44:42 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 14 11:45:07 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> Message-ID: <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> Will this help you along? #lang scheme (define-syntax (def-all stx) (syntax-case stx () [(_ type ...) #`(begin (begin (define type 1) (register-instruction 'type)) ...)])) (define (register-instruction x) x) (def-all exec float integer) From matthias at ccs.neu.edu Fri Aug 14 11:54:37 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 14 11:55:14 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> Message-ID: On second thought, this example is closer to what you need: (define-syntax (def-all stx) (syntax-case stx () [(_ type ...) (with-syntax ([(index ...) (build-list (length (syntax->list (syntax (type ...)))) add1)]) #`(begin (define-values (type ...) (values index ...)) (register-instruction 'type) ...))])) (define (register-instruction x) x) (def-all exec float integer) exec float integer On Aug 14, 2009, at 11:44 AM, Matthias Felleisen wrote: > > Will this help you along? > > #lang scheme > > (define-syntax (def-all stx) > (syntax-case stx () > [(_ type ...) > #`(begin (begin (define type 1) > (register-instruction 'type)) > ...)])) > > (define (register-instruction x) x) > > (def-all exec float integer) > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From lspector at hampshire.edu Fri Aug 14 15:10:12 2009 From: lspector at hampshire.edu (Lee Spector) Date: Fri Aug 14 15:23:40 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> Message-ID: That does help insofar as it tells me that the key to iteration in macro expansion (to use the CL terminology) seems to be the ellipsis, which is new to me and seems pretty interesting. I'll still have to figure out how to combine this with the symbol-merging code and figure out how to do this with the list of types defined separately... all of which is resisting my initial attempts, I guess because I still haven't wrapped my head around PLT syntax object concepts. Thanks again, -Lee On Aug 14, 2009, at 11:54 AM, Matthias Felleisen wrote: > > On second thought, this example is closer to what you need: > > (define-syntax (def-all stx) > (syntax-case stx () > [(_ type ...) > (with-syntax ([(index ...) (build-list (length (syntax->list > (syntax (type ...)))) add1)]) > #`(begin (define-values (type ...) (values index ...)) > (register-instruction 'type) > ...))])) > > (define (register-instruction x) x) > > (def-all exec float integer) > > exec float integer > > > > On Aug 14, 2009, at 11:44 AM, Matthias Felleisen wrote: > >> >> Will this help you along? >> >> #lang scheme >> >> (define-syntax (def-all stx) >> (syntax-case stx () >> [(_ type ...) >> #`(begin (begin (define type 1) >> (register-instruction 'type)) >> ...)])) >> >> (define (register-instruction x) x) >> >> (def-all exec float integer) >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From matthias at ccs.neu.edu Fri Aug 14 15:23:35 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 14 15:24:12 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> Message-ID: Replace the build-list code with the name-generating stuff that we discussed earlier (i.e., create a list of names such as exec.push and float.push etc) and replace (define-values (type ...) (values index ...)) with (define-values (index ...) (values type ...)) and your first concern is covered. (If push comes to shove, just use map/ car/cdr and friends to write the code -- just like in CL, but using syntax objects. Then you're done, too.) I don't understand the second one. On Aug 14, 2009, at 3:10 PM, Lee Spector wrote: > > That does help insofar as it tells me that the key to iteration in > macro expansion (to use the CL terminology) seems to be the > ellipsis, which is new to me and seems pretty interesting. I'll > still have to figure out how to combine this with the symbol- > merging code and figure out how to do this with the list of types > defined separately... all of which is resisting my initial > attempts, I guess because I still haven't wrapped my head around > PLT syntax object concepts. > > Thanks again, > > -Lee > > On Aug 14, 2009, at 11:54 AM, Matthias Felleisen wrote: > >> >> On second thought, this example is closer to what you need: >> >> (define-syntax (def-all stx) >> (syntax-case stx () >> [(_ type ...) >> (with-syntax ([(index ...) (build-list (length (syntax->list >> (syntax (type ...)))) add1)]) >> #`(begin (define-values (type ...) (values index ...)) >> (register-instruction 'type) >> ...))])) >> >> (define (register-instruction x) x) >> >> (def-all exec float integer) >> >> exec float integer >> >> >> >> On Aug 14, 2009, at 11:44 AM, Matthias Felleisen wrote: >> >>> >>> Will this help you along? >>> >>> #lang scheme >>> >>> (define-syntax (def-all stx) >>> (syntax-case stx () >>> [(_ type ...) >>> #`(begin (begin (define type 1) >>> (register-instruction 'type)) >>> ...)])) >>> >>> (define (register-instruction x) x) >>> >>> (def-all exec float integer) >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > From lspector at hampshire.edu Fri Aug 14 16:10:24 2009 From: lspector at hampshire.edu (Lee Spector) Date: Fri Aug 14 16:15:46 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> Message-ID: <7A24F99E-B1B8-4626-8209-9468A51077AF@hampshire.edu> Thanks Matthias. My second concern was that I don't want to provide all of the types in the call to def-all, as in your (def-all exec float integer), but rather have a definition elsewhere like: (define types '(exec float integer)) and then be able to make a call like (def-all 'push '(pusher type)) that expands into: (begin (define exec.push (pusher 'exec)) (register-instruction 'exec.push) (define float.push (pusher 'float)) (register-instruction 'float.push) The point of this exercise is to allow me to change the single list of types and have all of the def-all forms (of which there will be many) produce the right instructions for the new list of types. I have to confess, however, that I don't actually understand your response to the first issue. If I try to follow your advice literally, replacing the call to build-list with other list-generating code (like '(a b c)), and replacing (define-values (type ...) (values index ...)) with (define-values (index ...) (values type ...)) -- and leaving the rest of your code unchanged -- then I get "expand: unbound identifier in module in: exec". I'd love to use map/car/cdr (which are indeed my friends) to write the code "but using syntax objects" -- but I don't understand where/when the syntax objects come into play, how to refer to parts of matched patterns, etc. A lot of ignorance, I know :-(. -Lee On Aug 14, 2009, at 3:23 PM, Matthias Felleisen wrote: > > Replace the build-list code with the name-generating stuff that we > discussed earlier (i.e., create a list of names such as exec.push > and float.push etc) and replace (define-values (type ...) (values > index ...)) with (define-values (index ...) (values type ...)) and > your first concern is covered. (If push comes to shove, just use map/ > car/cdr and friends to write the code -- just like in CL, but using > syntax objects. Then you're done, too.) > > I don't understand the second one. > > > On Aug 14, 2009, at 3:10 PM, Lee Spector wrote: > >> >> That does help insofar as it tells me that the key to iteration in >> macro expansion (to use the CL terminology) seems to be the >> ellipsis, which is new to me and seems pretty interesting. I'll >> still have to figure out how to combine this with the symbol- >> merging code and figure out how to do this with the list of types >> defined separately... all of which is resisting my initial >> attempts, I guess because I still haven't wrapped my head around >> PLT syntax object concepts. >> >> Thanks again, >> >> -Lee >> >> On Aug 14, 2009, at 11:54 AM, Matthias Felleisen wrote: >> >>> >>> On second thought, this example is closer to what you need: >>> >>> (define-syntax (def-all stx) >>> (syntax-case stx () >>> [(_ type ...) >>> (with-syntax ([(index ...) (build-list (length (syntax->list >>> (syntax (type ...)))) add1)]) >>> #`(begin (define-values (type ...) (values index ...)) >>> (register-instruction 'type) >>> ...))])) >>> >>> (define (register-instruction x) x) >>> >>> (def-all exec float integer) >>> >>> exec float integer >>> >>> >>> >>> On Aug 14, 2009, at 11:44 AM, Matthias Felleisen wrote: >>> >>>> >>>> Will this help you along? >>>> >>>> #lang scheme >>>> >>>> (define-syntax (def-all stx) >>>> (syntax-case stx () >>>> [(_ type ...) >>>> #`(begin (begin (define type 1) >>>> (register-instruction 'type)) >>>> ...)])) >>>> >>>> (define (register-instruction x) x) >>>> >>>> (def-all exec float integer) >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> -- >> Lee Spector, Professor of Computer Science >> School of Cognitive Science, Hampshire College >> 893 West Street, Amherst, MA 01002-3359 >> lspector@hampshire.edu, http://hampshire.edu/lspector/ >> Phone: 413-559-5352, Fax: 413-559-5438 >> >> Check out Genetic Programming and Evolvable Machines: >> http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ >> -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From sbloch at adelphi.edu Fri Aug 14 20:34:53 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Fri Aug 14 20:35:20 2009 Subject: [BULK] Re: [plt-scheme] More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <19076.54013.636689.300854@winooski.ccs.neu.edu> <19076.57104.529453.418733@winooski.ccs.neu.edu> <19076.57366.179037.812730@winooski.ccs.neu.edu> <932b2f1f0908132101s19a3a457j4292310fd52da273@mail.gmail.com> Message-ID: <5B347A21-FB2C-4C0A-B230-62B0CC4B62B2@adelphi.edu> On Aug 14, 2009, at 8:54 AM, Doug Williams wrote: > You give me more credit for forward thinking than I deserve. I was > planning on having array-set!. I'm not sure how to avoid it at the > primitive level - I just won't have enough information at the time I > create the underlying vectors to make them immutable (and there are > no immutable SRFI vectors that I'm aware of). I've just been spectating on this thread, but would there be a way to use laziness to create vectors that are initially all-undefined but can have individual entries defined later, only once? Steve Bloch sbloch@adelphi.edu From matthias at ccs.neu.edu Fri Aug 14 21:45:14 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 14 21:45:46 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: <7A24F99E-B1B8-4626-8209-9468A51077AF@hampshire.edu> References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> <7A24F99E-B1B8-4626-8209-9468A51077AF@hampshire.edu> Message-ID: I don't know how to define the types first and then create the definitions w/o some mapping and whatever through syntax. BUT, when I have to do such things I actually define the list of types AND the 'instructions' at the same time: see below. (My one released instance that I can think of is the 'instruction set' for the Universe language, see collects/2htdp/universe.ss). -- Matthias #lang scheme (define register-instruction void) (define pusher void) (define-syntax (define-types stx) (syntax-case stx () [(_ name type ...) (let ([.exec (lambda (t) (define t:str (symbol->string (syntax-e t))) (define t.exec (string-append t:str ".exec")) (datum->syntax stx (string->symbol t.exec)))]) (with-syntax ([(index ...) (map .exec (syntax->list (syntax (type ...))))]) #`(begin (define name '(type ...)) (define-values (index ...) (values (pusher 'type) ...)) (register-instruction 'type) ...)))])) ;; --- let's "test" --- (define-types types* exec float integer) "we define the list of all types" types* "... and see these names are defined now" exec.exec float.exec integer.exec From lspector at hampshire.edu Fri Aug 14 22:15:42 2009 From: lspector at hampshire.edu (Lee Spector) Date: Fri Aug 14 22:21:06 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> <7A24F99E-B1B8-4626-8209-9468A51077AF@hampshire.edu> Message-ID: <9EAD3998-87FD-43F0-8D50-A3A83CDE99CA@hampshire.edu> That's an interesting approach -- quite different than what I had in mind. I don't mind having the list of types below the syntax definition, but in this formulation one has to modify the syntax definition to add/delete instructions. But you've given me the tools to work with and I see some things that I could try. Thanks, -Lee On Aug 14, 2009, at 9:45 PM, Matthias Felleisen wrote: > > I don't know how to define the types first and then create the > definitions w/o some mapping and whatever through syntax. BUT, when > I have to do such things I actually define the list of types AND the > 'instructions' at the same time: see below. (My one released > instance that I can think of is the 'instruction set' for the > Universe language, see collects/2htdp/universe.ss). > > -- Matthias > #lang scheme > > (define register-instruction void) > (define pusher void) > > (define-syntax (define-types stx) > (syntax-case stx () > [(_ name type ...) > (let ([.exec (lambda (t) > (define t:str (symbol->string (syntax-e t))) > (define t.exec (string-append t:str ".exec")) > (datum->syntax stx (string->symbol t.exec)))]) > (with-syntax ([(index ...) (map .exec (syntax->list (syntax > (type ...))))]) > #`(begin (define name '(type ...)) > (define-values (index ...) (values (pusher > 'type) ...)) > (register-instruction 'type) ...)))])) > > ;; --- let's "test" --- > > (define-types types* exec float integer) > > "we define the list of all types" > types* > > "... and see these names are defined now" > exec.exec > float.exec > integer.exec -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspector@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ From gremio at acm.org Sat Aug 15 00:15:57 2009 From: gremio at acm.org (Gregory Marton) Date: Sat Aug 15 00:16:24 2009 Subject: [plt-scheme] PLoT and legends Message-ID: Looking over the documentation at http://docs.plt-scheme.org/plot/ I see ways to mix several datasets on the same plot, which is wonderful, but no textual way to tell which is which. Is it possible to create a plot legend or key that associates the color/shape of each plot in a mix with a label? Another mystery is that mix* is mentioned in the second paragraph of section 1.2 but is never described anywhere (or mentioned again). What does it do? Does it still exist? > (require plot) > mix # > mix* . . reference to an identifier before its definition: mix* It would be cool if there were a mix* that let me label things. Thanks, Grem -- ------ __@ Gregory A. Marton http://csail.mit.edu/~gremio --- _`\<,_ 617-775-3005 -- (*)/ (*) Hiroshima '45, Tschernobyl '86, Windows '95. ~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~ From xscottg at gmail.com Sat Aug 15 00:23:05 2009 From: xscottg at gmail.com (Scott) Date: Sat Aug 15 00:35:08 2009 Subject: [plt-scheme] Re: More PLT Scheme as an Alternative to Matlab In-Reply-To: References: Message-ID: <4a6e4160-cb9c-4bcc-a4dc-280dad650c98@d15g2000prc.googlegroups.com> On Aug 13, 7:30 pm, Doug Williams wrote: > > I think the first thing we need to do is to define such a multidimensional > array representation for PLT Scheme. > I normally just lurk on this list (I'm only a novice with Scheme), but I figured I'd crawl out of hiding for this topic. (I tried to post a similar message last night but didn't realize I couldn't post through Google groups without being subscribed directly to the list.) First, let me say how great I think it would be to have a library like this. I've thought a lot about array libraries over the last few years, and I would love to have one for PLT Scheme. (All of that to say, "thank you, and please take all of my comments below as supportive of your goal!" :-) > > [...] arrays have an order, which may be 'row or 'column. > When you implement an array transpose for more than two dimensions (basically swapping two axes), and if you don't require a copy of the array, you can easily end up with arrays that are neither 'row nor 'column major. Similarly, you'll probably want to support striding or reversing an array without making a copy under the hood. For example, to pull out a sub-array, you might create a "take" operator like such: (take some-array #:start 3000 #:stop 1000 #:step -2) The actual syntax could be part of your array-ref function, and the actual parameters could be "to" and "from" and "by" etc.., but in any case the result will be a copy or it won't be either row or column major. Also note that a one dimensional array is *both* row and column major (Fortran and C will both be happy with it). Regardless, it's a straightforward predicate to determine if an array is row major or column major from its other details (shape, strides, and offset). (I mention zero dimensional arrays below, but whether a zero dimensional array is row major or not is probably a koan. :-) One thing that always frustrated me about NumPy is that you don't really know whether you've gotten a copy or a view for many operations. Sometimes it is safe to modify the copy, but other times you're trashing the original data in a view, and the same piece of code can do either based on runtime arguments to the function you're calling. I believe one correct thing to do is to implement copy-on- write for any shape changing operation, but that's trickier. Treating arrays as immutable is attractive (especially in a functional programming language), and an efficient implementation for that is probably even more complicated. Noel Welsh mentioned the SAC language, and it looks like they would be a good place from which to get ideas. Another frustrating thing in NumPy is the topic of zero-dimensional arrays (scalars) and how they integrate with the rest of the language and libraries. Does subscripting an N-dimensional array by N subscripts give you a Scheme numeric value, or a zero dimensional array? If it's a standard Scheme value, can you broadcast (or "new axis") a Scheme scalar value back to an array. Will it change it's type when you do this? Can you subscript with zero subscripts? It looks like this is also covered in the SAC language, and they seem to have a really nice way to do things, but to completely fit that way into Scheme might require that Scheme think of it's numeric values as zero dimensional arrays. A special PLT language could integrate arrays into the numeric tower, but that's probably not what you had in mind for your library. There is an unfortunate compromise to make in there somewhere. Similarly, when you do an element-wise multiplication of two arrays, you'll probably promote to a common super type (multiplying "signed 16 bit" by "32 bit floating point" should probably give you "32 bit floating point"). What should you promote to when you multiply an array by a Scheme scalar floating point or integer value? Will you support in-place multiplication, and will it give you the same type? There are lots of questions like that, and different people will give you different answers about the "right" way to do things... I have my own opinions, but they aren't more authoritative than any other. > > The types are object, u8, u16, u32, u64, s8, s16, s32, s64, f32, f64, c64, and c128. > In addition to the types you list above, I would personally benefit from complex integer formats. We use NumPy at work, and it is very inconvenient that we have to declare an N-by-2 array (translated to your syntax): (make-array (list N 2) #:type s16) When what we really want is a one dimensional array of N complex 16 bit integers: (make-array (list N) #:type cs16) If your library takes off, my guess is that someone will ask you for quaternions and arrays of structures (RGBA pixels for instance) too. :-) (As a silly style suggestion, I think you should call your complex floating point types cf32 and cf64 instead of c64 and c128.) I think other items will eventually crop up too... For instance, you'll probably want to be able to read data off disk or serialize it across a network. In this case, you'll need to keep track of the endianess. (Thankfully VAX floating point is mostly dead. :-) This thread has already started discussing how the memory for typed arrays could be handled specially with respect to the garbage collector. Someone will want to process huge arrays with memory mapped files (larger than can possibly fit in RAM). I think you'll find that eventually you want to implement your arrays on top of a generic "buffer of bytes" type like R6RS bytevectors. I sincerely hope that none of this discourages you! I just wanted to point out a few details I think you'll run into sooner or later. Maybe that will spare you some of the backwards compatibility baggage that other array libraries are stuck with. Cheers, -Scott From matthias at ccs.neu.edu Sat Aug 15 09:39:58 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Aug 15 09:42:48 2009 Subject: [plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names In-Reply-To: <9EAD3998-87FD-43F0-8D50-A3A83CDE99CA@hampshire.edu> References: <8DF1B7BD-F76A-48F6-8B7A-738B61F8FA73@ccs.neu.edu> <30557AA7-DD19-4E64-AA17-A64C9F5BC982@ccs.neu.edu> <2A1AD1A4-0B05-45A0-B5A6-857A687EAE01@ccs.neu.edu> <7321FA5A-19F3-4E98-B5DD-768626FA5356@ccs.neu.edu> <7A24F99E-B1B8-4626-8209-9468A51077AF@hampshire.edu> <9EAD3998-87FD-43F0-8D50-A3A83CDE99CA@hampshire.edu> Message-ID: <1D8C3BBC-F4D2-46EE-92D2-B3D92752AE46@ccs.neu.edu> On Aug 14, 2009, at 10:15 PM, Lee Spector wrote: > > That's an interesting approach -- quite different than what I had > in mind. I don't mind having the list of types below the syntax > definition, but in this formulation one has to modify the syntax > definition to add/delete instructions. But you've given me the > tools to work with and I see some things that I could try. Indeed, if you really need to add and delete types to the initial sets, it should be straightforward to create appropriate macros. > > Thanks, > > -Lee > > > On Aug 14, 2009, at 9:45 PM, Matthias Felleisen wrote: > >> >> I don't know how to define the types first and then create the >> definitions w/o some mapping and whatever through syntax. BUT, >> when I have to do such things I actually define the list of types >> AND the 'instructions' at the same time: see below. (My one >> released instance that I can think of is the 'instruction set' for >> the Universe language, see collects/2htdp/universe.ss). >> >> -- Matthias >> #lang scheme >> >> (define register-instruction void) >> (define pusher void) >> >> (define-syntax (define-types stx) >> (syntax-case stx () >> [(_ name type ...) >> (let ([.exec (lambda (t) >> (define t:str (symbol->string (syntax-e t))) >> (define t.exec (string-append t:str ".exec")) >> (datum->syntax stx (string->symbol t.exec)))]) >> (with-syntax ([(index ...) (map .exec (syntax->list (syntax >> (type ...))))]) >> #`(begin (define name '(type ...)) >> (define-values (index ...) (values (pusher >> 'type) ...)) >> (register-instruction 'type) ...)))])) >> >> ;; --- let's "test" --- >> >> (define-types types* exec float integer) >> >> "we define the list of all types" >> types* >> >> "... and see these names are defined now" >> exec.exec >> float.exec >> integer.exec > > -- > Lee Spector, Professor of Computer Science > School of Cognitive Science, Hampshire College > 893 West Street, Amherst, MA 01002-3359 > lspector@hampshire.edu, http://hampshire.edu/lspector/ > Phone: 413-559-5352, Fax: 413-559-5438 > > Check out Genetic Programming and Evolvable Machines: > http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Sat Aug 15 11:00:57 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Aug 15 11:01:37 2009 Subject: [plt-scheme] Re: More PLT Scheme as an Alternative to Matlab In-Reply-To: <4a6e4160-cb9c-4bcc-a4dc-280dad650c98@d15g2000prc.googlegroups.com> References: <4a6e4160-cb9c-4bcc-a4dc-280dad650c98@d15g2000prc.googlegroups.com> Message-ID: <323E6527-CDC8-4870-B169-99EF30678D13@ccs.neu.edu> On Aug 15, 2009, at 12:23 AM, Scott wrote: > Another frustrating thing in NumPy is the topic of zero-dimensional > arrays (scalars) and how they integrate with the rest of the language > and libraries. Does subscripting an N-dimensional array by N > subscripts give you a Scheme numeric value, or a zero dimensional > array? Would Scheme's 'values' philosophy help here? ;; --- In my experience, the development of array 'cultures' in languages is largely driven by applications and preemptive 'strikes' by language designers. PLT Scheme is about experimentation and having more than one language in play. ;; --- I know that people here keep pushing Scheme's functional nature. As much as I love to experiment with functional array languages (Fish, Sac, etc) I think it is fair to keep in mind that Scheme fundamentally accommodates imperative effects and that for arrays you may just have to bite the bullet -- Matthias From m.douglas.williams at gmail.com Sat Aug 15 12:14:36 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Aug 15 12:15:13 2009 Subject: [plt-scheme] Re: More PLT Scheme as an Alternative to Matlab In-Reply-To: <4a6e4160-cb9c-4bcc-a4dc-280dad650c98@d15g2000prc.googlegroups.com> References: <4a6e4160-cb9c-4bcc-a4dc-280dad650c98@d15g2000prc.googlegroups.com> Message-ID: > > I normally just lurk on this list (I'm only a novice with Scheme), but > I figured I'd crawl out of hiding for this topic. (I tried to post a > similar message last night but didn't realize I couldn't post through > Google groups without being subscribed directly to the list.) Thanks for joining in. > > > [...] arrays have an order, which may be 'row or 'column. > > > > When you implement an array transpose for more than two dimensions > (basically swapping two axes), and if you don't require a copy of the > array, you can easily end up with arrays that are neither 'row nor > 'column major. There are operations that require a copy and there is no way I know of around it. > Similarly, you'll probably want to support striding or reversing an > array without making a copy under the hood. For example, to pull out > a sub-array, you might create a "take" operator like such: > > (take some-array #:start 3000 #:stop 1000 #:step -2) > > The actual syntax could be part of your array-ref function, and the > actual parameters could be "to" and "from" and "by" etc.., but in any > case the result will be a copy or it won't be either row or column > major. Also note that a one dimensional array is *both* row and > column major (Fortran and C will both be happy with it). I was thinking a syntax like ( [ []]) do (array-ref some-array '((* * 3) 4)) would be the 5th column of every 4th row of some 2d array. I don't have a problem with negative steps. I'll have to play around and see what negative strides etc will work out, but I'm sure some copies may be required. Yes, for 1-dimensional arrays it doesn't matter what the order is - and it is its own transpose. One thing that always frustrated me about NumPy is that you don't > really know whether you've gotten a copy or a view for many > operations. Sometimes it is safe to modify the copy, but other times > you're trashing the original data in a view, and the same piece of > code can do either based on runtime arguments to the function you're > calling. I believe one correct thing to do is to implement copy-on- > write for any shape changing operation, but that's trickier. Treating > arrays as immutable is attractive (especially in a functional > programming language), and an efficient implementation for that is > probably even more complicated. Noel Welsh mentioned the SAC > language, and it looks like they would be a good place from which to > get ideas. I am leaning toward immutability, so it shouldn't matter if it is a copy or not. Another frustrating thing in NumPy is the topic of zero-dimensional > arrays (scalars) and how they integrate with the rest of the language > and libraries. Does subscripting an N-dimensional array by N > subscripts give you a Scheme numeric value, or a zero dimensional > array? If it's a standard Scheme value, can you broadcast (or "new > axis") a Scheme scalar value back to an array. Will it change it's > type when you do this? Can you subscript with zero subscripts? My current implementation has a schizophrenic array-ref, if a reference is fully qualified (i.e., values specified for all the dimensions), it returns a Scheme scalar value, otherwise it returns a new array object to the referenced subarray (slice). It subarray shares the parent array's data if possible, otherwise a new data vector is made for the subarray. I will use broadcasting - so a scalar can look like any shape array. It looks like this is also covered in the SAC language, and they seem > to have a really nice way to do things, but to completely fit that way > into Scheme might require that Scheme think of it's numeric values as > zero dimensional arrays. A special PLT language could integrate > arrays into the numeric tower, but that's probably not what you had in > mind for your library. There is an unfortunate compromise to make in > there somewhere. As a library, I can't control the Scheme side of things. [But, I've found the PLT Scheme implementators like to do the 'right thing' and they do listen.] So, comprimises at the boundary of the array collection and Scheme will be required. > > > > Similarly, when you do an element-wise multiplication of two arrays, > you'll probably promote to a common super type (multiplying "signed 16 > bit" by "32 bit floating point" should probably give you "32 bit > floating point"). What should you promote to when you multiply an > array by a Scheme scalar floating point or integer value? Will you > support in-place multiplication, and will it give you the same type? One of the comprimises I am making is that all computations will be done in native Scheme code using the Scheme numeric tower. I'll only coerce things at the array storage level. Indeed, the default array uses Scheme objects and the array library won't do any coercions at all. The operations don't even have to be numeric. > > > There are lots of questions like that, and different people will give > you different answers about the "right" way to do things... I have my > own opinions, but they aren't more authoritative than any other. Let's try shared authority and collaboration at this point. > > > > The types are object, u8, u16, u32, u64, s8, s16, s32, s64, f32, f64, > c64, and c128. > > > > In addition to the types you list above, I would personally benefit > from complex integer formats. We use NumPy at work, and it is very > inconvenient that we have to declare an N-by-2 array (translated to > your syntax): > > (make-array (list N 2) #:type s16) > > When what we really want is a one dimensional array of N complex 16 > bit integers: > > (make-array (list N) #:type cs16) Most of the type names above (and certainly the style of them) are from the SRFI 4 library. One of my next questions to the list was whether to keep this or use the C-vector style. I like this one for conciseness. I also like your suggestion below for cf32 and cf64 instead of c64 and c128. It does allow extending to things like cs32, for example. If your library takes off, my guess is that someone will ask you for > quaternions and arrays of structures (RGBA pixels for instance) > too. :-) I was already planning on quaternions (since I do a lot of simulation work). Of course you can have arrays of anything you want using object. We should make it extensible by exposing the vtype abstraction in a useful manner. (As a silly style suggestion, I think you should call your complex > floating point types cf32 and cf64 instead of c64 and c128.) I rather like this and will do that now. I think other items will eventually crop up too... For instance, > you'll probably want to be able to read data off disk or serialize it > across a network. In this case, you'll need to keep track of the > endianess. (Thankfully VAX floating point is mostly dead. :-) I'll probably extend the packed-binary package ( http://planet.plt-scheme.org/display.ss?package=packed-binary.plt&owner=williams) for that. This thread has already started discussing how the memory for typed > arrays could be handled specially with respect to the garbage > collector. Someone will want to process huge arrays with memory > mapped files (larger than can possibly fit in RAM). I think you'll > find that eventually you want to implement your arrays on top of a > generic "buffer of bytes" type like R6RS bytevectors. But, that is one for the future, I think. > I sincerely hope that none of this discourages you! I just wanted to > point out a few details I think you'll run into sooner or later. > Maybe that will spare you some of the backwards compatibility baggage > that other array libraries are stuck with. I was aware of most of them, but it helps having someone to keep me honest. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090815/7f0a6424/attachment.htm From m.douglas.williams at gmail.com Sat Aug 15 14:07:45 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Aug 15 14:08:08 2009 Subject: [plt-scheme] PLoT and legends In-Reply-To: References: Message-ID: > > Looking over the documentation at > http://docs.plt-scheme.org/plot/ > I see ways to mix several datasets on the same plot, which is wonderful, > but no textual way to tell which is which. Is it possible to create a plot > legend or key that associates the color/shape of each plot in a mix with a > label? Currently, I don't know of anyway to do it without writing a custom plot extension. The science collection ( http://planet.plt-scheme.org/display.ss?package=science.plt&owner=williams) has some extensions for histograms, etc if you want to look an example for writing your own. Another mystery is that mix* is mentioned in the second paragraph of section > 1.2 but is never described anywhere (or mentioned again). What does it do? > Does it still exist? > >> (require plot) >> mix >> > # > >> mix* >> > . . reference to an identifier before its definition: mix* I looked through the code and there is no mix* that I can see. I'm guessing that the functionality was merged into mix and the documentation was never changed. But, I don't know the history. I'll write a bug report on the documentation. > It would be cool if there were a mix* that let me label things. We really need more complete plot capability - there are many limitation of the current one that you'll run into. I've written some that I use in my own work, but the aren't documented, nor are the on PLaneT. It's something I'm hoping to get into Schemelab at some point. Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090815/50476d38/attachment.html From eli at barzilay.org Sat Aug 15 14:15:47 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Aug 15 14:16:11 2009 Subject: [plt-scheme] PLoT and legends In-Reply-To: References: Message-ID: <19078.64339.7855.147694@winooski.ccs.neu.edu> On Aug 15, Doug Williams wrote: > We really need more complete plot capability - there are many > limitation of the current one that you'll run into. I've written > some that I use in my own work, but the aren't documented, nor are > the on PLaneT. It's something I'm hoping to get into Schemelab at > some point. FWIW, there is no good reason to have it use an external library, since all of the plotting can be done within mred. The only C code that is needed is the curve fitting thing, and my guess is that even that would be simple for someone who remembers the math (I don't...). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From m.douglas.williams at gmail.com Sat Aug 15 15:55:09 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Aug 15 15:55:32 2009 Subject: [plt-scheme] PLoT and legends In-Reply-To: <19078.64339.7855.147694@winooski.ccs.neu.edu> References: <19078.64339.7855.147694@winooski.ccs.neu.edu> Message-ID: My own plot routines are all in Scheme with no external libraries. On Sat, Aug 15, 2009 at 12:15 PM, Eli Barzilay wrote: > On Aug 15, Doug Williams wrote: > > We really need more complete plot capability - there are many > > limitation of the current one that you'll run into. I've written > > some that I use in my own work, but the aren't documented, nor are > > the on PLaneT. It's something I'm hoping to get into Schemelab at > > some point. > > FWIW, there is no good reason to have it use an external library, > since all of the plotting can be done within mred. The only C code > that is needed is the curve fitting thing, and my guess is that even > that would be simple for someone who remembers the math (I don't...). > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://barzilay.org/ Maze is Life! > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090815/f10a8f16/attachment.htm From jmj at fellowhuman.com Sat Aug 15 18:25:31 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sat Aug 15 18:25:57 2009 Subject: [plt-scheme] Registering a new snip type Message-ID: <8CED7B36-BA8F-4DC1-B584-41A8D872BF55@fellowhuman.com> Hi all, I've been continuing my work on a snip to represent annotated code, and am now at the point of needing to integrate it with DrScheme. (I'd like to test it -- in conjunction with Stephen Bloch's "inventory" approach -- with one of my classes this fall.) I've got a brief (2min) demo online here: http://www.fellowhuman.com/scheme/anno-snip-demo.swf I'd like to do the following: 1) create an "Insert" menu item for inserting an empty annotated expression snip 2) create a "Scheme" menu item for annotating a chosen expression (as I do in the demo) 3) create similar items in the right-mouse-button context menu for the Definitions editor 4) ensure that it's evaluated as an ordinary expression in its place would be If someone could explain where I should be hooking in for these (or point me to docs I might be missing), I would appreciate it. So far, I've added my module to my copy of drscheme/private/eval.ss, and have been looking at drscheme/private/unit.ss, collects/xml/text- box.ss, and collects/framework/{scheme,comment-box}.ss as models. The snip code itself is attached. Many thanks, jmj -------------- next part -------------- A non-text attachment was scrubbed... Name: code-desc-snip.ss Type: application/octet-stream Size: 23282 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090815/b80ac77c/code-desc-snip-0001.obj -------------- next part -------------- From hendrik at topoi.pooq.com Sat Aug 15 18:23:33 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Sat Aug 15 18:44:53 2009 Subject: [plt-scheme] Re: More PLT Scheme as an Alternative to Matlab In-Reply-To: References: <4a6e4160-cb9c-4bcc-a4dc-280dad650c98@d15g2000prc.googlegroups.com> Message-ID: <20090815222333.GB25147@topoi.pooq.com> On Sat, Aug 15, 2009 at 10:14:36AM -0600, Doug Williams wrote: > > One thing that always frustrated me about NumPy is that you don't > > really know whether you've gotten a copy or a view for many > > operations. Sometimes it is safe to modify the copy, but other times > > you're trashing the original data in a view, and the same piece of > > code can do either based on runtime arguments to the function you're > > calling. I believe one correct thing to do is to implement copy-on- > > write for any shape changing operation, but that's trickier. Treating > > arrays as immutable is attractive (especially in a functional > > programming language), and an efficient implementation for that is > > probably even more complicated. Noel Welsh mentioned the SAC > > language, and it looks like they would be a good place from which to > > get ideas. > > > I am leaning toward immutability, so it shouldn't matter if it is a copy or > not. Algol 68 dealt with this problem by having different types for arrays and array variables. You could trim or slice array variables to get subarrays, and they were defined to share storage. You could trim or slice array values, and they wold be immutable, just like the arrays being sliced. Again, they could share storage, but since they were immutable, that would be an optimisation. There was room for considerable ingenuity in the compiler to avoid unnecessary copies when looking at a value obtained by dereferencing a variable. > > Another frustrating thing in NumPy is the topic of zero-dimensional > > arrays (scalars) and how they integrate with the rest of the language > > and libraries. Does subscripting an N-dimensional array by N > > subscripts give you a Scheme numeric value, or a zero dimensional > > array? If it's a standard Scheme value, can you broadcast (or "new > > axis") a Scheme scalar value back to an array. Will it change it's > > type when you do this? Can you subscript with zero subscripts? I suppose that's syntactically possible. Is it useful? Does it lead to simplifying generalisations? > > My current implementation has a schizophrenic array-ref, if a reference is > fully qualified (i.e., values specified for all the dimensions), it returns > a Scheme scalar value, otherwise it returns a new array object to the > referenced subarray (slice). It subarray shares the parent array's data if > possible, otherwise a new data vector is made for the subarray. I will use > broadcasting - so a scalar can look like any shape array. ... > As a library, I can't control the Scheme side of things. [But, I've found > the PLT Scheme implementators like to do the 'right thing' and they do > listen.] So, comprimises at the boundary of the array collection and Scheme > will be required. > > (As a silly style suggestion, I think you should call your complex > > floating point types cf32 and cf64 instead of c64 and c128.) There are mathematicians who do number theory with complex integers. They'd want the ci types. They'd probably want the unbounded versions of these, too. PL/I I'm told even implemented complex Sterling values, but that was probably going too far. Although imaginary money may make sense in the current economic climate, I suspect the mathematics isn't the right one. -- hendrik From sk at cs.brown.edu Sat Aug 15 21:36:48 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Aug 15 21:37:26 2009 Subject: [plt-scheme] tex2page Message-ID: Does anyone use tex2page to convert TeX strings to HTML strings? I would have expected the following to work, but it doesn't seem to. Definitions window: (module check (lib "plt-pretty-big.ss" "lang") (require (prefix t2p: (lib "tex2page-aux.ss" "tex2page"))) ) Interactions window: Welcome to DrScheme, version 4.2 [3m]. Language: Module; memory limit: 128 megabytes. > (define t t2p:tex2page-string) > (define t2 t2p:tex-string->html-string) > (t "") #t > (t " ") . . vector-ref: expects type as 1st argument, given: #f; other arguments were: 2 > (t2 "") "" > (t2 " ") . . vector-ref: expects type as 1st argument, given: #f; other arguments were: 2 > Thanks, Shriram From dherman at ccs.neu.edu Sat Aug 15 22:07:20 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Sat Aug 15 22:07:54 2009 Subject: [plt-scheme] tex2page In-Reply-To: References: Message-ID: <3D5F55B6-0722-4A7F-A037-040FC48010F2@ccs.neu.edu> This looks vaguely familiar. Is it possibly a (current-command-line- arguments) problem? Dave On Aug 15, 2009, at 9:36 PM, Shriram Krishnamurthi wrote: > Does anyone use tex2page to convert TeX strings to HTML strings? I > would have expected the following to work, but it doesn't seem to. > Definitions window: > > (module check (lib "plt-pretty-big.ss" "lang") > (require (prefix t2p: (lib "tex2page-aux.ss" "tex2page"))) > ) > > Interactions window: > > Welcome to DrScheme, version 4.2 [3m]. > Language: Module; memory limit: 128 megabytes. >> (define t t2p:tex2page-string) >> (define t2 t2p:tex-string->html-string) >> (t "") > #t >> (t " ") > . . vector-ref: expects type as 1st argument, given: #f; > other arguments were: 2 >> (t2 "") > "" >> (t2 " ") > . . vector-ref: expects type as 1st argument, given: #f; > other arguments were: 2 >> > > Thanks, > Shriram > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Sat Aug 15 22:14:47 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Aug 15 22:20:39 2009 Subject: [plt-scheme] tex2page In-Reply-To: <3D5F55B6-0722-4A7F-A037-040FC48010F2@ccs.neu.edu> References: <3D5F55B6-0722-4A7F-A037-040FC48010F2@ccs.neu.edu> Message-ID: Interesting hypothesis, but it USED to run entirely in string->string mode, and a quick glance through the code for several relevant names/keywords *suggests* this isn't the cause. Shriram From vengeance.storm at gmail.com Sat Aug 15 23:03:48 2009 From: vengeance.storm at gmail.com (Xingzhi Pan) Date: Sat Aug 15 23:04:11 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: <4A35BD92.6010806@neilvandyke.org> References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4A35AEF1.1090501@neilvandyke.org> <4A35BD92.6010806@neilvandyke.org> Message-ID: <841721380908152003p25116cchadd7389402286603@mail.gmail.com> A quick question to Shriram: I installed PLT 4.2.1 a few days ago and ran (require (planet plai/plai:1:3)). Then upon this code in the PLAI book, PLT fired an error saying "expand: unbound identifier in module in: num" (define (parse sexp) (cond [(number? sexp) (num sexp)] [(list? sexp) (case (first sexp) [(+) (add (parse (second sexp)) (parse (third sexp)))] [(-) (sub (parse (second sexp)) (parse (third sexp)))])])) Is the reader supposed to write num (and add/sub) to make everything work then? Thanks, Pan, Xingzhi 2009/6/15 Neil Van Dyke > Shriram Krishnamurthi wrote at 06/14/2009 10:54 PM: > >> >> Or perhaps the system should behave better? I think you have it backward. >> 128 Mb seems like perfectly enough memory to *install a package* (and build >> its docs). (I am actually surprised that this has *memory* problems, as >> opposed to being entirely i/o bound.) >> >> > It might just be that documentation-building could stand some more > optimization: > > http://list.cs.brown.edu/pipermail/plt-dev/2009-May/000933.html > > Or perhaps some PLaneT code is doing something like sucking a file into > memory. (Last year, I reimplemented some of the HTTP functionality to, > among other things, get rid of at least one place where big-file-sucking > happens, but I don't think that particular functionality is involved in > PLaneT installs.) > > -- > http://www.neilvandyke.org/ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090816/fb36ddf0/attachment.htm From eli at barzilay.org Sat Aug 15 23:12:24 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Aug 15 23:12:45 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: <841721380908152003p25116cchadd7389402286603@mail.gmail.com> References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4A35AEF1.1090501@neilvandyke.org> <4A35BD92.6010806@neilvandyke.org> <841721380908152003p25116cchadd7389402286603@mail.gmail.com> Message-ID: <19079.31000.176229.335746@winooski.ccs.neu.edu> On Aug 16, Xingzhi Pan wrote: > A quick question to Shriram: I installed PLT 4.2.1 a few days ago and ran > (require (planet plai/plai:1:3)). > > Then upon this code in the PLAI book, PLT fired an error saying "expand: > unbound identifier in module in: num" > > (define (parse sexp) > (cond > [(number? sexp) (num sexp)] > [(list? sexp) > (case (first sexp) > [(+) (add (parse (second sexp)) > (parse (third sexp)))] > [(-) (sub (parse (second sexp)) > (parse (third sexp)))])])) > > Is the reader supposed to write num (and add/sub) to make everything > work then? Yes -- you need to write the AE type definition, which defines `num' and the other constructors. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From robby at eecs.northwestern.edu Sat Aug 15 23:29:51 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Aug 15 23:30:15 2009 Subject: [plt-scheme] Registering a new snip type In-Reply-To: <8CED7B36-BA8F-4DC1-B584-41A8D872BF55@fellowhuman.com> References: <8CED7B36-BA8F-4DC1-B584-41A8D872BF55@fellowhuman.com> Message-ID: <932b2f1f0908152029j3b39788awf90ee6626b3bbe09@mail.gmail.com> On Sat, Aug 15, 2009 at 5:25 PM, Jordan Johnson wrote: > Hi all, > > I've been continuing my work on a snip to represent annotated code, and am > now at the point of needing to integrate it with DrScheme. ?(I'd like to > test it -- in conjunction with Stephen Bloch's "inventory" approach -- with > one of my classes this fall.) ?I've got a brief (2min) demo online here: > ? ? ? ?http://www.fellowhuman.com/scheme/anno-snip-demo.swf > > I'd like to do the following: For all of these, you need to create a tool that adds mixins to DrScheme. See the plugins manual for how to do this (and ask here if you get stuck). > ? ? ? ?1) create an "Insert" menu item for inserting an empty annotated > expression snip Use the "get-insert-menu" method to get the menu and add something to it. > ? ? ? ?2) create a "Scheme" menu item for annotating a chosen expression (as > I do in the demo) The get-language-menu method. > ? ? ? ?3) create similar items in the right-mouse-button context menu for > the Definitions editor See keymap:add-to-right-button-menu. > ? ? ? ?4) ensure that it's evaluated as an ordinary expression in its place > would be The snip needs to implement the readable-snip<%> interface. This is not drscheme, but mred level (ie, this will work outside of drscheme). Robby From lists.amitsaha at gmail.com Sun Aug 16 11:29:28 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Aug 16 11:29:59 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? Message-ID: <4A8825D8.60702@gmail.com> Hello all, After C/Java/Python, I have been exclusively using Scheme (plt-scheme) for my day-day programming fun. Now, I have started facing situations where I simply am not sure the correct way to do something in Scheme. The latest case was something like this: I needed to use a 'global' identifier in my program, where I had some procedures, couple of which needed R/W access respectively and I wanted the value to persist for the lifetime of the program- just the way it happens for variables you define at the topmost level in say, C. So, what I did in scheme is- I just defined using (define var 0) and used (set!..) to change value in one procedure and used the identifier name itself in some other procedure. For eg, (define var 0) (define (proc1) (set! var (+ 1 var))) ; some other procs ; in ; between ; (define (proc2) (display var)) But, I think this is not the way this should be done in Scheme, because global variables is just calling for trouble in large programs. At the same time, I am not sure how to achieve the same thing in a better way, if there is one.. PS: plt-scheme just has the necessary batteries to get started easily in Scheme :) Thanks a lot. Best Regards, Amit -- Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From neil at neilvandyke.org Sun Aug 16 11:37:35 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Aug 16 11:37:58 2009 Subject: [plt-scheme] HtmlPrag ported to PLT 4.x Message-ID: <4A8827BF.2070602@neilvandyke.org> HtmlPrag finally works with PLT 4.x. http://www.neilvandyke.org/htmlprag/ From tentaclius at gmail.com Sun Aug 16 11:54:16 2009 From: tentaclius at gmail.com (Anton Erdman) Date: Sun Aug 16 11:53:58 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: <4A8825D8.60702@gmail.com> References: <4A8825D8.60702@gmail.com> Message-ID: <20090816185416.2361e985@antnb.home> On Sun, 16 Aug 2009 20:59:28 +0530 Amit Saha wrote: > Hello all, > > After C/Java/Python, I have been exclusively using Scheme > (plt-scheme) for my day-day programming fun. Now, I have started > facing situations where I simply am not sure the correct way to do > something in Scheme. The latest case was something like this: > > I needed to use a 'global' identifier in my program, where I had some > procedures, couple of which needed R/W access respectively and I > wanted the value to persist for the lifetime of the program- just the > way it happens for variables you define at the topmost level in say, > C. > > So, what I did in scheme is- I just defined using (define var 0) and > used (set!..) to change value in one procedure and used the > identifier name itself in some other procedure. > > For eg, > > > > (define var 0) > > (define (proc1) (set! var (+ 1 var))) > > ; some other procs > ; in > ; between > ; > > (define (proc2) (display var)) > > > > But, I think this is not the way this should be done in Scheme, > because global variables is just calling for trouble in large > programs. At the same time, I am not sure how to achieve the same > thing in a better way, if there is one.. > > > PS: plt-scheme just has the necessary batteries to get started easily > in Scheme :) > > Thanks a lot. > > Best Regards, > Amit > I think, You can use modules or objects to isolate your global variable, as it may be done in C/C++. PLT-scheme has rich set of functions that work with namespaces. If it's what You have in mind. If the variable needs to be really global, than, I think, you wr Also You, probably, can use a function to isolate the variable, that manipulates the value in different ways like this: (define the-function (let ((the-variable 0)) (lambda (operation . values) (case operation ((set) (set! the-variable (car values))) ((display) (display the-variable)))))) (the-function 'display) ;; => 0 (the-function 'set 11) (the-function 'display) ;; => 11 I hope I understand you right way. From neil at neilvandyke.org Sun Aug 16 12:12:27 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Aug 16 12:12:50 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: <20090816185416.2361e985@antnb.home> References: <4A8825D8.60702@gmail.com> <20090816185416.2361e985@antnb.home> Message-ID: <4A882FEB.50603@neilvandyke.org> In addition to Anton's suggestions of hiding the variable, another option is to use a parameter: http://download.plt-scheme.org/doc/html/reference/parameters.html You might even wish to use a parameter *and* hide it. -- http://www.neilvandyke.org/ From matthias at ccs.neu.edu Sun Aug 16 12:22:03 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Aug 16 12:22:42 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: <4A8825D8.60702@gmail.com> References: <4A8825D8.60702@gmail.com> Message-ID: Use modules first to isolate globally mutable variables. (module A scheme (define var 0) ... (set! var (+ var 1)) ... (provide var++ ... ) ;; but not var ) (module B scheme (require "A.ss") (var++) ... (var++) ) On Aug 16, 2009, at 11:29 AM, Amit Saha wrote: > Hello all, > > After C/Java/Python, I have been exclusively using Scheme (plt- > scheme) for my day-day programming fun. Now, I have started facing > situations where I simply am not sure the correct way to do > something in Scheme. The latest case was something like this: > > I needed to use a 'global' identifier in my program, where I had > some procedures, couple of which needed R/W access respectively > and I wanted the value to persist for the lifetime of the program- > just the way it happens for variables you define at the topmost > level in say, C. > > So, what I did in scheme is- I just defined using (define var 0) > and used (set!..) to change value in one procedure and used the > identifier name itself in some other procedure. > > For eg, > > > > (define var 0) > > (define (proc1) (set! var (+ 1 var))) > > ; some other procs > ; in > ; between > ; > > (define (proc2) (display var)) > > > > But, I think this is not the way this should be done in Scheme, > because global variables is just calling for trouble in large > programs. At the same time, I am not sure how to achieve the same > thing in a better way, if there is one.. > > > PS: plt-scheme just has the necessary batteries to get started > easily in Scheme :) > > Thanks a lot. > > Best Regards, > Amit > > -- > Journal: http://amitksaha.wordpress.com > ?-blog: http://twitter.com/amitsaha > IRC: cornucopic on #scheme, #lisp, #math, #linux > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From lists.amitsaha at gmail.com Sun Aug 16 15:03:11 2009 From: lists.amitsaha at gmail.com (Amit Saha) Date: Sun Aug 16 15:03:40 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: <20090816185416.2361e985@antnb.home> References: <4A8825D8.60702@gmail.com> <20090816185416.2361e985@antnb.home> Message-ID: <4A8857EF.1060009@gmail.com> Anton Erdman wrote: > On Sun, 16 Aug 2009 20:59:28 +0530 > Amit Saha wrote: > >> Hello all, >> >> After C/Java/Python, I have been exclusively using Scheme >> (plt-scheme) for my day-day programming fun. Now, I have started >> facing situations where I simply am not sure the correct way to do >> something in Scheme. The latest case was something like this: >> >> I needed to use a 'global' identifier in my program, where I had some >> procedures, couple of which needed R/W access respectively and I >> wanted the value to persist for the lifetime of the program- just the >> way it happens for variables you define at the topmost level in say, >> C. >> >> So, what I did in scheme is- I just defined using (define var 0) and >> used (set!..) to change value in one procedure and used the >> identifier name itself in some other procedure. >> >> For eg, >> >> >> >> (define var 0) >> >> (define (proc1) (set! var (+ 1 var))) >> >> ; some other procs >> ; in >> ; between >> ; >> >> (define (proc2) (display var)) >> >> >> >> But, I think this is not the way this should be done in Scheme, >> because global variables is just calling for trouble in large >> programs. At the same time, I am not sure how to achieve the same >> thing in a better way, if there is one.. >> >> >> PS: plt-scheme just has the necessary batteries to get started easily >> in Scheme :) >> >> Thanks a lot. >> >> Best Regards, >> Amit >> > > I think, You can use modules or objects to isolate your global variable, > as it may be done in C/C++. PLT-scheme has rich set of functions > that work with namespaces. If it's what You have in mind. > > If the variable needs to be really global, than, I think, you wr > > Also You, probably, can use a function to isolate the variable, that > manipulates the value in different ways like this: > > > (define the-function > (let ((the-variable 0)) > (lambda (operation . values) > (case operation > ((set) (set! the-variable (car values))) > ((display) (display the-variable)))))) > > (the-function 'display) ;; => 0 > (the-function 'set 11) > (the-function 'display) ;; => 11 > > > I hope I understand you right way. For this particular use case I am faced with, your suggestion definitely works for me. I will need to put it to use and see how well it scales up generally. This looks like good abstraction. For now, Thanks a lot :) Best, Amit > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Journal: http://amitksaha.wordpress.com ?-blog: http://twitter.com/amitsaha IRC: cornucopic on #scheme, #lisp, #math, #linux From matthias at ccs.neu.edu Sun Aug 16 15:23:57 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Aug 16 15:24:26 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: <4A8857EF.1060009@gmail.com> References: <4A8825D8.60702@gmail.com> <20090816185416.2361e985@antnb.home> <4A8857EF.1060009@gmail.com> Message-ID: If you like this: On Aug 16, 2009, at 3:03 PM, Amit Saha wrote: >> (define the-function >> (let ((the-variable 0)) >> (lambda (operation . values) >> (case operation >> ((set) (set! the-variable (car values))) >> ((display) (display the-variable)))))) >> (the-function 'display) ;; => 0 >> (the-function 'set 11) >> (the-function 'display) ;; => 11 use classes instead: #lang scheme (define the-function% (class object% (init-field var) (define/public (var++) (set! var (+ var 1))) (define/public (display) (printf "~s\n" var)) (super-new))) (define the-function (new the-function% [var 0])) (send the-function display) ;; => 0 (send the-function var++) (send the-function display) ;; => 11 It really scales. -- Matthias From m.douglas.williams at gmail.com Sun Aug 16 17:56:37 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sun Aug 16 17:57:00 2009 Subject: [plt-scheme] Re: More PLT Scheme as an Alternative to Matlab In-Reply-To: References: Message-ID: I've got more of the multidimensional array code prototyped and I'll put it up on GitHub (http://github.com/DrDoug/numeric/tree/master). The interface elements are shown below: (provide object u8 u16 u32 u64 s8 s16 s32 s64 f32 f64 cf32 cf64) (provide/contract (vtype? (-> any/c boolean?)) (array? (-> any/c boolean?)) (array-shape (-> array? (listof exact-nonnegative-integer?))) (array-type (-> array? vtype?)) (array-order (-> array? (symbols 'row 'column))) (array-n-dim (-> array? exact-nonnegative-integer?)) (array-size (-> array? exact-nonnegative-integer?)) (describe-array (-> array? void?)) (make-array (->* ((listof exact-nonnegative-integer?)) (#:type (or/c vtype? symbol?) #:order (symbols 'row 'column) #:fill any/c) array?)) (build-array (->* ((listof exact-nonnegative-integer?) procedure?) (#:type (or/c vtype? symbol?) #:order (symbols 'row 'column)) array?)) (arange (->* (exact-nonnegative-integer?) (#:type (or/c vtype? symbol?) #:order (symbols 'row 'column)) array?)) (transpose (-> array? array?)) (reshape (-> array? (listof exact-nonnegative-integer?) array?)) (array-ref (->* (array?) () #:rest (listof exact-nonnegative-integer?) any/c)) (array-ref* (-> array? list? any/c)) (real (-> array? array?)) (imag (-> array? array?)) (array->list (-> array? list?)) (print-array (-> array? void?)) (list->array (->* (list?) (#:type (or/c vtype? symbol?) #:order (symbols 'row 'column)) array?))) This is prototype code only. It runs, but with limited error checking (although the contracts catch a lot of errors). I'm sure there are fragile areas. There are a couple of SRFIs dealing with arrays, but they aren't of the same ilk as what we're looking for here. But, this is somewhat of a superset of those and I should avoid being different just out of ignorance. Per Scott's suggestion, I have changed the named of the complex floats from c64 and C128 to cf32 and cf64. I have both array-ref and array-ref*. The difference is that array-ref* takes the index specification as a list of indices while array-ref takes the indices as parameters. So, (array-ref some-array i j) is equivalent to (array-ref* some-array (list i j)). I've found both to be convenient. I'm also open to alternatives. I've added slicing to array ref (and array-ref*). A slice specifies a subarray. So: if we define an array, a: (define a (reshape (arange 12) '(3 4))) ;; Creates a 3 x 4 array with a[0,0] = 0, a[0,1] = 1, ..., a[2.3] = 11 a = [[0 1 2 3] [4 5 6 7] [8 9 10 11]] then (array-ref* a '(0 1)) -> 1, while (array-ref* a '(* 3)) is the 4th column of a and is [3 7 11] and (array-ref* a '(1 *)) is the 2nd row of a and id [4 5 6 7]. An index can also specify indices as (start stop step). So, (array-ref a '(1 (1 * 2))) is every second column starting with index 1 of the first row of a and is [5 7]. Some examples of index ranges are: (1), which is equivalent to (1 * *), is index 1 through the last index with a step of 1 (the default) (1 4) is index 1 through 4 with a step of 1 (1 * 2) is index 1 through the last index with a step of 2. (* * 2) is every second index starting with 0 This is concise, but maybe not obvious. Also. it differs from the in-range sequence when maybe it should follow that. Some others might prefer a more verbose, but more readable alternative - maybe (#:start 1 #:step 2). Comments are welcome. So, array-ref can either return a scalar (if the indices are fully specified) or a subarray. There are a number of functions to construct arrays: make-array, build-array, arange, and list-> array. [With immutability, the primitive make-array isn't very useful.] The functions print-array and describe-array are quick-and-dirty implementations to support the prototyping effort. The functions like transpose, reshape, real, imag, and array-list show some of the typical functions we'll have to provide. --- I think it would be good to move this discussion off the general list - unless others want to keep it here. Github has a wiki we can use. It is set up automatically, but I've never used it and don't know how convenient it is. If anyone here has used it in the past let me know if you think it's a good place to move to. Also, I'll try to find time to update my Scheme blog with what I'm doing. As always, comments and suggestions are welcome. Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090816/26f637e0/attachment.html From namekuseijin at gmail.com Sun Aug 16 21:19:55 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Sun Aug 16 21:20:14 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: References: <4A8825D8.60702@gmail.com> <20090816185416.2361e985@antnb.home> <4A8857EF.1060009@gmail.com> Message-ID: <67d0527e0908161819w59c27839h9a9eb24647c22543@mail.gmail.com> On Sun, Aug 16, 2009 at 4:23 PM, Matthias Felleisen wrote: > > If you like this: > > On Aug 16, 2009, at 3:03 PM, Amit Saha wrote: > >>> (define the-function >>> (let ((the-variable 0)) >>> (lambda (operation . values) >>> (case operation >>> ((set) (set! the-variable (car values))) >>> ((display) (display the-variable)))))) >>> (the-function 'display) ;; => 0 >>> (the-function 'set 11) >>> (the-function 'display) ;; => 11 > > > use classes instead: > > It really scales. -- Matthias Except to other Schemes. The module solution is a good one. From beratn at gmail.com Sun Aug 16 21:53:49 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Sun Aug 16 21:54:14 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: <19079.31000.176229.335746@winooski.ccs.neu.edu> References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4A35AEF1.1090501@neilvandyke.org> <4A35BD92.6010806@neilvandyke.org> <841721380908152003p25116cchadd7389402286603@mail.gmail.com> <19079.31000.176229.335746@winooski.ccs.neu.edu> Message-ID: i tool same or similar error i dont remember whem try to debug.When you write (require blah..) it install programming and intepratation application.You can choose plai scheme from chhose language. On Sun, Aug 16, 2009 at 6:12 AM, Eli Barzilay wrote: > On Aug 16, Xingzhi Pan wrote: > > A quick question to Shriram: I installed PLT 4.2.1 a few days ago and ran > > (require (planet plai/plai:1:3)). > > > > Then upon this code in the PLAI book, PLT fired an error saying "expand: > > unbound identifier in module in: num" > > > > (define (parse sexp) > > (cond > > [(number? sexp) (num sexp)] > > [(list? sexp) > > (case (first sexp) > > [(+) (add (parse (second sexp)) > > (parse (third sexp)))] > > [(-) (sub (parse (second sexp)) > > (parse (third sexp)))])])) > > > > Is the reader supposed to write num (and add/sub) to make everything > > work then? > > Yes -- you need to write the AE type definition, which defines `num' > and the other constructors. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://barzilay.org/ Maze is Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090817/3eff1ffb/attachment.htm From sk at cs.brown.edu Sun Aug 16 21:55:10 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Aug 16 21:55:53 2009 Subject: [plt-scheme] Tip: installing PLAI Scheme in DrScheme 4.2 In-Reply-To: References: <4331ad810906141815y5abf1479g4faf9038f5a77bd3@mail.gmail.com> <4A35AEF1.1090501@neilvandyke.org> <4A35BD92.6010806@neilvandyke.org> <841721380908152003p25116cchadd7389402286603@mail.gmail.com> <19079.31000.176229.335746@winooski.ccs.neu.edu> Message-ID: No, this error is unrelated to the one you had. On Sun, Aug 16, 2009 at 9:53 PM, emre berat nebio?lu wrote: > i? tool same or similar error i dont remember whem try to debug.When you > write (require blah..) it install programming and intepratation > application.You can choose plai scheme from chhose language. > > On Sun, Aug 16, 2009 at 6:12 AM, Eli Barzilay wrote: >> >> On Aug 16, Xingzhi Pan wrote: >> > A quick question to Shriram: I installed PLT 4.2.1 a few days ago and >> > ran >> > (require (planet plai/plai:1:3)). >> > >> > Then upon this code in the PLAI book, PLT fired an error saying "expand: >> > unbound identifier in module in: num" >> > >> > (define (parse sexp) >> > ? (cond >> > ? ? [(number? sexp) (num sexp)] >> > ? ? [(list? sexp) >> > ? ? ?(case (first sexp) >> > ? ? ? ?[(+) (add (parse (second sexp)) >> > ? ? ? ? ? ? ? ? ?(parse (third sexp)))] >> > ? ? ? ?[(-) (sub (parse (second sexp)) >> > ? ? ? ? ? ? ? ? ?(parse (third sexp)))])])) >> > >> > Is the reader supposed to write num (and add/sub) to make everything >> > work then? >> >> Yes -- you need to write the AE type definition, which defines `num' >> and the other constructors. >> >> -- >> ? ? ? ? ?((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: >> ? ? ? ? ? ? ? ? ? ?http://barzilay.org/ ? ? ? ? ? ? ? ? ? Maze is Life! >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From alexshinn at gmail.com Sun Aug 16 22:29:30 2009 From: alexshinn at gmail.com (Alex Shinn) Date: Sun Aug 16 22:30:24 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: (Matthias Felleisen's message of "Sun\, 16 Aug 2009 15\:23\:57 -0400") References: <4A8825D8.60702@gmail.com> <20090816185416.2361e985@antnb.home> <4A8857EF.1060009@gmail.com> Message-ID: Matthias Felleisen writes: > use classes instead: > > #lang scheme > > (define the-function% > (class object% > (init-field var) > (define/public (var++) (set! var (+ var 1))) > (define/public (display) (printf "~s\n" var)) > (super-new))) > > (define the-function (new the-function% [var 0])) > (send the-function display) ;; => 0 > (send the-function var++) > (send the-function display) ;; => 11 > > > It really scales. But the class methods can only be defined statically inside the class (or its parents), right? How does that scale more than a traditional dispatch handler? -- Alex From jmj at fellowhuman.com Sun Aug 16 23:50:40 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sun Aug 16 23:51:04 2009 Subject: [plt-scheme] Registering a new snip type In-Reply-To: <932b2f1f0908152029j3b39788awf90ee6626b3bbe09@mail.gmail.com> References: <8CED7B36-BA8F-4DC1-B584-41A8D872BF55@fellowhuman.com> <932b2f1f0908152029j3b39788awf90ee6626b3bbe09@mail.gmail.com> Message-ID: <205D1407-BD21-4C39-93D1-7B5D753592AC@fellowhuman.com> Excellent -- this should give me enough to go on. Thanks, Robby. --jmj On Aug 15, 2009, at 8:29 PM, Robby Findler wrote: > On Sat, Aug 15, 2009 at 5:25 PM, Jordan Johnson > wrote: >> Hi all, >> >> I've been continuing my work on a snip to represent annotated code, >> and am >> now at the point of needing to integrate it with DrScheme. (I'd >> like to >> test it -- in conjunction with Stephen Bloch's "inventory" approach >> -- with >> one of my classes this fall.) I've got a brief (2min) demo online >> here: >> http://www.fellowhuman.com/scheme/anno-snip-demo.swf >> >> I'd like to do the following: > > For all of these, you need to create a tool that adds mixins to > DrScheme. See the plugins manual for how to do this (and ask here if > you get stuck). > >> 1) create an "Insert" menu item for inserting an empty >> annotated >> expression snip > > Use the "get-insert-menu" method to get the menu and add something > to it. > >> 2) create a "Scheme" menu item for annotating a chosen >> expression (as >> I do in the demo) > > The get-language-menu method. > >> 3) create similar items in the right-mouse-button context >> menu for >> the Definitions editor > > See keymap:add-to-right-button-menu. > >> 4) ensure that it's evaluated as an ordinary expression in >> its place >> would be > > The snip needs to implement the readable-snip<%> interface. This is > not drscheme, but mred level (ie, this will work outside of drscheme). > > Robby From jos.koot at telefonica.net Mon Aug 17 05:02:53 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Mon Aug 17 05:03:21 2009 Subject: [plt-scheme] FLIBUGmeeting reminder august 19 Message-ID: This is a reminder of the next meeting of FLIBUG: August 17 2009 at 7.30 PM Calle del Pi 3 Principal Interior (first floor) Barcelona Spain http://www.flibug.org Best wishes, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090817/19c53818/attachment.html From jos.koot at telefonica.net Mon Aug 17 05:07:48 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Mon Aug 17 05:08:17 2009 Subject: [plt-scheme] Fw: FLIBUG meeting reminder august 19 Message-ID: <133BF03D6681453CA9EF9E84684592FB@uw2b2dff239c4d> Sorry: correction: Wednesday August 19!!! This is a reminder of the next meeting of FLIBUG: August 19 2009 at 7.30 PM Calle del Pi 3 Principal Interior (first floor) Barcelona Spain http://www.flibug.org Best wishes, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090817/b27b017b/attachment.htm From noelwelsh at gmail.com Mon Aug 17 09:52:38 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Aug 17 09:53:00 2009 Subject: [plt-scheme] The Scheme way of: Using 'global' variables ? In-Reply-To: References: <4A8825D8.60702@gmail.com> <20090816185416.2361e985@antnb.home> <4A8857EF.1060009@gmail.com> Message-ID: On Mon, Aug 17, 2009 at 3:29 AM, Alex Shinn wrote: ... > But the class methods can only be defined statically inside > the class (or its parents), right? ?How does that scale more > than a traditional dispatch handler? Classes have more abstractions available (override, augment, mixins, etc.) N. From toddobryan at gmail.com Mon Aug 17 12:48:56 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Aug 17 12:49:20 2009 Subject: [plt-scheme] How to download/install a Planet file Message-ID: <904774730908170948g18a489cer6d5663e167b729@mail.gmail.com> I have a student who doesn't have internet and I'm trying to give her a CD with DrScheme and Stephen Bloch's tiles and sb-world teachpacks. I know there's an "Install PLT File..." menu item, but how do I download tiles.plt from Planet to put it on the CD? Thanks, Todd From grettke at acm.org Mon Aug 17 13:24:31 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Aug 17 13:24:50 2009 Subject: [plt-scheme] Is there a lot of overlap of teaching FP programming with types between HtDP and The Little MLer? Message-ID: <756daca50908171024r770676fuf032a2cc3d694c14@mail.gmail.com> Is there a lot of overlap of teaching FP programming with types between HtDP and The Little MLer? From noelwelsh at gmail.com Mon Aug 17 13:39:08 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Aug 17 13:39:36 2009 Subject: [plt-scheme] How to download/install a Planet file In-Reply-To: <904774730908170948g18a489cer6d5663e167b729@mail.gmail.com> References: <904774730908170948g18a489cer6d5663e167b729@mail.gmail.com> Message-ID: Use the planet command line tool: planet fetch http://docs.plt-scheme.org/planet/cmdline.html#%28part._fetch%29 N. (Also: no Internet o_O) On Mon, Aug 17, 2009 at 5:48 PM, Todd O'Bryan wrote: > I have a student who doesn't have internet and I'm trying to give her > a CD with DrScheme and Stephen Bloch's tiles and sb-world teachpacks. > > I know there's an "Install PLT File..." menu item, but how do I > download tiles.plt from Planet to put it on the CD? > > Thanks, > Todd From toddobryan at gmail.com Mon Aug 17 13:55:52 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Aug 17 13:56:14 2009 Subject: [plt-scheme] How to download/install a Planet file In-Reply-To: References: <904774730908170948g18a489cer6d5663e167b729@mail.gmail.com> Message-ID: <904774730908171055l436fae79m32ab592c63e2aa95@mail.gmail.com> Excellent! Stephen, will the student have to do anything special to get the teachpack to show up in the list? Todd On Mon, Aug 17, 2009 at 1:39 PM, Noel Welsh wrote: > Use the planet command line tool: > > ?planet fetch > > http://docs.plt-scheme.org/planet/cmdline.html#%28part._fetch%29 > > N. > > (Also: no Internet o_O) > > On Mon, Aug 17, 2009 at 5:48 PM, Todd O'Bryan wrote: >> I have a student who doesn't have internet and I'm trying to give her >> a CD with DrScheme and Stephen Bloch's tiles and sb-world teachpacks. >> >> I know there's an "Install PLT File..." menu item, but how do I >> download tiles.plt from Planet to put it on the CD? >> >> Thanks, >> Todd > From robby at eecs.northwestern.edu Mon Aug 17 14:43:03 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Aug 17 14:43:25 2009 Subject: [plt-scheme] How to download/install a Planet file In-Reply-To: <904774730908171055l436fae79m32ab592c63e2aa95@mail.gmail.com> References: <904774730908170948g18a489cer6d5663e167b729@mail.gmail.com> <904774730908171055l436fae79m32ab592c63e2aa95@mail.gmail.com> Message-ID: <932b2f1f0908171143sc476eb4me3af0fa8d4dc800f@mail.gmail.com> I think Stephen's teachpacks do that special stuff when the install. To put it another way: downloading the .plt file (as below) and then using drscheme's menu itme is equivalent to installing the file directly via the planet command-line tool. Robby On Mon, Aug 17, 2009 at 12:55 PM, Todd O'Bryan wrote: > Excellent! > > Stephen, will the student have to do anything special to get the > teachpack to show up in the list? > > Todd > > On Mon, Aug 17, 2009 at 1:39 PM, Noel Welsh wrote: >> Use the planet command line tool: >> >> ?planet fetch >> >> http://docs.plt-scheme.org/planet/cmdline.html#%28part._fetch%29 >> >> N. >> >> (Also: no Internet o_O) >> >> On Mon, Aug 17, 2009 at 5:48 PM, Todd O'Bryan wrote: >>> I have a student who doesn't have internet and I'm trying to give her >>> a CD with DrScheme and Stephen Bloch's tiles and sb-world teachpacks. >>> >>> I know there's an "Install PLT File..." menu item, but how do I >>> download tiles.plt from Planet to put it on the CD? >>> >>> Thanks, >>> Todd >> > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Mon Aug 17 14:43:04 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Aug 17 14:44:31 2009 Subject: [plt-scheme] Is there a lot of overlap of teaching FP programming with types between HtDP and The Little MLer? In-Reply-To: <756daca50908171024r770676fuf032a2cc3d694c14@mail.gmail.com> References: <756daca50908171024r770676fuf032a2cc3d694c14@mail.gmail.com> Message-ID: <98EB10C9-444D-4C6F-85EB-6D522B2767CC@ccs.neu.edu> Yes. The types in TML are explicit. Plus it gets you to types at the module level. On Aug 17, 2009, at 1:24 PM, Grant Rettke wrote: > Is there a lot of overlap of teaching FP programming with types > between HtDP and The Little MLer? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sbloch at adelphi.edu Mon Aug 17 20:54:26 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Aug 17 20:54:52 2009 Subject: [plt-scheme] How to download/install a Planet file In-Reply-To: <904774730908171055l436fae79m32ab592c63e2aa95@mail.gmail.com> References: <904774730908170948g18a489cer6d5663e167b729@mail.gmail.com> <904774730908171055l436fae79m32ab592c63e2aa95@mail.gmail.com> Message-ID: <379663F7-E5ED-4F7C-A204-3462F87337FA@adelphi.edu> On Aug 17, 2009, Todd O'Bryan wrote: > I have a student who doesn't have internet and I'm trying to give her > a CD with DrScheme and Stephen Bloch's tiles and sb-world teachpacks. > > I know there's an "Install PLT File..." menu item, but how do I > download tiles.plt from Planet to put it on the CD? > Stephen, will the student have to do anything special to get the > teachpack to show up in the list? Here are two possible ways to do it. One approach: 1) planet fetch sbloch tiles.plt 1 13 [and similarly with sb- world.plt 1 5] This downloads the .plt file into the current directory. 2) Copy the two .plt files and the DrScheme installer onto the CD. Give the CD to your student. Subsequent steps are to be done by your student on his/her home computer. 3) Run the DrScheme installer. 4) cd to the directory where the .plt files are (either on the CD, or copy them to the hard disk first). 5) planet fileinject sbloch tiles.plt 1 13 [and similarly with sb- world.plt 1 5] This will unpack the .plt file, compile its Scheme source to .zos, and re-index the help files to include the documentation for the package. The help re-indexing may take several minutes. 6) Find where each of the .plt files was unpacked and run its "install.ss" file (e.g. by double-clicking to open it in DrScheme, then clicking "Run"). On my Mac, they live in ~/Library/PLT Scheme/planet/300/4.2.1/sbloch/tiles.plt/1/13/ and ~/Library/PLT Scheme/planet/300/4.2.1/sbloch/sb-world.plt/1/5/ respectively. I don't remember where they are on Windows or Linux. Each of the two "install.ss" files should print a message in the Interactions pane that says "Wrote file to installed-teachpacks directory." 7) DrScheme's Language->Add Teachpack dialogue should now show the two teachpacks in question, and the Help Desk should include documentation for the functions in the teachpacks. 8) If you wish, you can delete the two .plt files, and even the install.ss files. Alternative approach (requires that you have the same kind of computer as your student has, but is less work for your student). 1) follow the "require" instructions in chapter 1 of my book, on a computer with the same operating system as your student's. It may take several minutes to re-index help files. 2) Then copy the DrScheme installer from wherever it is, and the user- specific add-ons directory (from ~/Library/PLT Scheme or I-don't- remember-where-on-Windows), onto the CD. Give the CD to your student. Subsequent steps to be done by your student on his/her home computer. 3) Run the DrScheme installer. 4) Copy the add-ons directory from the CD into wherever it's supposed to be. (Presumably you tell your student where it belongs.) 5) Run DrScheme, and the Language->Add Teachpack dialogue should now show the two teachpacks in question, and the Help Desk should include documentation for the functions in the teachpacks. Let me know if you have trouble with this. Stephen Bloch sbloch@adelphi.edu From toddobryan at gmail.com Mon Aug 17 20:57:09 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Aug 17 20:57:30 2009 Subject: [plt-scheme] How to download/install a Planet file In-Reply-To: <379663F7-E5ED-4F7C-A204-3462F87337FA@adelphi.edu> References: <904774730908170948g18a489cer6d5663e167b729@mail.gmail.com> <904774730908171055l436fae79m32ab592c63e2aa95@mail.gmail.com> <379663F7-E5ED-4F7C-A204-3462F87337FA@adelphi.edu> Message-ID: <904774730908171757qfe2dd9bifceb1029a6d0ccea@mail.gmail.com> Thanks! On Mon, Aug 17, 2009 at 8:54 PM, Stephen Bloch wrote: > > On Aug 17, 2009, Todd O'Bryan wrote: > >> I have a student who doesn't have internet and I'm trying to give her >> a CD with DrScheme and Stephen Bloch's tiles and sb-world teachpacks. >> >> I know there's an "Install PLT File..." menu item, but how do I >> download tiles.plt from Planet to put it on the CD? > >> Stephen, will the student have to do anything special to get the >> teachpack to show up in the list? > > Here are two possible ways to do it. ?One approach: > > 1) planet fetch sbloch tiles.plt 1 13 ? ?[and similarly with sb-world.plt 1 > 5] > This downloads the .plt file into the current directory. > > 2) Copy the two .plt files and the DrScheme installer onto the CD. ?Give the > CD to your student. > > Subsequent steps are to be done by your student on his/her home computer. > > 3) Run the DrScheme installer. > > 4) cd to the directory where the .plt files are (either on the CD, or copy > them to the hard disk first). > > 5) planet fileinject sbloch tiles.plt 1 13 [and similarly with sb-world.plt > 1 5] > This will unpack the .plt file, compile its Scheme source to .zos, and > re-index the help files to include the documentation for the package. ?The > help re-indexing may take several minutes. > > 6) Find where each of the .plt files was unpacked and run its "install.ss" > file (e.g. by double-clicking to open it in DrScheme, then clicking "Run"). > ?On my Mac, they live in > > ~/Library/PLT Scheme/planet/300/4.2.1/sbloch/tiles.plt/1/13/ > and > ~/Library/PLT Scheme/planet/300/4.2.1/sbloch/sb-world.plt/1/5/ > respectively. ?I don't remember where they are on Windows or Linux. > Each of the two "install.ss" files should print a message in the > Interactions pane that says "Wrote file to installed-teachpacks directory." > > 7) DrScheme's Language->Add Teachpack dialogue should now show the two > teachpacks in question, and the Help Desk should include documentation for > the functions in the teachpacks. > > 8) If you wish, you can delete the two .plt files, and even the install.ss > files. > > > Alternative approach (requires that you have the same kind of computer as > your student has, but is less work for your student). > > 1) follow the "require" instructions in chapter 1 of my book, on a computer > with the same operating system as your student's. ?It may take several > minutes to re-index help files. > > 2) Then copy the DrScheme installer from wherever it is, and the > user-specific add-ons directory (from ~/Library/PLT Scheme or > I-don't-remember-where-on-Windows), onto the CD. ?Give the CD to your > student. > > Subsequent steps to be done by your student on his/her home computer. > > 3) Run the DrScheme installer. > > 4) Copy the add-ons directory from the CD into wherever it's supposed to be. > ?(Presumably you tell your student where it belongs.) > > 5) Run DrScheme, and the Language->Add Teachpack dialogue should now show > the two teachpacks in question, and the Help Desk should include > documentation for the functions in the teachpacks. > > Let me know if you have trouble with this. > > Stephen Bloch > sbloch@adelphi.edu > From yinso.chen at gmail.com Mon Aug 17 21:15:33 2009 From: yinso.chen at gmail.com (YC) Date: Mon Aug 17 21:15:57 2009 Subject: [plt-scheme] ANN: SHP.plt - a PHP-like web framework for PLT Scheme Message-ID: <779bf2730908171815x566d1f43gc5396dc4c086d86@mail.gmail.com> Hi all - SHP 0.1 is now available through planet. It is a PHP-like web framework for PLT Scheme, created mainly to utilize the style of rapid UI prototyping, as well as taking advantage of all capabilities PLT Scheme has to offer. You can download it via planet (require (planet bzlib/shp:1:0)) It includes an example site that you can play with to get the idea. And you can find the documentation and tutorial at http://weblambda.blogspot.com/2009/08/introducing-shp-01-sheme-hypertext.html, as well as links to other entries that more or less chronicles the development process. As usual for first release, you might find bugs and other issues with the package, so please let me know if you encounter any such issues. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090817/974cfd11/attachment.htm From eeepc904 at gmail.com Sun Aug 16 14:03:44 2009 From: eeepc904 at gmail.com (Nathan Campos) Date: Tue Aug 18 10:27:33 2009 Subject: [plt-scheme] PLT Scheme Forum Message-ID: <4f47d947-c7e8-4c74-bbd3-6d6e3ff433e0@d4g2000yqa.googlegroups.com> Hello, I'm a Java developer, but about some days i'm learning PLT Scheme language, but i haven't found any forum of this language, then i've created one for some discussions about this very flexible language. I like email groups, but i'm so much familiar with forums, then this is for those who like forums. Please create an account there, let's discuss there too. Here is the link for the forum: http://z6.invisionfree.com/Scheme Thanks, Nathan Paulino Campos From eeepc904 at gmail.com Sun Aug 16 20:32:04 2009 From: eeepc904 at gmail.com (Nathan Campos) Date: Tue Aug 18 10:27:41 2009 Subject: [plt-scheme] Starting Guide Message-ID: <55185a9b-cff6-4405-a779-4e0850ea302b@r18g2000yqd.googlegroups.com> Hello, I'm really starting in PLT Scheme language, but i want some free resources for start. Remember that i'm already a Java developer. Thanks, Nathan Paulino Campos From jay.mccarthy at gmail.com Tue Aug 18 10:30:29 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Aug 18 10:30:51 2009 Subject: [plt-scheme] Starting Guide In-Reply-To: <55185a9b-cff6-4405-a779-4e0850ea302b@r18g2000yqd.googlegroups.com> References: <55185a9b-cff6-4405-a779-4e0850ea302b@r18g2000yqd.googlegroups.com> Message-ID: I suggest looking at the documentation that is online and that ships with PLT Scheme. The online version is: http://docs.plt-scheme.org/ At the top of the page you will find 3 tutorials and 1 guide about starting out in PLT Scheme. Jay On Sun, Aug 16, 2009 at 6:32 PM, Nathan Campos wrote: > Hello, > ?I'm really starting in PLT Scheme language, but i want some free > resources for start. Remember that i'm already a Java developer. > Thanks, > ?Nathan Paulino Campos > _________________________________________________ > ?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 grettke at acm.org Tue Aug 18 10:43:35 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Aug 18 11:12:26 2009 Subject: [plt-scheme] PLT Scheme Forum In-Reply-To: <4f47d947-c7e8-4c74-bbd3-6d6e3ff433e0@d4g2000yqa.googlegroups.com> References: <4f47d947-c7e8-4c74-bbd3-6d6e3ff433e0@d4g2000yqa.googlegroups.com> Message-ID: <756daca50908180743m747ff8aei4b2f58224b900fbf@mail.gmail.com> On Sun, Aug 16, 2009 at 1:03 PM, Nathan Campos wrote: > Hello, > ?I'm a Java developer, but about some days i'm learning PLT Scheme > language, but i haven't found any forum of this language, then i've > created one for some discussions about this very flexible language. I > like email groups, but i'm so much familiar with forums, then this is > for those who like forums. You can browse this group via the Google Groups interface here: http://groups.google.com/group/plt-scheme?lnk=srg This is a mirror of the PLT Scheme mailing list; so you can not post from it. From eli at barzilay.org Tue Aug 18 11:21:59 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Aug 18 11:22:22 2009 Subject: [plt-scheme] PLT Scheme Forum In-Reply-To: <756daca50908180743m747ff8aei4b2f58224b900fbf@mail.gmail.com> References: <4f47d947-c7e8-4c74-bbd3-6d6e3ff433e0@d4g2000yqa.googlegroups.com> <756daca50908180743m747ff8aei4b2f58224b900fbf@mail.gmail.com> Message-ID: <19082.50967.266079.138049@winooski.ccs.neu.edu> On Aug 18, Grant Rettke wrote: > On Sun, Aug 16, 2009 at 1:03 PM, Nathan Campos wrote: > > Hello, > > ?I'm a Java developer, but about some days i'm learning PLT Scheme > > language, but i haven't found any forum of this language, then > > i've created one for some discussions about this very flexible > > language. I like email groups, but i'm so much familiar with > > forums, then this is for those who like forums. > > You can browse this group via the Google Groups interface here: > > http://groups.google.com/group/plt-scheme?lnk=srg > > This is a mirror of the PLT Scheme mailing list; so you can not post > from it. You can post from it if you're subscribed to the list. To do this, mailman has a "no mail" option. So, if you set this option you get no emails from the list, but you can still post to the list. Note also that there is a Gmane mirror: http://blog.gmane.org/gmane.lisp.scheme.plt which is much more flexible than the google groups (you can see the messages in a threaded interface or a flat blog-like interface in multiple styles *or* use an nntp client), and you can also post to the list without being subscribed to it. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From ebellani at gmail.com Tue Aug 18 12:54:49 2009 From: ebellani at gmail.com (ebellani@gmail.com) Date: Tue Aug 18 13:01:49 2009 Subject: [plt-scheme] Starting Guide Message-ID: http://www.htdp.org/ would be cool too. If you're already a programmer, you could try out Matthias' advice: http://groups.google.com/group/plt-scheme/msg/167c9643e187d265 Hugs -- Eduardo Bellani www.cnxs.com.br Someone once called me "just a dreamer" That offended me, the "just" part. Being a dreamer is hard work. It really gets hard when you start believing in your dreams. --Doug Engelbart -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090818/ff3a01be/signature.pgp From fare at tunes.org Tue Aug 18 15:00:29 2009 From: fare at tunes.org (Francois-Rene Rideau) Date: Tue Aug 18 15:00:53 2009 Subject: [plt-scheme] Boston Lisp Meeting Monday 2009-08-31: Emmanuel Schanzer Message-ID: <20090818190029.6850041BB@bespin.org> Boston Lisp Meeting: Monday 2009-08-31 Emmanuel Schanzer http://fare.livejournal.com/146665.html A Boston Lisp Meeting will take place on Monday, August 31st 2009 at 1800 at MIT 34-401B, where *Emmanuel Schanzer* will speak about *Teaching Mathematics and Problem-Solving through Programming*. Additionally, we are still accepting proposals for up to two volunteers to each give of a 5-minute Lightning Talk (followed by 2-minute Q&A). Also, there will be a buffet offered by ITA Software. Registration is not necessary but appreciated. See details below. * *Emmanuel Schanzer* will speak about *Teaching Mathematics and Problem-Solving through Programming*. Most people agree that students should be exposed to some form of Computer Science before graduating high school, but there is little consensus about what kind of exposure is best. At the same, Algebra has been identified as a pivotally important concept for students, both as the crucial gateway to higher forms of mathematics and as an indicator of future success. This talk explores Bootstrap, a particular approach to computer science education that focuses on Algebra instruction as a natural format for computer programming. Over the course of nine classes, students are exposed to functions and variables, and use their knowledge to design and build a simple videogame. Bootstrap is currently active in middle schools around the country, using volunteer teachers from companies and universities to teach programming to children as young as ten years old. Emmanuel Schanzer is the Program Director for Bootstrap, an organization which trains volunteer teachers to bring functional computer programming to underprivileged middle school students around the country using the curriculum he's developed since 2004. He began teaching Computer Science in 2000, teaching students at Cornell University how to program in Scheme, and later constructed Bootstrap to teach the same concepts as part of an afterschool program. He is now a Doctoral Candidate at Harvard University, studying Cognitive Science and Mathematics Instruction. http://www.bootstrapworld.org/ * * At every meeting, before the main talk, there are two slots for strictly timed 5-minute "Lightning Talks" followed by 2 minutes for questions and answers. The slots for next meeting are still open. Step up and come talk about your pet project! * * * *The Lisp Meeting will take place on Monday August 31st 2009 at 1800 (6pm) at MIT, Room 34-401B.* As the numbers indicate, the room is in Building 34, on the 4th floor. This is the usual location, on 50 Vassar Street, Cambridge. MIT map: http://whereis.mit.edu/bin/map?selection=34 Google map: http://maps.google.com/maps?q=50+Vassar+St,+Cambridge,+MA+02139,+USA Many thanks go to Alexey Radul for arranging for the room, and to MIT for welcoming us. * * * * Dinner: ITA Software http://itasoftware.com/careers/ a fine employer of Lisp hackers (disclaimer: I work there), is kindly purchasing a buffet to accompany our monthly Boston Lisp meeting. Anyone who attends is welcome to partake. We appreciate it if you let us know you're coming, and what food taboos you have, so that we can order the correct amount and kind of food. Tell us by sending email to boston-lisp-meeting-register at common-lisp.net. We won't send any acknowledgement unless requested; importantly, we'll keep your identity and address confidential and won't communicate any such information to anyone, not even to our sponsors. Somehow, we the organizers got mixed up at the July meeting, and the promised buffet didn't materialize. I offer my sincere apologies to all concerned for this blatant failure. * * * * * The previous Boston Lisp Meeting on July 27th had about 30-odd participants. Bruce Lewis talked about OurDoings, and Richard Kreuter about Unary REQUIRE. http://fare.livejournal.com/145087.html We're always looking for more speakers. The call for speakers and all the other details are at: http://fare.livejournal.com/120393.html Volunteers to give Lightning Talks are also sought. http://fare.livejournal.com/143723.html For more information, see our web site http://boston-lisp.org/ For posts related to the Boston Lisp meetings in general, follow this link: http://fare.livejournal.com/tag/boston-lisp-meeting or subscribe to our RSS feed: http://fare.livejournal.com/data/rss?tag=boston-lisp-meeting Please forward this information to people you think would be interested. Please accept my apologies for your receiving this message multiple times. My apologies if this announce gets posted to a list where it shouldn't, or fails to get posted to a list where it should. Feedback welcome by private email reply to fare at tunes.org. From plt at synx.us.to Tue Aug 18 17:26:18 2009 From: plt at synx.us.to (Synx) Date: Tue Aug 18 17:26:54 2009 Subject: [plt-scheme] define-values/invoke-unit/infer failing Message-ID: <4A8B1C7A.5030809@synx.us.to> (define-compound-unit/infer runner@ (import) (export run^) (link foo@ bar@ baz@ thelma@ louise@ bonny@ something-that-provides-run@)) (define-values/invoke-unit/infer runner@) ERROR: vector->values: index 6 out of range [0, 3] for vector: #(# # # #) Any reason I might be running into that error? ._. I can't for some reason define-values/invoke-unit/infer my unit. It just gives me that weird error. From sstrickl at ccs.neu.edu Tue Aug 18 17:35:14 2009 From: sstrickl at ccs.neu.edu (Stevie Strickland) Date: Tue Aug 18 17:36:09 2009 Subject: [plt-scheme] define-values/invoke-unit/infer failing In-Reply-To: <4A8B1C7A.5030809@synx.us.to> References: <4A8B1C7A.5030809@synx.us.to> Message-ID: On Aug 18, 2009, at 5:26 PM, Synx wrote: > Any reason I might be running into that error? ._. I can't for some > reason define-values/invoke-unit/infer my unit. It just gives me that > weird error. Can you give me a complete program that illustrates this problem? If you can come up with a smaller testcase that fails, that would be better, of course, but I'm fine with taking exactly what you have now if you don't mind sharing it. Just send it to me directly, and I'll take a look and see what's going on. Thanks, Stevie From plt at synx.us.to Tue Aug 18 17:47:35 2009 From: plt at synx.us.to (Synx) Date: Tue Aug 18 17:48:06 2009 Subject: SOLVED: [plt-scheme] define-values/invoke-unit/infer failing In-Reply-To: <4A8B1C7A.5030809@synx.us.to> References: <4A8B1C7A.5030809@synx.us.to> Message-ID: <4A8B2177.4090403@synx.us.to> The reason was that thelma^ defined 4 functions, but thelma@ defined 6 functions, and louise@ used one of those 6 not in the signature. I just changed louise@ not to use procedure #6, and use #4 instead in the proper way, and it stopped breaking. Of course I stew on this for days, and only moments after I ask for help does the answer jump out at me. From robby at eecs.northwestern.edu Tue Aug 18 21:20:02 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Aug 18 21:20:23 2009 Subject: [plt-scheme] define-values/invoke-unit/infer failing In-Reply-To: <4A8B1C7A.5030809@synx.us.to> References: <4A8B1C7A.5030809@synx.us.to> Message-ID: <932b2f1f0908181820t25f736dfg2038d6ff8f8c791f@mail.gmail.com> Is your program using vector->values? If not, it would be nice to have a small program that illustrates that behavior, since it looks like a bug in the unit system (some check is missing that would turn that into a more meaningful error). Robby On Tue, Aug 18, 2009 at 4:26 PM, Synx wrote: > > (define-compound-unit/infer runner@ > ?(import) > ?(export run^) > ?(link foo@ > ? ? ? ?bar@ > ? ? ? ?baz@ > ? ? ? ?thelma@ > ? ? ? ?louise@ > ? ? ? ?bonny@ > ? ? ? ?something-that-provides-run@)) > > (define-values/invoke-unit/infer runner@) > > ERROR: > vector->values: index 6 out of range [0, 3] for vector: #(# > # # #) > > Any reason I might be running into that error? ._. I can't for some > reason define-values/invoke-unit/infer my unit. It just gives me that > weird error. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From ryan.aghdam at gmail.com Wed Aug 19 07:09:01 2009 From: ryan.aghdam at gmail.com (Ryan A) Date: Wed Aug 19 08:50:28 2009 Subject: [plt-scheme] Re: ANN: SHP.plt - a PHP-like web framework for PLT Scheme In-Reply-To: <779bf2730908171815x566d1f43gc5396dc4c086d86@mail.gmail.com> References: <779bf2730908171815x566d1f43gc5396dc4c086d86@mail.gmail.com> Message-ID: This looks great. On Aug 17, 9:15?pm, YC wrote: > Hi all - > > SHP 0.1 is now available through planet. ?It is a PHP-like web framework for > PLT Scheme, created mainly to utilize the style of rapid UI prototyping, as > well as taking advantage of all capabilities PLT Scheme has to offer. > > You can download it via planet > > (require (planet bzlib/shp:1:0)) > > It includes an example site that you can play with to get the idea. ?And you > can find the documentation and tutorial athttp://weblambda.blogspot.com/2009/08/introducing-shp-01-sheme-hypert..., > as well as links to other entries that more or less chronicles the > development process. > > As usual for first release, you might find bugs and other issues with the > package, so please let me know if you encounter any such issues. > > Cheers, > yc > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yinso.chen at gmail.com Wed Aug 19 17:41:42 2009 From: yinso.chen at gmail.com (YC) Date: Thu Aug 20 16:57:52 2009 Subject: [plt-scheme] Re: ANN: SHP.plt - a PHP-like web framework for PLT Scheme In-Reply-To: References: <779bf2730908171815x566d1f43gc5396dc4c086d86@mail.gmail.com> Message-ID: <779bf2730908191441t678759c9h98e446234c0ed0fc@mail.gmail.com> Thanks - feel free to let me know if you have specific feedback as well. The blog also chronicle the dev process (dev blogs might be what literate programming will look like in the future ;P) so you can see how it all works. Cheers, yc On Wed, Aug 19, 2009 at 4:09 AM, Ryan A wrote: > This looks great. > > On Aug 17, 9:15 pm, YC wrote: > > Hi all - > > > > SHP 0.1 is now available through planet. It is a PHP-like web framework > for > > PLT Scheme, created mainly to utilize the style of rapid UI prototyping, > as > > well as taking advantage of all capabilities PLT Scheme has to offer. > > > > You can download it via planet > > > > (require (planet bzlib/shp:1:0)) > > > > It includes an example site that you can play with to get the idea. And > you > > can find the documentation and tutorial athttp:// > weblambda.blogspot.com/2009/08/introducing-shp-01-sheme-hypert..., > > as well as links to other entries that more or less chronicles the > > development process. > > > > As usual for first release, you might find bugs and other issues with the > > package, so please let me know if you encounter any such issues. > > > > Cheers, > > yc > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090819/beb602f2/attachment.html From praimon at gmail.com Wed Aug 19 20:59:05 2009 From: praimon at gmail.com (praimon) Date: Thu Aug 20 17:01:16 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? Message-ID: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> hello, I'm having problems using 4.2.1 to run jay mccarthy's sqlite module. I'm using winxp. Simply running: #lang scheme (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 3 1))) ;; (3 1) through (3 8) lead to the same result: . ..\..\Documents and Settings\\Application Data\PLT Scheme\planet\300\4.2.1\cache\jaymccarthy\sqlite.plt\3\8\sqlite.ss:12:3: expand: unbound identifier in module in: ptr-ref If I run: #lang scheme (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 4 5))) ;; (4 0) through (4 5) lead to the same result: ffi-obj: couldn't get "sqlite3_prepare_v2" from "libsqlite3.dll" (The specified procedure could not be found.; errno=127) reference to an identifier before its definition: provide/contract-contract-id-sqlite3_open.5 If I uninstall DrScheme, wipe out the Application Data's PLT folder, reinstall and again run (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 3 1))) I get the following long readout: require: unknown module: 'program setup-plt: error: during Building docs for C:\Documents and Settings\\Application Data\PLT Scheme\planet\300\4.2.1\cache\cce\scheme.plt\4\1\scribblings/main.scrbl setup-plt: require: unknown module: 'program WARNING: collected information for key multiple times: (mod-path "(planet schematics/sake)"); values: #(#\Application Data\PLT Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake\Build_files.html> ("Build files") #t (mod-path "(planet schematics/sake)")) #(#\Application Data\PLT Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake\The_Sake_API.html> ("The Sake API") #t (mod-path "(planet schematics/sake)")) WARNING: collected information for key multiple times: (index-entry (mod-path "(planet schematics/sake)")); values: (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) WARNING: collected information for key multiple times: (mod-path "(planet schematics/sake)"); values: #(#\Application Data\PLT Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake\Build_files.html> ("Build files") #t (mod-path "(planet schematics/sake)")) #(#\Application Data\PLT Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake\The_Sake_API.html> ("The Sake API") #t (mod-path "(planet schematics/sake)")) WARNING: collected information for key multiple times: (index-entry (mod-path "(planet schematics/sake)")); values: (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) (("(planet schematics/sake)") (#(struct:sized-element ... ...)) #) compile: unbound identifier in module setup-plt: error: during making for /jaymccarthy/sqlite.plt/3/8 (SQLite 3 FFI) setup-plt: compile: unbound identifier in module (Note the references to version 3.8 of sqlite.plt) If, on a completely clean system, I run (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 4 5))) I get exactly the same result as above, except that the last 3 lines are replaced by: ffi-lib: couldn't open "libsqlite3.dll" (The specified module could not be found.; errno=126) reference to an identifier before its definition: provide/contract-contract-id-sqlite3_open.5 My sqlite programs work normally if I go back to version 4.1.5. Does anyone have any idea what's happening? regards, praimon From lordgeoffrey at optushome.com.au Thu Aug 20 04:22:40 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Thu Aug 20 17:09:33 2009 Subject: [plt-scheme] multiprocessor support? Message-ID: <4A8D07D0.8050703@optushome.com.au> I was wondering with the rising importance of multiple processors - are there any plans in plt scheme's future? From jmj at fellowhuman.com Thu Aug 20 14:37:52 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Thu Aug 20 17:26:24 2009 Subject: [plt-scheme] editor lockup in embedded editor-snip% Message-ID: Hi all, The annotated-code snip I've been working on is now working (thanks in large part to help from Matthew & Robby), with the exception of one bug that has me baffled. I suspect it involves the locking that happens in embedded-gui/aligned-pasteboard. The bug: If I have a snip in the Definitions editor and click "Run" while the snip's code-view (defined below) is hidden, it becomes impossible to edit the text in the code-editor (also defined below). By this I mean that when I click or tab into the code editor, the cursor does not appear, and typing has no effect. Further, this only happens when the editor is not visible. Here is the relevant code: ;;;;;;;;; ;; anno-snip% is my snip's class. ;; code-editor is an instance of a subclass of ;; ((drscheme:unit:get-program-editor-mixin) (tabbable-text-mixin scheme:text%)) ;; that caches the result of (scheme:text-balanced? this) for display purposes. ;; anno-editor is an instance of (tabbable-text-mixin scheme:text%). ;; The following is from the definition of a subclass of ;; aligned-pasteboard% that is the editor for an anno-snip%: (set-tabbing code-editor anno-editor) ;;;;;;; Container snips for the two editors: (define val (new vertical-alignment% [parent this])) ;; Container for the code editor. I'm using this for the ability to ;; show/hide the editor: (define code-view (new vertical-alignment% [parent val] [show? #f])) ;; Installs stretchable editor snips, if none are already installed, ;; to contain the code and anno editors. ;; (Does nothing if they already are installed, and returns #f.) ;; Returns #t if successful. (define (init-snips) (if (not (or (find-owner-snip code-editor) (find-owner-snip anno-editor))) (let ([code-snip (new stretchable-editor-snip% [editor code-editor] [with-border? #t] [min-width MIN-TEXT-WIDTH])] [anno-snip (new stretchable-editor-snip% [editor anno-editor] [with-border? #f] [min-width MIN-TEXT-WIDTH])]) (make-object snip-wrapper% code-view code-snip) (make-object hline% code-view) (make-object snip-wrapper% val anno-snip) #t) #f)) (init-snips) ;;;;;;;;; Interface for showing/hiding code ;;;;;;;;; (define showing-code #f) (define/public (showing-code?) showing-code) (define/public (show-code on/off) (send code-view show on/off) (set! showing-code on/off)) ;;;;;;;;; end of program excerpt. I have verified that the code-editor is *not* locked for writing, reflowing, or reading. Having looked at snip-wrapper.ss and aligned- pasteboard.ss in embedded-gui/private/, I am guessing something in the code-editor's or code-snip's state isn't getting properly restored when it is reinserted by show/hide (in snip-wrapper.ss), but I don't know what that piece of state would be. Any pointers? Oh, and here's an extra question that may be related: How can I give the caret to the code editor upon calling (show-code true)? Calling set-caret-owner on the code-snip's snip-admin doesn't seem to work. Thanks again for your help. Best, jmj From nallen05 at gmail.com Wed Aug 19 13:33:54 2009 From: nallen05 at gmail.com (nallen05) Date: Thu Aug 20 17:36:35 2009 Subject: [plt-scheme] "mzscheme for scripting" presentation in the Bay Area? Message-ID: <89c91058-a660-4e35-8d8f-b7f1c8447158@y10g2000prf.googlegroups.com> I'm the organizer of balisp (http://www.meetup.com/balisp/). I'd like to do a meetup centered around lightweight dialects / lisp for scripting. I have presenters for distributed systems hacking with newlisp and using emacs lisp to streamline embedded development (android). If anyone is interested in presenting, I'd love to ad an "mzscheme for scripting" presentation to the list. just email me or contact me through the balisp page. Take care Nick From robby at eecs.northwestern.edu Thu Aug 20 20:58:41 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Aug 20 20:59:02 2009 Subject: [plt-scheme] multiprocessor support? In-Reply-To: <4A8D07D0.8050703@optushome.com.au> References: <4A8D07D0.8050703@optushome.com.au> Message-ID: <932b2f1f0908201758r60b530e3k4447673a96e606c1@mail.gmail.com> Yes. There will be announcements here eventually, but it isn't something you can expect to read about within a single lungful of air. Robby On Thu, Aug 20, 2009 at 3:22 AM, LordGeoffrey wrote: > I was wondering with the rising importance of multiple processors - are > there any plans in plt scheme's future? > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at eecs.northwestern.edu Thu Aug 20 21:01:45 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Aug 20 21:02:16 2009 Subject: [plt-scheme] editor lockup in embedded editor-snip% In-Reply-To: References: Message-ID: <932b2f1f0908201801g40da7b64ob905b16043c651df@mail.gmail.com> That code by itself isn't enough for me to see what's wrong and you could certainly be running across a bug elsewhere in the system. The most useful thing would be a (small!) program that illustrated the problem, but if you can't seem to narrow down, send along what you've got and I'll have a look. Robby On Thu, Aug 20, 2009 at 1:37 PM, Jordan Johnson wrote: > Hi all, > > The annotated-code snip I've been working on is now working (thanks in large > part to help from Matthew & Robby), with the exception of one bug that has > me baffled. ?I suspect it involves the locking that happens in > embedded-gui/aligned-pasteboard. > > The bug: ?If I have a snip in the Definitions editor and click "Run" while > the snip's code-view (defined below) is hidden, it becomes impossible to > edit the text in the code-editor (also defined below). ?By this I mean that > when I click or tab into the code editor, the cursor does not appear, and > typing has no effect. ?Further, this only happens when the editor is not > visible. > > Here is the relevant code: > > ;;;;;;;;; > ;; anno-snip% is my snip's class. > > ;; code-editor is an instance of a subclass of > ;; ?((drscheme:unit:get-program-editor-mixin) (tabbable-text-mixin > scheme:text%)) > ;; that caches the result of (scheme:text-balanced? this) for display > purposes. > > ;; anno-editor is an instance of (tabbable-text-mixin scheme:text%). > > ;; The following is from the definition of a subclass of > ;; aligned-pasteboard% that is the editor for an anno-snip%: > > ? ? ?(set-tabbing code-editor anno-editor) > > ? ? ?;;;;;;; Container snips for the two editors: > ? ? ?(define val (new vertical-alignment% [parent this])) > ? ? ?;; Container for the code editor. ?I'm using this for the ability to > ? ? ?;; show/hide the editor: > ? ? ?(define code-view (new vertical-alignment% > ? ? ? ? ? ? ? ? ? ? ? ? ? ? [parent val] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? [show? #f])) > > ? ? ?;; Installs stretchable editor snips, if none are already installed, > ? ? ?;; to contain the code and anno editors. > ? ? ?;; (Does nothing if they already are installed, and returns #f.) > ? ? ?;; Returns #t if successful. > ? ? ?(define (init-snips) > ? ? ? ?(if (not (or (find-owner-snip code-editor) > ? ? ? ? ? ? ? ? ? ? (find-owner-snip anno-editor))) > ? ? ? ? ? ?(let ([code-snip (new stretchable-editor-snip% > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[editor code-editor] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[with-border? #t] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[min-width MIN-TEXT-WIDTH])] > ? ? ? ? ? ? ? ? ?[anno-snip (new stretchable-editor-snip% > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[editor anno-editor] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[with-border? #f] > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[min-width MIN-TEXT-WIDTH])]) > ? ? ? ? ? ? ?(make-object snip-wrapper% code-view code-snip) > ? ? ? ? ? ? ?(make-object hline% code-view) > ? ? ? ? ? ? ?(make-object snip-wrapper% val anno-snip) > ? ? ? ? ? ? ?#t) > ? ? ? ? ? ?#f)) > > ? ? ?(init-snips) > > ? ? ?;;;;;;;;; Interface for showing/hiding code ;;;;;;;;; > ? ? ?(define showing-code #f) > > ? ? ?(define/public (showing-code?) > ? ? ? ?showing-code) > ? ? ?(define/public (show-code on/off) > ? ? ? ?(send code-view show on/off) > ? ? ? ?(set! showing-code on/off)) > > ;;;;;;;;; end of program excerpt. > > I have verified that the code-editor is *not* locked for writing, reflowing, > or reading. ?Having looked at snip-wrapper.ss and aligned-pasteboard.ss in > embedded-gui/private/, I am guessing something in the code-editor's or > code-snip's state isn't getting properly restored when it is reinserted by > show/hide (in snip-wrapper.ss), but I don't know what that piece of state > would be. ?Any pointers? > > Oh, and here's an extra question that may be related: ?How can I give the > caret to the code editor upon calling (show-code true)? ?Calling > set-caret-owner on the code-snip's snip-admin doesn't seem to work. > > Thanks again for your help. > > Best, > jmj > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Thu Aug 20 21:02:55 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 20 21:04:33 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> Message-ID: <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> Howdy The old version is incompatible with new plt as you observed. The new version uses the v2 API of sqlite. It appears that you have an old version of sqlite. Jay Sent from my iPhone On Aug 19, 2009, at 5:59 PM, praimon wrote: > hello, > I'm having problems using 4.2.1 to run jay mccarthy's sqlite module. > I'm using winxp. > > Simply running: > #lang scheme > (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 3 1))) > ;; (3 1) through (3 8) lead to the same result: > > . ..\..\Documents and Settings\\Application Data\PLT > Scheme\planet\300\4.2.1\cache\jaymccarthy\sqlite.plt\3\8\sqlite.ss: > 12:3: > expand: unbound identifier in module in: ptr-ref > > If I run: > #lang scheme > (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 4 5))) > ;; (4 0) through (4 5) lead to the same result: > > ffi-obj: couldn't get "sqlite3_prepare_v2" from "libsqlite3.dll" > (The specified procedure could not be found.; errno=127) > reference to an identifier before its definition: > provide/contract-contract-id-sqlite3_open.5 > > If I uninstall DrScheme, wipe out the Application Data's PLT folder, > reinstall and again run > (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 3 1))) > I get the following long readout: > > require: unknown module: 'program > setup-plt: error: during Building docs for C:\Documents and > Settings\\Application Data\PLT > Scheme\planet\300\4.2.1\cache\cce\scheme.plt\4\1\scribblings/ > main.scrbl > setup-plt: require: unknown module: 'program > WARNING: collected information for key multiple times: (mod-path > "(planet schematics/sake)"); values: #(# Settings\\Application Data\PLT > Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake > \Build_files.html> > ("Build files") #t (mod-path "(planet schematics/sake)")) > #(#\Application Data\PLT > Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake > \The_Sake_API.html> > ("The Sake API") #t (mod-path "(planet schematics/sake)")) > WARNING: collected information for key multiple times: (index-entry > (mod-path "(planet schematics/sake)")); values: (("(planet > schematics/sake)") (#(struct:sized-element ... ...)) > #) (("(planet schematics/sake)") > (#(struct:sized-element ... ...)) #) > WARNING: collected information for key multiple times: (mod-path > "(planet schematics/sake)"); values: #(# Settings\\Application Data\PLT > Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake > \Build_files.html> > ("Build files") #t (mod-path "(planet schematics/sake)")) > #(#\Application Data\PLT > Scheme\planet\300\4.2.1\cache\schematics\sake.plt\1\0\doc\sake > \The_Sake_API.html> > ("The Sake API") #t (mod-path "(planet schematics/sake)")) > WARNING: collected information for key multiple times: (index-entry > (mod-path "(planet schematics/sake)")); values: (("(planet > schematics/sake)") (#(struct:sized-element ... ...)) > #) (("(planet schematics/sake)") > (#(struct:sized-element ... ...)) #) > compile: unbound identifier in module > setup-plt: error: during making for > /jaymccarthy/sqlite.plt/3/8 (SQLite 3 FFI) > setup-plt: compile: unbound identifier in module > > (Note the references to version 3.8 of sqlite.plt) > > If, on a completely clean system, I run > (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 4 5))) > I get exactly the same result as above, except that the last 3 lines > are replaced by: > > ffi-lib: couldn't open "libsqlite3.dll" (The specified module could > not be found.; errno=126) > reference to an identifier before its definition: > provide/contract-contract-id-sqlite3_open.5 > > My sqlite programs work normally if I go back to version 4.1.5. > Does anyone have any idea what's happening? > regards, > praimon > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yinso.chen at gmail.com Thu Aug 20 21:16:59 2009 From: yinso.chen at gmail.com (YC) Date: Thu Aug 20 21:17:19 2009 Subject: [plt-scheme] multiprocessor support? In-Reply-To: <932b2f1f0908201758r60b530e3k4447673a96e606c1@mail.gmail.com> References: <4A8D07D0.8050703@optushome.com.au> <932b2f1f0908201758r60b530e3k4447673a96e606c1@mail.gmail.com> Message-ID: <779bf2730908201816y38152724oe94220bd09dcf8fd@mail.gmail.com> There are a couple previous threads on this topic if you are interested. http://list.cs.brown.edu/pipermail/plt-scheme/2009-July/034380.html http://list.cs.brown.edu/pipermail/plt-scheme/2008-November/028615.html Cheers, yc > On Thu, Aug 20, 2009 at 3:22 AM, > LordGeoffrey wrote: > > I was wondering with the rising importance of multiple processors - are > > there any plans in plt scheme's future? > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090820/8d0f550a/attachment.html From feeley at iro.umontreal.ca Thu Aug 20 21:44:49 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Thu Aug 20 22:14:12 2009 Subject: [plt-scheme] [ANN] scheme-reports.org Message-ID: [Apologies if you get duplicates of this message.] This message is being posted to various lists to inform members of the Scheme community on the activities of the Scheme Language Steering Committee which is overseeing the process of Scheme language evolution. A website has been setup to publish various documents pertaining to our activities. The steering committee will be presenting and discussing these documents at the Scheme workshop on August 22. Our hope is that by publishing them now, a more fruitful question period will ensue at the workshop. The website URL is: http://www.scheme-reports.org/ The documents being published today are: 1) The amended Scheme Language Steering Committee charter. 2) The steering committee's position statement on Scheme language evolution. 3) A draft of the working group meta charter, that describes how working groups are run. 4) A draft of the charter for working group 1, which will be involved in the elaboration of a specification for a "small" Scheme language. 5) A draft of the charter for working group 2, which will be involved in the elaboration of a specification for a "large" Scheme language. If you would like to comment on these documents, we urge you to come to the Scheme workshop and/or to send email to the steering committee at this address: sc@scheme-reports.org . Will Clinger Marc Feeley Chris Hanson Jonathan Rees Olin Shivers From yinso.chen at gmail.com Fri Aug 21 02:16:15 2009 From: yinso.chen at gmail.com (YC) Date: Fri Aug 21 02:16:34 2009 Subject: [plt-scheme] run a setup module during planet package install Message-ID: <779bf2730908202316n70cf81a7p63e9ac3bdb3abf18@mail.gmail.com> Hi all - is there a way to run a setup script with installing of a planet package, so the setup script can do additional processing? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090820/7f8ccf9e/attachment.htm From noelwelsh at gmail.com Fri Aug 21 04:23:07 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Aug 21 04:24:10 2009 Subject: [plt-scheme] run a setup module during planet package install In-Reply-To: <779bf2730908202316n70cf81a7p63e9ac3bdb3abf18@mail.gmail.com> References: <779bf2730908202316n70cf81a7p63e9ac3bdb3abf18@mail.gmail.com> Message-ID: Yes, see section 1.1 of the setup-plt documentation. N. On Fri, Aug 21, 2009 at 7:16 AM, YC wrote: > Hi all - > > is there a way to run a setup script with installing of a planet package, so > the setup script can do additional processing? > > Thanks, > yc From jmj at fellowhuman.com Fri Aug 21 04:49:07 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Fri Aug 21 04:49:31 2009 Subject: [plt-scheme] editor lockup in embedded editor-snip% In-Reply-To: <932b2f1f0908201801g40da7b64ob905b16043c651df@mail.gmail.com> References: <932b2f1f0908201801g40da7b64ob905b16043c651df@mail.gmail.com> Message-ID: OK -- yeah, I didn't want to send out the whole thing unless needed, but here is a link to a version I've winnowed down to about half the program size, but that still exercises the bug: http://www.fellowhuman.com/scheme/annotated-snip/ I've been reproducing it by 1) putting the annotated-snip/ dir in my library path 2) "setup-plt'ing" it. 3) running DrScheme (using current nightly build, 4.2.1.7-svn20aug2009) 4) Insert menu -> Insert Annotated Code Box 5) right-click the code box's bitmap -> Hide program text 6) right-click the code box's bitmap -> Show program text ...after which I can no longer type into the snip's upper text editor. (Yes, since my original post I've noticed in playing around further that it isn't even necessary to click "Run" to exercise this bug; merely hiding and showing the editor suffices.) Once again, many thanks for your time. Best, jmj On Aug 20, 2009, at 6:01 PM, Robby Findler wrote: > That code by itself isn't enough for me to see what's wrong and you > could certainly be running across a bug elsewhere in the system. The > most useful thing would be a (small!) program that illustrated the > problem, but if you can't seem to narrow down, send along what you've > got and I'll have a look. > > Robby > > On Thu, Aug 20, 2009 at 1:37 PM, Jordan Johnson > wrote: >> Hi all, >> >> The annotated-code snip I've been working on is now working (thanks >> in large >> part to help from Matthew & Robby), with the exception of one bug >> that has >> me baffled. I suspect it involves the locking that happens in >> embedded-gui/aligned-pasteboard. >> >> The bug: If I have a snip in the Definitions editor and click >> "Run" while >> the snip's code-view (defined below) is hidden, it becomes >> impossible to >> edit the text in the code-editor (also defined below). By this I >> mean that >> when I click or tab into the code editor, the cursor does not >> appear, and >> typing has no effect. Further, this only happens when the editor >> is not >> visible. >> >> Here is the relevant code: >> >> ;;;;;;;;; >> ;; anno-snip% is my snip's class. >> >> ;; code-editor is an instance of a subclass of >> ;; ((drscheme:unit:get-program-editor-mixin) (tabbable-text-mixin >> scheme:text%)) >> ;; that caches the result of (scheme:text-balanced? this) for display >> purposes. >> >> ;; anno-editor is an instance of (tabbable-text-mixin scheme:text%). >> >> ;; The following is from the definition of a subclass of >> ;; aligned-pasteboard% that is the editor for an anno-snip%: >> >> (set-tabbing code-editor anno-editor) >> >> ;;;;;;; Container snips for the two editors: >> (define val (new vertical-alignment% [parent this])) >> ;; Container for the code editor. I'm using this for the >> ability to >> ;; show/hide the editor: >> (define code-view (new vertical-alignment% >> [parent val] >> [show? #f])) >> >> ;; Installs stretchable editor snips, if none are already >> installed, >> ;; to contain the code and anno editors. >> ;; (Does nothing if they already are installed, and returns #f.) >> ;; Returns #t if successful. >> (define (init-snips) >> (if (not (or (find-owner-snip code-editor) >> (find-owner-snip anno-editor))) >> (let ([code-snip (new stretchable-editor-snip% >> [editor code-editor] >> [with-border? #t] >> [min-width MIN-TEXT-WIDTH])] >> [anno-snip (new stretchable-editor-snip% >> [editor anno-editor] >> [with-border? #f] >> [min-width MIN-TEXT-WIDTH])]) >> (make-object snip-wrapper% code-view code-snip) >> (make-object hline% code-view) >> (make-object snip-wrapper% val anno-snip) >> #t) >> #f)) >> >> (init-snips) >> >> ;;;;;;;;; Interface for showing/hiding code ;;;;;;;;; >> (define showing-code #f) >> >> (define/public (showing-code?) >> showing-code) >> (define/public (show-code on/off) >> (send code-view show on/off) >> (set! showing-code on/off)) >> >> ;;;;;;;;; end of program excerpt. >> >> I have verified that the code-editor is *not* locked for writing, >> reflowing, >> or reading. Having looked at snip-wrapper.ss and aligned- >> pasteboard.ss in >> embedded-gui/private/, I am guessing something in the code-editor's >> or >> code-snip's state isn't getting properly restored when it is >> reinserted by >> show/hide (in snip-wrapper.ss), but I don't know what that piece of >> state >> would be. Any pointers? >> >> Oh, and here's an extra question that may be related: How can I >> give the >> caret to the code editor upon calling (show-code true)? Calling >> set-caret-owner on the code-snip's snip-admin doesn't seem to work. >> >> Thanks again for your help. >> >> Best, >> jmj >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> From yinso.chen at gmail.com Fri Aug 21 04:52:40 2009 From: yinso.chen at gmail.com (YC) Date: Fri Aug 21 04:52:57 2009 Subject: [plt-scheme] run a setup module during planet package install In-Reply-To: References: <779bf2730908202316n70cf81a7p63e9ac3bdb3abf18@mail.gmail.com> Message-ID: <779bf2730908210152q1524d9e1qdad20d7115df7aa8@mail.gmail.com> Thanks - I read it previously without grokking the meaning - so is it the install-collection, pre-install-collection, and post-installation-collection that I am looking for? Thanks, yc On Fri, Aug 21, 2009 at 1:23 AM, Noel Welsh wrote: > Yes, see section 1.1 of the setup-plt documentation. > > N. > > On Fri, Aug 21, 2009 at 7:16 AM, YC wrote: > > Hi all - > > > > is there a way to run a setup script with installing of a planet package, > so > > the setup script can do additional processing? > > > > Thanks, > > yc > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/8731090f/attachment.html From noelwelsh at gmail.com Fri Aug 21 05:24:16 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Aug 21 05:24:34 2009 Subject: [plt-scheme] run a setup module during planet package install In-Reply-To: <779bf2730908210152q1524d9e1qdad20d7115df7aa8@mail.gmail.com> References: <779bf2730908202316n70cf81a7p63e9ac3bdb3abf18@mail.gmail.com> <779bf2730908210152q1524d9e1qdad20d7115df7aa8@mail.gmail.com> Message-ID: I believe so. I've never used them myself. N. On Fri, Aug 21, 2009 at 9:52 AM, YC wrote: > Thanks - I read it previously without grokking the meaning - so is it the > install-collection, pre-install-collection, and post-installation-collection > that I am looking for? > > Thanks, > yc From sbloch at adelphi.edu Fri Aug 21 07:33:10 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Fri Aug 21 07:33:31 2009 Subject: [plt-scheme] run a setup module during planet package install In-Reply-To: <779bf2730908202316n70cf81a7p63e9ac3bdb3abf18@mail.gmail.com> References: <779bf2730908202316n70cf81a7p63e9ac3bdb3abf18@mail.gmail.com> Message-ID: On Aug 21, 2009, at 2:16 AM, YC wrote: > is there a way to run a setup script with installing of a planet > package, so the setup script can do additional processing? My tiles and sb-world packages are installed with (require (planet "install.ss" ...)) which gets the thing from the PLaneT server and then runs "install.ss". Ordinarily when you "require" a file, it's just a bunch of defines and provides, but there's no rule that the file can't also do things; mine writes a short file into the installed- teachpacks directory. I suspect this isn't the way PLaneT and "require" are supposed to be used, but it seems to work. Steve Bloch From robby at eecs.northwestern.edu Fri Aug 21 08:02:09 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Aug 21 08:02:30 2009 Subject: [plt-scheme] editor lockup in embedded editor-snip% In-Reply-To: References: <932b2f1f0908201801g40da7b64ob905b16043c651df@mail.gmail.com> Message-ID: <932b2f1f0908210502v1110311as21de2349e11bd1de@mail.gmail.com> Here is a 20 line problem that seems to indicate the bug is in the show method of the vertical-alignment% class. Probably worth submitting a PR now that the program is a manageable size. hth, Robby #lang scheme/gui (require embedded-gui) (define f (new frame% [label ""][width 200] [height 200])) (define pb (new aligned-pasteboard%)) (define ec2 (new editor-canvas% [parent f] [editor pb])) (define code-editor (new text%)) ;; code box's editor (define val (new vertical-alignment% [parent pb])) (define code-view (new vertical-alignment% [parent val] [show? #t])) (define code-snip (new stretchable-editor-snip% [editor code-editor] [with-border? #t] [min-width 100])) (make-object snip-wrapper% code-view code-snip) (send code-view show #f) (send code-view show #t) (send f show #t) On Fri, Aug 21, 2009 at 3:49 AM, Jordan Johnson wrote: > OK -- yeah, I didn't want to send out the whole thing unless needed, but > here is a link to a version I've winnowed down to about half the program > size, but that still exercises the bug: > ? ? ? ?http://www.fellowhuman.com/scheme/annotated-snip/ > > I've been reproducing it by > ? ? ? ?1) putting the annotated-snip/ dir in my library path > ? ? ? ?2) "setup-plt'ing" it. > ? ? ? ?3) running DrScheme (using current nightly build, > 4.2.1.7-svn20aug2009) > ? ? ? ?4) Insert menu -> Insert Annotated Code Box > ? ? ? ?5) right-click the code box's bitmap -> Hide program text > ? ? ? ?6) right-click the code box's bitmap -> Show program text > > ...after which I can no longer type into the snip's upper text editor. > ?(Yes, since my original post I've noticed in playing around further that it > isn't even necessary to click "Run" to exercise this bug; merely hiding and > showing the editor suffices.) > > Once again, many thanks for your time. > > Best, > jmj > > On Aug 20, 2009, at 6:01 PM, Robby Findler wrote: > >> That code by itself isn't enough for me to see what's wrong and you >> could certainly be running across a bug elsewhere in the system. The >> most useful thing would be a (small!) program that illustrated the >> problem, but if you can't seem to narrow down, send along what you've >> got and I'll have a look. >> >> Robby >> >> On Thu, Aug 20, 2009 at 1:37 PM, Jordan Johnson >> wrote: >>> >>> Hi all, >>> >>> The annotated-code snip I've been working on is now working (thanks in >>> large >>> part to help from Matthew & Robby), with the exception of one bug that >>> has >>> me baffled. ?I suspect it involves the locking that happens in >>> embedded-gui/aligned-pasteboard. >>> >>> The bug: ?If I have a snip in the Definitions editor and click "Run" >>> while >>> the snip's code-view (defined below) is hidden, it becomes impossible to >>> edit the text in the code-editor (also defined below). ?By this I mean >>> that >>> when I click or tab into the code editor, the cursor does not appear, and >>> typing has no effect. ?Further, this only happens when the editor is not >>> visible. >>> >>> Here is the relevant code: >>> >>> ;;;;;;;;; >>> ;; anno-snip% is my snip's class. >>> >>> ;; code-editor is an instance of a subclass of >>> ;; ?((drscheme:unit:get-program-editor-mixin) (tabbable-text-mixin >>> scheme:text%)) >>> ;; that caches the result of (scheme:text-balanced? this) for display >>> purposes. >>> >>> ;; anno-editor is an instance of (tabbable-text-mixin scheme:text%). >>> >>> ;; The following is from the definition of a subclass of >>> ;; aligned-pasteboard% that is the editor for an anno-snip%: >>> >>> ? ? (set-tabbing code-editor anno-editor) >>> >>> ? ? ;;;;;;; Container snips for the two editors: >>> ? ? (define val (new vertical-alignment% [parent this])) >>> ? ? ;; Container for the code editor. ?I'm using this for the ability to >>> ? ? ;; show/hide the editor: >>> ? ? (define code-view (new vertical-alignment% >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?[parent val] >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?[show? #f])) >>> >>> ? ? ;; Installs stretchable editor snips, if none are already installed, >>> ? ? ;; to contain the code and anno editors. >>> ? ? ;; (Does nothing if they already are installed, and returns #f.) >>> ? ? ;; Returns #t if successful. >>> ? ? (define (init-snips) >>> ? ? ? (if (not (or (find-owner-snip code-editor) >>> ? ? ? ? ? ? ? ? ? ?(find-owner-snip anno-editor))) >>> ? ? ? ? ? (let ([code-snip (new stretchable-editor-snip% >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [editor code-editor] >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [with-border? #t] >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [min-width MIN-TEXT-WIDTH])] >>> ? ? ? ? ? ? ? ? [anno-snip (new stretchable-editor-snip% >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [editor anno-editor] >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [with-border? #f] >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [min-width MIN-TEXT-WIDTH])]) >>> ? ? ? ? ? ? (make-object snip-wrapper% code-view code-snip) >>> ? ? ? ? ? ? (make-object hline% code-view) >>> ? ? ? ? ? ? (make-object snip-wrapper% val anno-snip) >>> ? ? ? ? ? ? #t) >>> ? ? ? ? ? #f)) >>> >>> ? ? (init-snips) >>> >>> ? ? ;;;;;;;;; Interface for showing/hiding code ;;;;;;;;; >>> ? ? (define showing-code #f) >>> >>> ? ? (define/public (showing-code?) >>> ? ? ? showing-code) >>> ? ? (define/public (show-code on/off) >>> ? ? ? (send code-view show on/off) >>> ? ? ? (set! showing-code on/off)) >>> >>> ;;;;;;;;; end of program excerpt. >>> >>> I have verified that the code-editor is *not* locked for writing, >>> reflowing, >>> or reading. ?Having looked at snip-wrapper.ss and aligned-pasteboard.ss >>> in >>> embedded-gui/private/, I am guessing something in the code-editor's or >>> code-snip's state isn't getting properly restored when it is reinserted >>> by >>> show/hide (in snip-wrapper.ss), but I don't know what that piece of state >>> would be. ?Any pointers? >>> >>> Oh, and here's an extra question that may be related: ?How can I give the >>> caret to the code editor upon calling (show-code true)? ?Calling >>> set-caret-owner on the code-snip's snip-admin doesn't seem to work. >>> >>> Thanks again for your help. >>> >>> Best, >>> jmj >>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> > > From ebellani at gmail.com Fri Aug 21 12:18:52 2009 From: ebellani at gmail.com (Eduardo Bellani) Date: Fri Aug 21 12:19:13 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement Message-ID: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> http://scheme-reports.org/2009/position-statement.html Any comments? -- Eduardo Bellani www.cnxs.com.br Someone once called me "just a dreamer" That offended me, the "just" part. Being a dreamer is hard work. It really gets hard when you start believing in your dreams. --Doug Engelbart From gmarceau at gmail.com Fri Aug 21 12:37:05 2009 From: gmarceau at gmail.com (Guillaume Marceau) Date: Fri Aug 21 12:37:37 2009 Subject: [plt-scheme] Sandboxed evaluator for Beginner Scheme Message-ID: I am trying to automatically evaluate code under BSL. The Scheme Sandbox has support for specifying BSL as the language, but somehow it's not behaving as I would expect. Welcome to DrScheme, version 4.2 [3m]. Language: Module. > (require scheme/sandbox) > (define e (parameterize ([sandbox-output 'string]) (make-evaluator '(special beginner) "7 (check-expect (id 1) 1) (define (id x) x)"))) 7 > (get-output e) "" > I would expect the 7 to appear in the string that results from GET-OUTPUT, followed by a newline, then "The test passed!" I am using calling MAKE-EVALUATOR wrong? I should be using some other library, such as lang/run-teaching-program ? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/beebf5d9/attachment.htm From robby at eecs.northwestern.edu Fri Aug 21 13:00:46 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Fri Aug 21 13:01:07 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> Message-ID: <932b2f1f0908211000o46ee7214ndf01bc455be4dd8d@mail.gmail.com> Very well written. Robby On Friday, August 21, 2009, Eduardo Bellani wrote: > http://scheme-reports.org/2009/position-statement.html > > Any comments? > > -- > Eduardo Bellani > > http://www.cnxs.com.br > > Someone once called me "just a dreamer" > That offended me, the "just" part. > Being a dreamer is hard work. > It really gets hard when you start believing in your dreams. > --Doug Engelbart > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From m.douglas.williams at gmail.com Fri Aug 21 13:08:31 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 21 13:17:13 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> Message-ID: It's rather hard to complain about a position statement. It is their position. I do that they succinctly stated the problem that we all went through during the R6RS process - there are basically two camps with divergent goals in terms of Scheme as a 'programming' language. The ones favoring the 'small' language concept have an advantage - there is less to argue about in a smaller language definition (and that language has been relatively stable). The ones favoring a 'large' language [and I am definitely in that camp] are at a disadvantage in that there are several Scheme implementations (and there adherents) that solved the same problems in often (or even usually) incompatible ways. The differing majorities required for ratification of the two 'languages' seems like a good methodology to approach. I am hoping R7RS gets the 'large' language back into a common fold and allow us to start writing truly portable Scheme applications. I wish them well and would like to support the process in any way that helps. Doug On Fri, Aug 21, 2009 at 10:18 AM, Eduardo Bellani wrote: > http://scheme-reports.org/2009/position-statement.html > > Any comments? > > -- > Eduardo Bellani > > www.cnxs.com.br > > Someone once called me "just a dreamer" > That offended me, the "just" part. > Being a dreamer is hard work. > It really gets hard when you start believing in your dreams. > --Doug Engelbart > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/a706b5e7/attachment.html From samth at ccs.neu.edu Fri Aug 21 14:08:43 2009 From: samth at ccs.neu.edu (Sam TH) Date: Fri Aug 21 14:09:04 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> Message-ID: <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> On Fri, Aug 21, 2009 at 12:18 PM, Eduardo Bellani wrote: > http://scheme-reports.org/2009/position-statement.html > > Any comments? I'm disappointed that people think that a Scheme that works well for education and research can't be the same as one that works well for writing large-scale programs. I think the existence of PLT Scheme, in which large quantities of all three are done, is an existence proof of the opposite. -- sam th samth@ccs.neu.edu From dvanhorn at ccs.neu.edu Fri Aug 21 14:17:03 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Fri Aug 21 14:17:31 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> Message-ID: <4A8EE49F.5090100@ccs.neu.edu> Sam TH wrote: > On Fri, Aug 21, 2009 at 12:18 PM, Eduardo Bellani wrote: >> http://scheme-reports.org/2009/position-statement.html >> >> Any comments? > > I'm disappointed that people think that a Scheme that works well for > education and research can't be the same as one that works well for > writing large-scale programs. I think the existence of PLT Scheme, in > which large quantities of all three are done, is an existence proof of > the opposite. Agreed. I also think the large v. small language is a false dichotomy. If you want to write a module (library) using nothing but lambda and apply, you can do that in R6RS. If you want all the bells and whistles, you can do that too. We should (and PLT does) focus on enabling this sort of thing. Rather than focus on a small and large instantiation of "Scheme", we should work on the boundaries between languages, small and large, safe and unsafe, typed and untyped, sane and crazy, etc. David From praimon at gmail.com Fri Aug 21 14:30:17 2009 From: praimon at gmail.com (praimon) Date: Fri Aug 21 14:30:39 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> Message-ID: <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> Hi Jay, Thanks for replying. I downloaded the latest version of sqlite3, but the error didn't go away. Then I realized that I probably needed to require the latest version of your binding, so changed the call to version (3 1) to (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 4 5))) I still get the same error: 'ffi-obj: couldn't get "sqlite3_prepare_v2" from "libsqlite3.dll" (The specified procedure could not be found.; errno=127) reference to an identifier before its definition: provide/contract-contract-id-sqlite3_open.5' Maybe I need a newer version of libsqlite3.dll as well? The only place I know to get it is http://ja.soegaard.net/planet/html/soegaard/sqlite.plt/current/libsqlite3.dll and that link no longer seems to work. Or maybe it's just looking for libsqlite3.dll in a different place? regards, praimon On Thu, Aug 20, 2009 at 9:02 PM, Jay McCarthy wrote: > Howdy > > The old version is incompatible with new plt as you observed. > > The new version uses the v2 API of sqlite. It appears that you have an old > version of sqlite. > > Jay > > Sent from my iPhone > > On Aug 19, 2009, at 5:59 PM, praimon wrote: > >> hello, >> I'm having problems using 4.2.1 to run jay mccarthy's sqlite module. >> I'm using winxp. From jay.mccarthy at gmail.com Fri Aug 21 14:32:00 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Aug 21 14:33:34 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> Message-ID: <05FD9CAF-075C-4CFB-8933-0101345D33F6@gmail.com> The package uses the os to find the dll in the standard place. The dll is available from the official sqlite homepage. Jay Sent from my iPhone On Aug 21, 2009, at 11:30 AM, praimon wrote: > Hi Jay, > Thanks for replying. I downloaded the latest version of sqlite3, but > the error didn't go away. Then I realized that I probably needed to > require the latest version of your binding, so changed the call to > version (3 1) to > (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 4 5))) > I still get the same error: > 'ffi-obj: couldn't get "sqlite3_prepare_v2" from "libsqlite3.dll" (The > specified procedure could not be found.; errno=127) > reference to an identifier before its definition: > provide/contract-contract-id-sqlite3_open.5' > > Maybe I need a newer version of libsqlite3.dll as well? The only place > I know to get it is > http://ja.soegaard.net/planet/html/soegaard/sqlite.plt/current/libsqlite3.dll > and that link no longer seems to work. > Or maybe it's just looking for libsqlite3.dll in a different place? > regards, > praimon > > On Thu, Aug 20, 2009 at 9:02 PM, Jay > McCarthy wrote: >> Howdy >> >> The old version is incompatible with new plt as you observed. >> >> The new version uses the v2 API of sqlite. It appears that you have >> an old >> version of sqlite. >> >> Jay >> >> Sent from my iPhone >> >> On Aug 19, 2009, at 5:59 PM, praimon wrote: >> >>> hello, >>> I'm having problems using 4.2.1 to run jay mccarthy's sqlite module. >>> I'm using winxp. From namekuseijin at gmail.com Fri Aug 21 14:53:55 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Fri Aug 21 14:54:15 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <4A8EE49F.5090100@ccs.neu.edu> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> Message-ID: <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> On Fri, Aug 21, 2009 at 3:17 PM, David Van Horn wrote: > Sam TH wrote: >> >> On Fri, Aug 21, 2009 at 12:18 PM, Eduardo Bellani >> wrote: >>> >>> http://scheme-reports.org/2009/position-statement.html >>> >>> Any comments? >> >> I'm disappointed that people think that a Scheme that works well for >> education and research can't be the same as one that works well for >> writing large-scale programs. ?I think the existence of PLT Scheme, in >> which large quantities of all three are done, is an existence proof of >> the opposite. > > Agreed. > > I also think the large v. small language is a false dichotomy. ?If you want > to write a module (library) using nothing but lambda and apply, you can do > that in R6RS. Yes, with a mere (import (rnrs base)) it provides an even smaller subset than R5RS. All batteries-included Scheme implementations provide pretty much everything a programmer needs for real world tasks. I just wish all of them provided at least one common interface for such features as IPC, FFI etc, beside their specific. That's where I see standardization efforts could focus instead of relying on people possibly agreeing upon one or other SRFIs and hopefully providing support. my 1 cent... From yinso.chen at gmail.com Fri Aug 21 15:15:05 2009 From: yinso.chen at gmail.com (YC) Date: Fri Aug 21 15:15:24 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> Message-ID: <779bf2730908211215w52be1296n35c31b7d4bb63816@mail.gmail.com> On Fri, Aug 21, 2009 at 11:53 AM, namekuseijin wrote: > On Fri, Aug 21, 2009 at 3:17 PM, David Van Horn > wrote: > > Sam TH wrote: > >> > >> On Fri, Aug 21, 2009 at 12:18 PM, Eduardo Bellani > > Agreed. > > > > I also think the large v. small language is a false dichotomy. If you > want > > to write a module (library) using nothing but lambda and apply, you can > do > > that in R6RS. > > Yes, with a mere (import (rnrs base)) it provides an even smaller > subset than R5RS. > IMHO the appeal of a small language is not that it's easy to use (on the contrary it is harder because you have to write everything from scratch), but that it is easy to implement (besides the purity thing) - scheme is one language where there are hobby implementations, I've not seen one for Perl, Python, C, etc. For the hobby language implementers, Scheme is wildly successful. > All batteries-included Scheme implementations provide pretty much > everything a programmer needs for real world tasks. I just wish all > of them provided at least one common interface for such features as > IPC, FFI etc, beside their specific. That's where I see > standardization efforts could focus instead of relying on people > possibly agreeing upon one or other SRFIs and hopefully providing > support In CL there are compatible layers that allow one to port from say allegro to lispworks with relative ease. It seems that's a better approach than trying to standardize into a compromise that will force everyone to rewrite. And maybe all these scheme implementations are really distinct platforms, and we should just stick with one instead of thinking to work across multiple ones. My 0.1 cent. Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/f442ebd3/attachment.htm From m.douglas.williams at gmail.com Fri Aug 21 15:19:04 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 21 15:19:27 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <4A8EE49F.5090100@ccs.neu.edu> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> Message-ID: I assume most people on this mailing list would agree with you. I certainly do. But, there are members of the larger Scheme community who believe just as strongly that small = elegant and elegant = beautiful, therefore small = beautiful, QED.While this might be a false dichotomy from a language perspective, it's a very real dichotomy in the community. They have to address it or give up on a standard that is ratified by a 75-90% majority of the community. It would be nice if the two working groups (the "small" language working group and the "large" language working group) see themselves as working on the same language. There are statements in both draft charters that state, "The names of the languages to be developed by working groups 1 and 2 have not yet been determined. The Steering Committee will consider names suggested by the working groups." I can see each of them saying, "We're defining the Scheme language. We don't know what the other language is." So maybe I talked myself into agreeing that the language dichotomy is artificial and bad. On Fri, Aug 21, 2009 at 12:17 PM, David Van Horn wrote: > Sam TH wrote: > >> On Fri, Aug 21, 2009 at 12:18 PM, Eduardo Bellani >> wrote: >> >>> http://scheme-reports.org/2009/position-statement.html >>> >>> Any comments? >>> >> >> I'm disappointed that people think that a Scheme that works well for >> education and research can't be the same as one that works well for >> writing large-scale programs. I think the existence of PLT Scheme, in >> which large quantities of all three are done, is an existence proof of >> the opposite. >> > > Agreed. > > I also think the large v. small language is a false dichotomy. If you want > to write a module (library) using nothing but lambda and apply, you can do > that in R6RS. If you want all the bells and whistles, you can do that too. > We should (and PLT does) focus on enabling this sort of thing. Rather than > focus on a small and large instantiation of "Scheme", we should work on the > boundaries between languages, small and large, safe and unsafe, typed and > untyped, sane and crazy, etc. > > David > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/93a4689d/attachment.html From matthias at ccs.neu.edu Fri Aug 21 15:19:24 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 21 15:19:53 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <4A8EE49F.5090100@ccs.neu.edu> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> Message-ID: Thank you Dave and Same for pointing out the obvious flaws with these documents (though sure, I can see why one would call this stuff "well written"). As Matthew tends to say (he's in-flight for another four hours so I can quote him any way I want for now :), you need a certain amount complexity to make things look simple. What surprised me to hear is that according to Sam, Guy tends to tell people the same kind of thing. In the case of PLT Scheme, one can easily argue that we built the LARGE system so that we could build lots and lots of SMALL languages, all suitable for various purposes and all integrable if needed through the larger, surrounding universe. So it shouldn't surprise anyone that PLT comes not only with batteries, but with - 5 small languages for HtDP, - an EOPL plug-in - a PLAI plug-in - a Lazy Scheme plug-in - and one Eli plugin per week of 'languages' at NEU and I am probably overlooking some Scheme dialects here, not to speak of an ACL2 plug-in and many many others. So the real question is Do we even need a 'standard' document? -- Matthias On Aug 21, 2009, at 2:17 PM, David Van Horn wrote: > Sam TH wrote: >> On Fri, Aug 21, 2009 at 12:18 PM, Eduardo >> Bellani wrote: >>> http://scheme-reports.org/2009/position-statement.html >>> >>> Any comments? >> I'm disappointed that people think that a Scheme that works well for >> education and research can't be the same as one that works well for >> writing large-scale programs. I think the existence of PLT Scheme, >> in >> which large quantities of all three are done, is an existence proof >> of >> the opposite. > > Agreed. > > I also think the large v. small language is a false dichotomy. If > you want to write a module (library) using nothing but lambda and > apply, you can do that in R6RS. If you want all the bells and > whistles, you can do that too. We should (and PLT does) focus on > enabling this sort of thing. Rather than focus on a small and large > instantiation of "Scheme", we should work on the boundaries between > languages, small and large, safe and unsafe, typed and untyped, sane > and crazy, etc. > > David > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jensaxel at soegaard.net Fri Aug 21 15:34:41 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Fri Aug 21 15:35:03 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> Message-ID: <4072c51f0908211234y5de33345veb8b483501c236b@mail.gmail.com> 2009/8/21 praimon : > Maybe I need a newer version of libsqlite3.dll as well? The only place > I know to get it is > http://ja.soegaard.net/planet/html/soegaard/sqlite.plt/current/libsqlite3.dll > and that link no longer seems to work. Planet still has the (now old) dll file. http://planet.plt-scheme.org/package-source/soegaard/sqlite.plt/1/2/libsqlite3.dll You can find (new) precompiled versions here: http://sqlite.org/download.html -- Jens Axel S?gaard From kwinterling at gmail.com Fri Aug 21 15:35:33 2009 From: kwinterling at gmail.com (Karl Winterling) Date: Fri Aug 21 15:35:54 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> Message-ID: <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> PLT is not really a ``large'' language. It's just an implementation with a large number of libraries (like ``standard'' Perl) and sub-languages (like the teaching languages). Libraries become part of the language definition as a result of creeping featurism. I would support going the ``small'' route and finding portable ways to introduce new constructs along with keeping the base features as simple as possible. It's probably impossible to get all implementations to agree on a ``standard way'' to define structs, for example. Libraries need to live or die depending on usage. Whether a standard is ``large'' or ``small'' depends on how it is organized. Therefore, R7RS should focus mainly on portability concerns, but avoid doing anything rash. A collection of suggested FFI procedures would help, but not a complete C interface. Oh well, I guess we're doomed anyway... On Fri, Aug 21, 2009 at 11:53 AM, namekuseijin wrote: > On Fri, Aug 21, 2009 at 3:17 PM, David Van Horn wrote: >> Sam TH wrote: >>> >>> On Fri, Aug 21, 2009 at 12:18 PM, Eduardo Bellani >>> wrote: >>>> >>>> http://scheme-reports.org/2009/position-statement.html >>>> >>>> Any comments? >>> >>> I'm disappointed that people think that a Scheme that works well for >>> education and research can't be the same as one that works well for >>> writing large-scale programs. ?I think the existence of PLT Scheme, in >>> which large quantities of all three are done, is an existence proof of >>> the opposite. >> >> Agreed. >> >> I also think the large v. small language is a false dichotomy. ?If you want >> to write a module (library) using nothing but lambda and apply, you can do >> that in R6RS. > > Yes, with a mere (import (rnrs base)) it provides an even smaller > subset than R5RS. > > All batteries-included Scheme implementations provide pretty much > everything a programmer needs for real world tasks. ?I just wish all > of them provided at least one common interface for such features as > IPC, FFI etc, beside their specific. ?That's where I see > standardization efforts could focus instead of relying on people > possibly agreeing upon one or other SRFIs and hopefully providing > support. > > my 1 cent... > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From praimon at gmail.com Fri Aug 21 15:41:54 2009 From: praimon at gmail.com (praimon) Date: Fri Aug 21 15:42:15 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: <4072c51f0908211234y5de33345veb8b483501c236b@mail.gmail.com> References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> <4072c51f0908211234y5de33345veb8b483501c236b@mail.gmail.com> Message-ID: <4acd8930908211241i3d2fec83o9e11c9d35b7dfba2@mail.gmail.com> Hi Jens, Of course, I earlier searched for it on the sqlite homepage, without luck. Googling 'libsqlite3.dll site:sqlite.org' was also not helpful. I must be going blind - where on that page do you see it? None of the 4 "Precompiled Binaries For Windows" has it. regards, praimon On Fri, Aug 21, 2009 at 3:34 PM, Jens Axel S?gaard wrote: > 2009/8/21 praimon : > >> Maybe I need a newer version of libsqlite3.dll as well? The only place >> I know to get it is >> http://ja.soegaard.net/planet/html/soegaard/sqlite.plt/current/libsqlite3.dll >> and that link no longer seems to work. > > Planet still has the (now old) dll file. > > http://planet.plt-scheme.org/package-source/soegaard/sqlite.plt/1/2/libsqlite3.dll > > You can find (new) precompiled versions here: > > ? ?http://sqlite.org/download.html > > -- > Jens Axel S?gaard > From noelwelsh at gmail.com Fri Aug 21 15:48:11 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Aug 21 15:48:28 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> Message-ID: On Fri, Aug 21, 2009 at 8:35 PM, Karl Winterling wrote: > It's probably impossible to get all > implementations to agree on a ``standard way'' to define structs, for > example. If you can't standardise such a basic thing, what exactly is the point of a standard? This is the bit I don't get about the "small language" argument. If you're going to define a standard so anemic that all practical implementations are forced to implement multiple incompatible features, what exactly does a standard get you? Any moderate sized program won't be portable under this standard (and this is exactly the situation with R5RS) so why bother? Scheme suffers from too many talented programmers reimplementing the same stuff in their own pet implementation. We need fewer implementations not more. That situation doesn't seem to hurt, e.g., Haskell. N. From matthias at ccs.neu.edu Fri Aug 21 15:48:57 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 21 15:49:21 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> Message-ID: <1376BAC5-BC58-4088-BC05-0221FCE9DE71@ccs.neu.edu> On Aug 21, 2009, at 3:35 PM, Karl Winterling wrote: > PLT is not really a ``large'' language. You're absolutely correct, it isn't. So now re-read what they wrote from that angle :-) From noelwelsh at gmail.com Fri Aug 21 15:52:15 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Aug 21 15:52:37 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: <4acd8930908211241i3d2fec83o9e11c9d35b7dfba2@mail.gmail.com> References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> <4072c51f0908211234y5de33345veb8b483501c236b@mail.gmail.com> <4acd8930908211241i3d2fec83o9e11c9d35b7dfba2@mail.gmail.com> Message-ID: You want this: http://www.sqlite.org/sqlitedll-3_6_17.zip If necessary rename the DLL to libsqlite3.dll N. On Fri, Aug 21, 2009 at 8:41 PM, praimon wrote: > Hi Jens, > Of course, I earlier searched for it on the sqlite homepage, without luck. > Googling 'libsqlite3.dll site:sqlite.org' was also not helpful. > I must be going blind - where on that page do you see it? None of the > 4 "Precompiled Binaries For Windows" has it. > regards, > praimon From m.douglas.williams at gmail.com Fri Aug 21 16:15:42 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 21 16:16:04 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <1376BAC5-BC58-4088-BC05-0221FCE9DE71@ccs.neu.edu> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> <1376BAC5-BC58-4088-BC05-0221FCE9DE71@ccs.neu.edu> Message-ID: As a developer, I definitely see PLT Scheme as a large language. To me everything in the PLT Scheme Reference Manual is part of the PLT Scheme language. Even if you restrict it to the #lang scheme subset, I'd still consider it large. How many other languages include: an sophisticated macro system, a rich numeric stack (including exactness, infinities, complex numbers, etc), classes, modules, units, contracts, pattern matching, multiple values, exceptions, continuations, concurrency, namespaces, custodians, and I'm bound to be missing features in that list. That's a large language. The libraries are on top of that. PLT Scheme is a large, rich language (or implementation, if you prefer). Another 1cent for good measure. On Fri, Aug 21, 2009 at 1:48 PM, Matthias Felleisen wrote: > > On Aug 21, 2009, at 3:35 PM, Karl Winterling wrote: > > PLT is not really a ``large'' language. >> > > You're absolutely correct, it isn't. So now re-read what they wrote from > that angle :-)_________________________________________________ > > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/956efddb/attachment.htm From kwinterling at gmail.com Fri Aug 21 16:16:27 2009 From: kwinterling at gmail.com (Karl Winterling) Date: Fri Aug 21 16:16:45 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> Message-ID: <5dd359570908211316s5f345407w271b70c51302f353@mail.gmail.com> On Fri, Aug 21, 2009 at 12:48 PM, Noel Welsh wrote: > If you can't standardise such a basic thing, what exactly is the point > of a standard? This is the bit I don't get about the "small language" > argument. If you're going to define a standard so anemic that all > practical implementations are forced to implement multiple > incompatible features, what exactly does a standard get you? Any > moderate sized program won't be portable under this standard (and this > is exactly the situation with R5RS) so why bother? The point is: Either the ``pet implementations'' die or they agree on some ``standard way'' for stuff like FFI or whatever.The point is: Either the ``pet implementations'' die or they agree on some ``standard way'' for stuff like FFI or whatever. Define ``moderate sized program.'' Which features would implementations have to agree on to all support such a program? > > Scheme suffers from too many talented programmers reimplementing the > same stuff in their own pet implementation. We need fewer > implementations not more. That situation doesn't seem to hurt, e.g., > Haskell. Haskell is great, but it's not Scheme. Fewer implementations would only work well if people found them flexible enough to support their desired platforms and programming styles. A larger community-developed implementation could probably help out a lot. I still want Haskell on my cell phone and that old BeOS workstation :-) From kwinterling at gmail.com Fri Aug 21 16:20:02 2009 From: kwinterling at gmail.com (Karl Winterling) Date: Fri Aug 21 16:20:20 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <5dd359570908211316s5f345407w271b70c51302f353@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> <5dd359570908211316s5f345407w271b70c51302f353@mail.gmail.com> Message-ID: <5dd359570908211320l6578f13fi717d51ee2019b9c1@mail.gmail.com> On Fri, Aug 21, 2009 at 1:16 PM, Karl Winterling wrote: > On Fri, Aug 21, 2009 at 12:48 PM, Noel Welsh wrote: > The point is: Either the ``pet implementations'' die or they agree on > some ``standard way'' for stuff like FFI or whatever.The point is: > Either the ``pet implementations'' die or they agree on some > ``standard way'' for stuff like FFI or whatever. > Sorry for the repeated repeated sentence. From m.douglas.williams at gmail.com Fri Aug 21 16:30:26 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Aug 21 16:30:44 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <5dd359570908211325r3101142flaf1f97b9ccb7ecbc@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> <1376BAC5-BC58-4088-BC05-0221FCE9DE71@ccs.neu.edu> <5dd359570908211325r3101142flaf1f97b9ccb7ecbc@mail.gmail.com> Message-ID: Do you not see the things mentioned as part of the PLT Scheme language proper or that they don't amount to a large language? Just looking for a clarification. On Fri, Aug 21, 2009 at 2:25 PM, Karl Winterling wrote: > On Fri, Aug 21, 2009 at 1:15 PM, Doug > Williams wrote: > > As a developer, I definitely see PLT Scheme as a large language. > > Speaking as a (l)user with rather idiosyncratic programming habits, I > respectfully disagree :-). > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/42f85b40/attachment.html From kwinterling at gmail.com Fri Aug 21 16:25:06 2009 From: kwinterling at gmail.com (Karl Winterling) Date: Fri Aug 21 16:31:28 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> <1376BAC5-BC58-4088-BC05-0221FCE9DE71@ccs.neu.edu> Message-ID: <5dd359570908211325r3101142flaf1f97b9ccb7ecbc@mail.gmail.com> On Fri, Aug 21, 2009 at 1:15 PM, Doug Williams wrote: > As a developer, I definitely see PLT Scheme as a large language. Speaking as a (l)user with rather idiosyncratic programming habits, I respectfully disagree :-). From matthias at ccs.neu.edu Fri Aug 21 16:33:51 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Aug 21 16:34:23 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <5dd359570908211235i50f395b9kc57cddb8d1e7e1ba@mail.gmail.com> <1376BAC5-BC58-4088-BC05-0221FCE9DE71@ccs.neu.edu> <5dd359570908211325r3101142flaf1f97b9ccb7ecbc@mail.gmail.com> Message-ID: <42A8F494-B11B-484F-A145-E4110168ABDD@ccs.neu.edu> If you don't use the macro system (to define macros), the language isn't really large. Think of what you can say in C++ (const, malloc, types, functions, classes, templates, ...) or Java (types, incl. generics, boxed values, packages, ...). But it simply doesn't matter. The Steering committee thinks PLT and its r6rs brother are large. -- Matthias For me, Java and C# are On Aug 21, 2009, at 4:30 PM, Doug Williams wrote: > Do you not see the things mentioned as part of the PLT Scheme > language proper or that they don't amount to a large language? Just > looking for a clarification. > > On Fri, Aug 21, 2009 at 2:25 PM, Karl Winterling > wrote: > On Fri, Aug 21, 2009 at 1:15 PM, Doug > Williams wrote: > > As a developer, I definitely see PLT Scheme as a large language. > > Speaking as a (l)user with rather idiosyncratic programming habits, I > respectfully disagree :-). > From praimon at gmail.com Fri Aug 21 16:54:29 2009 From: praimon at gmail.com (praimon) Date: Fri Aug 21 16:54:51 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> <4072c51f0908211234y5de33345veb8b483501c236b@mail.gmail.com> <4acd8930908211241i3d2fec83o9e11c9d35b7dfba2@mail.gmail.com> Message-ID: <4acd8930908211354l315a523fo7c16c6ac8c20e776@mail.gmail.com> Hi Noel, I renamed sqlite3.dll to libsqlite3.dll, but got the same error message. sqlite3.dll is twice the size of libsqlite3.dll, so I don't think they can be used interchangeably(?). regards, praimon On Fri, Aug 21, 2009 at 3:52 PM, Noel Welsh wrote: > You want this: > > ?http://www.sqlite.org/sqlitedll-3_6_17.zip > > If necessary rename the DLL to libsqlite3.dll > > N. > > On Fri, Aug 21, 2009 at 8:41 PM, praimon wrote: >> Hi Jens, >> Of course, I earlier searched for it on the sqlite homepage, without luck. >> Googling 'libsqlite3.dll site:sqlite.org' was also not helpful. >> I must be going blind - where on that page do you see it? None of the >> 4 "Precompiled Binaries For Windows" has it. >> regards, >> praimon > From praimon at gmail.com Fri Aug 21 17:08:38 2009 From: praimon at gmail.com (praimon) Date: Fri Aug 21 17:09:00 2009 Subject: [plt-scheme] 4.2.1 not running sqlite.plt? In-Reply-To: <4acd8930908211354l315a523fo7c16c6ac8c20e776@mail.gmail.com> References: <4acd8930908191759t530b621fjce4b2dc1dbedac98@mail.gmail.com> <8E07A7D4-ECD7-48D1-BBDB-EFE0E64C71F5@gmail.com> <4acd8930908211130m4ca914c6p592804a73dacde0@mail.gmail.com> <4072c51f0908211234y5de33345veb8b483501c236b@mail.gmail.com> <4acd8930908211241i3d2fec83o9e11c9d35b7dfba2@mail.gmail.com> <4acd8930908211354l315a523fo7c16c6ac8c20e776@mail.gmail.com> Message-ID: <4acd8930908211408w2963504ema8416cfabdf43d68@mail.gmail.com> My mistake! I forgot to restart DrScheme. After doing so, everything works! Thanks, guys. On Fri, Aug 21, 2009 at 4:54 PM, praimon wrote: > Hi Noel, > I renamed sqlite3.dll to libsqlite3.dll, but got the same error > message. sqlite3.dll is twice the size of libsqlite3.dll, so I don't > think they can be used interchangeably(?). > regards, > praimon > > On Fri, Aug 21, 2009 at 3:52 PM, Noel Welsh wrote: >> You want this: >> >> ?http://www.sqlite.org/sqlitedll-3_6_17.zip >> >> If necessary rename the DLL to libsqlite3.dll >> >> N. >> >> On Fri, Aug 21, 2009 at 8:41 PM, praimon wrote: >>> Hi Jens, >>> Of course, I earlier searched for it on the sqlite homepage, without luck. >>> Googling 'libsqlite3.dll site:sqlite.org' was also not helpful. >>> I must be going blind - where on that page do you see it? None of the >>> 4 "Precompiled Binaries For Windows" has it. >>> regards, >>> praimon >> > From xscottg at gmail.com Fri Aug 21 17:01:58 2009 From: xscottg at gmail.com (Scott Gilbert) Date: Fri Aug 21 17:10:34 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> Message-ID: <443b9d10908211401u52966e41i23b844955d256835@mail.gmail.com> On Fri, Aug 21, 2009 at 11:08 AM, Sam TH wrote: > > I'm disappointed that people think that a Scheme that works well for > education and research can't be the same as one that works well for > writing large-scale programs. I think the existence of PLT Scheme, in > which large quantities of all three are done, is an existence proof of > the opposite. > As explained in the charters for the "small" and "large" languages, the small language is supposed to be a *subset* of the large language. I can't see why this would cause any disappointment. I could be wrong, but I presume PLT Scheme would be interested in implementing the large language, and any libraries written for the small or large languages would therefore be portable to PLT Scheme. Other implementors might not be interested in implementing all of a large language, and there are legitimate reasons for programmers wanting to use those other smaller implementations. (I'm trying, unsuccessfully, to keep this short, so I won't enumerate the reasons.) I think some people are getting hung up with stigmas associated with the words "small" and "large". I could be wrong, but I squint and read between the lines and translate those words as: small = R5RS with extensions and cleanups that everyone can agree on + some changes to make it a compatible subset of "large" large = R6RS with extensions and cleanups that most everyone can agree on It looks like a good start to me. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090821/c9f96cc6/attachment.htm From samth at ccs.neu.edu Fri Aug 21 18:02:35 2009 From: samth at ccs.neu.edu (Sam TH) Date: Fri Aug 21 18:02:55 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <443b9d10908211401u52966e41i23b844955d256835@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <443b9d10908211401u52966e41i23b844955d256835@mail.gmail.com> Message-ID: <63bb19ae0908211502o3bc5dbbct92daa588bf6656af@mail.gmail.com> On Fri, Aug 21, 2009 at 5:01 PM, Scott Gilbert wrote: > > As explained in the charters for the "small" and "large" languages, the > small language is supposed to be a *subset* of the large language.? I can't > see why this would cause any disappointment.? I could be wrong, but I > presume PLT Scheme would be interested in implementing the large language, > and any libraries written for the small or large languages would therefore > be portable to PLT Scheme. What I'm disappointed in is this bit, from the original document: > Small Scheme > > * Constituencies: educators, casual implementors, researchers, embedded languages, "50-page" purists I'm in constituencies 1 and 3 in that list, and I don't see why they belong under 'small' rather than 'large', especially given the excellent experience that many people, myself included, have had doing both teaching and research with PLT Scheme. -- sam th samth@ccs.neu.edu From thomas.gordon at fokus.fraunhofer.de Fri Aug 21 19:27:08 2009 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Fri Aug 21 19:27:52 2009 Subject: [plt-scheme] Re: Scheme Steering Committee Position Statement References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <443b9d10908211401u52966e41i23b844955d256835@mail.gmail.com> <63bb19ae0908211502o3bc5dbbct92daa588bf6656af@mail.gmail.com> Message-ID: Sam TH writes: > I don't see why they > belong under 'small' rather than 'large', especially given the > excellent experience that many people, myself included, have had doing > both teaching and research with PLT Scheme. One way to interpret the proposal is that it is following PLT's lead. PLT isn't one language, but an (extensible) set of languages. At last count, PLT ships with than 10 teaching languages (e.g. Beginning Student .. Advanced Student, and four German language versions), 3 legacy languages (e.g. R5RS), four experimental languages, R6RS and PLT's latest own "Scheme" dialect. Apparently the large versions of PLT are not used for teaching purposes, at least not initially, but rather the smaller versions. -Tom Gordon From spamme at innerpaths.net Fri Aug 21 23:57:35 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Fri Aug 21 23:57:56 2009 Subject: [plt-scheme] Newbie question: using a macro to create a top-level variable? Message-ID: <7220ab64-b59c-491d-b108-a24b9fb4f7af@u20g2000prg.googlegroups.com> Hi! I am working on creating a command-line environment for interactively working with electronic notecards called infocards (see my project http://InfoML.org if this sounds interesting to you). A collection of infocards is called a "rack," and with various manipulations I am creating racks, adding infocards to and deleting them from racks, etc.. Here's my problem. To make racks modifiable, they must be top-level variables created with "(define... )" (Please correct me anywhere that my assumptions are wrong.) For this reason, I've been creating racks as follows: (define ideas (infoml:make-rack-manual 'ideas)) I need the variable named "ideas" so I can manipulate the rack from the command line. I need the symbol 'ideas (which goes into the rack data structure) so that I can, for example, print a list of all existing racks. The thing is, I would like to be able to write the simpler "(infoml:make-rack-manual 'ideas))" and let it create a top-level variable with the same name as the symbol given as an argument. I can't do that within a simple function definition, but I thought I could do it within a macro. Here's what I tried at first (which of course didn't work): (define-syntax-rule (infoml:make-rack rack-symbol) (define rack-symbol (infoml:make-rack-manual rack-symbol))) When I did a macro expand in DrScheme, I could see why it didn't work-- the expansion was: (define (quote rack-symbol) (infoml:make-rack-manual rack-symbol)) Obviously, it was important to get precisely the right thing after the keyword "define". I tried unquoting the symbol; I tried converting the symbol into a string--neither worked. Despite some time spent reading the PLT Scheme documentation, I couldn't get any insight as to what needs to follow "define". Can I do this with a macro? Is my overall reasoning flawed? Am I approaching this problem in the wrong way? Any and all feedback would be greatly appreciated. Thanks. From eli at barzilay.org Sat Aug 22 05:32:29 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Aug 22 05:32:50 2009 Subject: [plt-scheme] Newbie question: using a macro to create a top-level variable? In-Reply-To: <7220ab64-b59c-491d-b108-a24b9fb4f7af@u20g2000prg.googlegroups.com> References: <7220ab64-b59c-491d-b108-a24b9fb4f7af@u20g2000prg.googlegroups.com> Message-ID: <19087.47917.594436.867093@winooski.ccs.neu.edu> On Aug 21, Gregg Williams wrote: > > (define ideas (infoml:make-rack-manual 'ideas)) > > I need the variable named "ideas" so I can manipulate the rack from > the command line. I need the symbol 'ideas (which goes into the rack > data structure) so that I can, for example, print a list of all > existing racks. > > The thing is, I would like to be able to write the simpler > "(infoml:make-rack-manual 'ideas))" and let it create a top-level > variable with the same name as the symbol given as an argument. I > can't do that within a simple function definition, but I thought I > could do it within a macro. Here's what I tried at first (which of > course didn't work): > > (define-syntax-rule (infoml:make-rack rack-symbol) > (define rack-symbol (infoml:make-rack-manual rack-symbol))) > > When I did a macro expand in DrScheme, I could see why it didn't work-- > the expansion was: > > (define (quote rack-symbol) (infoml:make-rack-manual rack-symbol)) > > Obviously, it was important to get precisely the right thing after the > keyword "define". I tried unquoting the symbol; I tried converting the > symbol into a string--neither worked. The thing is that you want to quote one place only. An easy way to do this is: (define-syntax-rule (infoml:make-rack rack-id) (define rack-id (infoml:make-rack-manual 'rack-id))) (infoml:make-rack ideas) ; no quote You can do this with the quote: (define-syntax-rule (infoml:make-rack 'rack-id) (define rack-id (infoml:make-rack-manual 'rack-id))) (infoml:make-rack 'ideas) This looks like it's working, but what's really happening is that the scheme reader sees: (define-syntax-rule (infoml:make-rack (quote rack-id)) (define rack-id (infoml:make-rack-manual (quote rack-id)))) and `quote' is just a pattern variable that matches anything. So if you enter (infoml:make-rack (add1 ideas)) it actually expands to (define ideas (infoml:make-rack-manual (add1 ideas))) To make this way work, you can use the more explicit `syntax-rules', and specify `quote' as a keyword: (define-syntax infoml:make-rack (syntax-rules (quote) [(_ (quote rack-id)) (define rack-id (infoml:make-rack-manual (quote rack-id)))])) and doing this should make it clear that this is all redundant since the `quote' requirement is just an arbitrary piece of syntax that isn't really doing anything. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From ciprian.craciun at gmail.com Sat Aug 22 06:42:37 2009 From: ciprian.craciun at gmail.com (Ciprian Dorin, Craciun) Date: Sat Aug 22 06:49:39 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: <779bf2730908211215w52be1296n35c31b7d4bb63816@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <63bb19ae0908211108j407af3d4q5ccd46df4e848b06@mail.gmail.com> <4A8EE49F.5090100@ccs.neu.edu> <67d0527e0908211153q47a87a19n4cce208e13c96c28@mail.gmail.com> <779bf2730908211215w52be1296n35c31b7d4bb63816@mail.gmail.com> Message-ID: <8e04b5820908220342g3964f126v1d8b011dc3cc56da@mail.gmail.com> On Fri, Aug 21, 2009 at 10:15 PM, YC wrote: > [... snip, snip ...] > > IMHO the appeal of a small language is not that it's easy to use (on the > contrary it is harder because you have to write everything from scratch), > but that it is easy to implement (besides the purity thing) - scheme is one > language where there are hobby implementations, I've not seen one for Perl, > Python, C, etc. > > For the hobby language implementers, Scheme is wildly successful. > [... snip, snip ...] > > My 0.1 cent.? Cheers, > yc +1 for a small+large specification. :) If I may add my opinion to this small+large vs one big specification of the language, I would say that indeed if a language is small (or has a small version, a core let's say), it is more easily implemented and embeddable (as in "called from another language"), and thus it could find way in more corners (niches) than otherwise would. For example while I was working in a telecom company we did some Java development, and because Lisp-like languages and interpreters are easily implemented I was able to create in three days a small interpreter that allowed us to externalize some business logic that would have been a pain to write in pure Java. So it would have been nice to have a small specification that I would have been able to say it followed. This would have allowed me to point my colleagues to existing documentation, tutorials, examples, etc. Also it would allow some IDEs (like Eclipse) to support such a "small" language out of the box (or from "supported" plugins). Ciprian. From neil at neilvandyke.org Sat Aug 22 14:05:51 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sat Aug 22 14:06:13 2009 Subject: [plt-scheme] Scribble defproc without contracts? Message-ID: <4A90337F.6070205@neilvandyke.org> In Scribble, is there an easy way to document a procedure without providing contract info for it? I automatically translate a legacy documentation format to Scribble. This format does not have type info for procedures, so the translator uses "any/c" everywhere that Scribble "defproc" needs contract info, which makes for scary and misleading documentation. "defform" does almost what I want, presentation-wise, except for the part about Scribble thinking it's syntax rather than procedure. If nobody has a simpler way, I will try to steal and adapt code from "manual-form.ss" and have the translator insert it into the generated Scribble files. One reason I'd prefer not to do that is that the Scribble implementation might change. Thanks. -- http://www.neilvandyke.org/ From spamme at innerpaths.net Sat Aug 22 23:56:23 2009 From: spamme at innerpaths.net (Gregg Williams) Date: Sat Aug 22 23:56:47 2009 Subject: [plt-scheme] Re: Newbie question: using a macro to create a top-level variable? In-Reply-To: <19087.47917.594436.867093@winooski.ccs.neu.edu> References: <7220ab64-b59c-491d-b108-a24b9fb4f7af@u20g2000prg.googlegroups.com> <19087.47917.594436.867093@winooski.ccs.neu.edu> Message-ID: <091b1200-5eff-4424-beb4-85f0c103403b@p36g2000prn.googlegroups.com> Thanks for the exceedingly clear explanation of what works and why. Not only do I have a choice of solutions for my immediate situation, but I also learned something you about define-syntax-rule: namely, that there can be arbitrary syntax in the pattern as well as the template. I never would have thought to put the apostrophe into the pattern "(infoml:make-rack 'rack-id)". Thanks again for your help. > > The thing is that you want to quote one place only. ?An easy way to do > this is: > > ? (define-syntax-rule (infoml:make-rack rack-id) > ? ? (define rack-id (infoml:make-rack-manual 'rack-id))) > ? (infoml:make-rack ideas) ; no quote > > You can do this with the quote: > > ? (define-syntax-rule (infoml:make-rack 'rack-id) > ? ? (define rack-id (infoml:make-rack-manual 'rack-id))) > ? (infoml:make-rack 'ideas) > > This looks like it's working, but what's really happening is that the > scheme reader sees: > > ? (define-syntax-rule (infoml:make-rack (quote rack-id)) > ? ? (define rack-id (infoml:make-rack-manual (quote rack-id)))) > > and `quote' is just a pattern variable that matches anything. ?So if > you enter > > ? (infoml:make-rack (add1 ideas)) > > it actually expands to > > ? (define ideas (infoml:make-rack-manual (add1 ideas))) > > To make this way work, you can use the more explicit `syntax-rules', > and specify `quote' as a keyword: > > ? (define-syntax infoml:make-rack > ? ? (syntax-rules (quote) > ? ? ? [(_ (quote rack-id)) > ? ? ? ?(define rack-id (infoml:make-rack-manual (quote rack-id)))])) > > and doing this should make it clear that this is all redundant since > the `quote' requirement is just an arbitrary piece of syntax that > isn't really doing anything. > > -- > ? ? ? ? ? ((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ? ?http://barzilay.org/? ? ? ? ? ? ? ? ? Maze is Life! > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dyrueta at gmail.com Mon Aug 24 09:37:26 2009 From: dyrueta at gmail.com (David Yrueta) Date: Mon Aug 24 09:38:10 2009 Subject: [plt-scheme] HtDP Section 29 -- Abstract Running Time & Big-O Message-ID: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> Hi All -- I have a few questions concerning the section on abstract running time and Big-O in HtDP, discussed here -- http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-36.html#node_sec_29.1 First, I don't understand this statement, which relates to the function "insert" (reproduced below) -- "Because there are *N* applications of insert, we have an average of on the order of *N*2 natural recursions of insert." I tabled the results for 4 "worst-case" scenarios for sort: (list 1), (list 1 2), (list 1 2 3) and (list 1 2 3 4) -- (list 1) -> sort=1 natural recursion (nr); insert=1 nr -> (list 1) (list 1 2) -> sort=2 nr; insert=3 -> (list 2 1) (list 1 2 3) sort=3 nr; insert=6 nr -> (list 3 2 1) (list 1 2 3 4) sort=4 nr; insert=10 nr (list 4 3 2 1) Why are the number of natural recursion for insert described as an exponential function of N? I don't see it. Second question refers to exercise 29.1.1. I'm assuming the definition of a number-tree follows the standard recursive structure, and is not just either "a number" or "a pair of number-trees." If so, I'm not sure how to measure tree sizes, or in other words, compare the size of this tree -- (list 1 2) -- to this tree -- (list (list empty) (list empty)). Do both have an N of 2? If so, is the abstract running time an average of the two? (I wrote the function sum-tree as the requested by the exercise, but am not posting it here out of regard for other students). Third, with regards to exercise 29.2.1, must the constant c referred to in the discussion of Big-O be an integer, or can it be a fractional number? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sortr : list-of-numbers -> list-of-numbers ;; sorts a list-of-numbers in descending order (define (sortr list-of-numbers) (cond [(empty? list-of-numbers) empty] [else (insert (first list-of-numbers) (sortr (rest list-of-numbers)))])) ;; examples & tests ;; (check-expect (sortr (list 1 2 3)) (list 3 2 1)) ;; insert : number (list-of-numbers) -> (list-of-numbers) ;; places number in descending order within a list of numbers (define (insert a list-of-numbers) (cond [(empty? list-of-numbers) (list a)] [(> a (first list-of-numbers)) (cons a list-of-numbers)] [else (cons (first list-of-numbers) (insert a (rest list-of-numbers)))])) ;; examples & tests ;; (check-expect (insert 2 (list 3 1)) (list 3 2 1)) Thanks! Dave Yrueta -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090824/4dda9494/attachment.html From jensaxel at soegaard.net Mon Aug 24 11:14:10 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Mon Aug 24 11:14:33 2009 Subject: [plt-scheme] HtDP Section 29 -- Abstract Running Time & Big-O In-Reply-To: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> References: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> Message-ID: <4072c51f0908240814p2cd9262x8a668f27cbd7a672@mail.gmail.com> 2009/8/24 David Yrueta : > Hi All -- > > I have a few questions concerning the section on abstract running time and > Big-O in HtDP, discussed here -- > http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-36.html#node_sec_29.1 > > First, I don't understand this statement, which relates to the function > "insert" (reproduced below) -- > "Because there are?N?applications of?insert, we have an average of on the > order of?N2?natural recursions of?insert." > > I tabled the results for 4 "worst-case" scenarios for sort: (list 1), (list > 1 2), (list 1 2 3) and (list 1 2 3 4) -- > (list 1) -> sort=1 natural recursion (nr); insert=1 nr -> (list 1) > (list 1 2) -> sort=2 nr; insert=3 -> (list 2 1) > (list 1 2 3) ?sort=3 nr; insert=6 nr -> (list 3 2 1) > (list 1 2 3 4) sort=4 nr; insert=10 nr (list 4 3 2 1) > Why are the number of natural recursion for insert described as an > exponential function of N? ?I don't see it. So adding your results we get: 1+2+3+4 = 10 In general we get: 1+2+3+4+...+n = 1/2*n*(n+1) = 1/2 n^2 + 1/2n The result is quadratic (not exponential) in n. -- Jens Axel S?gaard From dyrueta at gmail.com Mon Aug 24 12:31:39 2009 From: dyrueta at gmail.com (David Yrueta) Date: Mon Aug 24 12:32:23 2009 Subject: [plt-scheme] HtDP Section 29 -- Abstract Running Time & Big-O In-Reply-To: <4072c51f0908240814p2cd9262x8a668f27cbd7a672@mail.gmail.com> References: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> <4072c51f0908240814p2cd9262x8a668f27cbd7a672@mail.gmail.com> Message-ID: <186df66b0908240931v57177162pe463b1e8a907b3ee@mail.gmail.com> Thank you Jens. So it is correct to say with HtDP that "there is an average of on the order of N^2 natural recursions of insert" by ignoring the constants in "1/2 n^2 + 1/2n?" On Mon, Aug 24, 2009 at 8:14 AM, Jens Axel S?gaard wrote: > 2009/8/24 David Yrueta : > > Hi All -- > > > > I have a few questions concerning the section on abstract running time > and > > Big-O in HtDP, discussed here -- > > http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-36.html#node_sec_29.1 > > > > First, I don't understand this statement, which relates to the function > > "insert" (reproduced below) -- > > "Because there are N applications of insert, we have an average of on the > > order of N2 natural recursions of insert." > > > > I tabled the results for 4 "worst-case" scenarios for sort: (list 1), > (list > > 1 2), (list 1 2 3) and (list 1 2 3 4) -- > > (list 1) -> sort=1 natural recursion (nr); insert=1 nr -> (list 1) > > (list 1 2) -> sort=2 nr; insert=3 -> (list 2 1) > > (list 1 2 3) sort=3 nr; insert=6 nr -> (list 3 2 1) > > (list 1 2 3 4) sort=4 nr; insert=10 nr (list 4 3 2 1) > > Why are the number of natural recursion for insert described as an > > exponential function of N? I don't see it. > > So adding your results we get: > 1+2+3+4 = 10 > > In general we get: > > 1+2+3+4+...+n = 1/2*n*(n+1) = 1/2 n^2 + 1/2n > > The result is quadratic (not exponential) in n. > > > -- > Jens Axel S?gaard > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090824/527f9fa8/attachment.htm From jensaxel at soegaard.net Mon Aug 24 13:18:48 2009 From: jensaxel at soegaard.net (=?UTF-8?Q?Jens_Axel_S=C3=B8gaard?=) Date: Mon Aug 24 13:19:08 2009 Subject: [plt-scheme] HtDP Section 29 -- Abstract Running Time & Big-O In-Reply-To: <186df66b0908240931v57177162pe463b1e8a907b3ee@mail.gmail.com> References: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> <4072c51f0908240814p2cd9262x8a668f27cbd7a672@mail.gmail.com> <186df66b0908240931v57177162pe463b1e8a907b3ee@mail.gmail.com> Message-ID: <4072c51f0908241018s3e96b3ffn584e7f2d9674fb2d@mail.gmail.com> 2009/8/24 David Yrueta : > Thank you Jens. > So it is correct to say with HtDP that "there is?an average of on the?order > of?N^2 natural recursions of?insert" by ignoring the constants in "1/2 n^2 + > 1/2n?" Yes. Two functions f and g is said to have the same order of growth if f(n)/g(n) -> c for n->infinity, where c is a non-zero constant. This is indeed the case here, since (1/2 n^2 + 1/2 n)/n^2 -> 1/2 for n->infinity. -- Jens Axel S?gaard From dyrueta at gmail.com Mon Aug 24 13:47:29 2009 From: dyrueta at gmail.com (David Yrueta) Date: Mon Aug 24 13:48:17 2009 Subject: [plt-scheme] HtDP Section 29 -- Abstract Running Time & Big-O In-Reply-To: <4072c51f0908241018s3e96b3ffn584e7f2d9674fb2d@mail.gmail.com> References: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> <4072c51f0908240814p2cd9262x8a668f27cbd7a672@mail.gmail.com> <186df66b0908240931v57177162pe463b1e8a907b3ee@mail.gmail.com> <4072c51f0908241018s3e96b3ffn584e7f2d9674fb2d@mail.gmail.com> Message-ID: <186df66b0908241047o22279536vdb1d07359b8e58fa@mail.gmail.com> Okay, but I'm still a bit hung up on the way N^2 for insert was informally derived by HtDP (if I'm using the terminology incorrectly, please bear with me -- this is my first encounter with notions of growth rates, etc). "Because there are *N* applications of insert, we have an average of on the order of *N*2 natural recursions of insert." Is the point to accept this and move on, or am I missing something important? As I mentioned before, I counted 10 applications of insert for an input of N=4. You derived that same result (I think) by adding the number of elements in the list which insert progressively traverses -- 1+2-3+4=10 -- turning that into a quadratic equation which accepts the number of elements in the list -- 1/2 n^2 + 1/2n -- and outputs abstract running times (N=4; abstract running time = 10). We took the abstract running time as "on the order of n^2" because, as Eugene says, "we ignore the coeeficients because, as n grows, they matter less and less." Am I in the ballpark? Thanks, Dave On Mon, Aug 24, 2009 at 10:18 AM, Jens Axel S?gaard wrote: > 2009/8/24 David Yrueta : > > Thank you Jens. > > So it is correct to say with HtDP that "there is an average of on > the order > > of N^2 natural recursions of insert" by ignoring the constants in "1/2 > n^2 + > > 1/2n?" > > Yes. Two functions f and g is said to have the same order of growth > if f(n)/g(n) -> c for n->infinity, where c is a non-zero constant. > > This is indeed the case here, since > > (1/2 n^2 + 1/2 n)/n^2 -> 1/2 for n->infinity. > > -- > Jens Axel S?gaard > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090824/dcaebe86/attachment.html From sbloch at adelphi.edu Mon Aug 24 14:31:28 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Aug 24 14:33:01 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> Message-ID: One of the great things about having a macro system is that you can write extensions with different syntax. In at least PLT, you can even redefine the reader to parse, say, C syntax rather than Scheme s- expressions. So why not just put all the "large language" stuff into optional libraries? The "core" language would need to standardize the basic stuff that all reasonable Schemes agree on anyway, plus enough about modules and macros to write and invoke those libraries in a portable way. Presumably the most popular of these optional libraries would come to be bundled with all the common implementations, so they would be a de facto standardized programming base. We would still have to negotiate a common ground among the various module system, and among the various macro systems, but that seems more manageable than trying to standardize everything that any professional programmer anywhere might want in the language. And conceptually simpler than having a "small" language standard and a "big" language standard. But I'm not a Scheme-language mucky-muck; this approach is so obvious that the committee must have thought of it and rejected it for some reason. Stephen Bloch sbloch@adelphi.edu From wookiz at hotmail.com Mon Aug 24 16:15:46 2009 From: wookiz at hotmail.com (wooks) Date: Mon Aug 24 16:17:09 2009 Subject: [plt-scheme] Re: HtDP Section 29 -- Abstract Running Time & Big-O In-Reply-To: <186df66b0908241047o22279536vdb1d07359b8e58fa@mail.gmail.com> References: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> <4072c51f0908240814p2cd9262x8a668f27cbd7a672@mail.gmail.com> <186df66b0908240931v57177162pe463b1e8a907b3ee@mail.gmail.com> <4072c51f0908241018s3e96b3ffn584e7f2d9674fb2d@mail.gmail.com> <186df66b0908241047o22279536vdb1d07359b8e58fa@mail.gmail.com> Message-ID: <4ef5dfab-83c6-45e4-8233-30e81fb87535@o36g2000vbl.googlegroups.com> On Aug 24, 10:47?am, David Yrueta wrote: > Okay, but I'm still a bit hung up on the way N^2 for insert was informally > derived by HtDP (if I'm using the terminology incorrectly, please bear with > me -- this is my first encounter with notions of growth rates, etc). > ?"Because there are *N* applications of insert, we have an average of on the > order of *N*2 natural recursions of insert." > N applications of insert but the size of the problem decreases by one on every iteration so the sum is a triangle number ( a search on that term will probably yield a derivation of the formula Jens mentioned in his first reply). From sbloch at adelphi.edu Mon Aug 24 16:49:12 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Aug 24 16:51:09 2009 Subject: [BULK] [plt-scheme] HtDP Section 29 -- Abstract Running Time & Big-O In-Reply-To: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> References: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> Message-ID: <3D56E89A-3F66-4AD1-9E75-1003025D708B@adelphi.edu> On Aug 24, 2009, at 9:37 AM, David Yrueta wrote: > "Because there are N applications of insert, we have an average of > on the order of N2 natural recursions of insert." There's some hand-waving going on behind this sentence, hiding the fact that \Sigma_{i=1}^n i is n(n+1)/2, which is O(n^2) after ignoring constants. > Third, with regards to exercise 29.2.1, must the constant c > referred to in the discussion of Big-O be an integer, or can it be > a fractional number? It doesn't matter. If the statement is true with a fractional number, then it's also true for the next larger integer. Stephen Bloch sbloch@adelphi.edu From sbloch at adelphi.edu Mon Aug 24 17:07:42 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Aug 24 17:11:04 2009 Subject: [plt-scheme] HtDP Section 29 -- Abstract Running Time & Big-O In-Reply-To: <186df66b0908241047o22279536vdb1d07359b8e58fa@mail.gmail.com> References: <186df66b0908240637y289810bak56cebf16f51df4b1@mail.gmail.com> <4072c51f0908240814p2cd9262x8a668f27cbd7a672@mail.gmail.com> <186df66b0908240931v57177162pe463b1e8a907b3ee@mail.gmail.com> <4072c51f0908241018s3e96b3ffn584e7f2d9674fb2d@mail.gmail.com> <186df66b0908241047o22279536vdb1d07359b8e58fa@mail.gmail.com> Message-ID: On Aug 24, 2009, at 1:47 PM, David Yrueta wrote: > ... a quadratic equation which accepts the number of elements in > the list -- 1/2 n^2 + 1/2n -- and outputs abstract running times > (N=4; abstract running time = 10). We took the abstract running > time as "on the order of n^2" because, as Eugene says, "we ignore > the coeeficients because, as n grows, they matter less and less." > Am I in the ballpark? Yes, that's on the right track. If Program A runs twice as fast (or ten times as fast) as Program B, you can make up the difference by running Program B on faster hardware, or a better operating system, or with a more-optimizing compiler, or something like that. But if Program A runs in O(n) time and Program B in O(n^2) time, nothing you can do will make Program B consistently faster than Program A, short of changing the algorithm. Now suppose your goal is to study algorithmic efficiency, and you're not interested in hardware, compiler optimizations, or operating systems. By ignoring constant factors, the effects of hardware, compiler, and operating system disappear completely and you're left with only differences between algorithms. It's like one of those pictures where there's a message written in blue dots, obscured by a lot of red dots: if you look at it through a red filter, the red dots disappear and you're left with a clear view of what you were interested in. One can introduce ordering operators "<", ">", "<=", ">=", and "=" into the space of functions. (I'll keep the quotation marks, to distinguish these things from ordinary numeric ordering operators.) If function f, in the long run, is at most a constant factor larger than g, then we say f "<=" g or g ">=" f. If f "<=" g and simultaneously g "<=" f, we say f "=" g, and that f and g have the same order of growth. If f "<=" g but it's NOT true that g "<=" f, we say that f "<" g, i.e. that f grows strictly slower than g. In fact, these operators act pretty much the way you expect except that they don't obey trichotomy, i.e. it's quite possible for particular functions f and g to satisfy none of "<", "=", nor ">". It turns out that once you agree to ignore constant factors, you are forced to also ignore slower-growing additive terms, because (for example) n^2 "<=" n^2+n "<=" 2n^2 "=" n^2. n^2+n, being pinched in between two things that are "equal", must be "equal" to both of them. (This is intuitive reasoning, but it can also be made rigorous.) Stephen Bloch sbloch@adelphi.edu From erich at snafu.de Tue Aug 25 09:24:37 2009 From: erich at snafu.de (Erich Rast) Date: Tue Aug 25 09:44:15 2009 Subject: [plt-scheme] Scheme Steering Committee Position Statement In-Reply-To: References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> Message-ID: <1251206677.26578.42.camel@darkstar> Elegancy and ease of implementation suggests a small language. In the real world, a batteries-included standard suitable for writing programs that can run on various platforms/Scheme implementations is needed. Both views are obviously right. Therefore, R7RS should specify an onion model: R7RS Core: extremely small core language (sort of like the Scheme assembler, possibly smaller than R6RS, but ideally including an FFI) R7RS Plus: R7RS Core + a number of libraries that make the language as big or slightly bigger than R6RS + standard libraries R7RS GUI: R7RS Plus + a standard, cross-platform GUI widget library that supports *all* common user-interface widgets (not just a small subset) If the Steering Committee follows this model and takes a lot of time and care, I predict grand success. ;-) Otherwise, I'm not so sure if I'm really interested in yet another 'standard.' I treat Plt scheme as a development platform/language of its own and it suits my needs fine. Best, Erich > why not just put all the "large language" stuff into > optional libraries? That's fine, as long as the optional libraries are also specified by the standard. Otherwise, the standard document just specifies something that nobody actually uses. > The "core" language would need to standardize > the basic stuff that all reasonable Schemes agree on anyway, plus > enough about modules and macros to write and invoke those libraries > in a portable way. Presumably the most popular of these optional > libraries would come to be bundled with all the common > implementations, so they would be a de facto standardized programming > base. From gmarceau at gmail.com Tue Aug 25 16:45:04 2009 From: gmarceau at gmail.com (Guillaume Marceau) Date: Tue Aug 25 17:27:45 2009 Subject: [plt-scheme] Re: Scheme Steering Committee Position Statement In-Reply-To: <1251206677.26578.42.camel@darkstar> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <1251206677.26578.42.camel@darkstar> Message-ID: <51be3630-06cc-46a4-a57f-4f1cccefe9a9@z34g2000vbl.googlegroups.com> > R7RS Core: extremely small core language (sort of like the Scheme > assembler, possibly smaller than R6RS, but ideally including an FFI) > > R7RS Plus: R7RS Core + a number of libraries that make the language as > big or slightly bigger than R6RS + standard libraries > > R7RS GUI: R7RS Plus + a standard, cross-platform GUI widget library that > supports *all* common user-interface widgets (not just a small subset) I remember discussing this strategy with Matthew some time in 2002. I can't remember what his objection was, but he wasn't moved. To your list, I would actually add: R7BS Bytecode: a bytecode that conforming compilers can write, and that conforming run-time environments can read, in addition to which evernative compilation strategy they use. If all the Schemes are so different that they might actually be different languages, and if bytecode is the solution to interoperability between languages in the JVM/CLR/Parrot world, then perhaps the Scheme world should have its own bytecode too. From namekuseijin at gmail.com Tue Aug 25 17:35:21 2009 From: namekuseijin at gmail.com (namekuseijin) Date: Tue Aug 25 17:35:39 2009 Subject: [plt-scheme] Re: Scheme Steering Committee Position Statement In-Reply-To: <51be3630-06cc-46a4-a57f-4f1cccefe9a9@z34g2000vbl.googlegroups.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <1251206677.26578.42.camel@darkstar> <51be3630-06cc-46a4-a57f-4f1cccefe9a9@z34g2000vbl.googlegroups.com> Message-ID: <67d0527e0908251435o240063anb38e1b0069e551f1@mail.gmail.com> On Tue, Aug 25, 2009 at 5:45 PM, Guillaume Marceau wrote: > To your list, I would actually add: > > ? R7BS Revised 7th BS? From matthias at ccs.neu.edu Tue Aug 25 17:37:37 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Aug 25 17:38:13 2009 Subject: [plt-scheme] Re: Scheme Steering Committee Position Statement In-Reply-To: <67d0527e0908251435o240063anb38e1b0069e551f1@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <1251206677.26578.42.camel@darkstar> <51be3630-06cc-46a4-a57f-4f1cccefe9a9@z34g2000vbl.googlegroups.com> <67d0527e0908251435o240063anb38e1b0069e551f1@mail.gmail.com> Message-ID: I sure like the BS part :-) On Aug 25, 2009, at 5:35 PM, namekuseijin wrote: > On Tue, Aug 25, 2009 at 5:45 PM, Guillaume > Marceau wrote: >> To your list, I would actually add: >> >> R7BS > > Revised 7th BS? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From fahree at gmail.com Tue Aug 25 18:05:12 2009 From: fahree at gmail.com (=?ISO-8859-1?Q?Far=E9?=) Date: Tue Aug 25 18:11:02 2009 Subject: [plt-scheme] Re: Scheme Steering Committee Position Statement In-Reply-To: <51be3630-06cc-46a4-a57f-4f1cccefe9a9@z34g2000vbl.googlegroups.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <1251206677.26578.42.camel@darkstar> <51be3630-06cc-46a4-a57f-4f1cccefe9a9@z34g2000vbl.googlegroups.com> Message-ID: <653bea160908251505i104cd37fx2d33ddfa691f658d@mail.gmail.com> > To your list, I would actually add: > > ? R7BS Bytecode: a bytecode that conforming compilers can write, and > that conforming > ? run-time environments can read, in addition to which evernative > compilation strategy > ? they use. I propose the following extensible bytecode: Code 40 would denote a function call, a macro to expand, or a list, depending on the context. Codes 97 to 122 (and a few more) would combine to indicate an abstract location, that itself could designate a variable or macro. Codes 32, 10, 13, 8 (not recommended) and some more would separate elements of the bytecode. Code 39 would be a magic reflection operator allowing to access some high-level representation of what might otherwise be compiled. Codes 48 to 57 would help encode immediate numeric constants. Code 41 would denote the end of the function call, macro, or list. etc. This may sound painful, but with a proper bytecode editor, and proper training, it could even be somewhat human readable! Now to agree what the predefined abstract locations guaranteed to be bound (and none others) and to what, in the initial context. > If all the Schemes are so different that they might actually be > different languages, and if bytecode is the solution to > interoperability between languages in the JVM/CLR/Parrot world, then > perhaps the Scheme world should have its own bytecode too. My proposed solution to interoperability is: have a big multibillion-dollar company or government push for the use of R7RS, and lots of people will follow suit and interoperate with it. [ Fran?ois-Ren? ?VB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] Oh, he's sincere all right. The question is: what is he sincere about? -- John McCarthy From hendrik at topoi.pooq.com Tue Aug 25 20:05:44 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Tue Aug 25 20:06:23 2009 Subject: [plt-scheme] Re: Scheme Steering Committee Position Statement In-Reply-To: <653bea160908251505i104cd37fx2d33ddfa691f658d@mail.gmail.com> References: <184222e50908210918u1db74008t792ab895303d046f@mail.gmail.com> <1251206677.26578.42.camel@darkstar> <51be3630-06cc-46a4-a57f-4f1cccefe9a9@z34g2000vbl.googlegroups.com> <653bea160908251505i104cd37fx2d33ddfa691f658d@mail.gmail.com> Message-ID: <20090826000544.GA16386@topoi.pooq.com> On Tue, Aug 25, 2009 at 06:05:12PM -0400, Far? wrote: > > I propose the following extensible bytecode: Code 40 would denote a ( :-) From leximatica at mac.com Tue Aug 25 20:25:41 2009 From: leximatica at mac.com (David Richards) Date: Tue Aug 25 21:26:06 2009 Subject: [plt-scheme] puzzled by 'new' failure Message-ID: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> This one line program fails: (define frame (new frame% (label "test"))) Any advice, please? From aconchillo at gmail.com Tue Aug 25 21:26:14 2009 From: aconchillo at gmail.com (=?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?=) Date: Tue Aug 25 21:26:34 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 Message-ID: Hi, I'm playing a bit with chapter 6 source code. While doing exercise 6.4.2 (explicit with) I found out that I was not able to use 'with' for functions, that is: {with {double {fun {x} {+ x x}}} {double 5}} Then I also tried it with redundant with, and another problem arose, as "aSub" second argument needs to be a FAE not a closureV, which is what we get interpreting (interp arg-expr ds). Using a lazy regime (exercise 6.6.1) we solve the issue for both cases (we do not evaluate arg-expr nor named-expr), but of course, we need to repeat things (I think chapter 8 solves this). [id (v) (interp (lookup-defrdsub v ds) ds)] [with (name named-expr body) (interp body (aSub name named-expr ds))] [app (fun-expr arg-expr) (let ([fun-val (interp fun-expr ds)]) (interp (closureV-body fun-val) (aSub (closureV-param fun-val) arg-expr (closureV-ds fun-val))))] I tried to solve the problem with eager regime but I was getting a too complicated code. I'm not sure if that's the idea, so any comment or hint would be appreciated. Best regards, Aleix From rafkind at cs.utah.edu Tue Aug 25 21:33:30 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Tue Aug 25 21:35:29 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> Message-ID: <4A9490EA.7040009@cs.utah.edu> David Richards wrote: > This one line program fails: > > (define frame (new frame% (label "test"))) > > Any advice, please? > ___________________________________________ Whats the error? > ______ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Tue Aug 25 21:36:08 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Tue Aug 25 22:07:07 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 In-Reply-To: References: Message-ID: You have at least a partial understanding of what is going on, which is a start. However, you haven't stated a concrete question. What precisely is the problem you're trying to solve (in your own words), and how far do you think you've gotten? Do you think you have a solution that is correct but too complex, or one that is correct but only partial, or no solution at all? Shriram From leximatica at mac.com Wed Aug 26 00:05:26 2009 From: leximatica at mac.com (David Richards) Date: Wed Aug 26 00:24:20 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: <4A9490EA.7040009@cs.utah.edu> References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> <4A9490EA.7040009@cs.utah.edu> Message-ID: <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> On Aug 25, 2009, at 9:33 PM, Jon Rafkind wrote: > David Richards wrote: >> This one line program fails: >> >> (define frame (new frame% (label "test"))) >> >> Any advice, please? >> ___________________________________________ > Whats the error? reference to undefined identified: new >> ______ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Wed Aug 26 00:27:56 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Wed Aug 26 00:35:53 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> <4A9490EA.7040009@cs.utah.edu> <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> Message-ID: What language are you writing it in? scheme/gui? #lang scheme/gui (define frame (new frame% (label "test"))) On Tue, Aug 25, 2009 at 10:05 PM, David Richards wrote: > > On Aug 25, 2009, at 9:33 PM, Jon Rafkind wrote: > >> David Richards wrote: >>> >>> This one line program fails: >>> >>> (define frame (new frame% (label "test"))) >>> >>> Any advice, please? >>> ___________________________________________ >> >> Whats the error? > > reference to undefined identified: new > >>> ______ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From rafkind at cs.utah.edu Wed Aug 26 01:29:26 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Wed Aug 26 01:31:20 2009 Subject: [plt-scheme] generators with sequences Message-ID: <4A94C836.7090608@cs.utah.edu> I wrote a generator syntax for use with the v4 `for' sequences. Some example usages are below but the main point is you can say (yield 5) when you want a function to produce a value that can be used as a sequence. It took me a few tries to get this right and I left most of my attempts in so others can maybe learn what not to do. This could go into collects/, so if anyone has any improvements please share! The last attempt (test4) is my best effort so far. #lang scheme (require scheme/control) (require scheme/stxparam) (define (check v1 v2) (when (not (equal? v1 v2)) (printf "test failed expected ~a actual ~a\n" v1 v2))) (define (do-tests for-function) (check (for/list ([i (in-range 0 10)]) i) (for/list ([i (in-range 0 10)]) i)) #; (let ([x 0]) (for/list ([i (for-function)]) (printf "i ~a x ~a\n" i x) (set! x (add1 x)) i)) (check (for/list ([i (in-range 0 10)]) i) (let ([x 0]) (for/list ([i (for-function)]) ;; (printf "i ~a x ~a\n" i x) (set! x (add1 x)) i))) (for/list ([i (for-function)] [j (in-range 0 5)]) ;; (printf "i ~a j ~a\n" i j) (list i j)) (check (for/list ([i (in-range 0 10)] [j (in-range 0 5)]) (list i j)) (for/list ([i (for-function)] [j (in-range 0 5)]) ;; (printf "i ~a j ~a\n" i j) (list i j))) (check (for/list ([i (in-range 0 10)] [j (in-range 0 10)]) (list i j)) (for/list ([i (for-function)] [j (for-function)]) (list i j))) (check (for/list ([(v vi) (in-indexed (in-range 0 10))]) (list v vi)) (for/list ([(v vi) (in-indexed (for-function))]) (list v vi))) (check (for/list ([v (in-sequences (in-range 0 10) (in-range 0 10))]) v) (for/list ([v (in-sequences (for-function) (for-function))]) v)) ;; doesn't work yet #; (check (for/list ([v (in-cycle (in-range 0 10))] [x (in-range 0 100)]) v) (for/list ([v (in-cycle (for-function))] [x (in-range 0 100)]) (printf "~a ~a\n" v x) v)) ) ;; completely broken version using call/cc and creating too many sequence objects (define test1 (let () (define-syntax yield (syntax-rules () [(_ yielder value) (call/cc (lambda (ret) (let ([s (make-do-sequence (lambda () (values (lambda (i) value) (lambda (x) (ret #f)) 0 (lambda (x) #t) (lambda (v) (eq? v value)) (lambda (x v) #t))))]) (yielder s))))])) (define-syntax define-generator (syntax-rules () [(_ ret (name args ...) body0 bodies ...) (define (name args ...) (call/cc (lambda (ret) body0 bodies ... (make-do-sequence (lambda () (values (lambda (i) (void)) (lambda (x) (void)) 0 (lambda (x) #f) (lambda (x) #f) (lambda (x y) #f)))) )))])) (define-generator yielder (blah) (for ([x (in-range 0 10)]) (yield yielder x))) (printf "test1\n") (do-tests blah) )) ;; working version using prompt/control (define test2 (let () (define-syntax yield (syntax-rules () [(_ value) ;; Capture the current delimited continuation, f, and pass back to the last prompt a, ;; value and a function that installs a new prompt and continues where f left off. (control f (values value (lambda () (prompt (f)))))])) (define-syntax lambda-generator (syntax-rules () [(_ (args ...) body0 bodies ...) (lambda (args ...) (let* ([current (lambda () (prompt body0 bodies ... ;; (printf "now what\n") (values #f #f) ))] [pos 0] [seq (make-do-sequence (lambda () (values (lambda (i) (let-values ([(value next) (current)]) ;; (printf "Next value is ~a\n" value) (set! current next) value)) (lambda (x) (add1 x)) 0 (lambda (x) current) (lambda (v) current) (lambda (x v) current))))]) seq))])) (define-syntax define-generator (syntax-rules () [(_ (name args ...) body0 bodies ...) (define name (lambda-generator (args ...) body0 bodies ...))])) (define-generator (blah) (for ([x (in-range 0 10)]) (yield x))) (printf "test2\n") (do-tests blah) #; (printf "test3\n") #; (do-tests (lambda () (make-do-sequence (lambda () (values (lambda (i) i) (lambda (x) (add1 x)) 0 (lambda (x) (< x 10)) (lambda (v) #t) (lambda (x v) #t)))))) ;; a cute example #; (let () ;; generate infinte list of unique names (define-generator (machine-names) (define letters "abcdefghijklmnopqrstuvwxyz") (let loop ([len 0]) ;; generates strings of length num (define-generator (generate num) (for ([letter (in-string letters)]) (if (= num 0) (yield (string letter)) (for ([l2 (generate (- num 1))]) (yield (string-append (string letter) l2)))))) (for ([str (generate len)]) (yield str)) (loop (add1 len)))) (for ([s (machine-names)] [j (in-range 0 1000)]) (printf "~a: ~a\n" j s))) )) ;; better version using shift/reset (define test3 (let () (define-syntax yield (syntax-rules () [(_ value) (shift f (values value f))])) (define-syntax lambda-generator (syntax-rules () [(_ (args ...) body0 bodies ...) (lambda (args ...) (let* ([current (lambda () (reset body0 bodies ... ;; (printf "now what\n") (values #f #f) ))] [pos 0] [seq (make-do-sequence (lambda () (values (lambda (i) (let-values ([(value next) (current)]) ;; (printf "Next value is ~a\n" value) (set! current next) value)) (lambda (x) (add1 x)) 0 (lambda (x) current) (lambda (v) current) (lambda (x v) current))))]) seq))])) (define-syntax define-generator (syntax-rules () [(_ (name args ...) body0 bodies ...) (define name (lambda-generator (args ...) body0 bodies ...))])) (define-generator (blah) (for ([x (in-range 0 10)]) (yield x))) (printf "test3\n") (do-tests blah) #; (printf "test3\n") #; (do-tests (lambda () (make-do-sequence (lambda () (values (lambda (i) i) (lambda (x) (add1 x)) 0 (lambda (x) (< x 10)) (lambda (v) #t) (lambda (x v) #t)))))) ;; a cute example #; (let () ;; generate infinte list of unique names (define-generator (machine-names) (define letters "abcdefghijklmnopqrstuvwxyz") (let loop ([len 0]) ;; generates strings of length num (define-generator (generate num) (for ([letter (in-string letters)]) (if (= num 0) (yield (string letter)) (for ([l2 (generate (- num 1))]) (yield (string-append (string letter) l2)))))) (for ([str (generate len)]) (yield str)) (loop (add1 len)))) (for ([s (machine-names)] [j (in-range 0 1000)]) (printf "~a: ~a\n" j s))) )) ;; better version of shift/reset using continuation tags ;; also use a unique value to determine the end of the sequence instead of using #f (define test4 (let () (define-syntax-parameter yield (lambda (stx) (raise-syntax-error #f "yield is only bound inside a sequence generator"))) (define-syntax lambda-generator (syntax-rules () [(_ (args ...) body0 bodies ...) (lambda (args ...) (let* ([last (lambda () (void))] ;; current is a function that invokes user code and produces values [current (lambda () ;; a unique tag to jump to (define tag (make-continuation-prompt-tag)) ;; give the value to the sequence (define next (lambda (value) (shift-at tag f (values value f)))) (syntax-parameterize ([yield (make-rename-transformer #'next)]) (reset-at tag body0 bodies ... (values #f last) )))] [pos 0] [seq (make-do-sequence (lambda () (values ;; produce a value and a continuation (lambda (i) (let-values ([(value next) (current)]) ;; set! is ugly but can we do better? (set! current next) value)) (lambda (x) (add1 x)) 0 (lambda (x) (not (eq? last current))) (lambda (v) (not (eq? last current))) (lambda (x v) (not (eq? last current))))))]) seq))])) (define-syntax define-generator (syntax-rules () [(_ (name args ...) body0 bodies ...) (define name (lambda-generator (args ...) body0 bodies ...))])) (define-generator (blah) (for ([x (in-range 0 10)]) (yield x))) (printf "test4\n") (do-tests blah) (check (for/list ([i ((lambda-generator () (for ([i (in-range 0 5)]) (yield #f))))]) i) (for/list ([i (in-range 0 5)]) #f)) (check (for/list ([i ((lambda-generator () (for ([i (in-range 0 5)]) (yield (reset (for ([j (in-range 2 5)]) (shift k (+ i j))))))))]) i) (for/list ([i (in-range 2 7)]) i)) #; (printf "test3\n") #; (do-tests (lambda () (make-do-sequence (lambda () (values (lambda (i) i) (lambda (x) (add1 x)) 0 (lambda (x) (< x 10)) (lambda (v) #t) (lambda (x v) #t)))))) ;; a cute example #; (let () ;; generate infinte list of unique names (define-generator (machine-names) (define letters "abcdefghijklmnopqrstuvwxyz") (let loop ([len 0]) ;; generates strings of length num (define-generator (generate num) (for ([letter (in-string letters)]) (if (= num 0) (yield (string letter)) (for ([l2 (generate (- num 1))]) (yield (string-append (string letter) l2)))))) (for ([str (generate len)]) (yield str)) (loop (add1 len)))) (for ([s (machine-names)] [j (in-range 0 1000)]) (printf "~a: ~a\n" j s))) )) From rafkind at cs.utah.edu Wed Aug 26 01:34:35 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Wed Aug 26 01:36:38 2009 Subject: [OT] [Fwd: Re: [plt-scheme] generators with sequences] Message-ID: <4A94C96B.10104@cs.utah.edu> I sent two emails (not including this one) to the PLT list today and both times got a response from friendfeed. What is this thing? I only seem to get a response from friendfeed when I send emails to the PLT list. -------------- next part -------------- An embedded message was scrubbed... From: FriendFeed Subject: Re: [plt-scheme] generators with sequences Date: Tue, 25 Aug 2009 22:31:39 -0700 (PDT) Size: 24329 Url: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090825/79b260df/plt-schemegeneratorswithsequences-0001.eml From aconchillo at gmail.com Wed Aug 26 04:42:35 2009 From: aconchillo at gmail.com (=?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?=) Date: Wed Aug 26 04:42:55 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 In-Reply-To: References: Message-ID: On Wed, Aug 26, 2009 at 03:36, Shriram Krishnamurthi wrote: > You have at least a partial understanding of what is going on, which > is a start. ?However, you haven't stated a concrete question. ?What > precisely is the problem you're trying to solve (in your own words), > and how far do you think you've gotten? ?Do you think you have a > solution that is correct but too complex, or one that is correct but > only partial, or no solution at all? > The problem is that I didn't know if I should get further with the eager regime or not (and well, it was 3:30am). With further I mean having a complete language with every thing seen so far working on, and with the eager regime I did not achieve it. I did not have a concrete question, I just needed some hint to see if I was following the right path. In fact, I solved my problem using lazy regime without even being completely conscious about it and before reading exercise 6.6.1. Your answer does really help, I will keep on working with the eager regime, as the lazy one makes sense to my mind as it is now. Thanks, Aleix From erich at snafu.de Wed Aug 26 05:04:23 2009 From: erich at snafu.de (Erich Rast) Date: Wed Aug 26 05:04:39 2009 Subject: [OT] [Fwd: Re: [plt-scheme] generators with sequences] In-Reply-To: <4A94C96B.10104@cs.utah.edu> References: <4A94C96B.10104@cs.utah.edu> Message-ID: <1251277463.1822.6.camel@darkstar> > I sent two emails (not including this one) to the PLT list today and > both times got a response from friendfeed. What is this thing? It appears to me that it's some email to Facebook et. al. gateway, designed to reinvent the wheel, invade your privacy, store other people's data on huge server farms, and generally make lots of $$$ Personally, I consider the use of such services on mailing lists bad etiquette and my advice is to not use them and not click on the confirmation links. That's just my opinion, though. Call me old-fashioned. Best, Erich From aconchillo at gmail.com Wed Aug 26 09:17:46 2009 From: aconchillo at gmail.com (=?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?=) Date: Wed Aug 26 09:18:06 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 In-Reply-To: References: Message-ID: On Wed, Aug 26, 2009 at 03:36, Shriram Krishnamurthi wrote: > You have at least a partial understanding of what is going on, which > is a start. ?However, you haven't stated a concrete question. ?What > precisely is the problem you're trying to solve (in your own words), > and how far do you think you've gotten? ?Do you think you have a > solution that is correct but too complex, or one that is correct but > only partial, or no solution at all? > OK, I think I finally get it, correct me if wrong. With eager regime we need to store FAE-Value types in the repository, which are, in fact, the possible outputs of our evaluation, so interpreting before storing in the repository is what we need. With lazy evaluation we store FAE expressions in the repository directly leaving the evaluation until needed (until lookup). The origin of my problem was that I used DefrdSub defined in 6.4. There, it should use FAE-Value (which is not yet explained). Now, I've seen that the code of the interpreter is correct at the end of the chapter. I always try to do it by myself, so I had to fight a bit until everything made sense, but that helps understanding things much better. Cheers, Aleix From scheme at phirho.com Wed Aug 26 09:31:44 2009 From: scheme at phirho.com (Thomas Holubar) Date: Wed Aug 26 09:41:45 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 Message-ID: <4A953940.7040900@phirho.com> Hi Aleix! Aleix Conchillo Flaqu? wrote: > Hi, > > I'm playing a bit with chapter 6 source code. While doing exercise > 6.4.2 (explicit with) I found out that I was not able to use 'with' > for functions, that is: > > {with {double {fun {x} {+ x x}}} {double 5}} > > Then I also tried it with redundant with, and another problem arose, > as "aSub" second argument needs to be a FAE not a closureV, which is > what we get interpreting (interp arg-expr ds). Why needs the second argument to be a FAE? Couldn't it be a FAE-Value? That one is "closure compatible"... Regards, Thomas From eli at barzilay.org Wed Aug 26 09:44:56 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Aug 26 09:45:17 2009 Subject: [OT] [Fwd: Re: [plt-scheme] generators with sequences] In-Reply-To: <4A94C96B.10104@cs.utah.edu> References: <4A94C96B.10104@cs.utah.edu> Message-ID: <19093.15448.308573.594276@winooski.ccs.neu.edu> On Aug 25, Jon Rafkind wrote: > I sent two emails (not including this one) to the PLT list today and > both times got a response from friendfeed. What is this thing? I > only seem to get a response from friendfeed when I send emails to > the PLT list. If anyone sees such problems, please forward the offending email to me. I need the *complete* set of headers. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From eli at barzilay.org Wed Aug 26 10:22:13 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Aug 26 10:22:34 2009 Subject: [plt-scheme] [OT] FriendFeed In-Reply-To: <19093.15448.308573.594276@winooski.ccs.neu.edu> References: <4A94C96B.10104@cs.utah.edu> <19093.15448.308573.594276@winooski.ccs.neu.edu> Message-ID: <19093.17685.25947.360107@winooski.ccs.neu.edu> On Aug 26, Eli Barzilay wrote: > On Aug 25, Jon Rafkind wrote: > > I sent two emails (not including this one) to the PLT list today > > and both times got a response from friendfeed. What is this thing? > > I only seem to get a response from friendfeed when I send emails > > to the PLT list. > > If anyone sees such problems, please forward the offending email to > me. I need the *complete* set of headers. As for this particular case, just replying got me a sample... It looks like someone has set up a FriendFeed group (whatever that is), and FriendFeed is stupid enough[*] to reply to each an every poster directly. Whoever set this thing up, please contact me asap. [ [*] There is a reason there, of course -- you force more people to get to your web site, which means that you have more chances of getting people to subscribe. But the real stupidity is people not realizing that pissing people off is not a great way to have them subscribe. For some reason, decades of success stories from sites that are strict about not annoying you (eg, google with no flash ads) are ignored over and over again. ] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From aconchillo at gmail.com Wed Aug 26 10:30:46 2009 From: aconchillo at gmail.com (=?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?=) Date: Wed Aug 26 10:31:06 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 In-Reply-To: <4A952961.4080207@phirho.com> References: <4A952961.4080207@phirho.com> Message-ID: On Wed, Aug 26, 2009 at 14:24, Thomas Holubar wrote: > Hi Aleix! > > Why needs the second argument to be a FAE? > Couldn't it be a FAE-Value? That one is "closure compatible"... > Yes, thanks Thomas. As I said in the other mail, that was the problem. Everything makes sense now. Aleix From eli at barzilay.org Wed Aug 26 10:37:41 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Aug 26 10:38:04 2009 Subject: [plt-scheme] [OT] FriendFeed In-Reply-To: <19093.17685.25947.360107@winooski.ccs.neu.edu> References: <4A94C96B.10104@cs.utah.edu> <19093.15448.308573.594276@winooski.ccs.neu.edu> <19093.17685.25947.360107@winooski.ccs.neu.edu> Message-ID: <19093.18613.961915.114343@winooski.ccs.neu.edu> On Aug 26, Eli Barzilay wrote: > > It looks like someone has set up a FriendFeed group (whatever that > is), and FriendFeed is stupid enough[*] to reply to each an every > poster directly. Whoever set this thing up, please contact me asap. In any case I found the offending email, and disabled mail delivery. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From matthias at ccs.neu.edu Wed Aug 26 10:46:21 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Aug 26 10:47:05 2009 Subject: [plt-scheme] generators with sequences In-Reply-To: <4A94C836.7090608@cs.utah.edu> References: <4A94C836.7090608@cs.utah.edu> Message-ID: <31441A25-7C63-49FB-AED2-48967B201F7F@ccs.neu.edu> Write up a section for the Guide, check it in as an aux library for for-loops, and advertise. I am sure Matthew can show you where the Guide lives and what the editorial rules are. -- Matthias On Aug 26, 2009, at 1:29 AM, Jon Rafkind wrote: > I wrote a generator syntax for use with the v4 `for' sequences. Some > example usages are below but the main point is you can say (yield 5) > when you want a function to produce a value that can be used as a > sequence. It took me a few tries to get this right and I left most > of my attempts in so others can maybe learn what not to do. This > could go into collects/, so if anyone has any improvements please > share! The last attempt (test4) is my best effort so far. > > #lang scheme > > (require scheme/control) > (require scheme/stxparam) > (define (check v1 v2) > (when (not (equal? v1 v2)) > (printf "test failed expected ~a actual ~a\n" v1 v2))) > > (define (do-tests for-function) > (check (for/list ([i (in-range 0 10)]) > i) > (for/list ([i (in-range 0 10)]) > i)) > > #; > (let ([x 0]) > (for/list ([i (for-function)]) > (printf "i ~a x ~a\n" i x) > (set! x (add1 x)) > i)) > > (check (for/list ([i (in-range 0 10)]) > i) > (let ([x 0]) > (for/list ([i (for-function)]) > ;; (printf "i ~a x ~a\n" i x) > (set! x (add1 x)) > i))) > > (for/list ([i (for-function)] > [j (in-range 0 5)]) > ;; (printf "i ~a j ~a\n" i j) > (list i j)) > > (check (for/list ([i (in-range 0 10)] > [j (in-range 0 5)]) > (list i j)) > (for/list ([i (for-function)] > [j (in-range 0 5)]) > ;; (printf "i ~a j ~a\n" i j) > (list i j))) > > (check (for/list ([i (in-range 0 10)] > [j (in-range 0 10)]) > (list i j)) > (for/list ([i (for-function)] > [j (for-function)]) > (list i j))) > > (check (for/list ([(v vi) (in-indexed (in-range 0 10))]) > (list v vi)) > (for/list ([(v vi) (in-indexed (for-function))]) > (list v vi))) > > (check (for/list ([v (in-sequences (in-range 0 10) (in-range 0 10))]) > v) > (for/list ([v (in-sequences (for-function) (for-function))]) > v)) > > ;; doesn't work yet > #; > (check (for/list ([v (in-cycle (in-range 0 10))] > [x (in-range 0 100)]) > v) > (for/list ([v (in-cycle (for-function))] > [x (in-range 0 100)]) > (printf "~a ~a\n" v x) > v)) > ) > > ;; completely broken version using call/cc and creating too many > sequence objects > (define test1 > (let () > (define-syntax yield > (syntax-rules () > [(_ yielder value) > (call/cc (lambda (ret) > (let ([s (make-do-sequence (lambda () > (values > (lambda (i) value) > (lambda (x) (ret #f)) > 0 > (lambda (x) #t) > (lambda (v) (eq? v > value)) > (lambda (x v) > #t))))]) > (yielder s))))])) > > (define-syntax define-generator > (syntax-rules () > [(_ ret (name args ...) body0 bodies ...) > (define (name args ...) > (call/cc (lambda (ret) > body0 bodies ... > (make-do-sequence (lambda () > (values > (lambda (i) (void)) > (lambda (x) (void)) > 0 > (lambda (x) #f) > (lambda (x) #f) > (lambda (x y) #f)))) > )))])) > > > (define-generator yielder (blah) > (for ([x (in-range 0 10)]) > (yield yielder x))) > > (printf "test1\n") > (do-tests blah) > )) > > ;; working version using prompt/control > (define test2 > (let () > (define-syntax yield > (syntax-rules () > [(_ value) > ;; Capture the current delimited continuation, f, and pass > back to the last prompt a, > ;; value and a function that installs a new prompt and > continues where f left off. > (control f (values value (lambda () (prompt (f)))))])) > > (define-syntax lambda-generator > (syntax-rules () > [(_ (args ...) body0 bodies ...) > (lambda (args ...) > (let* ([current (lambda () > (prompt > body0 bodies ... > ;; (printf "now what\n") > (values #f #f) > ))] > [pos 0] > [seq (make-do-sequence (lambda () > (values > (lambda (i) (let-values > ([(value next) (current)]) > ;; (printf > "Next value is ~a\n" value) > (set! > current next) > value)) > (lambda (x) (add1 x)) > 0 > (lambda (x) current) > (lambda (v) current) > (lambda (x v) current))))]) > seq))])) > > (define-syntax define-generator > (syntax-rules () > [(_ (name args ...) body0 bodies ...) > (define name (lambda-generator (args ...) body0 bodies ...))])) > > (define-generator (blah) > (for ([x (in-range 0 10)]) > (yield x))) > > (printf "test2\n") > (do-tests blah) > > #; > (printf "test3\n") > #; > (do-tests (lambda () > (make-do-sequence (lambda () > (values > (lambda (i) i) > (lambda (x) (add1 x)) > 0 > (lambda (x) (< x 10)) > (lambda (v) #t) > (lambda (x v) #t)))))) > > ;; a cute example > #; > (let () > ;; generate infinte list of unique names > (define-generator (machine-names) > (define letters "abcdefghijklmnopqrstuvwxyz") > (let loop ([len 0]) > ;; generates strings of length num > (define-generator (generate num) > (for ([letter (in-string > letters)]) > (if (= num 0) > (yield (string > letter)) > (for ([l2 (generate > (- num 1))]) > (yield (string- > append (string letter) l2)))))) > (for ([str (generate len)]) > (yield str)) > (loop (add1 len)))) > (for ([s (machine-names)] > [j (in-range 0 1000)]) > (printf "~a: ~a\n" j s))) > > )) > > ;; better version using shift/reset > (define test3 > (let () > (define-syntax yield > (syntax-rules () > [(_ value) > (shift f (values value f))])) > > (define-syntax lambda-generator > (syntax-rules () > [(_ (args ...) body0 bodies ...) > (lambda (args ...) > (let* ([current (lambda () > (reset > body0 bodies ... > ;; (printf "now what\n") > (values #f #f) > ))] > [pos 0] > [seq (make-do-sequence (lambda () > (values > (lambda (i) (let-values > ([(value next) (current)]) > ;; (printf > "Next value is ~a\n" value) > (set! > current next) > value)) > (lambda (x) (add1 x)) > 0 > (lambda (x) current) > (lambda (v) current) > (lambda (x v) current))))]) > seq))])) > > (define-syntax define-generator > (syntax-rules () > [(_ (name args ...) body0 bodies ...) > (define name (lambda-generator (args ...) body0 bodies ...))])) > > (define-generator (blah) > (for ([x (in-range 0 10)]) > (yield x))) > > (printf "test3\n") > (do-tests blah) > > #; > (printf "test3\n") > #; > (do-tests (lambda () > (make-do-sequence (lambda () > (values > (lambda (i) i) > (lambda (x) (add1 x)) > 0 > (lambda (x) (< x 10)) > (lambda (v) #t) > (lambda (x v) #t)))))) > > ;; a cute example > #; > (let () > ;; generate infinte list of unique names > (define-generator (machine-names) > (define letters "abcdefghijklmnopqrstuvwxyz") > (let loop ([len 0]) > ;; generates strings of length num > (define-generator (generate num) > (for ([letter (in-string > letters)]) > (if (= num 0) > (yield (string > letter)) > (for ([l2 (generate > (- num 1))]) > (yield (string- > append (string letter) l2)))))) > (for ([str (generate len)]) > (yield str)) > (loop (add1 len)))) > (for ([s (machine-names)] > [j (in-range 0 1000)]) > (printf "~a: ~a\n" j s))) > > )) > > ;; better version of shift/reset using continuation tags > ;; also use a unique value to determine the end of the sequence > instead of using #f > (define test4 > (let () > (define-syntax-parameter yield (lambda (stx) > (raise-syntax-error #f "yield is > only bound inside a sequence generator"))) > > (define-syntax lambda-generator > (syntax-rules () > [(_ (args ...) body0 bodies ...) > (lambda (args ...) > (let* ([last (lambda () (void))] > ;; current is a function that invokes user code and > produces values > [current (lambda () > ;; a unique tag to jump to > (define tag (make-continuation-prompt-tag)) > ;; give the value to the sequence > (define next (lambda (value) > (shift-at tag f (values > value f)))) > (syntax-parameterize ([yield (make-rename- > transformer #'next)]) > (reset-at tag > body0 bodies ... > (values #f last) > )))] > [pos 0] > [seq (make-do-sequence (lambda () > (values > ;; produce a value and a > continuation > (lambda (i) (let-values > ([(value next) (current)]) > ;; set! is > ugly but can we do better? > (set! > current next) > value)) > (lambda (x) (add1 x)) > 0 > (lambda (x) (not (eq? > last current))) > (lambda (v) (not (eq? > last current))) > (lambda (x v) (not (eq? > last current))))))]) > seq))])) > > (define-syntax define-generator > (syntax-rules () > [(_ (name args ...) body0 bodies ...) > (define name (lambda-generator (args ...) body0 bodies ...))])) > > (define-generator (blah) > (for ([x (in-range 0 10)]) > (yield x))) > > (printf "test4\n") > (do-tests blah) > > (check (for/list ([i ((lambda-generator () > (for ([i (in-range 0 5)]) > (yield #f))))]) > i) > (for/list ([i (in-range 0 5)]) > #f)) > > (check (for/list ([i ((lambda-generator () > (for ([i (in-range 0 5)]) > (yield > (reset > (for ([j (in-range > 2 5)]) > (shift k (+ i > j))))))))]) > i) > (for/list ([i (in-range 2 7)]) > i)) > > #; > (printf "test3\n") > #; > (do-tests (lambda () > (make-do-sequence (lambda () > (values > (lambda (i) i) > (lambda (x) (add1 x)) > 0 > (lambda (x) (< x 10)) > (lambda (v) #t) > (lambda (x v) #t)))))) > > ;; a cute example > #; > (let () > ;; generate infinte list of unique names > (define-generator (machine-names) > (define letters "abcdefghijklmnopqrstuvwxyz") > (let loop ([len 0]) > ;; generates strings of length num > (define-generator (generate num) > (for ([letter (in-string > letters)]) > (if (= num 0) > (yield (string > letter)) > (for ([l2 (generate > (- num 1))]) > (yield (string- > append (string letter) l2)))))) > (for ([str (generate len)]) > (yield str)) > (loop (add1 len)))) > (for ([s (machine-names)] > [j (in-range 0 1000)]) > (printf "~a: ~a\n" j s))) > > )) > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sshickey at qwest.net Wed Aug 26 10:47:15 2009 From: sshickey at qwest.net (Scott Hickey) Date: Wed Aug 26 10:47:34 2009 Subject: [plt-scheme] minor suggestion/questions for tutorial on plt-webserver Message-ID: <151436.66476.qm@web62508.mail.re1.yahoo.com> In the tutorial "Continue: Web Applications in PLT Scheme" in section 6 "Advanced Flow Control", the sample code uses the symbol "make-url", which is incorrectly hyperlinked to the docs for the struct url in the module net/url . My suggestion is to rename this to something other than make-url so that it is less confusing to a newbie. Of course, this leads me to next two questions: 1) Since make-??? is automatically defined for structs, is considered a good Scheme practice not to use the make prefix for anything other than structs? 2) If a person wanted to leave the name make-url, how would you tell scribble not to create the hyperlink to the net/url document page? Scott Hickey Senior Consultant Object Partners, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090826/4d8b99aa/attachment.html From jay.mccarthy at gmail.com Wed Aug 26 10:59:15 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Wed Aug 26 10:59:38 2009 Subject: [plt-scheme] minor suggestion/questions for tutorial on plt-webserver In-Reply-To: <151436.66476.qm@web62508.mail.re1.yahoo.com> References: <151436.66476.qm@web62508.mail.re1.yahoo.com> Message-ID: Thanks! I updated it. On Wed, Aug 26, 2009 at 8:47 AM, Scott Hickey wrote: > In the tutorial "Continue: Web Applications in PLT Scheme" in section 6 > "Advanced Flow Control", the sample code uses the symbol "make-url", which > is incorrectly hyperlinked to the docs for the struct url in the module > net/url . My suggestion is to rename this to something other than make-url > so that it is less confusing to a newbie. > > Of course, this leads me to next two questions: > > 1) Since make-??? is automatically defined for structs, is considered a good > Scheme practice not to use the make prefix for anything other than structs? I do it a lot. > > 2) If a person wanted to leave the name make-url, how would you tell > scribble not to create the hyperlink to the net/url document page? A simple way is to use @schemeidfont rather than @scheme Jay > > > Scott Hickey > Senior Consultant > Object Partners, Inc. > > > _________________________________________________ > ?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 leximatica at mac.com Wed Aug 26 11:02:10 2009 From: leximatica at mac.com (David Richards) Date: Wed Aug 26 11:02:42 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> <4A9490EA.7040009@cs.utah.edu> <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> Message-ID: <944C8405-0A77-482D-B71C-7248DA5916C6@mac.com> On Aug 26, 2009, at 12:27 AM, Jay McCarthy wrote: > What language are you writing it in? scheme/gui? > > #lang scheme/gui I admit I haven't used PLT Scheme in a while, but what is this "#lang scheme/gui" line about? Is it some sort of 'pragma'? Do we have pragma now? This is new and exciting. Whatever the case, it might compress progress, because it causes a new error: read: #lang expressions not currently enabled - d > > (define frame (new frame% (label "test"))) > > On Tue, Aug 25, 2009 at 10:05 PM, David Richards > wrote: >> >> On Aug 25, 2009, at 9:33 PM, Jon Rafkind wrote: >> >>> David Richards wrote: >>>> >>>> This one line program fails: >>>> >>>> (define frame (new frame% (label "test"))) >>>> >>>> Any advice, please? >>>> ___________________________________________ >>> >>> Whats the error? >> >> reference to undefined identified: new >> >>>> ______ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 From jay.mccarthy at gmail.com Wed Aug 26 11:05:18 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Wed Aug 26 11:05:40 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: <944C8405-0A77-482D-B71C-7248DA5916C6@mac.com> References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> <4A9490EA.7040009@cs.utah.edu> <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> <944C8405-0A77-482D-B71C-7248DA5916C6@mac.com> Message-ID: What language level are you using? You should use Module. Here's a discussion of #lang http://docs.plt-scheme.org/guide/Module_Syntax.html#(part._hash-lang) Jay On Wed, Aug 26, 2009 at 9:02 AM, David Richards wrote: > > On Aug 26, 2009, at 12:27 AM, Jay McCarthy wrote: > >> What language are you writing it in? scheme/gui? >> >> #lang scheme/gui > > I admit I haven't used PLT Scheme in a while, but what is this "#lang > scheme/gui" line about? Is it some sort of 'pragma'? Do we have pragma now? > This is new and exciting. > > Whatever the case, it might compress progress, because it causes a new > error: > > read: #lang expressions not currently enabled > > - d > >> >> (define frame (new frame% (label "test"))) >> >> On Tue, Aug 25, 2009 at 10:05 PM, David Richards >> wrote: >>> >>> On Aug 25, 2009, at 9:33 PM, Jon Rafkind wrote: >>> >>>> David Richards wrote: >>>>> >>>>> This one line program fails: >>>>> >>>>> (define frame (new frame% (label "test"))) >>>>> >>>>> Any advice, please? >>>>> ___________________________________________ >>>> >>>> Whats the error? >>> >>> reference to undefined identified: new >>> >>>>> ______ >>>>> For list-related administrative tasks: >>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> >> >> -- >> Jay McCarthy >> Assistant Professor / Brigham Young University >> http://teammccarthy.org/jay >> >> "The glory of God is Intelligence" - D&C 93 > > _________________________________________________ > ?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 eli at barzilay.org Wed Aug 26 11:06:18 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Aug 26 11:06:40 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: <944C8405-0A77-482D-B71C-7248DA5916C6@mac.com> References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> <4A9490EA.7040009@cs.utah.edu> <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> <944C8405-0A77-482D-B71C-7248DA5916C6@mac.com> Message-ID: <19093.20330.310359.847141@winooski.ccs.neu.edu> On Aug 26, David Richards wrote: > On Aug 26, 2009, at 12:27 AM, Jay McCarthy wrote: > > > What language are you writing it in? scheme/gui? > > > > #lang scheme/gui > > I admit I haven't used PLT Scheme in a while, but what is this > "#lang scheme/gui" line about? Is it some sort of 'pragma'? Do we > have pragma now? This is new and exciting. > > Whatever the case, it might compress progress, because it causes a > new error: > > read: #lang expressions not currently enabled You're probably using some language like Pretty Big -- if this is the case, then you should switch to the Module language. The `#lang' line is not a pragma -- it is a kind of a declaration that determines the language that the file is written in. It is similar in nature to the in (module my-module ...code...) except that it can also control the syntax of the code. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From beratn at gmail.com Wed Aug 26 11:19:53 2009 From: beratn at gmail.com (=?UTF-8?Q?emre_berat_nebio=C4=9Flu?=) Date: Wed Aug 26 11:20:15 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 In-Reply-To: References: <4A952961.4080207@phirho.com> Message-ID: May be i am wrong. But i read this discussion and i plan to finish PLAI book. I am in chapter 12.I supposed the different between eager and lazy regime is in application of interp function. I mean for eager regime we make two recursive call. (interp blah blah blah (interp blah.... for lazy regime, we make one recursive call (interp blah blah blah blah...)) am i true ? On Wed, Aug 26, 2009 at 5:30 PM, Aleix Conchillo Flaqu? < aconchillo@gmail.com> wrote: > On Wed, Aug 26, 2009 at 14:24, Thomas Holubar wrote: > > Hi Aleix! > > > > Why needs the second argument to be a FAE? > > Couldn't it be a FAE-Value? That one is "closure compatible"... > > > > Yes, thanks Thomas. As I said in the other mail, that was the problem. > Everything makes sense now. > > Aleix > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090826/f644aacc/attachment.htm From leximatica at mac.com Wed Aug 26 11:29:35 2009 From: leximatica at mac.com (David Richards) Date: Wed Aug 26 11:30:03 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: <19093.20330.310359.847141@winooski.ccs.neu.edu> References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> <4A9490EA.7040009@cs.utah.edu> <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> <944C8405-0A77-482D-B71C-7248DA5916C6@mac.com> <19093.20330.310359.847141@winooski.ccs.neu.edu> Message-ID: <2B1C21EF-6908-419C-9E7B-2F60297FB87B@mac.com> On Aug 26, 2009, at 11:06 AM, Eli Barzilay wrote: > On Aug 26, David Richards wrote: >> On Aug 26, 2009, at 12:27 AM, Jay McCarthy wrote: >> >>> What language are you writing it in? scheme/gui? >>> >>> #lang scheme/gui >> >> I admit I haven't used PLT Scheme in a while, but what is this >> "#lang scheme/gui" line about? Is it some sort of 'pragma'? Do we >> have pragma now? This is new and exciting. >> >> Whatever the case, it might compress progress, because it causes a >> new error: >> >> read: #lang expressions not currently enabled > > You're probably using some language like Pretty Big -- if this is the > case, then you should switch to the Module language. > > The `#lang' line is not a pragma -- it is a kind of a declaration that > determines the language that the file is written in. It is similar in > nature to the in > > (module my-module > ...code...) > > except that it can also control the syntax of the code. I see. So instead of 'shebang' (#!) we now have 'shelang' (#lang). Neat. - d > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli > Barzilay: > http://barzilay.org/ Maze is > Life! From eli at barzilay.org Wed Aug 26 11:31:18 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Aug 26 11:31:40 2009 Subject: [plt-scheme] puzzled by 'new' failure In-Reply-To: <2B1C21EF-6908-419C-9E7B-2F60297FB87B@mac.com> References: <92303C80-9863-40CF-9836-32D81E5D4FAD@mac.com> <4A9490EA.7040009@cs.utah.edu> <6D00612A-EA50-49DB-9E04-61989656F1A1@mac.com> <944C8405-0A77-482D-B71C-7248DA5916C6@mac.com> <19093.20330.310359.847141@winooski.ccs.neu.edu> <2B1C21EF-6908-419C-9E7B-2F60297FB87B@mac.com> Message-ID: <19093.21830.626127.767595@winooski.ccs.neu.edu> On Aug 26, David Richards wrote: > > I see. So instead of 'shebang' (#!) we now have 'shelang' (#lang). Now all you need is to combine both, write some cute code, and finally compose music to play the whole thing to. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From grettke at acm.org Wed Aug 26 12:20:07 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Aug 26 12:20:28 2009 Subject: [plt-scheme] minor suggestion/questions for tutorial on plt-webserver In-Reply-To: <151436.66476.qm@web62508.mail.re1.yahoo.com> References: <151436.66476.qm@web62508.mail.re1.yahoo.com> Message-ID: <756daca50908260920m79081edcg7602046ae0f09ee7@mail.gmail.com> On Wed, Aug 26, 2009 at 9:47 AM, Scott Hickey wrote: > 1) Since make-??? is automatically defined for structs, is considered a good > Scheme practice not to use the make prefix for anything other than structs? If you are using objects, you will use new. For everything else, use make. From sk at cs.brown.edu Wed Aug 26 13:19:45 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Aug 26 13:20:24 2009 Subject: [plt-scheme] minor suggestion/questions for tutorial on plt-webserver In-Reply-To: <151436.66476.qm@web62508.mail.re1.yahoo.com> References: <151436.66476.qm@web62508.mail.re1.yahoo.com> Message-ID: > 1) Since make-??? is automatically defined for structs, is considered a good > Scheme practice not to use the make prefix for anything other than structs? I prefer to use CREATE-. That way, I can even have a MAKE- and CREATE- for the same structure, where the CREATE- enforces certain invariants, fills in optional arguments, tracks the creation, etc., before passing the arguments on to MAKE-. So for me, MAKE- is always "raw", while CREATE- implies a layer of interpolation (checking, augmenting, recording, etc). Shriram From grettke at acm.org Wed Aug 26 13:58:50 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Aug 26 13:59:09 2009 Subject: [plt-scheme] minor suggestion/questions for tutorial on plt-webserver In-Reply-To: References: <151436.66476.qm@web62508.mail.re1.yahoo.com> Message-ID: <756daca50908261058n363099f9s8a54bb27678597bf@mail.gmail.com> On Wed, Aug 26, 2009 at 12:19 PM, Shriram Krishnamurthi wrote: >> 1) Since make-??? is automatically defined for structs, is considered a good >> Scheme practice not to use the make prefix for anything other than structs? > > So for me, MAKE- is always > "raw", while CREATE- implies a layer of interpolation (checking, > augmenting, recording, etc). Was the choice arbitrary or based on the definitions of the two words? From sk at cs.brown.edu Wed Aug 26 14:00:09 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Aug 26 14:00:51 2009 Subject: [plt-scheme] minor suggestion/questions for tutorial on plt-webserver In-Reply-To: <756daca50908261058n363099f9s8a54bb27678597bf@mail.gmail.com> References: <151436.66476.qm@web62508.mail.re1.yahoo.com> <756daca50908261058n363099f9s8a54bb27678597bf@mail.gmail.com> Message-ID: Guess. On Wed, Aug 26, 2009 at 1:58 PM, Grant Rettke wrote: > On Wed, Aug 26, 2009 at 12:19 PM, Shriram Krishnamurthi wrote: >>> 1) Since make-??? is automatically defined for structs, is considered a good >>> Scheme practice not to use the make prefix for anything other than structs? >> >> So for me, MAKE- is always >> "raw", while CREATE- implies a layer of interpolation (checking, >> augmenting, recording, etc). > > Was the choice arbitrary or based on the definitions of the two words? > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From grettke at acm.org Wed Aug 26 14:02:08 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Aug 26 14:02:32 2009 Subject: [plt-scheme] minor suggestion/questions for tutorial on plt-webserver In-Reply-To: References: <151436.66476.qm@web62508.mail.re1.yahoo.com> <756daca50908261058n363099f9s8a54bb27678597bf@mail.gmail.com> Message-ID: <756daca50908261102v37e1ea09xd652d5a5075bc85d@mail.gmail.com> Abitrary! On Wed, Aug 26, 2009 at 1:00 PM, Shriram Krishnamurthi wrote: > Guess. > > On Wed, Aug 26, 2009 at 1:58 PM, Grant Rettke wrote: >> On Wed, Aug 26, 2009 at 12:19 PM, Shriram Krishnamurthi wrote: >>>> 1) Since make-??? is automatically defined for structs, is considered a good >>>> Scheme practice not to use the make prefix for anything other than structs? >>> >>> So for me, MAKE- is always >>> "raw", while CREATE- implies a layer of interpolation (checking, >>> augmenting, recording, etc). >> >> Was the choice arbitrary or based on the definitions of the two words? >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- http://www.wisdomandwonder.com/ From ryanc at ccs.neu.edu Wed Aug 26 14:03:51 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Wed Aug 26 14:04:17 2009 Subject: [plt-scheme] scribble examples and errors Message-ID: <4B3334E9-0FF8-49BF-91C5-B465E7D7C07B@ccs.neu.edu> How can I eliminate the "eval:X:0:" prefix from the error message shown in scribble examples for syntax errors, while still showing the terms that caused the error? For example, if I put this in my scribble file: @(examples (raise-syntax-error 'some-example "some message" #'x)) I get this in the output: Example: > (raise-syntax-error 'some-example "some message" #'x) eval:1:0: some-example: some message in: x If I create an evaluator and set the 'error-print-source-location' parameter to #f within the evaluator, the prefix goes away but so do the terms: Example: > (raise-syntax-error 'some-example "some message" #'x) some-example: some message Is there any way to get the following? Example: > (raise-syntax-error 'some-example "some message" #'x) some-example: some message in: x Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090826/d9db3c97/attachment.html From scheme at phirho.com Wed Aug 26 17:20:12 2009 From: scheme at phirho.com (Thomas Holubar) Date: Wed Aug 26 17:20:36 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 In-Reply-To: References: <4A952961.4080207@phirho.com> Message-ID: <4A95A70C.5070507@phirho.com> Hi Emre! emre berat nebio?lu wrote: > May be i am wrong. But i read this discussion and i plan to finish PLAI book. I am in chapter 12. > I supposed the different between eager and lazy regime is in application of interp function. Well, the difference is illustrated in chapter 3.4 (page 23). The first evaluation scheme is eager, the second lazy. > I mean for eager regime we make two recursive call. > > (interp blah > blah blah > (interp blah.... > > for lazy regime, we make one recursive call > (interp blah > blah blah blah...)) > am i true ? Since 'interp' could be anything I do not think it qualifies well as a definition for eager vs. lazy. If applying 'interp' to an expression has the effect of "reducing" it (simplifying it as much as possible) - instead of delaying reduction - then it works eagerly. So in some cases the patterns you describe coincide with eager <-> lazy, but IMHO they're certainly not a definition. Regards, Thomas From sk at cs.brown.edu Wed Aug 26 17:48:36 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Wed Aug 26 17:49:15 2009 Subject: [plt-scheme] plai: lazyness and exercise 6.4.2 In-Reply-To: <4A95A70C.5070507@phirho.com> References: <4A952961.4080207@phirho.com> <4A95A70C.5070507@phirho.com> Message-ID: > Since 'interp' could be anything I do not think it qualifies well as a > definition for eager vs. lazy. [...] Excellent answer that demonstrates a really good understanding of the material. Shriram From aconchillo at gmail.com Wed Aug 26 21:30:16 2009 From: aconchillo at gmail.com (=?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?=) Date: Wed Aug 26 21:30:38 2009 Subject: [plt-scheme] loading plai language in mzscheme Message-ID: Hi, I was wondering how to load the PLAI language in a mzscheme repl. I have a found a thread in: http://groups.google.com/group/plt-scheme/browse_thread/thread/fb15dd113cf9fecc about someone that had the same problem. I am using PLT Scheme 4.2.1. I have tried the following, but no luck. Any help would be really appreciated. Sorry if this is a newbie question, but I'm searching through the documentation also without luck. Aleix ------------------------------------------------------------------------ $ mzscheme Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > (load "chapter-06-6.ss") ####### This is a file that successfully works in DrScheme > (interp) reference to undefined identifier: interp === context === /usr/lib/plt/collects/scheme/private/misc.ss:74:7 > ------------------------------------------------------------------------ $ mzscheme Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > #reader(planet plai/plai:1:3/lang/reader) ######### Then CTRL-D (otherwise it gets stuck) > (define-type) reference to undefined identifier: define-type === context === /usr/lib/plt/collects/scheme/private/misc.ss:74:7 > ------------------------------------------------------------------------ $ mzscheme -i -l plai Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. lib: standard-module-name-resolver: collection not found: "plai" in any of: (# #) in: (lib "plai") > ------------------------------------------------------------------------ $ mzscheme Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > #lang plai standard-module-name-resolver: collection not found: # in any of: (# #) === context === /usr/lib/plt/collects/scheme/private/misc.ss:74:7 > ------------------------------------------------------------------------ From jay.mccarthy at gmail.com Thu Aug 27 00:31:26 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Aug 27 00:31:47 2009 Subject: [plt-scheme] loading plai language in mzscheme In-Reply-To: References: Message-ID: Write the program in PLAI using the #lang planet plai/plai mechanism and you just mzscheme -t it Jay On Wed, Aug 26, 2009 at 7:30 PM, Aleix Conchillo Flaqu? wrote: > Hi, > > I was wondering how to load the PLAI language in a mzscheme repl. I > have a found a thread in: > > http://groups.google.com/group/plt-scheme/browse_thread/thread/fb15dd113cf9fecc > > about someone that had the same problem. I am using PLT Scheme 4.2.1. > > I have tried the following, but no luck. Any help would be really appreciated. > > Sorry if this is a newbie question, but I'm searching through the > documentation also without luck. > > Aleix > > ------------------------------------------------------------------------ > $ mzscheme > Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. >> (load "chapter-06-6.ss") ? ? ? ? ####### This is a file that successfully works in DrScheme >> (interp) > reference to undefined identifier: interp > > ?=== context === > /usr/lib/plt/collects/scheme/private/misc.ss:74:7 > >> > ------------------------------------------------------------------------ > $ mzscheme > Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. >> #reader(planet plai/plai:1:3/lang/reader) ? ? ? ? ? ######### Then CTRL-D (otherwise it gets stuck) >> (define-type) > reference to undefined identifier: define-type > > ?=== context === > /usr/lib/plt/collects/scheme/private/misc.ss:74:7 > >> > ------------------------------------------------------------------------ > $ mzscheme -i -l plai > Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. > lib: standard-module-name-resolver: collection not found: "plai" in > any of: (# > #) in: (lib "plai") >> > ------------------------------------------------------------------------ > $ mzscheme > Welcome to MzScheme v4.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. >> #lang plai > standard-module-name-resolver: collection not found: # > in any of: (# > #) > > ?=== context === > /usr/lib/plt/collects/scheme/private/misc.ss:74:7 > >> > ------------------------------------------------------------------------ > _________________________________________________ > ?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 aconchillo at gmail.com Thu Aug 27 05:52:35 2009 From: aconchillo at gmail.com (=?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?=) Date: Thu Aug 27 05:52:55 2009 Subject: [plt-scheme] loading plai language in mzscheme In-Reply-To: References: Message-ID: On Thu, Aug 27, 2009 at 06:31, Jay McCarthy wrote: > Write the program in PLAI using the #lang planet plai/plai mechanism > and you just mzscheme -t it > That did the job! Thanks. Aleix From plt at synx.us.to Thu Aug 27 16:33:10 2009 From: plt at synx.us.to (Synx) Date: Thu Aug 27 16:33:38 2009 Subject: [plt-scheme] pool-for-each Message-ID: <4A96ED86.7030609@synx.us.to> A semi-common pattern for me is to take a list of tasks that block and feed it into a thread-pool for parallel execution, but not unbounded parallelism. So I thought of a neat way to represent that I thought I'd share here. -------------- next part -------------- #lang scheme/base (define (make-pool-for-each n) (? (proc items) (define tasks (make-channel)) (define results (make-semaphore)) (define threads #f) (dynamic-wind (? () (set! threads (build-list n (? (i) (thread (? () (let loop () (let ((value (channel-get tasks))) (proc value)) (semaphore-post results) (loop)))))))) (? () (for-each (? (item) (channel-put tasks item)) items) (for-each (? (item) (semaphore-wait results)) items)) (? () (for-each (? (thread) (kill-thread thread) (thread-wait thread)) threads))))) (define (example) (define pool-for-each (make-pool-for-each 20)) (pool-for-each (? (i) ; (display (format "~s~n" (* C (exp (* r i))))) (sleep 1) (display i)(display "-") (flush-output)) ; note reverse order! (build-list 100 (? (i) (- 100 i))))) (provide make-pool-for-each) From dbastos+0 at toledo.com Thu Aug 27 18:57:05 2009 From: dbastos+0 at toledo.com (Daniel Bastos) Date: Thu Aug 27 19:00:24 2009 Subject: [plt-scheme] looking for a pattern Message-ID: (*) The problem I'd like to apply a series of regular expression search and replace on a string. Here's an example of what I'm looking for. > (f (f (f "m?t?m?ti?a" '("[?]" "a")) '("[?]" "e")) '("[?]" "c")) "matematica" What pattern would this be? (*) Investigations At first I thought this would be a fold. It really looks like it, but I'm not really sure because I tend to think of folds on f requiring f to be a binary operator, and my operands have different types. But maybe I'm wrong about folds. It's not a map because I must use the result of the first f-application, in the second. I think these are the only patterns I know. It can certainly be made recursive, because of the example written above. So I wrote the following to see if some light would come. (define (conv table s) (cond [(empty? table) s] [ else (regexp-replace* (car (car table)) (conv (cdr table) s) (last (car table)))])) > (conv '(("[?]" "a") ("[?]" "e") ("[?]" "c")) "m?t?m?ti?a") "matematica" Seems to work. I also wrote the following trying to clean up the cars and cdrs. (define (conv table s) (cond [(empty? table) s] [ else (letrec ((pat (car (car table))) (ins (last (car table)))) (regexp-replace* pat (conv (cdr table) s) ins))])) Doesn't seem much better. From matthias at ccs.neu.edu Thu Aug 27 19:21:22 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Aug 27 19:22:13 2009 Subject: [plt-scheme] looking for a pattern In-Reply-To: References: Message-ID: <947A7AA7-5E48-44AE-AAB1-1522AC873601@ccs.neu.edu> > #lang scheme > > (require test-engine/scheme-tests) > > ;; > ----------------------------------------------------------------------------- > (check-expect (f (f (f "m?t?m?ti?a" '("[?]" "a")) '("[?]" "e")) > '("[?]" "c")) > "matematica") > > (define (f str from-to) > (regexp-replace* (first from-to) str (second from-to))) > > ;; > ----------------------------------------------------------------------------- > > (check-expect (F "m?t?m?ti?a" '(("[?]" "a") ("[?]" "e") ("[?]" "c"))) > "matematica") > > (define (F str from-to-table) > (foldl (lambda (from-to str) (f str from-to)) str from-to-table)) > > (define (tee f) > (lambda x > (printf "~s -> ~s\n" x (apply f x)) > (apply f x))) > > (test) On Aug 27, 2009, at 6:57 PM, Daniel Bastos wrote: > (*) The problem > > I'd like to apply a series of regular expression search and replace on > a string. Here's an example of what I'm looking for. > >> (f (f (f "m?t?m?ti?a" '("[?]" "a")) '("[?]" "e")) '("[?]" "c")) > "matematica" > > What pattern would this be? > > (*) Investigations > > At first I thought this would be a fold. It really looks like it, but > I'm not really sure because I tend to think of folds on f requiring f > to be a binary operator, and my operands have different types. But > maybe I'm wrong about folds. It's not a map because I must use the > result of the first f-application, in the second. > > I think these are the only patterns I know. It can certainly be made > recursive, because of the example written above. So I wrote the > following to see if some light would come. > > (define (conv table s) > (cond > [(empty? table) s] > [ else (regexp-replace* (car (car table)) > (conv (cdr table) s) > (last (car table)))])) > >> (conv '(("[?]" "a") ("[?]" "e") ("[?]" "c")) "m?t?m?ti?a") > "matematica" > > Seems to work. > > I also wrote the following trying to clean up the cars and cdrs. > > (define (conv table s) > (cond > [(empty? table) s] > [ else > (letrec ((pat (car (car table))) > (ins (last (car table)))) > (regexp-replace* pat (conv (cdr table) s) ins))])) > > Doesn't seem much better. > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at eecs.northwestern.edu Thu Aug 27 19:30:37 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Aug 27 19:31:14 2009 Subject: [plt-scheme] generators with sequences In-Reply-To: <31441A25-7C63-49FB-AED2-48967B201F7F@ccs.neu.edu> References: <4A94C836.7090608@cs.utah.edu> <31441A25-7C63-49FB-AED2-48967B201F7F@ccs.neu.edu> Message-ID: <932b2f1f0908271630s279dd33dh2a5541e058b6f6ed@mail.gmail.com> One other thought: did your explorations with the call/cc variant suggest ways that Ruby might be broken? Did you try to confirm that? It may shed some light on the Scheme version. Robby On Wed, Aug 26, 2009 at 9:46 AM, Matthias Felleisen wrote: > > Write up a section for the Guide, check it in as an aux library for > for-loops, and advertise. I am sure Matthew can show you where the Guide > lives and what the editorial rules are. -- Matthias > > > > > On Aug 26, 2009, at 1:29 AM, Jon Rafkind wrote: > >> I wrote a generator syntax for use with the v4 `for' sequences. Some >> example usages are below but the main point is you can say (yield 5) when >> you want a function to produce a value that can be used as a sequence. It >> took me a few tries to get this right and I left most of my attempts in so >> others can maybe learn what not to do. This could go into collects/, so if >> anyone has any improvements please share! The last attempt (test4) is my >> best effort so far. >> >> #lang scheme >> >> (require scheme/control) >> (require scheme/stxparam) >> (define (check v1 v2) >> (when (not (equal? v1 v2)) >> ?(printf "test failed expected ~a actual ~a\n" v1 v2))) >> >> (define (do-tests for-function) >> (check (for/list ([i (in-range 0 10)]) >> ? ? ? ? ? ? ? ? i) >> ? ? ? (for/list ([i (in-range 0 10)]) >> ? ? ? ? ? ? ? ? i)) >> >> #; >> (let ([x 0]) >> ?(for/list ([i (for-function)]) >> ? ? ? ? ? ?(printf "i ~a x ~a\n" i x) >> ? ? ? ? ? ?(set! x (add1 x)) >> ? ? ? ? ? ?i)) >> >> (check (for/list ([i (in-range 0 10)]) >> ? ? ? ? ? ? ? ? i) >> ? ? ? (let ([x 0]) >> ? ? ? ? (for/list ([i (for-function)]) >> ? ? ? ? ? ? ? ? ? ;; (printf "i ~a x ~a\n" i x) >> ? ? ? ? ? ? ? ? ? (set! x (add1 x)) >> ? ? ? ? ? ? ? ? ? i))) >> >> (for/list ([i (for-function)] >> ? ? ? ? ? [j (in-range 0 5)]) >> ? ? ? ? ?;; (printf "i ~a j ~a\n" i j) >> ? ? ? ? ?(list i j)) >> >> (check (for/list ([i (in-range 0 10)] >> ? ? ? ? ? ? ? ? ?[j (in-range 0 5)]) >> ? ? ? ? ? ? ? ? (list i j)) >> ? ? ? (for/list ([i (for-function)] >> ? ? ? ? ? ? ? ? ?[j (in-range 0 5)]) >> ? ? ? ? ? ? ? ? ;; (printf "i ~a j ~a\n" i j) >> ? ? ? ? ? ?(list i j))) >> >> (check (for/list ([i (in-range 0 10)] >> ? ? ? ? ? ? ? ? ?[j (in-range 0 10)]) >> ? ? ? ? ? ? ? ? (list i j)) >> ? ? ? (for/list ([i (for-function)] >> ? ? ? ? ? ? ? ? ?[j (for-function)]) >> ? ? ? ? ? ? ? ? (list i j))) >> >> (check (for/list ([(v vi) (in-indexed (in-range 0 10))]) >> ? ? ? ? ? ? ? ? (list v vi)) >> ? ? ? (for/list ([(v vi) (in-indexed (for-function))]) >> ? ? ? ? ? ? ? ? (list v vi))) >> >> (check (for/list ([v (in-sequences (in-range 0 10) (in-range 0 10))]) >> ? ? ? ? ? ? ? ? v) >> ? ? ? (for/list ([v (in-sequences (for-function) (for-function))]) >> ? ? ? ? ? ? ? ? v)) >> >> ;; doesn't work yet >> #; >> (check (for/list ([v (in-cycle (in-range 0 10))] >> ? ? ? ? ? ? ? ? ?[x (in-range 0 100)]) >> ? ? ? ? ? ? ? ? v) >> ? ? ? (for/list ([v (in-cycle (for-function))] >> ? ? ? ? ? ? ? ? ?[x (in-range 0 100)]) >> ? ? ? ? ? ? ? ? (printf "~a ~a\n" v x) >> ? ? ? ? ? ? ? ? v)) >> ) >> >> ;; completely broken version using call/cc and creating too many sequence >> objects >> (define test1 >> (let () >> ?(define-syntax yield >> ? ?(syntax-rules () >> ? ? ?[(_ yielder value) >> ? ? ? (call/cc (lambda (ret) >> ? ? ? ? ? ? ? ? ?(let ([s (make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (i) value) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) (ret #f)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) #t) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (v) (eq? v value)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x v) #t))))]) >> ? ? ? ? ? ? ? ? ? ?(yielder s))))])) >> >> ?(define-syntax define-generator >> ? ?(syntax-rules () >> ? ? ?[(_ ret (name args ...) body0 bodies ...) >> ? ? ? (define (name args ...) >> ? ? ? ? (call/cc (lambda (ret) >> ? ? ? ? ? ? ? ? ? ?body0 bodies ... >> ? ? ? ? ? ? ? ? ? ?(make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (i) (void)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) (void)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) #f) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) #f) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x y) #f)))) >> ? ? ? ? ? ? ? ? ? ?)))])) >> >> >> ?(define-generator yielder (blah) >> ? ? ? ? ? ? ? ? ? ?(for ([x (in-range 0 10)]) >> ? ? ? ? ? ? ? ? ? ? ? ? (yield yielder x))) >> >> ?(printf "test1\n") >> ?(do-tests blah) >> ?)) >> >> ;; working version using prompt/control >> (define test2 >> (let () >> ?(define-syntax yield >> ? ?(syntax-rules () >> ? ? ?[(_ value) >> ? ? ? ;; Capture the current delimited continuation, f, and pass back to >> the last prompt a, >> ? ? ? ;; value and a function that installs a new prompt and continues >> where f left off. >> ? ? ? (control f (values value (lambda () (prompt (f)))))])) >> >> ?(define-syntax lambda-generator >> ? ?(syntax-rules () >> ? ? ?[(_ (args ...) body0 bodies ...) >> ? ? ? (lambda (args ...) >> ? ? ? ? (let* ([current (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? (prompt >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? body0 bodies ... >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ;; (printf "now what\n") >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? (values #f #f) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ))] >> ? ? ? ? ? ? ? ? ?[pos 0] >> ? ? ? ? ? ? ? ? ?[seq (make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (i) (let-values ([(value >> next) (current)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ;; (printf "Next >> value is ~a\n" value) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (set! current >> next) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? value)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) (add1 x)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) current) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (v) current) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x v) current))))]) >> ? ? ? ? ? seq))])) >> >> ?(define-syntax define-generator >> ? ?(syntax-rules () >> ? ? ?[(_ (name args ...) body0 bodies ...) >> ? ? ? (define name (lambda-generator (args ...) body0 bodies ...))])) >> >> ?(define-generator (blah) >> ? ? ? ? ? ? ? ? ? ?(for ([x (in-range 0 10)]) >> ? ? ? ? ? ? ? ? ? ? ? ? (yield x))) >> >> ?(printf "test2\n") >> ?(do-tests blah) >> >> ?#; >> ?(printf "test3\n") >> ?#; >> ?(do-tests (lambda () >> ? ? ? ? ? ? ?(make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (i) i) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) (add1 x)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) (< x 10)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (v) #t) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x v) #t)))))) >> >> ?;; a cute example >> ?#; >> ?(let () >> ? ?;; generate infinte list of unique names >> ? ?(define-generator (machine-names) >> ? ? ? ? ? ? ? ? ? ? ?(define letters "abcdefghijklmnopqrstuvwxyz") >> ? ? ? ? ? ? ? ? ? ? ?(let loop ([len 0]) >> ? ? ? ? ? ? ? ? ? ? ? ?;; generates strings of length num >> ? ? ? ? ? ? ? ? ? ? ? ?(define-generator (generate num) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(for ([letter (in-string >> letters)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (if (= num 0) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (yield (string letter)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (for ([l2 (generate (- num >> 1))]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(yield (string-append >> (string letter) l2)))))) >> ? ? ? ? ? ? ? ? ? ? ? ?(for ([str (generate len)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? (yield str)) >> ? ? ? ? ? ? ? ? ? ? ? ?(loop (add1 len)))) >> ? ?(for ([s (machine-names)] >> ? ? ? ? ?[j (in-range 0 1000)]) >> ? ? ? ? (printf "~a: ~a\n" j s))) >> >> ?)) >> >> ;; better version using shift/reset >> (define test3 >> (let () >> ?(define-syntax yield >> ? ?(syntax-rules () >> ? ? ?[(_ value) >> ? ? ? (shift f (values value f))])) >> >> ?(define-syntax lambda-generator >> ? ?(syntax-rules () >> ? ? ?[(_ (args ...) body0 bodies ...) >> ? ? ? (lambda (args ...) >> ? ? ? ? (let* ([current (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? (reset >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? body0 bodies ... >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ;; (printf "now what\n") >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? (values #f #f) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ))] >> ? ? ? ? ? ? ? ? ?[pos 0] >> ? ? ? ? ? ? ? ? ?[seq (make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (i) (let-values ([(value >> next) (current)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ;; (printf "Next >> value is ~a\n" value) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (set! current >> next) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? value)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) (add1 x)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) current) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (v) current) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x v) current))))]) >> ? ? ? ? ? seq))])) >> >> ?(define-syntax define-generator >> ? ?(syntax-rules () >> ? ? ?[(_ (name args ...) body0 bodies ...) >> ? ? ? (define name (lambda-generator (args ...) body0 bodies ...))])) >> >> ?(define-generator (blah) >> ? ? ? ? ? ? ? ? ? ?(for ([x (in-range 0 10)]) >> ? ? ? ? ? ? ? ? ? ? ? ? (yield x))) >> >> ?(printf "test3\n") >> ?(do-tests blah) >> >> ?#; >> ?(printf "test3\n") >> ?#; >> ?(do-tests (lambda () >> ? ? ? ? ? ? ?(make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (i) i) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) (add1 x)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) (< x 10)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (v) #t) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x v) #t)))))) >> >> ?;; a cute example >> ?#; >> ?(let () >> ? ?;; generate infinte list of unique names >> ? ?(define-generator (machine-names) >> ? ? ? ? ? ? ? ? ? ? ?(define letters "abcdefghijklmnopqrstuvwxyz") >> ? ? ? ? ? ? ? ? ? ? ?(let loop ([len 0]) >> ? ? ? ? ? ? ? ? ? ? ? ?;; generates strings of length num >> ? ? ? ? ? ? ? ? ? ? ? ?(define-generator (generate num) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(for ([letter (in-string >> letters)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (if (= num 0) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (yield (string letter)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (for ([l2 (generate (- num >> 1))]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(yield (string-append >> (string letter) l2)))))) >> ? ? ? ? ? ? ? ? ? ? ? ?(for ([str (generate len)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? (yield str)) >> ? ? ? ? ? ? ? ? ? ? ? ?(loop (add1 len)))) >> ? ?(for ([s (machine-names)] >> ? ? ? ? ?[j (in-range 0 1000)]) >> ? ? ? ? (printf "~a: ~a\n" j s))) >> >> ?)) >> >> ;; better version of shift/reset using continuation tags >> ;; also use a unique value to determine the end of the sequence instead of >> using #f >> (define test4 >> (let () >> ?(define-syntax-parameter yield (lambda (stx) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (raise-syntax-error #f "yield is only >> bound inside a sequence generator"))) >> >> ?(define-syntax lambda-generator >> ? ?(syntax-rules () >> ? ? ?[(_ (args ...) body0 bodies ...) >> ? ? ? (lambda (args ...) >> ? ? ? ? (let* ([last (lambda () (void))] >> ? ? ? ? ? ? ? ?;; current is a function that invokes user code and >> produces values >> ? ? ? ? ? ? ? ?[current (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ;; a unique tag to jump to >> ? ? ? ? ? ? ? ? ? ? ? ? ? (define tag (make-continuation-prompt-tag)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ;; give the value to the sequence >> ? ? ? ? ? ? ? ? ? ? ? ? ? (define next (lambda (value) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(shift-at tag f (values value >> f)))) >> ? ? ? ? ? ? ? ? ? ? ? ? ? (syntax-parameterize ([yield >> (make-rename-transformer #'next)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(reset-at tag >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?body0 bodies ... >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(values #f last) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?)))] >> ? ? ? ? ? ? ? ? ?[pos 0] >> ? ? ? ? ? ? ? ? ?[seq (make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ;; produce a value and a >> continuation >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (i) (let-values ([(value >> next) (current)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ;; set! is ugly >> but can we do better? >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (set! current >> next) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? value)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) (add1 x)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x) (not (eq? last >> current))) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (v) (not (eq? last >> current))) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (lambda (x v) (not (eq? last >> current))))))]) >> ? ? ? ? ? seq))])) >> >> ?(define-syntax define-generator >> ? ?(syntax-rules () >> ? ? ?[(_ (name args ...) body0 bodies ...) >> ? ? ? (define name (lambda-generator (args ...) body0 bodies ...))])) >> >> ?(define-generator (blah) >> ? ? ? ? ? ? ? ? ? ?(for ([x (in-range 0 10)]) >> ? ? ? ? ? ? ? ? ? ? ? ? (yield x))) >> >> ?(printf "test4\n") >> ?(do-tests blah) >> >> ?(check (for/list ([i ((lambda-generator () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (for ([i (in-range 0 5)]) (yield >> #f))))]) >> ? ? ? ? ? ? ? ? ? i) >> ? ? ? ? (for/list ([i (in-range 0 5)]) >> ? ? ? ? ? ? ? ? ? #f)) >> >> ?(check (for/list ([i ((lambda-generator () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (for ([i (in-range 0 5)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(yield >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(reset >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(for ([j (in-range 2 5)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (shift k (+ i >> j))))))))]) >> ? ? ? ? ? ? ? ? ? i) >> ? ? ? ? (for/list ([i (in-range 2 7)]) >> ? ? ? ? ? ? ? ? ? i)) >> >> ?#; >> ?(printf "test3\n") >> ?#; >> ?(do-tests (lambda () >> ? ? ? ? ? ? ?(make-do-sequence (lambda () >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(values >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (i) i) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) (add1 x)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?0 >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x) (< x 10)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (v) #t) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(lambda (x v) #t)))))) >> >> ?;; a cute example >> ?#; >> ?(let () >> ? ?;; generate infinte list of unique names >> ? ?(define-generator (machine-names) >> ? ? ? ? ? ? ? ? ? ? ?(define letters "abcdefghijklmnopqrstuvwxyz") >> ? ? ? ? ? ? ? ? ? ? ?(let loop ([len 0]) >> ? ? ? ? ? ? ? ? ? ? ? ?;; generates strings of length num >> ? ? ? ? ? ? ? ? ? ? ? ?(define-generator (generate num) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(for ([letter (in-string >> letters)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (if (= num 0) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (yield (string letter)) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (for ([l2 (generate (- num >> 1))]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(yield (string-append >> (string letter) l2)))))) >> ? ? ? ? ? ? ? ? ? ? ? ?(for ([str (generate len)]) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? (yield str)) >> ? ? ? ? ? ? ? ? ? ? ? ?(loop (add1 len)))) >> ? ?(for ([s (machine-names)] >> ? ? ? ? ?[j (in-range 0 1000)]) >> ? ? ? ? (printf "~a: ~a\n" j s))) >> >> ?)) >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From eli at barzilay.org Thu Aug 27 21:30:23 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Aug 27 21:30:45 2009 Subject: [plt-scheme] looking for a pattern In-Reply-To: References: Message-ID: <19095.13103.133741.444928@winooski.ccs.neu.edu> On Aug 27, Daniel Bastos wrote: > > (*) Investigations > > At first I thought this would be a fold. It really looks like it, > but I'm not really sure because I tend to think of folds on f > requiring f to be a binary operator, and my operands have different > types. But maybe I'm wrong about folds. It's not a map because I > must use the result of the first f-application, in the second. Folding works fine for this: > (define patterns '(["A" "B"] ["C" "D"])) > (foldl (lambda (subst str) (regexp-replace* (car subst) str (cadr subst))) "ABCDEF" patterns) "BBDDEF" > (for/fold ([str "ABCDEF"]) ([subst patterns]) (regexp-replace* (car subst) str (cadr subst))) "BBDDEF" But one thing that can lead to a very different solution is the fact that the substitutions are not independent -- in that case you'd want to create a pattern that matches all of them and arrange for a replacement in a single call. But this can be a little tricky to do. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Thu Aug 27 23:20:21 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Aug 27 23:20:54 2009 Subject: [plt-scheme] scribble examples and errors In-Reply-To: <4B3334E9-0FF8-49BF-91C5-B465E7D7C07B@ccs.neu.edu> References: <4B3334E9-0FF8-49BF-91C5-B465E7D7C07B@ccs.neu.edu> Message-ID: <20090828032024.8BF7365010B@mail-svr1.cs.utah.edu> The "eval" comes from the sandbox, which reads terms to evaluate using `read-syntax' with the source 'eval. Maybe that should be configurable in the sandbox, so you could use #f to indicate no source? (Eli?) At Wed, 26 Aug 2009 14:03:51 -0400, Ryan Culpepper wrote: > How can I eliminate the "eval:X:0:" prefix from the error message > shown in scribble examples for syntax errors, while still showing the > terms that caused the error? > > For example, if I put this in my scribble file: > > @(examples (raise-syntax-error 'some-example "some message" #'x)) > > I get this in the output: > > Example: > > (raise-syntax-error 'some-example "some message" #'x) > eval:1:0: some-example: some message in: x > > If I create an evaluator and set the 'error-print-source-location' > parameter to #f within the evaluator, the prefix goes away but so do > the terms: > > Example: > > (raise-syntax-error 'some-example "some message" #'x) > some-example: some message > > Is there any way to get the following? > > Example: > > (raise-syntax-error 'some-example "some message" #'x) > some-example: some message in: x > > Ryan > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Thu Aug 27 23:23:18 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Aug 27 23:23:42 2009 Subject: [plt-scheme] Scribble defproc without contracts? In-Reply-To: <4A90337F.6070205@neilvandyke.org> References: <4A90337F.6070205@neilvandyke.org> Message-ID: <20090828032320.7EEE365010B@mail-svr1.cs.utah.edu> How about `defthing' with the contract `procedure?'. At Sat, 22 Aug 2009 14:05:51 -0400, Neil Van Dyke wrote: > In Scribble, is there an easy way to document a procedure without > providing contract info for it? > > I automatically translate a legacy documentation format to Scribble. > This format does not have type info for procedures, so the translator > uses "any/c" everywhere that Scribble "defproc" needs contract info, > which makes for scary and misleading documentation. > > "defform" does almost what I want, presentation-wise, except for the > part about Scribble thinking it's syntax rather than procedure. > > If nobody has a simpler way, I will try to steal and adapt code from > "manual-form.ss" and have the translator insert it into the generated > Scribble files. One reason I'd prefer not to do that is that the > Scribble implementation might change. > > Thanks. > > -- > http://www.neilvandyke.org/ > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Fri Aug 28 00:09:13 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Aug 28 00:21:54 2009 Subject: [plt-scheme] scribble examples and errors In-Reply-To: <20090828032024.8BF7365010B@mail-svr1.cs.utah.edu> References: <4B3334E9-0FF8-49BF-91C5-B465E7D7C07B@ccs.neu.edu> <20090828032024.8BF7365010B@mail-svr1.cs.utah.edu> Message-ID: <19095.22633.562767.18717@winooski.ccs.neu.edu> This is currently hard-wired to the way it converts strings into syntaxes. It uses 'program for the given program and 'eval for later interactions. It's possible to bypass it in two ways: 1. Give it syntax values, so there is no need to read the strings, 2. Change the `sandbox-reader' function to one that uses it's own source, eg (parameterize ([sandbox-reader (let ([old (sandbox-reader)]) (lambda (_) (old #f)))]) (make-module-evaluator "#lang scheme (if 1)")) But when I do that I still see a "#f" in the syntax error. On Aug 27, Matthew Flatt wrote: > The "eval" comes from the sandbox, which reads terms to evaluate using > `read-syntax' with the source 'eval. Maybe that should be configurable > in the sandbox, so you could use #f to indicate no source? (Eli?) > > At Wed, 26 Aug 2009 14:03:51 -0400, Ryan Culpepper wrote: > > How can I eliminate the "eval:X:0:" prefix from the error message > > shown in scribble examples for syntax errors, while still showing the > > terms that caused the error? > > > > For example, if I put this in my scribble file: > > > > @(examples (raise-syntax-error 'some-example "some message" #'x)) > > > > I get this in the output: > > > > Example: > > > (raise-syntax-error 'some-example "some message" #'x) > > eval:1:0: some-example: some message in: x > > > > If I create an evaluator and set the 'error-print-source-location' > > parameter to #f within the evaluator, the prefix goes away but so do > > the terms: > > > > Example: > > > (raise-syntax-error 'some-example "some message" #'x) > > some-example: some message > > > > Is there any way to get the following? > > > > Example: > > > (raise-syntax-error 'some-example "some message" #'x) > > some-example: some message in: x > > > > Ryan > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From keydana at gmx.de Fri Aug 28 15:32:47 2009 From: keydana at gmx.de (keydana@gmx.de) Date: Fri Aug 28 15:33:09 2009 Subject: [plt-scheme] Problems using post-pure-port and reading posted request Message-ID: <2EE059B3-AC78-40B3-AE20-2388385A3D95@gmx.de> Hi all, I'd be glad for some help with a problem I have reading in a raw POST request and/or the usage of post-pure-port. I'm developing a small web service client, and I'm faking the corresponding server using the basic server from the More tutorial and adapting it just enough to send the required responses. While this works fine for a GET request, I cannot make it work for a POST, and unfortunately I even do not know whether the problem is on the server or the client side... From the client, I use (define store-events-to-ws (lambda (xexpr) (let ((payload (string->bytes/utf-8 (xexpr->string xexpr))) (request (format "http://~a:~a/calendar/events" *HOSTNAME* *PORT*))) (let ((response (post-pure-port (string->url request) payload))) (read-line response))))) In the server, when it's a POST request, I try to parse the content, but I don't get at anything. With a regex like the one below, I get 2 response headers and 2 empty strings: POST content is: (#"Host: localhost:6666\r\nContent-Length: 517\r\n\r \n" #"Host: localhost:6666" #"Content-Length: 517" #"" #"") When I try to make the regex longer, hoping for some POSTED content, the process hangs. (define handle-request (lambda (in out) (let ((req (regexp-match #rx"^(.*) (.+) HTTP/[0-9]+\\. [0-9]+" (read-line in)))) (when req (let ((method (second req)) (path (third req))) (let ((posted-content (if (equal? method "POST") (regexp-match (byte-regexp #"(.*?)\r\n(.*?)\r \n(.*?)\r\n(.*?)") in) #f))) (printf "POST content is: ~s~n" posted-content) (printf "Requested path is: ~s~n" path) (printf "Method is: ~s~n" method) (let ((xexpr (prompt (dispatch path method posted- content)))) (display "HTTP/1.0 200 Okay\r\n" out) (display "Server: k\r\nContent-Type: text/html\r\n\r\n" out) (display (xexpr->string xexpr) out) (printf "Request answered~n")))))))) Now I am a bit clueless how to investigate the problem. Perhaps I am making mistakes with the regex, or the handling of the input port. Or perhaps the POST did not work and there was really nothing... I'd be grateful for any advice in this. Of course I can at any time send more chunks of the code. Best greetings, Sigrid From yinso.chen at gmail.com Fri Aug 28 16:03:41 2009 From: yinso.chen at gmail.com (YC) Date: Fri Aug 28 16:04:06 2009 Subject: [plt-scheme] Problems using post-pure-port and reading posted request In-Reply-To: <2EE059B3-AC78-40B3-AE20-2388385A3D95@gmx.de> References: <2EE059B3-AC78-40B3-AE20-2388385A3D95@gmx.de> Message-ID: <779bf2730908281303t50cd54f3o5bdd9ff99242eb9b@mail.gmail.com> It seems the first thing to do is to isolate the problem you are having. A way to do so is to use either a known working server (so you can test the client) or a known working client (so you can test the server). If you use PLT web-server, you should be able to access the post data with request-post-data/raw. See http://docs.plt-scheme.org/web-server/http.html#(def._((lib._web-server/http/request-structs..ss)._request)) It is unclear what you mean by you "cannot make it work for a POST" - does it throw an error or hangs? post-pure-port returns only the data (without the headers), and your usage appears correct below. Another way of finding out what's posted to the server is to read in the whole request at once - you can use read-bytes and pass a large enough number that you'll for sure the request will not exceed. Above are what I thought of immediately. Cheers, yc On Fri, Aug 28, 2009 at 12:32 PM, keydana@gmx.de wrote: > Hi all, > > I'd be glad for some help with a problem I have reading in a raw POST > request and/or the usage of post-pure-port. > I'm developing a small web service client, and I'm faking the corresponding > server using the basic server from the More tutorial and adapting it just > enough to send the required responses. > > While this works fine for a GET request, I cannot make it work for a POST, > and unfortunately I even do not know whether the problem is on the server or > the client side... > > From the client, I use > > (define store-events-to-ws > (lambda (xexpr) > (let ((payload (string->bytes/utf-8 (xexpr->string xexpr))) (request > (format "http://~a:~a/calendar/events" *HOSTNAME* *PORT*))) > (let ((response (post-pure-port (string->url request) payload))) > (read-line response))))) > > > In the server, when it's a POST request, I try to parse the content, but I > don't get at anything. With a regex like the one below, I get 2 response > headers and 2 empty strings: > > POST content is: (#"Host: localhost:6666\r\nContent-Length: 517\r\n\r\n" > #"Host: localhost:6666" #"Content-Length: 517" #"" #"") > > When I try to make the regex longer, hoping for some POSTED content, the > process hangs. > > > (define handle-request > (lambda (in out) > (let ((req (regexp-match #rx"^(.*) (.+) HTTP/[0-9]+\\.[0-9]+" > (read-line in)))) > (when req > (let ((method (second req)) (path (third req))) > (let ((posted-content > (if (equal? method "POST") > (regexp-match (byte-regexp > #"(.*?)\r\n(.*?)\r\n(.*?)\r\n(.*?)") in) > #f))) > (printf "POST content is: ~s~n" posted-content) > (printf "Requested path is: ~s~n" path) > (printf "Method is: ~s~n" method) > (let ((xexpr (prompt (dispatch path method posted-content)))) > (display "HTTP/1.0 200 Okay\r\n" out) > (display "Server: k\r\nContent-Type: text/html\r\n\r\n" out) > (display (xexpr->string xexpr) out) > (printf "Request answered~n")))))))) > > > Now I am a bit clueless how to investigate the problem. Perhaps I am making > mistakes with the regex, or the handling of the input port. Or perhaps the > POST did not work and there was really nothing... > > I'd be grateful for any advice in this. Of course I can at any time send > more chunks of the code. > > Best greetings, > Sigrid > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090828/04eb5ac0/attachment.htm From yinso.chen at gmail.com Fri Aug 28 17:42:06 2009 From: yinso.chen at gmail.com (YC) Date: Fri Aug 28 17:42:28 2009 Subject: [plt-scheme] ANN: SHP 0.2 is now available + introducing JSMGR 0.1 Message-ID: <779bf2730908281442j4d645ae2kdc1ef64a4481e415@mail.gmail.com> Hi all - SHP 0.2 is now available through planet, along with JSMGR 0.1 and HTTP 0.1. SHP adds a number of enhancements toward making SHP easy to use: - simpler startup - default and configurable chrome - so you can switch the UI chrome depending on the page - proxy integration - a built-in http/s proxy so you can use AJAX with ease - JSMGR, which allows you to develop javascript and css in modular fashion but yet serve them combined and compressed; it is optionally available (you need to require the module explicitly) in SHP - HTTP client abstraction, which include https protocol - this is the basis of proxy To download SHP and JSMGR: (require (planet bzlib/shp)) (require (planet bzlib/jsmgr/shp)) You can find additional details and sample code at http://weblambda.blogspot.com/2009/08/shp-02-and-jsmgr-01-http-01-are-now.html Cheers, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090828/fce851dd/attachment.html From con.amalgamate at gmail.com Fri Aug 28 21:01:06 2009 From: con.amalgamate at gmail.com (Simon Haines) Date: Fri Aug 28 21:01:26 2009 Subject: [plt-scheme] Patching my PLT scheme Message-ID: Hello I have a patch for my scheme installation that I'd like to try out. I've patched a .ss file in collects/web-server/http, but when I try to use it, I get 'link: module mismatch, probably from old bytecode whose dependencies have changed...' I understand the nature of the problem, my question is how do I recompile/relink the offending file with its dependencies? I've tried renaming/removing the .zo files hoping that a file-not-found triggers a recompile, but that doesn't seem to work. Any suggestions? Thanks, Simon. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090829/ee29414e/attachment.htm From mflatt at cs.utah.edu Fri Aug 28 21:05:32 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri Aug 28 21:05:58 2009 Subject: [plt-scheme] Patching my PLT scheme In-Reply-To: References: Message-ID: <20090829010536.1F98E6500E7@mail-svr1.cs.utah.edu> At Sat, 29 Aug 2009 11:01:06 +1000, Simon Haines wrote: > Hello > I have a patch for my scheme installation that I'd like to try out. I've > patched a .ss file in collects/web-server/http, but when I try to use it, I > get 'link: module mismatch, probably from old bytecode whose dependencies > have changed...' > > I understand the nature of the problem, my question is how do I > recompile/relink the offending file with its dependencies? I've tried > renaming/removing the .zo files hoping that a file-not-found triggers a > recompile, but that doesn't seem to work. Any suggestions? If the file is called x.ss, use mzc x.ss Or, since the file is in the `web-server/http' collection, setup-plt -l web-server/http From mflatt at cs.utah.edu Fri Aug 28 21:08:47 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri Aug 28 21:09:11 2009 Subject: [plt-scheme] Patching my PLT scheme In-Reply-To: <20090829010536.1F98E6500E7@mail-svr1.cs.utah.edu> References: <20090829010536.1F98E6500E7@mail-svr1.cs.utah.edu> Message-ID: <20090829010848.757066500E7@mail-svr1.cs.utah.edu> At Fri, 28 Aug 2009 19:05:32 -0600, Matthew Flatt wrote: > At Sat, 29 Aug 2009 11:01:06 +1000, Simon Haines wrote: > > Hello > > I have a patch for my scheme installation that I'd like to try out. I've > > patched a .ss file in collects/web-server/http, but when I try to use it, I > > get 'link: module mismatch, probably from old bytecode whose dependencies > > have changed...' > > > > I understand the nature of the problem, my question is how do I > > recompile/relink the offending file with its dependencies? I've tried > > renaming/removing the .zo files hoping that a file-not-found triggers a > > recompile, but that doesn't seem to work. Any suggestions? > > If the file is called x.ss, use > > mzc x.ss Actually... that just recompiles the changed "x.ss", but you're probably getting the error when some other starting point "y.ss" tries to use "x.ss". In that case, you want mzc y.ss From d.j.gurnell at gmail.com Sat Aug 29 05:13:16 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Sat Aug 29 05:13:40 2009 Subject: [plt-scheme] Keyword arguments using syntax/parse Message-ID: Hi all, I'm experimenting with syntax/parse as a way of implementing optional keyword arguments with default values. I've included some test code below. I'm new to this library so I want to make sure I'm not missing anything. Is this the intended approach for this kind of thing? Many thanks, -- Dave ; keyword-test.ss ================================= #lang scheme (require (for-syntax syntax/parse)) ; Example macro ----------------------------------- ; (_ [#:a expr] [#:b expr]) ; ; Expands to (list a b) where a and b: ; - are either specified using #:a and #:b; ; - or take on default values 'default-a and 'default-b. (define-syntax (test stx) (syntax-parse stx [(_ (~or (~optional (~seq #:a user-a) #:name "#:a keyword") (~optional (~seq #:b user-b) #:name "#:b keyword")) ...) (with-syntax ([a (or (attribute user-a) #''default-a)] [b (or (attribute user-b) #''default-b)]) #'(list a b))])) ; Test code --------------------------------------- (test) ; => '(default-a default-b) (test #:a 1) ; => '(1 default-b) (test #:a 1 #:b 2) ; => '(1 2) ; ================================================= -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090829/62f9ea4b/attachment.html From toddobryan at gmail.com Sat Aug 29 11:00:48 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Aug 29 11:01:08 2009 Subject: [plt-scheme] XML exercises or important concepts Message-ID: <904774730908290800t24914bd1je328835be1832f48@mail.gmail.com> I'm having my post-AP class go through the XML tutorial at w3schools.com and when I see them next week I want to start talking about how to manipulate XML documents in Scheme. Does anybody teach this material and have some exercises they've assigned that I could steal from? If not, can someone suggest what the most important topics/functions to cover would be and I'll try to pull something together and post it back to the list. Todd From keydana at gmx.de Sat Aug 29 14:03:02 2009 From: keydana at gmx.de (keydana@gmx.de) Date: Sat Aug 29 14:03:28 2009 Subject: [plt-scheme] Problems using post-pure-port and reading posted request In-Reply-To: <779bf2730908281303t50cd54f3o5bdd9ff99242eb9b@mail.gmail.com> References: <2EE059B3-AC78-40B3-AE20-2388385A3D95@gmx.de> <779bf2730908281303t50cd54f3o5bdd9ff99242eb9b@mail.gmail.com> Message-ID: Hi, thanks a lot for your advice! I tried read-bytes and it worked - I see the posted request, it is there! So now it only remains for me to find out what I did wrong with regex, just for fun/curiosity/learning :-; BTW just as an aside, I was also planning to use the web server as a last resort, just it was easier for me to extend the code from the More tutorial as I have worked through this not-too-long-ago and of course again, I was curious to experiment with this basic & raw server implementation :-; So thanks again, this saved me quite some hours! Sigrid Am 28.08.2009 um 22:03 schrieb YC: > It seems the first thing to do is to isolate the problem you are > having. A way to do so is to use either a known working server (so > you can test the client) or a known working client (so you can test > the server). > > If you use PLT web-server, you should be able to access the post > data with request-post-data/raw. See http://docs.plt-scheme.org/web-server/http.html#(def._((lib._web-server/ > http/request-structs..ss)._request)) > > It is unclear what you mean by you "cannot make it work for a POST" > - does it throw an error or hangs? > > post-pure-port returns only the data (without the headers), and your > usage appears correct below. > > Another way of finding out what's posted to the server is to read in > the whole request at once - you can use read-bytes and pass a large > enough number that you'll for sure the request will not exceed. > > Above are what I thought of immediately. Cheers, > yc > > On Fri, Aug 28, 2009 at 12:32 PM, keydana@gmx.de > wrote: > Hi all, > > I'd be glad for some help with a problem I have reading in a raw > POST request and/or the usage of post-pure-port. > I'm developing a small web service client, and I'm faking the > corresponding server using the basic server from the More tutorial > and adapting it just enough to send the required responses. > > While this works fine for a GET request, I cannot make it work for a > POST, and unfortunately I even do not know whether the problem is on > the server or the client side... > > >From the client, I use > > (define store-events-to-ws > (lambda (xexpr) > (let ((payload (string->bytes/utf-8 (xexpr->string xexpr))) > (request (format "http://~a:~a/calendar/events" *HOSTNAME* *PORT*))) > (let ((response (post-pure-port (string->url request) payload))) > (read-line response))))) > > > In the server, when it's a POST request, I try to parse the content, > but I don't get at anything. With a regex like the one below, I get > 2 response headers and 2 empty strings: > > POST content is: (#"Host: localhost:6666\r\nContent-Length: 517\r\n\r > \n" #"Host: localhost:6666" #"Content-Length: 517" #"" #"") > > When I try to make the regex longer, hoping for some POSTED content, > the process hangs. > > > (define handle-request > (lambda (in out) > (let ((req (regexp-match #rx"^(.*) (.+) HTTP/[0-9]+\\. > [0-9]+" (read-line in)))) > (when req > (let ((method (second req)) (path (third req))) > (let ((posted-content > (if (equal? method "POST") > (regexp-match (byte-regexp #"(.*?)\r\n(.*?)\r > \n(.*?)\r\n(.*?)") in) > #f))) > (printf "POST content is: ~s~n" posted-content) > (printf "Requested path is: ~s~n" path) > (printf "Method is: ~s~n" method) > (let ((xexpr (prompt (dispatch path method posted- > content)))) > (display "HTTP/1.0 200 Okay\r\n" out) > (display "Server: k\r\nContent-Type: text/html\r\n\r\n" > out) > (display (xexpr->string xexpr) out) > (printf "Request answered~n")))))))) > > > Now I am a bit clueless how to investigate the problem. Perhaps I am > making mistakes with the regex, or the handling of the input port. > Or perhaps the POST did not work and there was really nothing... > > I'd be grateful for any advice in this. Of course I can at any time > send more chunks of the code. > > Best greetings, > Sigrid > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090829/8f221f18/attachment.htm From ryanc at ccs.neu.edu Sat Aug 29 20:58:03 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Sat Aug 29 20:58:52 2009 Subject: [plt-scheme] Keyword arguments using syntax/parse In-Reply-To: References: Message-ID: <4A99CE9B.6010103@ccs.neu.edu> Dave Gurnell wrote: > Hi all, > > I'm experimenting with syntax/parse as a way of implementing optional > keyword arguments with default values. > > I've included some test code below. I'm new to this library so I want to > make sure I'm not missing anything. Is this the intended approach for > this kind of thing? Yes, that's right. I intend to streamline this a little more soon, but for now that's how to do it. Here's another way that you might find more pleasant: it separates the options out into a "splicing syntax class": (define-syntax (test stx) (define-splicing-syntax-class options #:attributes (a b) (pattern (~seq (~or (~optional (~seq #:a user-a) #:name "#:a keyword") (~optional (~seq #:b user-b) #:name "#:b keyword")) ...) #:with a (or (attribute user-a) #''default-a) #:with b (or (attribute user-b) #''default-b))) (syntax-parse stx [(_ opt:options) #'(list opt.a opt.b)])) Ryan > > Many thanks, > > -- Dave > > ; keyword-test.ss ================================= > > #lang scheme > > (require (for-syntax syntax/parse)) > > ; Example macro ----------------------------------- > > ; (_ [#:a expr] [#:b expr]) > ; > ; Expands to (list a b) where a and b: > ; - are either specified using #:a and #:b; > ; - or take on default values 'default-a and 'default-b. > > (define-syntax (test stx) > (syntax-parse stx > [(_ (~or (~optional (~seq #:a user-a) #:name "#:a keyword") > (~optional (~seq #:b user-b) #:name "#:b keyword")) ...) > > (with-syntax ([a (or (attribute user-a) #''default-a)] > [b (or (attribute user-b) #''default-b)]) > > #'(list a b))])) > > ; Test code --------------------------------------- > > (test) ; => '(default-a default-b) > (test #:a 1) ; => '(1 default-b) > (test #:a 1 #:b 2) ; => '(1 2) > > ; ================================================= > > > > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From d.j.gurnell at gmail.com Sun Aug 30 05:12:12 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Sun Aug 30 05:12:34 2009 Subject: [plt-scheme] Keyword arguments using syntax/parse In-Reply-To: <4A99CE9B.6010103@ccs.neu.edu> References: <4A99CE9B.6010103@ccs.neu.edu> Message-ID: Ryan Culpepper wrote: > Dave Gurnell wrote: >> Hi all, >> I'm experimenting with syntax/parse as a way of implementing >> optional keyword arguments with default values. >> I've included some test code below. I'm new to this library so I >> want to make sure I'm not missing anything. Is this the intended >> approach for this kind of thing? > > Yes, that's right. I intend to streamline this a little more soon, > but for now that's how to do it. > > Here's another way that you might find more pleasant: it separates > the options out into a "splicing syntax class": > > (define-syntax (test stx) > > (define-splicing-syntax-class options > #:attributes (a b) > (pattern (~seq (~or (~optional (~seq #:a user-a) > #:name "#:a keyword") > (~optional (~seq #:b user-b) > #:name "#:b keyword")) ...) > #:with a (or (attribute user-a) #''default-a) > #:with b (or (attribute user-b) #''default-b))) > > (syntax-parse stx > [(_ opt:options) > #'(list opt.a opt.b)])) > > Ryan That's very nice. syntax/parse is awesome. I just managed to reduce two pages of parsing code by a factor of four in length. Keep up the good work! -- Dave From toddobryan at gmail.com Sun Aug 30 18:06:24 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 30 18:06:44 2009 Subject: [plt-scheme] Way to insert arbitrary web links in Scribble document? Message-ID: <904774730908301506l54a11319l56dbc287db96a83@mail.gmail.com> Is this possible. I see how to insert links to other documentation, but is there a way to link to outside pages? From toddobryan at gmail.com Sun Aug 30 18:57:09 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 30 18:57:27 2009 Subject: [plt-scheme] Exercises in Scribble Message-ID: <904774730908301557j619520e9y1b47c2c7df9898ac@mail.gmail.com> In another Scribble-related question, is there a standard way to style exercises so that they're auto-numbered, typeset appropriately, etc.? I have this sense that Scribble could be very useful, but since I'm spending so much time looking for what I want to do, I'm tempted to fall back into LaTeX (shiver). Is there a more user-friendly description than the standard documentation in the Help Desk? Todd From neil at neilvandyke.org Sun Aug 30 19:53:00 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Aug 30 19:53:23 2009 Subject: [plt-scheme] Way to insert arbitrary web links in Scribble document? In-Reply-To: <904774730908301506l54a11319l56dbc287db96a83@mail.gmail.com> References: <904774730908301506l54a11319l56dbc287db96a83@mail.gmail.com> Message-ID: <4A9B10DC.9040901@neilvandyke.org> Todd O'Bryan wrote at 08/30/2009 06:06 PM: > Is this possible. I see how to insert links to other documentation, > but is there a way to link to outside pages? > I think you want to use "link": http://download.plt-scheme.org/doc/html/scribble/section-links.html#(def._((lib._scribble/manual..ss)._link)) @link["http://www.plt-scheme.org/"]{PLT Scheme} From toddobryan at gmail.com Sun Aug 30 20:57:53 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sun Aug 30 20:58:15 2009 Subject: [plt-scheme] Way to insert arbitrary web links in Scribble document? In-Reply-To: <4A9B10DC.9040901@neilvandyke.org> References: <904774730908301506l54a11319l56dbc287db96a83@mail.gmail.com> <4A9B10DC.9040901@neilvandyke.org> Message-ID: <904774730908301757v3faf16c4laf0bd05a65c80082@mail.gmail.com> You are correct and I feel stupid for missing that. I had tried searching for scribble link and didn't find anything. Then I went to make sure that was correct and saw (for the first time) the [?] and [!] links. Sure enough M:scribble link returned the part I had missed. Todd On Sun, Aug 30, 2009 at 7:53 PM, Neil Van Dyke wrote: > Todd O'Bryan wrote at 08/30/2009 06:06 PM: >> >> Is this possible. I see how to insert links to other documentation, >> but is there a way to link to outside pages? >> > > I think you want to use "link": > > http://download.plt-scheme.org/doc/html/scribble/section-links.html#(def._((lib._scribble/manual..ss)._link)) > > @link["http://www.plt-scheme.org/"]{PLT Scheme} > > > From grettke at acm.org Mon Aug 31 16:50:17 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Aug 31 16:50:37 2009 Subject: [plt-scheme] Scribble defproc without contracts? In-Reply-To: <20090828032320.7EEE365010B@mail-svr1.cs.utah.edu> References: <4A90337F.6070205@neilvandyke.org> <20090828032320.7EEE365010B@mail-svr1.cs.utah.edu> Message-ID: <756daca50908311350n6f82c875h7615d0feab6a9580@mail.gmail.com> On Thu, Aug 27, 2009 at 10:23 PM, Matthew Flatt wrote: > How about `defthing' with the contract `procedure?'. Neil did this end up working well for you? From matthias at ccs.neu.edu Mon Aug 31 12:11:21 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Aug 31 17:43:20 2009 Subject: [plt-scheme] Exercises in Scribble In-Reply-To: <904774730908301557j619520e9y1b47c2c7df9898ac@mail.gmail.com> References: <904774730908301557j619520e9y1b47c2c7df9898ac@mail.gmail.com> Message-ID: There is a figure package with numbering figures and cross-referencing I recommend copying it and adapting it to your purposes. See the HtDP/2e package on my web page to see what you can produce. -- Matthias On Aug 30, 2009, at 6:57 PM, Todd O'Bryan wrote: > In another Scribble-related question, is there a standard way to style > exercises so that they're auto-numbered, typeset appropriately, etc.? > > I have this sense that Scribble could be very useful, but since I'm > spending so much time looking for what I want to do, I'm tempted to > fall back into LaTeX (shiver). Is there a more user-friendly > description than the standard documentation in the Help Desk? > > Todd > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From tbourdon at gmail.com Sun Aug 30 19:42:02 2009 From: tbourdon at gmail.com (tbourdon) Date: Tue Sep 1 17:49:02 2009 Subject: [plt-scheme] Lexical Scoping, References and Side Effects Message-ID: <6af48c6b-39dc-4003-9da6-4bbb6582f299@j9g2000vbp.googlegroups.com> Hello - I'm currently teaching myself Scheme by working through "Teach Yourself Scheme in Fixnum Days" and "The Little Schemer". As I was working through the sources I decided to break off and implement some stack data structures. So far I've implemented the stack functions three different ways and I've noticed that I really can't (or haven't found a way) to create a reference to a stack and pass it around to be operated on. For example; I can't come up with an implementation for a stack-push function where the following works: (define stack ()) (stack-push stack 1) (stack-top stack) => 1 I have been able to come up with the following implementation (1): (define-struct list-pointer (value)) (define stack (make-list-pointer ())) (stack-push stack 1) (stack-top stack) => 1 I've also been able to implement the following (2): (define stack ()) (set! stack (stack-push stack 1)) (stack-top stack) => 1 I also have a more traditional implementation (3) where I've defined two structures (stack and stack-item) where a stack-item has a value and reference to a next-stack-item. Because this implementation used structures I was able to make my stack, pass it to the various stack functions and have the caller's reference of stack changed in the functions. Now I've read in some places that side effects are avoided in Scheme. But the idea of passing references down call stacks and changing the values they point to is so pervasive in other languages that its something I do as second nature. Is there really no way in Scheme to create a reference to a value, pass it to a function and have it's value changed in the caller's scope? My second implementation which used the (define-struct list-pointer (value)) was my hack for this behavior but I'm wondering if there's just something I'm missing. For my second implementation I had the stack-push function just return the updated stack but as you can see this leads to successive set! calls in order to update the stack. While the stack-push function seems more "Schemey" by not relying on side effects, it sure is a paradigm shift from other languages. Any insights on this topic would be appreciated. From rich at WPI.EDU Sun Aug 30 22:11:16 2009 From: rich at WPI.EDU (Charles Rich) Date: Tue Sep 1 17:49:09 2009 Subject: [plt-scheme] Meta editing key on Mac DrScheme Message-ID: It would be really nice for the Alt(Option) key to serve as the Meta key for Emacs-style editing on the Mac (just like all Emacs-like editing apps on the Mac) instead of the currently offered Apple key option. Has anyone else already solved this? How about a feature request? Tx, -CR --------------------------------------------------- Dr. Charles Rich, Professor of Computer Science Interactive Media and Game Development Worcester Polytechnic Institute, Fuller Laboratories B25b 100 Institute Road, Worcester, MA 01609-2280 Email: rich@wpi.edu Phone: 508-831-5945 Fax: 508-831-5776 Home: http://www.cs.wpi.edu/~rich