From benjisimon at gmail.com Wed Apr 1 01:35:45 2009 From: benjisimon at gmail.com (Ben Simon) Date: Wed Apr 1 01:36:07 2009 Subject: [plt-scheme] Moby Scheme - world.ss versus gui-world.ss Message-ID: Howdy, I know I'm on the bleeding edge here, but I'd like to toss out a question about Moby Scheme [1]. While writing my first application [2], I came across some confusion about gui-world.ss and world.ss. >From what I can tell, you can either build your app based on gui-world.ss and have access to buttons and message boxes, or, you can build it on moby/stub/world.ss in which case you have access to location and tilt information. Attempting to import both libraries raise the error: (require moby/stub/world) (require gui-world/gui-world) => module: identifier already imported from a different source So, how can I get the GUI controls from gui-world and Android specific stuff from world.ss? I must say - Moby Scheme is a fun project, and I really love the direction it's heading. -Ben [1] - http://list.cs.brown.edu/pipermail/plt-scheme/2009-March/031703.html [2] - http://benjisimon.blogspot.com/2009/03/location-stamper-putting-moby-scheme-to.html -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090401/a1358325/attachment.htm From dyoo at cs.wpi.edu Wed Apr 1 01:48:12 2009 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Wed Apr 1 01:48:31 2009 Subject: [plt-scheme] Moby Scheme - world.ss versus gui-world.ss In-Reply-To: References: Message-ID: > Attempting to import both libraries raise the error: > > (require moby/stub/world) > (require gui-world/gui-world) > => > module: identifier already imported from a different source > > So, how can I get the GUI controls from gui-world and Android specific stuff > from world.ss? (I just talked with Ben in private email.) Yes, the gui-world component is missing the integration with the Android-specific services; I ran out of time before the ILC talk. But it's on our radar, and we'll have this fixed shortly. From nik at fo.am Wed Apr 1 05:00:06 2009 From: nik at fo.am (nik gaffney) Date: Wed Apr 1 05:00:33 2009 Subject: [plt-scheme] ssl/tls connections In-Reply-To: <20090331194131.4EEC96500E2@mail-svr1.cs.utah.edu> References: <49CF8EF4.2060001@fo.am> <20090331164813.8140B65009C@mail-svr1.cs.utah.edu> <49D25342.7010500@fo.am> <20090331182426.1ECFB6500B2@mail-svr1.cs.utah.edu> <20090331194131.4EEC96500E2@mail-svr1.cs.utah.edu> Message-ID: <49D32D16.7020302@fo.am> >> I don't yet believe any of this, but maybe it's worth one more try. > > This change does seem to work, so I've committed it to SVN and removed > the documentation's claim that attempting to read/write puts the port > in read-/write-only mode. With some minimal testing, it looks like it works here too (using sync rather than byte-ready). glad to see the empiricist impulse overcome belief in this case. .. thanks again, nik From DekuDekuplex at Yahoo.com Wed Apr 1 06:07:44 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Wed Apr 1 06:08:30 2009 Subject: [plt-scheme] How to remap keybinding "(c:j)" from "newline" to "newline-and-indent"? Message-ID: While editing a file in the Definitions panel in DrScheme, version 4.1.5 [3m], english, I discovered that the keybinding for "C-j" (in Emacs-style notation, the control key held while the 'j' key is pressed) did not indent the following line, but merely created a newline. Previously, in order to activate Emacs-style keybindings, I had navigated to the "Edit -> Preferences" menu item -> "Editing -> General" tab, and unchecked "Enable keybindings in menus." This allowed many Emacs-style keybindings to override the keybindings normally set in the menus in DrScheme. However, this particular keybinding had apparently been mapped to just "newline", instead of to "newline-and-indent". According to the "Edit -> Keybindings -> Show Active Keybindings" menu item, indeed, the keybinding "(c:j)" (in DrScheme-style notation, again, the control key held while the 'j' key is pressed) was, by default, mapped to "newline" instead of "newline-and-indent", unlike in Emacs. Navigating to the "Edit -> Keybindings -> Add User-defined Keybindings ..." menu item displayed a file navigator dialog box prompting to select a file. Mystified, in order to figure out how to override the above-mentioned keybinding, I then went to the "Help -> Help Desk" menu item, and found a very cryptic entry for "keymap:add-user-keybindings-file provided from framework" (see file:///c:/bin/PLT-4.1.5/doc/framework/Keymap.html#(def._((lib._framework/main..ss)._keymap~3aadd-user-keybindings-file))", but was unable to figure out exactly what sequence of commands to use to override this keybinding. Then, I search using Google with the keywords "DrScheme "keybindings"", and found a reference to "PLT Scheme Blog: Adjusting DrScheme's Keybindings" (see http://blog.plt-scheme.org/2007/05/adjusting-drschemes-keybindings.html), which in turn provided a reference to "Scheme from the Florida Keys: Keybinding in DrScheme Explained" (see http://schemekeys.blogspot.com/2007/05/keybinding-101-in-drscheme.html). According to this blog, in DrScheme, version 369.100-svn5may2007 [3m], it is possible to create a single file, say, mykeys.ss, containing keybindings using the special keybindings language, (lib "keybinding-lang.ss" "framework"), in which, to override a single keybinding, an incantation similar to the following is used: (module mykeys (lib "keybinding-lang.ss" "framework") (require (lib "tool-lib.ss" "drscheme")) (keybinding keybinding-string-expr keybinding-proc-expr)) in which the "keybinding-string-expr" and the "keybinding-proc-expr" expressions are to be substituted with appropriate definitions for the overriding keybindings. Based on the information in the blog, I constructed the following mykeys.ss file: -- (module mykeys (lib "keybinding-lang.ss" "framework") ; Adds DrScheme Specific functions to the ; available functions we can bind to. (require (lib "tool-lib.ss" "drscheme")) (keybinding "c:j" (lambda (editor event) (begin (newline) (tabify-at-caret))))) -- However, loading it into the "Edit -> Keybindings -> Add User-defined Keybindings ..." menu item resulted in the following error message: -- Error when installing the keybindings C:\Documents and Settings\Benjamin\My Documents\DrScheme\User-defined Keybindings\mykeys.ss: C:\Documents and Settings\Benjamin\My Documents\DrScheme\User-defined Keybindings\mykeys.ss:12:5: compile: unbound identifier in module in: tabify-at-caret -- But "tabify-at-caret" is a legal command listed in both the list displayed by the "Edit -> Keybindings -> Show Active Keybindings" menu item and the above-mentioned blog entry! How should I rewrite the code for mykeys.ss file to remap the keybinding "(c:j)" from "newline" to "newline-and-indent", as in Emacs? -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From nik at fo.am Wed Apr 1 06:17:24 2009 From: nik at fo.am (nik gaffney) Date: Wed Apr 1 06:18:00 2009 Subject: [plt-scheme] srfi 13 Message-ID: <49D33F34.3070505@fo.am> I've just noticed a small bug in srfi 13, as the following 2 functions appear to return the same result (in PLT 4.1.5) (require srfi/13) (string-index "abcde" #\d) (string-index-right "abcde" #\d) From eli at barzilay.org Wed Apr 1 06:20:22 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Apr 1 06:20:48 2009 Subject: [plt-scheme] srfi 13 In-Reply-To: <49D33F34.3070505@fo.am> References: <49D33F34.3070505@fo.am> Message-ID: <18899.16358.739821.930252@winooski.ccs.neu.edu> On Apr 1, nik gaffney wrote: > > I've just noticed a small bug in srfi 13, as the following 2 functions > appear to return the same result (in PLT 4.1.5) > > (require srfi/13) > > (string-index "abcde" #\d) > (string-index-right "abcde" #\d) What should they return? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From toon.verwaest at gmail.com Wed Apr 1 06:23:51 2009 From: toon.verwaest at gmail.com (Toon Verwaest) Date: Wed Apr 1 06:24:15 2009 Subject: [plt-scheme] r6rs define-struct and gensym Message-ID: <49D340B7.1080804@gmail.com> Hi, I am trying to port an OO-lib I wrote in PLT, SchemeTalk (http://smallwiki.unibe.ch/SchemeTalk), to r6rs; I'm having some problems with trying to load gensym and define-struct. I have found define-struct in (scheme private old-ds); but I guess I should use something else in the future? And how can I include gensym? I don't directly find the exact package. cheers, Toon Verwaest From samth at ccs.neu.edu Wed Apr 1 07:39:25 2009 From: samth at ccs.neu.edu (Sam TH) Date: Wed Apr 1 07:39:46 2009 Subject: [plt-scheme] srfi 13 In-Reply-To: <49D33F34.3070505@fo.am> References: <49D33F34.3070505@fo.am> Message-ID: <63bb19ae0904010439w6ce1abb9u92681ab0d68edc78@mail.gmail.com> I believe that behavior is correct. I think the difference is: (require srfi/13) (string-index "bob" #\b) ; => 0 (string-index-right "bob" #\b) ; => 2 sam th On Wed, Apr 1, 2009 at 6:17 AM, nik gaffney wrote: > > I've just noticed a small bug in srfi 13, as the following 2 functions > appear to return the same result (in PLT 4.1.5) > > (require srfi/13) > > (string-index "abcde" #\d) > (string-index-right "abcde" #\d) > > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From matthias at ccs.neu.edu Wed Apr 1 08:09:09 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Apr 1 08:10:28 2009 Subject: [plt-scheme] srfi 13 In-Reply-To: <63bb19ae0904010439w6ce1abb9u92681ab0d68edc78@mail.gmail.com> References: <49D33F34.3070505@fo.am> <63bb19ae0904010439w6ce1abb9u92681ab0d68edc78@mail.gmail.com> Message-ID: <70B9DD17-B5E6-4F59-8769-2F67F9CF8BE2@ccs.neu.edu> So this should be the contracts: (define si string-index) (define si-right string-index-right) ;; --- signature --- (require scheme/contract) (define (no-c-in c sel) (lambda (i) (and (integer? i) (>= i 0) (boolean? (member c (string->list (sel i))))))) (provide/contract [si (->d ((s string?) (c char?)) () (i (no-c-in c (? (i) (substring s 0 i)))))] [si-right (->d ((s string?) (c char?)) () (i (no-c-in c (? (i) (substring s (+ i 1))))))]) ?? -- Matthias On Apr 1, 2009, at 7:39 AM, Sam TH wrote: > I believe that behavior is correct. I think the difference is: > > (require srfi/13) > > (string-index "bob" #\b) ; => 0 > (string-index-right "bob" #\b) ; => 2 > > sam th > > On Wed, Apr 1, 2009 at 6:17 AM, nik gaffney wrote: >> >> I've just noticed a small bug in srfi 13, as the following 2 >> functions >> appear to return the same result (in PLT 4.1.5) >> >> (require srfi/13) >> >> (string-index "abcde" #\d) >> (string-index-right "abcde" #\d) >> >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Wed Apr 1 08:11:36 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Apr 1 08:12:45 2009 Subject: [plt-scheme] Re: HTDP 14.3.4 lists within lists. In-Reply-To: References: <6E37AECE-9B55-458A-8846-9A7AF5862BA5@ccs.neu.edu> <20090331164423.3544a9af@halmanfloyd.lan.local> Message-ID: On Mar 31, 2009, at 11:18 PM, Dave wrote: > I got it, I wasn't thinking clearly about what happens to Rest This is precisely why the purpose statement is so critical. It tells you WHAT the function computes without telling you HOW it computes it -- Matthias > when > it's pumped through the function so was over compensating. I'm pretty > happy with the way I've evaluated which of the two is the larger > branch, though it is unnerving to see the process performed twice on > the selected branch. > > -- if all branches of a cond add 1 to something, you can move this > outside. > > I'll keep my eye open for that one. On to 14.4 Extended Exercise: > Evaluating Scheme! Thanks for all the help. > > On Apr 1, 3:44 am, Marek Kubica wrote: >> Hi, >> >> I implemented it for myself and guess what - I did the same error as >> you did, my solution often returned a bigger depth than there >> actually >> was. >> >> On Tue, 31 Mar 2009 10:03:01 -0400 >> >> Matthias Felleisen wrote: >>> To answer question 1, you need to come up with a test case for which >>> you expect one result and your function produces a different one. >>> (Indeed, you should also have an argument as to why your expected >>> result is the one you want.) >> >> I recommend testing this test case: >> >> (depth '((a) (b))) >> >> It should return 1 but on my first solution it returned 2. It is >> useful >> to start the debugger to step over it and find out why that happens. >> >> After realizing what the problem is, a fix is trivial. >> >> regards, >> Marek >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > On Apr 1, 3:44 am, Marek Kubica wrote: >> Hi, >> >> I implemented it for myself and guess what - I did the same error as >> you did, my solution often returned a bigger depth than there >> actually >> was. >> >> On Tue, 31 Mar 2009 10:03:01 -0400 >> >> Matthias Felleisen wrote: >>> To answer question 1, you need to come up with a test case for which >>> you expect one result and your function produces a different one. >>> (Indeed, you should also have an argument as to why your expected >>> result is the one you want.) >> >> I recommend testing this test case: >> >> (depth '((a) (b))) >> >> It should return 1 but on my first solution it returned 2. It is >> useful >> to start the debugger to step over it and find out why that happens. >> >> After realizing what the problem is, a fix is trivial. >> >> regards, >> Marek >> _________________________________________________ >> 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 matthias at ccs.neu.edu Wed Apr 1 08:14:47 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Apr 1 08:15:55 2009 Subject: [plt-scheme] Moby Scheme - world.ss versus gui-world.ss In-Reply-To: References: Message-ID: Danny, if you integrated this stuff with the code base and turned such reports into bug reports, you would do yourself and us a favor -- Matthias On Apr 1, 2009, at 1:48 AM, Danny Yoo wrote: >> Attempting to import both libraries raise the error: >> >> (require moby/stub/world) >> (require gui-world/gui-world) >> => >> module: identifier already imported from a different source >> >> So, how can I get the GUI controls from gui-world and Android >> specific stuff >> from world.ss? > > > (I just talked with Ben in private email.) Yes, the gui-world > component is missing the integration with the Android-specific > services; I ran out of time before the ILC talk. But it's on our > radar, and we'll have this fixed shortly. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From grodenhi at holycross.edu Wed Apr 1 09:55:35 2009 From: grodenhi at holycross.edu (Greg Rodenhiser) Date: Wed Apr 1 09:55:54 2009 Subject: [plt-scheme] installing 103p1 on RHEL5 Message-ID: <6e4810db0904010655h62cac67fq8598537b263de103@mail.gmail.com> Has anyone gotten v103p1 to install on Redhat Enterprise 5? We have an instructor that requires this version, but I cannot get it to install on newer versions of Redhat. It requires libstdc++-libc6.1-1.so.2, which I installed via compat-libstdc++-7.3-2.96.118.i386. This got me past installing the plt rpm, but attempting to run drscheme segfaults. Thanks! -- Greg Rodenhiser College of the Holy Cross Technical Services Engineer -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090401/5002288b/attachment.htm From robby at eecs.northwestern.edu Wed Apr 1 09:57:51 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Apr 1 09:58:13 2009 Subject: [plt-scheme] installing 103p1 on RHEL5 In-Reply-To: <6e4810db0904010655h62cac67fq8598537b263de103@mail.gmail.com> References: <6e4810db0904010655h62cac67fq8598537b263de103@mail.gmail.com> Message-ID: <932b2f1f0904010657l5738f947t562e86780cbe58cf@mail.gmail.com> I don't have any experience with that particular combination, but I would suggest that you try building from source. 103p1 was a long time ago, but I think it should still be smooth (er than via binaries). Robby On Wed, Apr 1, 2009 at 8:55 AM, Greg Rodenhiser wrote: > Has anyone gotten v103p1 to install on Redhat Enterprise 5?? We have an > instructor that requires this version, but I cannot get it to install on > newer versions of Redhat.? It requires libstdc++-libc6.1-1.so.2, which I > installed via compat-libstdc++-7.3-2.96.118.i386.? This got me past > installing the plt rpm, but attempting to run drscheme segfaults. > > Thanks! > -- > Greg Rodenhiser > College of the Holy Cross > Technical Services Engineer > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From hu.ying.13 at gmail.com Wed Apr 1 10:00:11 2009 From: hu.ying.13 at gmail.com (ying hu) Date: Wed Apr 1 10:00:30 2009 Subject: [plt-scheme] need examples on some macro patterns Message-ID: <43c837f70904010700j4fec48a5w548ea5dacc957c81@mail.gmail.com> Hi, When I was reading 11.1 of plt scheme reference, I can't understand the patterns below | #(pattern ...) | #(pattern ... pattern ellipses pattern ...) | #s( key-datum pattern ...) | #s(key-datum pattern ... pattern ellipses pattern ...) I tried to find some examples about these on google but I failed. Can someone give me some example on these patterns? Thanks a lot Huying -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090401/e31cdd83/attachment.html From eli at barzilay.org Wed Apr 1 10:04:50 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Apr 1 10:05:12 2009 Subject: [plt-scheme] installing 103p1 on RHEL5 In-Reply-To: <932b2f1f0904010657l5738f947t562e86780cbe58cf@mail.gmail.com> References: <6e4810db0904010655h62cac67fq8598537b263de103@mail.gmail.com> <932b2f1f0904010657l5738f947t562e86780cbe58cf@mail.gmail.com> Message-ID: <18899.29826.839645.365916@winooski.ccs.neu.edu> Another option is to install it on RedHat 7.2, which seems to be the RH version at the time. (On a VM, to be practical...) On Apr 1, Robby Findler wrote: > I don't have any experience with that particular combination, but I > would suggest that you try building from source. 103p1 was a long time > ago, but I think it should still be smooth (er than via binaries). > > Robby > > On Wed, Apr 1, 2009 at 8:55 AM, Greg Rodenhiser wrote: > > Has anyone gotten v103p1 to install on Redhat Enterprise 5?? We > > have an instructor that requires this version, but I cannot get it > > to install on newer versions of Redhat.? It requires > > libstdc++-libc6.1-1.so.2, which I installed via > > compat-libstdc++-7.3-2.96.118.i386.? This got me past installing > > the plt rpm, but attempting to run drscheme segfaults. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Wed Apr 1 10:08:51 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Apr 1 10:09:13 2009 Subject: [plt-scheme] installing 103p1 on RHEL5 In-Reply-To: <6e4810db0904010655h62cac67fq8598537b263de103@mail.gmail.com> References: <6e4810db0904010655h62cac67fq8598537b263de103@mail.gmail.com> Message-ID: <20090401140854.2B11C6500D4@mail-svr1.cs.utah.edu> At Wed, 1 Apr 2009 09:55:35 -0400, Greg Rodenhiser wrote: > Has anyone gotten v103p1 to install on Redhat Enterprise 5? We have an > instructor that requires this version, but I cannot get it to install on > newer versions of Redhat. It requires libstdc++-libc6.1-1.so.2, which I > installed via compat-libstdc++-7.3-2.96.118.i386. This got me past > installing the plt rpm, but attempting to run drscheme segfaults. Do you have a stacksize limit? If not, try setting it to 8MB. (If I remember correctly, version 103 gets confused when newer versions of Linux report an unlimited stack size available to the program.) From eli at barzilay.org Wed Apr 1 10:10:12 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Apr 1 10:10:35 2009 Subject: [plt-scheme] need examples on some macro patterns In-Reply-To: <43c837f70904010700j4fec48a5w548ea5dacc957c81@mail.gmail.com> References: <43c837f70904010700j4fec48a5w548ea5dacc957c81@mail.gmail.com> Message-ID: <18899.30148.818753.522104@winooski.ccs.neu.edu> On Apr 1, ying hu wrote: > Hi, > > When I was reading 11.1 of plt scheme reference, I can't understand the > patterns below > | #(pattern ...) | #(pattern ... pattern ellipses pattern ...) | #s( > key-datum pattern ...) | #s(key-datum pattern ... pattern ellipses pattern > ...) > I tried to find some examples about these on google but I failed. > Can someone give me some example on these patterns? > (define-syntax foo (syntax-rules () [(foo (x ...)) (list x ...)] [(foo #(x ...)) (list 'vec x ...)] [(foo #s(add x ...)) (+ x ...)] [(foo #s(mul x ...)) (* x ...)])) > (foo (1 2 3 4)) (1 2 3 4) > (foo #(1 2 3 4)) (vec 1 2 3 4) > (foo #s(add 1 2 3 4)) 10 > (foo #s(mul 1 2 3 4)) 24 -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From czhu at cs.utah.edu Wed Apr 1 10:28:45 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Wed Apr 1 10:29:27 2009 Subject: [plt-scheme] r6rs define-struct and gensym In-Reply-To: <49D340B7.1080804@gmail.com> References: <49D340B7.1080804@gmail.com> Message-ID: <49D37A1D.20701@cs.utah.edu> Toon Verwaest wrote: > Hi, > > I am trying to port an OO-lib I wrote in PLT, SchemeTalk > (http://smallwiki.unibe.ch/SchemeTalk), to r6rs; I'm having some > problems with trying to load gensym and define-struct. > > I have found define-struct in (scheme private old-ds); but I guess I > should use something else in the future? > R6RS records: http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-7.html > And how can I include gensym? I don't directly find the exact package. > According to R6RS, "two symbols whose names are spelled the same way are never distinguishable". So no gensym in the sense of uninterned symbol is available. For the purpose of "generating something that is distinct from anything else", use some other data type instead. > cheers, > Toon Verwaest Chongkai From icfp.publicity at googlemail.com Wed Apr 1 11:32:37 2009 From: icfp.publicity at googlemail.com (Matthew Fluet (ICFP Publicity Chair)) Date: Wed Apr 1 11:33:02 2009 Subject: [plt-scheme] DEFUN09: Call for Talks & Tutorials (co-located w/ ICFP09) Message-ID: <53ff55480904010832t69032ab6k83f25cdc5907c6e0@mail.gmail.com> Call for Talks and Tutorials ACM SIGPLAN 2009 Developer Tracks on Functional Programming http://www.defun2009.info/ Edinburgh, Scotland, September 3 and 5, 2009 The workshop will be held in conjunction with ICFP 2009 http://www.cs.nott.ac.uk/~gmh/icfp09.html Important dates Proposal Deadline: June 5, 2009, 0:00 UTC Notification: June 19, 2009 DEFUN 2009 invites functional programmers and researchers who know how to solve problems with functional progamming to give talks and lead tutorials at the The ICFP Developer Tracks. We want to know about your favorite programming techniques, powerful libraries, and engineering approaches you've used that the world should know about and apply to other projects. We want to know how to be productive using functional programming, write better code, and avoid common pitfalls. We invite proposals for presentations in the following categories. Lightning talks 5- to 10-minute talks that introduce exciting and promising research or techniques that may be in progress or not yet ready for widespread use, but that offer a glimpse into the near future of real world functional programming. Examples: * Clustered high performance computing in a functional language * Making advanced type systems more accessible to working programmers * How and why we're infiltrating category theory info industry How-to talks 45-minute "how-to" talks that provide specific information on how to solve specific problems using functional programming. These talks focus on concrete examples, but provide useful information for developers working on different projects or in different contexts. Examples: * "How I use Haskell for oilfield simulations." * "How I replaced /sbin/init by a Scheme program." * "How I hooked up my home appliances to an Erlang control system." * "How I got an SML program to drive my BMW." General language tutorials Half-day general language tutorials for specific functional languages, given by recognized experts for the respective languages. Technology tutorials Half-day tutorials on techniques, technologies, or solving specific problems in functional programming. Examples: * How to make the best use of specific FP programming techniques * How to inject FP into a development team used to more conventional technologies * How to connect FP to existing libraries / frameworks / platforms * How to deliver high-performance systems with FP * How to deliver high-reliability systems with FP Remember that your audience will include computing professionals who are not academics and who may not already be experts on functional programming. Presenters of tutorials will receive free registration to CUFP 2009. Submission guidelines Submit a proposal of 150 words or less for either a 45-minute talk with a short Q&A session at the end, or a 300-word-or-less proposal for a 3-hour tutorial, where you present your material, but also give participants a chance to practice it on their own laptops. Some advice: * Give it a simple and straightforward title or name; avoid fancy titles or puns that would make it harder for attendees to figure out what you'll be talking about. * Clearly identify the level of the talk: What knowledge should people have when they come to the presentation or tutorial? * Explain why people will want to attend: o Is the language or library useful for a wide range of attendees? o Is the pitfall you're identifying common enough that a wide range of attendees is likely to encounter it? * Explain what benefits attendees are expected to take home to their own projects. * For a tutorial, explain how you want to structure the time, and what you expect to have attendees to do on their laptops. List what software you'll expect attendees to have installed prior to coming. Submit your proposal in plain text electronically to defun-2009-submissions@serpentine.com by the beginning of Friday, June 5 2009, Universal Coordinated Time. Organizers * Yaron Minsky (Jane Street Capital) * Ulf Wiger (Erlang Training and Consulting) * Mike Sperber - co-chair (DeinProgramm) * Bryan O'Sullivan - co-chair (Linden Lab) From marc.chamly at gmail.com Wed Apr 1 12:41:35 2009 From: marc.chamly at gmail.com (CHAMLY) Date: Wed Apr 1 12:41:59 2009 Subject: [plt-scheme] Compatibility MACOS <--> VISTA In-Reply-To: <1c1a33bc0903311623t21f913d6ua08d0e922b4836ba@mail.gmail.com> References: <9EF71524-D37B-4B00-9C4B-D5517B49E60A@gmail.com> <1c1a33bc0903311623t21f913d6ua08d0e922b4836ba@mail.gmail.com> Message-ID: Ok, thanks .. And is there any solution? Other than working on Windows oO ... What should I not do, to avoid : >[...]break down on MacOS X if excessive pixelwise drawing was performed on a display >graphics context [...] On Apr 1, 2009, at 1:23 AM, Thomas Chust wrote: > 2009-03-31 CHAMLY : >> [...] >> My friend is using Windows vista, and I am on Mac OS, [...] >> When we try to run the program on my mac, it seems to have a hard >> time to work... the game's movement is VERY VERY slow, it lags, and >> sometimes even crashes , it does that with Other Macs as well. >> >> Does it come from his PC? or is there really a compatibility issue >> with >> DrScheme. >> [...] > > Hello, > > I don't know of any special compatibility issues between Windows and > MacOS X using PLT Scheme graphics. However, MacOS X has a very > different graphics subsystem than many other operating systems and > uses a form of display PostScript for most drawing operations. I have > seen cross platform GUI toolkits (notably for example SWT) break down > on MacOS X if excessive pixelwise drawing was performed on a display > graphics context, since this apparently caused the allocation of huge > amounts of geometry objects. > > cu, > Thomas > > > -- > When C++ is your hammer, every problem looks like your thumb. From acowley at seas.upenn.edu Wed Apr 1 13:34:03 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Wed Apr 1 13:34:22 2009 Subject: [plt-scheme] How to remap keybinding "(c:j)" from "newline" to "newline-and-indent"? In-Reply-To: References: Message-ID: <81addec70904011034l619457f9te1d8917bb018708a@mail.gmail.com> > Based on the information in the blog, I constructed the following > mykeys.ss file: > > -- > (module mykeys > (lib "keybinding-lang.ss" "framework") > > ; Adds DrScheme Specific functions to the > ; available functions we can bind to. > (require (lib "tool-lib.ss" "drscheme")) > > (keybinding "c:j" > (lambda (editor event) > ?(begin > ? ?(newline) > ? ?(tabify-at-caret))))) > -- Does this do what you want? (keybinding "c:j" (lambda (editor event) (send editor insert #\newline) (send (send editor get-keymap) call-function "tabify-at-caret" editor event #t))) Anthony From chust at web.de Wed Apr 1 14:40:51 2009 From: chust at web.de (Thomas Chust) Date: Wed Apr 1 14:41:27 2009 Subject: [plt-scheme] Compatibility MACOS <--> VISTA In-Reply-To: References: <9EF71524-D37B-4B00-9C4B-D5517B49E60A@gmail.com> <1c1a33bc0903311623t21f913d6ua08d0e922b4836ba@mail.gmail.com> Message-ID: <1c1a33bc0904011140i59469dcv7c5844185e8be11e@mail.gmail.com> 2009-04-01 CHAMLY : > [...] > And is there any solution? Other than working on Windows oO ... > What should I not do, to avoid : >> [...] break down on MacOS X if excessive pixelwise drawing was performed on >> a display graphics context [...] Hello, I remember solving the problem I had in SWT once by drawing the pixels on off-screen buffers and copying those bitmap buffers to the screen in a single operation, which was faster on all systems anyway but more drastically so on MacOS X. I don't have much experience with the MrEd toolkit, though, and I don't know what exactly your program is drawing, so I'm not sure the problem couldn't be a different one in the first place... cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From toon.verwaest at gmail.com Wed Apr 1 17:01:51 2009 From: toon.verwaest at gmail.com (Toon Verwaest) Date: Wed Apr 1 17:07:33 2009 Subject: [plt-scheme] r6rs define-struct and gensym In-Reply-To: <49D37A1D.20701@cs.utah.edu> References: <49D340B7.1080804@gmail.com> <49D37A1D.20701@cs.utah.edu> Message-ID: <49D3D63F.8000200@gmail.com> Just in case other people are wondering as well. Gensym can still be loaded (although you might not want to do that anymore; and Chongkai was right in my case #!r6rs (library (Test) (export gensym) (import (rnrs) (only (scheme) gensym) (rnrs io ports)) (display (gensym))) Chongkai Zhu wrote: > Toon Verwaest wrote: >> Hi, >> >> I am trying to port an OO-lib I wrote in PLT, SchemeTalk >> (http://smallwiki.unibe.ch/SchemeTalk), to r6rs; I'm having some >> problems with trying to load gensym and define-struct. >> >> I have found define-struct in (scheme private old-ds); but I guess I >> should use something else in the future? >> > > R6RS records: http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-7.html > >> And how can I include gensym? I don't directly find the exact package. >> > > According to R6RS, "two symbols whose names are spelled the same way > are never distinguishable". So no gensym in the sense of uninterned > symbol is available. For the purpose of "generating something that is > distinct from anything else", use some other data type instead. > >> cheers, >> Toon Verwaest > > Chongkai From pocmatos at gmail.com Wed Apr 1 19:01:42 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 1 19:02:19 2009 Subject: [plt-scheme] Predicates from Types Message-ID: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> Hi all, I have been using typed-scheme and funny thing is, it is so powerful and flexible I sometimes start doing things with it I am not so sure I should. One example is the following: I have several predicate forms, represented by structures: Quantifier, Logic-Predicate, Relational-Predicate. I could have all of these, inheriting from an empty structure Predicate and the I would have Predicate? for free, however, it seems given that I have typed scheme a bit nonsense to be doing this because Predicate really has no fields and was just used to say, hey, all of those are predicates. Then if a function received a predicate I would check: (unless (Predicate? x) (error ...)) With typed scheme I can remove that non-sensical structure and just do: (define-type-alias Predicate (U Quantifier Logic-Predicate Relational-Predicate)) and the function that should receive a predicate loses the guard and is typed as receiving an argument of type predicate, but now I just noticed... there are sometimes where I still need the Predicate? predicate, and so what do I do now? Great would be to extract a predicate from the type. On the other hand I could just go back to the previous solution and I would have the type and the predicate by defining the structure but hey, I don't need no make-Predicate or anything so that would just be extra garbage that would be created with the structure and not needed. Is there then a way to extract a predicate from a type? Given I assume the answer is no, what's the best solution for this? Right now I had to define : (: Predicate? (Any -> Boolean)) (define (Predicate? u) (or (Quantifier? u) (Logic-Predicate? u) ...)) Any hints on this issue would be great. At the end of the day, I just noticed two things: 1 - Types help A LOT! Errors given by typed-scheme improve your code and show problems with your code that you would only realize much later if not using typed-scheme. 2 - I do not yet understand fully how to program with types using scheme, such that porting a model checker to typed-scheme is not only giving me a lot of headaches but is also in some way making me re-design the whole system [which in a way I didn't want given that my PhD has a deadline... :)]. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Wed Apr 1 19:16:38 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 1 19:17:15 2009 Subject: [plt-scheme] Case Sensitive Search Message-ID: <11b141710904011616m55012a64j53a31a7dd2277433@mail.gmail.com> Hi all, Is there a way to make the search case sensitive? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Wed Apr 1 19:43:29 2009 From: samth at ccs.neu.edu (Sam TH) Date: Wed Apr 1 19:43:56 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> Message-ID: <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> On Wed, Apr 1, 2009 at 7:01 PM, Paulo J. Matos wrote: > Is there then a way to extract a predicate from a type? Given I assume > the answer is no, what's the best solution for this? > Right now I had to define : > (: Predicate? (Any -> Boolean)) > (define (Predicate? u) > ? ? (or (Quantifier? u) (Logic-Predicate? u) ...)) This is the right solution, but you probably want the type: (: Predicate? (Any -> Boolean : Predicate)) -- sam th samth@ccs.neu.edu From DekuDekuplex at Yahoo.com Wed Apr 1 23:22:02 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Wed Apr 1 23:22:41 2009 Subject: [plt-scheme] Re: How to remap keybinding "(c:j)" from "newline" to "newline-and-indent"? References: <81addec70904011034l619457f9te1d8917bb018708a@mail.gmail.com> Message-ID: On Wed, 1 Apr 2009 13:34:03 -0400, Anthony Cowley wrote: >> Based on the information in the blog, I constructed the following >> mykeys.ss file: >> >> -- >> (module mykeys >> (lib "keybinding-lang.ss" "framework") >> >> ; Adds DrScheme Specific functions to the >> ; available functions we can bind to. >> (require (lib "tool-lib.ss" "drscheme")) >> >> (keybinding "c:j" >> (lambda (editor event) >> ?(begin >> ? ?(newline) >> ? ?(tabify-at-caret))))) >> -- > >Does this do what you want? > >(keybinding "c:j" (lambda (editor event) > (send editor insert #\newline) > (send > (send editor get-keymap) > call-function > "tabify-at-caret" > editor event #t))) Although slightly slow in calling "tabify-at-caret", otherwise, it does do what I wish. Thank you for the code. It solves the problem for now. If I need another keybinding and can't figure it out from the information provided in the "Scheme from the Florida Keys: Keybinding in DrScheme Explained" (see http://schemekeys.blogspot.com/2007/05/keybinding-101-in-drscheme.html) blog entry, I'll ask here again. Thanks. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From jos.koot at telefonica.net Thu Apr 2 03:56:11 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Apr 2 03:56:33 2009 Subject: [plt-scheme] Case Sensitive Search References: <11b141710904011616m55012a64j53a31a7dd2277433@mail.gmail.com> Message-ID: If you mean DrScheme's search, yes. Look in the edit menu and toggle Find Case Sensitive on or off. For the search in Help I don't see a case sensitive search option. Jos ----- Original Message ----- From: "Paulo J. Matos" To: "PLT-Scheme Mailing List" Sent: Thursday, April 02, 2009 1:16 AM Subject: [plt-scheme] Case Sensitive Search > Hi all, > > Is there a way to make the search case sensitive? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From pocmatos at gmail.com Thu Apr 2 08:20:33 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 08:21:11 2009 Subject: [plt-scheme] Case Sensitive Search In-Reply-To: References: <11b141710904011616m55012a64j53a31a7dd2277433@mail.gmail.com> Message-ID: <11b141710904020520t45dc3e3dhf942c312fd605111@mail.gmail.com> Thanks for the replies on this. I didn't see that check menu there... I would have thought it would make more sense to put it in the search bar that shows up when you try to search for something... Cheers, Paulo Matos On Thu, Apr 2, 2009 at 7:56 AM, Jos Koot wrote: > If you mean DrScheme's search, yes. Look in the edit menu and toggle Find > Case Sensitive on or off. > For the search in Help I don't see a case sensitive search option. > Jos > > ----- Original Message ----- From: "Paulo J. Matos" > To: "PLT-Scheme Mailing List" > Sent: Thursday, April 02, 2009 1:16 AM > Subject: [plt-scheme] Case Sensitive Search > > >> Hi all, >> >> Is there a way to make the search case sensitive? >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Thu Apr 2 08:35:55 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 08:36:34 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> Message-ID: <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> On Wed, Apr 1, 2009 at 11:43 PM, Sam TH wrote: > On Wed, Apr 1, 2009 at 7:01 PM, Paulo J. Matos wrote: >> Is there then a way to extract a predicate from a type? Given I assume >> the answer is no, what's the best solution for this? >> Right now I had to define : >> (: Predicate? (Any -> Boolean)) >> (define (Predicate? u) >> ? ? (or (Quantifier? u) (Logic-Predicate? u) ...)) > > This is the right solution, but you probably want the type: > > (: Predicate? (Any -> Boolean : Predicate)) > Now you lost me here... Why do I need the ": Predicate" part? and what does it do? Cheers, Paulo Matos > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From robby at eecs.northwestern.edu Thu Apr 2 08:49:30 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 2 08:49:53 2009 Subject: [plt-scheme] Case Sensitive Search In-Reply-To: <11b141710904020520t45dc3e3dhf942c312fd605111@mail.gmail.com> References: <11b141710904011616m55012a64j53a31a7dd2277433@mail.gmail.com> <11b141710904020520t45dc3e3dhf942c312fd605111@mail.gmail.com> Message-ID: <932b2f1f0904020549v1ca3915fvc95e4f7ee70dac0e@mail.gmail.com> I decided that it took up too much space but you can certainly make a plugin that adds it. Let me know if you get stuck. Robby On 4/2/09, Paulo J. Matos wrote: > Thanks for the replies on this. I didn't see that check menu there... > I would have thought it would make more sense to put it in the search > bar that shows up when you try to search for something... > > Cheers, > > Paulo Matos > > On Thu, Apr 2, 2009 at 7:56 AM, Jos Koot wrote: >> If you mean DrScheme's search, yes. Look in the edit menu and toggle Find >> Case Sensitive on or off. >> For the search in Help I don't see a case sensitive search option. >> Jos >> >> ----- Original Message ----- From: "Paulo J. Matos" >> To: "PLT-Scheme Mailing List" >> Sent: Thursday, April 02, 2009 1:16 AM >> Subject: [plt-scheme] Case Sensitive Search >> >> >>> Hi all, >>> >>> Is there a way to make the search case sensitive? >>> >>> Cheers, >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> Webpage: http://www.personal.soton.ac.uk/pocm >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > From samth at ccs.neu.edu Thu Apr 2 08:52:30 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 2 08:52:49 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> Message-ID: <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> On Thu, Apr 2, 2009 at 8:35 AM, Paulo J. Matos wrote: > On Wed, Apr 1, 2009 at 11:43 PM, Sam TH wrote: >> On Wed, Apr 1, 2009 at 7:01 PM, Paulo J. Matos wrote: >>> Is there then a way to extract a predicate from a type? Given I assume >>> the answer is no, what's the best solution for this? >>> Right now I had to define : >>> (: Predicate? (Any -> Boolean)) >>> (define (Predicate? u) >>> ? ? (or (Quantifier? u) (Logic-Predicate? u) ...)) >> >> This is the right solution, but you probably want the type: >> >> (: Predicate? (Any -> Boolean : Predicate)) >> > > Now you lost me here... Why do I need the ": Predicate" part? and what > does it do? If a function has the type (Any -> Boolean : T), then that function is a "predicate" for T (no relation to the "Predicate" in your mail). This means that using that function checks if a value of of that type. `number?' is an excellent example here. For example: (if (number? x) (add1 x) 7) always has type `Number'. Similarly, if you give `Predicate?' the type I described, then you can use `Predicate?' to check membership in the type `Predicate' in the same way. -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Thu Apr 2 08:52:34 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 08:53:13 2009 Subject: [plt-scheme] Case Sensitive Search In-Reply-To: <932b2f1f0904020549v1ca3915fvc95e4f7ee70dac0e@mail.gmail.com> References: <11b141710904011616m55012a64j53a31a7dd2277433@mail.gmail.com> <11b141710904020520t45dc3e3dhf942c312fd605111@mail.gmail.com> <932b2f1f0904020549v1ca3915fvc95e4f7ee70dac0e@mail.gmail.com> Message-ID: <11b141710904020552q73af4f7bndc33ef4ac0c56b9@mail.gmail.com> On Thu, Apr 2, 2009 at 12:49 PM, Robby Findler wrote: > I decided that it took up too much space but you can certainly make a > plugin that adds it. Let me know if you get stuck. > OK, thanks! > Robby > > On 4/2/09, Paulo J. Matos wrote: >> Thanks for the replies on this. I didn't see that check menu there... >> I would have thought it would make more sense to put it in the search >> bar that shows up when you try to search for something... >> >> Cheers, >> >> Paulo Matos >> >> On Thu, Apr 2, 2009 at 7:56 AM, Jos Koot wrote: >>> If you mean DrScheme's search, yes. Look in the edit menu and toggle Find >>> Case Sensitive on or off. >>> For the search in Help I don't see a case sensitive search option. >>> Jos >>> >>> ----- Original Message ----- From: "Paulo J. Matos" >>> To: "PLT-Scheme Mailing List" >>> Sent: Thursday, April 02, 2009 1:16 AM >>> Subject: [plt-scheme] Case Sensitive Search >>> >>> >>>> Hi all, >>>> >>>> Is there a way to make the search case sensitive? >>>> >>>> Cheers, >>>> >>>> -- >>>> Paulo Jorge Matos - pocmatos at gmail.com >>>> Webpage: http://www.personal.soton.ac.uk/pocm >>>> _________________________________________________ >>>> ?For list-related administrative tasks: >>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Thu Apr 2 08:55:10 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 08:55:47 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> Message-ID: <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> On Thu, Apr 2, 2009 at 12:52 PM, Sam TH wrote: > On Thu, Apr 2, 2009 at 8:35 AM, Paulo J. Matos wrote: >> On Wed, Apr 1, 2009 at 11:43 PM, Sam TH wrote: >>> On Wed, Apr 1, 2009 at 7:01 PM, Paulo J. Matos wrote: >>>> Is there then a way to extract a predicate from a type? Given I assume >>>> the answer is no, what's the best solution for this? >>>> Right now I had to define : >>>> (: Predicate? (Any -> Boolean)) >>>> (define (Predicate? u) >>>> ? ? (or (Quantifier? u) (Logic-Predicate? u) ...)) >>> >>> This is the right solution, but you probably want the type: >>> >>> (: Predicate? (Any -> Boolean : Predicate)) >>> >> >> Now you lost me here... Why do I need the ": Predicate" part? and what >> does it do? > > If a function has the type (Any -> Boolean : T), then that function is > a "predicate" for T (no relation to the "Predicate" in your mail). > This means that using that function checks if a value of of that type. > ?`number?' is an excellent example here. ?For example: > > (if (number? x) (add1 x) 7) > > always has type `Number'. > > Similarly, if you give `Predicate?' the type I described, then you can > use `Predicate?' to check membership in the type `Predicate' in the > same way. I got it, so it basically gives more information for the type inference mechanism to infer types in certain situations but doesn't really change the function itself, right? > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Thu Apr 2 09:11:28 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 2 09:11:49 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> Message-ID: <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> On Thu, Apr 2, 2009 at 8:55 AM, Paulo J. Matos wrote: > On Thu, Apr 2, 2009 at 12:52 PM, Sam TH wrote: >> On Thu, Apr 2, 2009 at 8:35 AM, Paulo J. Matos wrote: >>> On Wed, Apr 1, 2009 at 11:43 PM, Sam TH wrote: >>>> On Wed, Apr 1, 2009 at 7:01 PM, Paulo J. Matos wrote: >>>>> Is there then a way to extract a predicate from a type? Given I assume >>>>> the answer is no, what's the best solution for this? >>>>> Right now I had to define : >>>>> (: Predicate? (Any -> Boolean)) >>>>> (define (Predicate? u) >>>>> ? ? (or (Quantifier? u) (Logic-Predicate? u) ...)) >>>> >>>> This is the right solution, but you probably want the type: >>>> >>>> (: Predicate? (Any -> Boolean : Predicate)) >>>> >>> >>> Now you lost me here... Why do I need the ": Predicate" part? and what >>> does it do? >> >> If a function has the type (Any -> Boolean : T), then that function is >> a "predicate" for T (no relation to the "Predicate" in your mail). >> This means that using that function checks if a value of of that type. >> ?`number?' is an excellent example here. ?For example: >> >> (if (number? x) (add1 x) 7) >> >> always has type `Number'. >> >> Similarly, if you give `Predicate?' the type I described, then you can >> use `Predicate?' to check membership in the type `Predicate' in the >> same way. > > I got it, so it basically gives more information for the type > inference mechanism to infer types in certain situations but doesn't > really change the function itself, right? This isn't related to type inference, so that's not correct. But it doesn't change the behavior of the function (no type annotation ever changes the behavior of a Typed Scheme function). -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Thu Apr 2 09:42:08 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 09:42:45 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> Message-ID: <11b141710904020642u6b713a3dx152706de10f4b747@mail.gmail.com> On Thu, Apr 2, 2009 at 1:11 PM, Sam TH wrote: > > This isn't related to type inference, so that's not correct. ?But it > doesn't change the behavior of the function (no type annotation ever > changes the behavior of a Typed Scheme function). > So, I guess I didn't really get it. What is the annotation that a function is a predicate for a type useful for? > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From grettke at acm.org Thu Apr 2 10:02:05 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Apr 2 10:02:24 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> Message-ID: <756daca50904020702k5b6b9e08rfa31ce0b6fa5cada@mail.gmail.com> On Thu, Apr 2, 2009 at 7:52 AM, Sam TH wrote: > If a function has the type (Any -> Boolean : T), then that function is > a "predicate" for T (no relation to the "Predicate" in your mail). > This means that using that function checks if a value of of that type. > ?`number?' is an excellent example here. ?For example: When you say Predicate in the example, do you mean the type for which the Predicate? checks? From jos.koot at telefonica.net Thu Apr 2 10:05:03 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Apr 2 10:05:39 2009 Subject: [plt-scheme] redex side-condition binding question Message-ID: The pattern of a side-condition in define-language does not shadow the non terminal. For example Check Syntax on the following constructed example #lang scheme (require redex) (define-language lang (T number (side-condition (T) (number? (term T))))) shows that both occurrences of 'T' in the last line are linked to the occurrence in the last but one line. Is this intentional, or do I misunderstand the docs? (quite possibly the latter) Of course the above example is simpler written as (T number (number)), but it just a simple example related to my question. Thanks, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090402/894bdb97/attachment.html From pocmatos at gmail.com Thu Apr 2 10:04:46 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 10:05:42 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <756daca50904020702k5b6b9e08rfa31ce0b6fa5cada@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <756daca50904020702k5b6b9e08rfa31ce0b6fa5cada@mail.gmail.com> Message-ID: <11b141710904020704t4e8d544dp67492572178ed49a@mail.gmail.com> On Thu, Apr 2, 2009 at 2:02 PM, Grant Rettke wrote: > On Thu, Apr 2, 2009 at 7:52 AM, Sam TH wrote: >> If a function has the type (Any -> Boolean : T), then that function is >> a "predicate" for T (no relation to the "Predicate" in your mail). >> This means that using that function checks if a value of of that type. >> ?`number?' is an excellent example here. ?For example: > > When you say Predicate in the example, do you mean the type for which > the Predicate? checks? > Yes... Still couldn't understand its use though. -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Thu Apr 2 10:39:42 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 10:40:40 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <990e0c030904020718l3cae863cyf3e9d57badb3350a@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> <11b141710904020642u6b713a3dx152706de10f4b747@mail.gmail.com> <990e0c030904020718l3cae863cyf3e9d57badb3350a@mail.gmail.com> Message-ID: <11b141710904020739jfc3e774o2de4a8a1c27684be@mail.gmail.com> On Thu, Apr 2, 2009 at 2:18 PM, Carl Eastlund wrote: > On Thu, Apr 2, 2009 at 9:42 AM, Paulo J. Matos wrote: >> On Thu, Apr 2, 2009 at 1:11 PM, Sam TH wrote: >>> >>> This isn't related to type inference, so that's not correct. ?But it >>> doesn't change the behavior of the function (no type annotation ever >>> changes the behavior of a Typed Scheme function). >> >> So, I guess I didn't really get it. What is the annotation that a >> function is a predicate for a type useful for? > > Let's say you have some type X, and some predicate p of type (Any -> > Boolean : X). ?Then you can write: > > (: f ((U X Y) -> X)) > (define (f x-or-y) > ?(if (p x-or-y) x-or-y (error 'f "I don't have an X"))) > > Notice that x-or-y initially has the type (U X Y), but by the time f > returns it in the first branch of the if it has type X. ?That's > because (p x-or-y) returns true, and the ": X" annotation tells Typed > Scheme that when p returns true, its input is of type X. ?So that ": > X" is useful when you have unions involving X and conditionals that > distinguish them. > Ahhhhhh, beautiful!!! Thanks for the explanation. In fact, going also back to what Sam said before about the number?, now I got it! > -- > Carl Eastlund > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From carl.eastlund at gmail.com Thu Apr 2 10:18:24 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Apr 2 10:40:44 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <11b141710904020642u6b713a3dx152706de10f4b747@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> <11b141710904020642u6b713a3dx152706de10f4b747@mail.gmail.com> Message-ID: <990e0c030904020718l3cae863cyf3e9d57badb3350a@mail.gmail.com> On Thu, Apr 2, 2009 at 9:42 AM, Paulo J. Matos wrote: > On Thu, Apr 2, 2009 at 1:11 PM, Sam TH wrote: >> >> This isn't related to type inference, so that's not correct. ?But it >> doesn't change the behavior of the function (no type annotation ever >> changes the behavior of a Typed Scheme function). > > So, I guess I didn't really get it. What is the annotation that a > function is a predicate for a type useful for? Let's say you have some type X, and some predicate p of type (Any -> Boolean : X). Then you can write: (: f ((U X Y) -> X)) (define (f x-or-y) (if (p x-or-y) x-or-y (error 'f "I don't have an X"))) Notice that x-or-y initially has the type (U X Y), but by the time f returns it in the first branch of the if it has type X. That's because (p x-or-y) returns true, and the ": X" annotation tells Typed Scheme that when p returns true, its input is of type X. So that ": X" is useful when you have unions involving X and conditionals that distinguish them. -- Carl Eastlund From jay.mccarthy at gmail.com Thu Apr 2 11:35:07 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Apr 2 11:35:29 2009 Subject: [plt-scheme] Web Server documentation reorganization In-Reply-To: <36366a980904020733v31af559dt43b17ed4d0dc4270@mail.gmail.com> References: <36366a980904020733v31af559dt43b17ed4d0dc4270@mail.gmail.com> Message-ID: I've changed this to the following: Suppose you would like to start a server for a stateless Web servlet "servlet.ss" that provides start: #lang scheme (require "servlet.ss" web-server/servlet-env) (serve/servlet start #:stateless? #t) Warning: If you put the call to serve/servlet in a web-server module directly it will not work correctly. Consider the following module: #lang web-server (require web-server/servlet-env) (define (start req) (start (send/suspend (lambda (k-url) `(html (body (a ([href ,k-url]) "Hello world!"))))))) (serve/servlet start #:stateless? #t) First, if this module is not saved in a file (e.g., "servlet.ss"), then the serialization layer cannot locate the definitions of the serialized continuations. Second, due to an unfortunately subtle bug that we have not yet corrected, every time the continuation link is clicked, serve/servlet will run and attempt to start a Web server instance and open a browser window. These problems do not occur if your servlet is saved in a file and if serve/servlet is run in another module. On Thu, Apr 2, 2009 at 8:33 AM, Eric Hanchrow wrote: > On Mon, Mar 30, 2009 at 10:13 AM, Jay McCarthy > wrote: >> Hello all, >> >> I've been working on reorganizing the Web server documentation into >> two manuals: one for writing Web applications and another about the >> Web server itself. I've finished a first cut and I'd like to get a few >> comments before I commit. > > Can you clarify ?what "like normal" means in > If you put the call to serve/servlet in the module like normal, strange > things will happen because of the way the top-level interacts with > continuations. (Read: Don?t do it.) > ?? And for that matter,can you give a hint of what strange things will > happen? > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From pocmatos at gmail.com Thu Apr 2 11:45:26 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 11:46:03 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme Message-ID: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> Hi all, Why is this failing: #lang typed-scheme (require srfi/1) (: test-map ((Listof Number) -> (Listof Number))) (define (test-map lst) (map (lambda: ((x : Number)) (* x x)) lst)) typecheck: unbound identifier map in: map Without the require it works. Obviously this is a short example and I don't need the require but on a bigger example I need every from srfi1 so I do need to require srfi/1 but then it claims map is an unbound identifier. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From robby at eecs.northwestern.edu Thu Apr 2 11:59:08 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 2 11:59:31 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <11b141710904020739jfc3e774o2de4a8a1c27684be@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> <11b141710904020642u6b713a3dx152706de10f4b747@mail.gmail.com> <990e0c030904020718l3cae863cyf3e9d57badb3350a@mail.gmail.com> <11b141710904020739jfc3e774o2de4a8a1c27684be@mail.gmail.com> Message-ID: <932b2f1f0904020859t3cc5b241vd4ca9aed067e76f2@mail.gmail.com> What if X and p don't actually match? On Thu, Apr 2, 2009 at 9:39 AM, Paulo J. Matos wrote: > On Thu, Apr 2, 2009 at 2:18 PM, Carl Eastlund wrote: >> On Thu, Apr 2, 2009 at 9:42 AM, Paulo J. Matos wrote: >>> On Thu, Apr 2, 2009 at 1:11 PM, Sam TH wrote: >>>> >>>> This isn't related to type inference, so that's not correct. ?But it >>>> doesn't change the behavior of the function (no type annotation ever >>>> changes the behavior of a Typed Scheme function). >>> >>> So, I guess I didn't really get it. What is the annotation that a >>> function is a predicate for a type useful for? >> >> Let's say you have some type X, and some predicate p of type (Any -> >> Boolean : X). ?Then you can write: >> >> (: f ((U X Y) -> X)) >> (define (f x-or-y) >> ?(if (p x-or-y) x-or-y (error 'f "I don't have an X"))) >> >> Notice that x-or-y initially has the type (U X Y), but by the time f >> returns it in the first branch of the if it has type X. ?That's >> because (p x-or-y) returns true, and the ": X" annotation tells Typed >> Scheme that when p returns true, its input is of type X. ?So that ": >> X" is useful when you have unions involving X and conditionals that >> distinguish them. >> > > Ahhhhhh, beautiful!!! > > Thanks for the explanation. In fact, going also back to what Sam said > before about the number?, now I got it! > >> -- >> Carl Eastlund >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From pocmatos at gmail.com Thu Apr 2 12:00:18 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 12:01:21 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <932b2f1f0904020859t3cc5b241vd4ca9aed067e76f2@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> <11b141710904020642u6b713a3dx152706de10f4b747@mail.gmail.com> <990e0c030904020718l3cae863cyf3e9d57badb3350a@mail.gmail.com> <11b141710904020739jfc3e774o2de4a8a1c27684be@mail.gmail.com> <932b2f1f0904020859t3cc5b241vd4ca9aed067e76f2@mail.gmail.com> Message-ID: <11b141710904020900h7e1b4806k57f12a9855dde749@mail.gmail.com> On Thu, Apr 2, 2009 at 3:59 PM, Robby Findler wrote: > What if X and p don't actually match? > Hell breaks loose? > On Thu, Apr 2, 2009 at 9:39 AM, Paulo J. Matos wrote: >> On Thu, Apr 2, 2009 at 2:18 PM, Carl Eastlund wrote: >>> On Thu, Apr 2, 2009 at 9:42 AM, Paulo J. Matos wrote: >>>> On Thu, Apr 2, 2009 at 1:11 PM, Sam TH wrote: >>>>> >>>>> This isn't related to type inference, so that's not correct. ?But it >>>>> doesn't change the behavior of the function (no type annotation ever >>>>> changes the behavior of a Typed Scheme function). >>>> >>>> So, I guess I didn't really get it. What is the annotation that a >>>> function is a predicate for a type useful for? >>> >>> Let's say you have some type X, and some predicate p of type (Any -> >>> Boolean : X). ?Then you can write: >>> >>> (: f ((U X Y) -> X)) >>> (define (f x-or-y) >>> ?(if (p x-or-y) x-or-y (error 'f "I don't have an X"))) >>> >>> Notice that x-or-y initially has the type (U X Y), but by the time f >>> returns it in the first branch of the if it has type X. ?That's >>> because (p x-or-y) returns true, and the ": X" annotation tells Typed >>> Scheme that when p returns true, its input is of type X. ?So that ": >>> X" is useful when you have unions involving X and conditionals that >>> distinguish them. >>> >> >> Ahhhhhh, beautiful!!! >> >> Thanks for the explanation. In fact, going also back to what Sam said >> before about the number?, now I got it! >> >>> -- >>> Carl Eastlund >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From robby at eecs.northwestern.edu Thu Apr 2 12:16:18 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 2 12:16:40 2009 Subject: [plt-scheme] redex side-condition binding question In-Reply-To: References: Message-ID: <932b2f1f0904020916g31255ff5jccec144edb0beba@mail.gmail.com> The arrows are wrong. Thanks for pointing that out. Robby On Thu, Apr 2, 2009 at 9:05 AM, Jos Koot wrote: > The pattern of a side-condition in define-language does not shadow the non > terminal. For example Check Syntax on the following constructed example > > #lang scheme > (require redex) > (define-language lang > ?(T number > ? (side-condition (T) (number? (term T))))) > > shows that both occurrences of 'T' in the last line are linked to the > occurrence in the last but one line. Is this intentional, or do I > misunderstand the docs? (quite possibly the latter) > > Of course the above example is simpler written as (T number (number)), but > it just a simple example related to my question. > Thanks, Jos > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From samth at ccs.neu.edu Thu Apr 2 12:31:24 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 2 12:31:46 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> Message-ID: <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> SRFI 1 provides `map', which overrides the `map' provided from `typed-scheme'. That `map' doesn't have a type associated with it, and you didn't specify one with `require/typed', so you get the error you see. If you want to use a procedure from SRFI 1, or any other untyped library, you need to use `require/typed'. sam th On Thu, Apr 2, 2009 at 11:45 AM, Paulo J. Matos wrote: > Hi all, > > Why is this failing: > #lang typed-scheme > > (require srfi/1) > > (: test-map ((Listof Number) -> (Listof Number))) > (define (test-map lst) > ?(map (lambda: ((x : Number)) (* x x)) lst)) > > typecheck: unbound identifier map in: map > > Without the require it works. Obviously this is a short example and I > don't need the require but on a bigger example I need every from srfi1 > so I do need to require srfi/1 but then it claims map is an unbound > identifier. > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From samth at ccs.neu.edu Thu Apr 2 12:32:57 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 2 12:33:16 2009 Subject: [plt-scheme] Predicates from Types In-Reply-To: <932b2f1f0904020859t3cc5b241vd4ca9aed067e76f2@mail.gmail.com> References: <11b141710904011601q5a052c14tcb6b98b428332ff0@mail.gmail.com> <63bb19ae0904011643q54fe6e25l66a244ab1cabeb99@mail.gmail.com> <11b141710904020535k1b498da4k2f69114754f12bec@mail.gmail.com> <63bb19ae0904020552j127be988w6c8c8b2e05396e04@mail.gmail.com> <11b141710904020555s5fd132fcj158eb179f4e1a505@mail.gmail.com> <63bb19ae0904020611u27fbf84bp14ae0a96169cecf7@mail.gmail.com> <11b141710904020642u6b713a3dx152706de10f4b747@mail.gmail.com> <990e0c030904020718l3cae863cyf3e9d57badb3350a@mail.gmail.com> <11b141710904020739jfc3e774o2de4a8a1c27684be@mail.gmail.com> <932b2f1f0904020859t3cc5b241vd4ca9aed067e76f2@mail.gmail.com> Message-ID: <63bb19ae0904020932r28fff21eq4ca1553cb7478e48@mail.gmail.com> On Thu, Apr 2, 2009 at 11:59 AM, Robby Findler wrote: > What if X and p don't actually match? X and p must match - the type system requires this. The type I proposed for the `Predicate?' function will only work if `Predicate?' is implemented such that it is a predicate for the `Predicate' type. -- sam th samth@ccs.neu.edu From matthias at ccs.neu.edu Thu Apr 2 13:11:04 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Apr 2 13:12:16 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> Message-ID: <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> The error message is clearly uninformative and unhelpful, which points out that in some sense a plain require shouldn't work at all in TS modules UNLESS they refer to a typed module. -- Matthias On Apr 2, 2009, at 12:31 PM, Sam TH wrote: > SRFI 1 provides `map', which overrides the `map' provided from > `typed-scheme'. That `map' doesn't have a type associated with it, > and you didn't specify one with `require/typed', so you get the error > you see. > > If you want to use a procedure from SRFI 1, or any other untyped > library, you need to use `require/typed'. > > sam th > > On Thu, Apr 2, 2009 at 11:45 AM, Paulo J. Matos > wrote: >> Hi all, >> >> Why is this failing: >> #lang typed-scheme >> >> (require srfi/1) >> >> (: test-map ((Listof Number) -> (Listof Number))) >> (define (test-map lst) >> (map (lambda: ((x : Number)) (* x x)) lst)) >> >> typecheck: unbound identifier map in: map >> >> Without the require it works. Obviously this is a short example and I >> don't need the require but on a bigger example I need every from >> srfi1 >> so I do need to require srfi/1 but then it claims map is an unbound >> identifier. >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at eecs.northwestern.edu Thu Apr 2 13:13:31 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 2 13:13:53 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> Message-ID: <932b2f1f0904021013w2f73a0d0ma6686ba1294dbf2c@mail.gmail.com> Why not allow requires of modules that have contracts (perhaps in a sublanguage of the contract language that correspond to TS types) too? Robby On Thu, Apr 2, 2009 at 12:11 PM, Matthias Felleisen wrote: > > The error message is clearly uninformative and unhelpful, which points out > that in some sense a plain require shouldn't work at all in TS modules > UNLESS they refer to a typed module. -- Matthias > > > > > On Apr 2, 2009, at 12:31 PM, Sam TH wrote: > >> SRFI 1 provides `map', which overrides the `map' provided from >> `typed-scheme'. ?That `map' doesn't have a type associated with it, >> and you didn't specify one with `require/typed', so you get the error >> you see. >> >> If you want to use a procedure from SRFI 1, or any other untyped >> library, you need to use `require/typed'. >> >> sam th >> >> On Thu, Apr 2, 2009 at 11:45 AM, Paulo J. Matos >> wrote: >>> >>> Hi all, >>> >>> Why is this failing: >>> #lang typed-scheme >>> >>> (require srfi/1) >>> >>> (: test-map ((Listof Number) -> (Listof Number))) >>> (define (test-map lst) >>> ?(map (lambda: ((x : Number)) (* x x)) lst)) >>> >>> typecheck: unbound identifier map in: map >>> >>> Without the require it works. Obviously this is a short example and I >>> don't need the require but on a bigger example I need every from srfi1 >>> so I do need to require srfi/1 but then it claims map is an unbound >>> identifier. >>> >>> Cheers, >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> Webpage: http://www.personal.soton.ac.uk/pocm >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> >> >> -- >> sam th >> samth@ccs.neu.edu >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Thu Apr 2 13:16:11 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Apr 2 13:17:22 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <932b2f1f0904021013w2f73a0d0ma6686ba1294dbf2c@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <932b2f1f0904021013w2f73a0d0ma6686ba1294dbf2c@mail.gmail.com> Message-ID: <650EAA03-2701-4131-BBE3-EAE28F46449A@ccs.neu.edu> That's the nest step. And the third step is to find an analysis of the contract language that separates them into statically checkable parts and dynamic parts. That's the long term vision. Sam proposed a "5 year" plan vision (he's a lefty :-) for the August PLT day/afternoon, and I have been paging back in my "big picture" ideas from the past years. -- Matthias On Apr 2, 2009, at 1:13 PM, Robby Findler wrote: > Why not allow requires of modules that have contracts (perhaps in a > sublanguage of the contract language that correspond to TS types) too? > > Robby > > On Thu, Apr 2, 2009 at 12:11 PM, Matthias Felleisen > wrote: >> >> The error message is clearly uninformative and unhelpful, which >> points out >> that in some sense a plain require shouldn't work at all in TS >> modules >> UNLESS they refer to a typed module. -- Matthias >> >> >> >> >> On Apr 2, 2009, at 12:31 PM, Sam TH wrote: >> >>> SRFI 1 provides `map', which overrides the `map' provided from >>> `typed-scheme'. That `map' doesn't have a type associated with it, >>> and you didn't specify one with `require/typed', so you get the >>> error >>> you see. >>> >>> If you want to use a procedure from SRFI 1, or any other untyped >>> library, you need to use `require/typed'. >>> >>> sam th >>> >>> On Thu, Apr 2, 2009 at 11:45 AM, Paulo J. Matos >>> wrote: >>>> >>>> Hi all, >>>> >>>> Why is this failing: >>>> #lang typed-scheme >>>> >>>> (require srfi/1) >>>> >>>> (: test-map ((Listof Number) -> (Listof Number))) >>>> (define (test-map lst) >>>> (map (lambda: ((x : Number)) (* x x)) lst)) >>>> >>>> typecheck: unbound identifier map in: map >>>> >>>> Without the require it works. Obviously this is a short example >>>> and I >>>> don't need the require but on a bigger example I need every from >>>> srfi1 >>>> so I do need to require srfi/1 but then it claims map is an unbound >>>> identifier. >>>> >>>> Cheers, >>>> >>>> -- >>>> Paulo Jorge Matos - pocmatos at gmail.com >>>> Webpage: http://www.personal.soton.ac.uk/pocm >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>> >>> >>> >>> -- >>> sam th >>> samth@ccs.neu.edu >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> From carl.eastlund at gmail.com Thu Apr 2 13:17:17 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Apr 2 13:17:43 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <932b2f1f0904021013w2f73a0d0ma6686ba1294dbf2c@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <932b2f1f0904021013w2f73a0d0ma6686ba1294dbf2c@mail.gmail.com> Message-ID: <990e0c030904021017m19406fd8y93392e21012a32e9@mail.gmail.com> That's pretty much what require/typed is. You can use require for already-typed bindings, or require/typed for untyped bindings; it gives Typed Scheme a type to work with and adds a contract to ensure the type. --Carl On Thu, Apr 2, 2009 at 1:13 PM, Robby Findler wrote: > Why not allow requires of modules that have contracts (perhaps in a > sublanguage of the contract language that correspond to TS types) too? > > Robby > > On Thu, Apr 2, 2009 at 12:11 PM, Matthias Felleisen > wrote: >> >> The error message is clearly uninformative and unhelpful, which points out >> that in some sense a plain require shouldn't work at all in TS modules >> UNLESS they refer to a typed module. -- Matthias >> >> >> >> >> On Apr 2, 2009, at 12:31 PM, Sam TH wrote: >> >>> SRFI 1 provides `map', which overrides the `map' provided from >>> `typed-scheme'. ?That `map' doesn't have a type associated with it, >>> and you didn't specify one with `require/typed', so you get the error >>> you see. >>> >>> If you want to use a procedure from SRFI 1, or any other untyped >>> library, you need to use `require/typed'. >>> >>> sam th From robby at eecs.northwestern.edu Thu Apr 2 13:17:52 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 2 13:18:11 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <990e0c030904021017m19406fd8y93392e21012a32e9@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <932b2f1f0904021013w2f73a0d0ma6686ba1294dbf2c@mail.gmail.com> <990e0c030904021017m19406fd8y93392e21012a32e9@mail.gmail.com> Message-ID: <932b2f1f0904021017xa168f29m2cdbcfdf5a3cd624@mail.gmail.com> I mean pick up the types from the contracts without having to say it again. On Thu, Apr 2, 2009 at 12:17 PM, Carl Eastlund wrote: > That's pretty much what require/typed is. ?You can use require for > already-typed bindings, or require/typed for untyped bindings; it > gives Typed Scheme a type to work with and adds a contract to ensure > the type. > > --Carl > > On Thu, Apr 2, 2009 at 1:13 PM, Robby Findler > wrote: >> Why not allow requires of modules that have contracts (perhaps in a >> sublanguage of the contract language that correspond to TS types) too? >> >> Robby >> >> On Thu, Apr 2, 2009 at 12:11 PM, Matthias Felleisen >> wrote: >>> >>> The error message is clearly uninformative and unhelpful, which points out >>> that in some sense a plain require shouldn't work at all in TS modules >>> UNLESS they refer to a typed module. -- Matthias >>> >>> >>> >>> >>> On Apr 2, 2009, at 12:31 PM, Sam TH wrote: >>> >>>> SRFI 1 provides `map', which overrides the `map' provided from >>>> `typed-scheme'. ?That `map' doesn't have a type associated with it, >>>> and you didn't specify one with `require/typed', so you get the error >>>> you see. >>>> >>>> If you want to use a procedure from SRFI 1, or any other untyped >>>> library, you need to use `require/typed'. >>>> >>>> sam th > From carl.eastlund at gmail.com Thu Apr 2 13:18:27 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Apr 2 13:18:47 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <932b2f1f0904021017xa168f29m2cdbcfdf5a3cd624@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <932b2f1f0904021013w2f73a0d0ma6686ba1294dbf2c@mail.gmail.com> <990e0c030904021017m19406fd8y93392e21012a32e9@mail.gmail.com> <932b2f1f0904021017xa168f29m2cdbcfdf5a3cd624@mail.gmail.com> Message-ID: <990e0c030904021018s8cbb59aqa57a6b84b8d788f4@mail.gmail.com> Oh, as in if it's exported with a contract, work out a type? I see. --Carl On Thu, Apr 2, 2009 at 1:17 PM, Robby Findler wrote: > I mean pick up the types from the contracts without having to say it again. > > On Thu, Apr 2, 2009 at 12:17 PM, Carl Eastlund wrote: >> That's pretty much what require/typed is. ?You can use require for >> already-typed bindings, or require/typed for untyped bindings; it >> gives Typed Scheme a type to work with and adds a contract to ensure >> the type. >> >> --Carl >> >> On Thu, Apr 2, 2009 at 1:13 PM, Robby Findler >> wrote: >>> Why not allow requires of modules that have contracts (perhaps in a >>> sublanguage of the contract language that correspond to TS types) too? >>> >>> Robby From samth at ccs.neu.edu Thu Apr 2 13:26:52 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 2 13:27:12 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> Message-ID: <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> On Thu, Apr 2, 2009 at 1:11 PM, Matthias Felleisen wrote: > > The error message is clearly uninformative and unhelpful, which points out > that in some sense a plain require shouldn't work at all in TS modules > UNLESS they refer to a typed module. -- Matthias I agree the error message is unhelpful, but I think that's a problem with name shadowing, not with Typed Scheme. Plain `require' is also useful for syntax (`scheme/match', for example). -- sam th samth@ccs.neu.edu From matthias at ccs.neu.edu Thu Apr 2 13:41:40 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Apr 2 13:42:45 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> Message-ID: <09C86718-F941-48F6-9441-0EA9C0AA0896@ccs.neu.edu> Let Matthew deal with the untyped problem. You **must** deal with the typed problem. If you have an alternative to disallowing this form of require, that's fine We have diagnosed the problem, let's find a solution. On Apr 2, 2009, at 1:26 PM, Sam TH wrote: > On Thu, Apr 2, 2009 at 1:11 PM, Matthias Felleisen > wrote: >> >> The error message is clearly uninformative and unhelpful, which >> points out >> that in some sense a plain require shouldn't work at all in TS >> modules >> UNLESS they refer to a typed module. -- Matthias > > I agree the error message is unhelpful, but I think that's a problem > with name shadowing, not with Typed Scheme. > > Plain `require' is also useful for syntax (`scheme/match', for > example). > > -- > sam th > samth@ccs.neu.edu From pocmatos at gmail.com Thu Apr 2 13:46:20 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 13:46:57 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> Message-ID: <11b141710904021046n721be7c5ha1a59c6c33672e70@mail.gmail.com> On Thu, Apr 2, 2009 at 5:26 PM, Sam TH wrote: > On Thu, Apr 2, 2009 at 1:11 PM, Matthias Felleisen wrote: >> >> The error message is clearly uninformative and unhelpful, which points out >> that in some sense a plain require shouldn't work at all in TS modules >> UNLESS they refer to a typed module. -- Matthias > > I agree the error message is unhelpful, but I think that's a problem > with name shadowing, not with Typed Scheme. > > Plain `require' is also useful for syntax (`scheme/match', for example). > Definitely I use the normal require for typed-scheme modules and scheme/match regularly. > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From matthias at ccs.neu.edu Thu Apr 2 13:55:07 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Apr 2 13:56:23 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <11b141710904021046n721be7c5ha1a59c6c33672e70@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> <11b141710904021046n721be7c5ha1a59c6c33672e70@mail.gmail.com> Message-ID: I said requiring UNtyped modules should raise errors. It is almost always the wrong thing to do. On Apr 2, 2009, at 1:46 PM, Paulo J. Matos wrote: > On Thu, Apr 2, 2009 at 5:26 PM, Sam TH wrote: >> On Thu, Apr 2, 2009 at 1:11 PM, Matthias Felleisen >> wrote: >>> >>> The error message is clearly uninformative and unhelpful, which >>> points out >>> that in some sense a plain require shouldn't work at all in TS >>> modules >>> UNLESS they refer to a typed module. -- Matthias >> >> I agree the error message is unhelpful, but I think that's a problem >> with name shadowing, not with Typed Scheme. >> >> Plain `require' is also useful for syntax (`scheme/match', for >> example). >> > > Definitely I use the normal require for typed-scheme modules and > scheme/match regularly. > >> -- >> sam th >> samth@ccs.neu.edu >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm From ryanc at ccs.neu.edu Thu Apr 2 14:07:42 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Apr 2 14:08:08 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> Message-ID: <49D4FEEE.5080404@ccs.neu.edu> Sam TH wrote: > On Thu, Apr 2, 2009 at 1:11 PM, Matthias Felleisen wrote: >> The error message is clearly uninformative and unhelpful, which points out >> that in some sense a plain require shouldn't work at all in TS modules >> UNLESS they refer to a typed module. -- Matthias > > I agree the error message is unhelpful, but I think that's a problem > with name shadowing, not with Typed Scheme. > > Plain `require' is also useful for syntax (`scheme/match', for example). You should be able to use 'identifier-binding' to distinguish unbound variables from variables imported from untyped modules. You should report those cases differently, and in the latter case you can even use the module path to say which module was incorrectly required. Ryan From pocmatos at gmail.com Thu Apr 2 14:08:44 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 14:09:22 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <9D9E1FA5-9002-4BC7-B69F-57A00BF30A91@ccs.neu.edu> <63bb19ae0904021026j27d87e6v71384a9e6f22f3fe@mail.gmail.com> <11b141710904021046n721be7c5ha1a59c6c33672e70@mail.gmail.com> Message-ID: <11b141710904021108h7e293930qdbc1a2e6e56db4f5@mail.gmail.com> On Thu, Apr 2, 2009 at 5:55 PM, Matthias Felleisen wrote: > > I said requiring UNtyped modules should raise errors. It is almost always > the wrong thing to do. > I didn't mean to say you said something else. I just commented on it to say: "Hey, please, let me still use require for typed modules and syntax... don't change that!". > > On Apr 2, 2009, at 1:46 PM, Paulo J. Matos wrote: > >> On Thu, Apr 2, 2009 at 5:26 PM, Sam TH wrote: >>> >>> On Thu, Apr 2, 2009 at 1:11 PM, Matthias Felleisen >>> wrote: >>>> >>>> The error message is clearly uninformative and unhelpful, which points >>>> out >>>> that in some sense a plain require shouldn't work at all in TS modules >>>> UNLESS they refer to a typed module. -- Matthias >>> >>> I agree the error message is unhelpful, but I think that's a problem >>> with name shadowing, not with Typed Scheme. >>> >>> Plain `require' is also useful for syntax (`scheme/match', for example). >>> >> >> Definitely I use the normal require for typed-scheme modules and >> scheme/match regularly. >> >>> -- >>> sam th >>> samth@ccs.neu.edu >>> >> >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm > > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Thu Apr 2 14:09:59 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 14:10:51 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> Message-ID: <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> On Thu, Apr 2, 2009 at 4:31 PM, Sam TH wrote: > SRFI 1 provides `map', which overrides the `map' provided from > `typed-scheme'. ?That `map' doesn't have a type associated with it, > and you didn't specify one with `require/typed', so you get the error > you see. > > If you want to use a procedure from SRFI 1, or any other untyped > library, you need to use `require/typed'. > I see, so I can just require/typed every from srfi/1 and provide a type. Now, if I do (require/typed srfi/1 every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean)))) I get: All: not a require sub-form in: (All (a) (((a * -> Boolean) (Listof a) * -> Boolean))) but even if it worked... problem is that every has to receive a procedure with as many arguments as lists... is this possible to specify or is it not up to the type to specify this? Cheers, Paulo Matos > sam th > > On Thu, Apr 2, 2009 at 11:45 AM, Paulo J. Matos wrote: >> Hi all, >> >> Why is this failing: >> #lang typed-scheme >> >> (require srfi/1) >> >> (: test-map ((Listof Number) -> (Listof Number))) >> (define (test-map lst) >> ?(map (lambda: ((x : Number)) (* x x)) lst)) >> >> typecheck: unbound identifier map in: map >> >> Without the require it works. Obviously this is a short example and I >> don't need the require but on a bigger example I need every from srfi1 >> so I do need to require srfi/1 but then it claims map is an unbound >> identifier. >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Thu Apr 2 14:22:48 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 2 14:23:09 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> Message-ID: <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> On Thu, Apr 2, 2009 at 2:09 PM, Paulo J. Matos wrote: > On Thu, Apr 2, 2009 at 4:31 PM, Sam TH wrote: >> SRFI 1 provides `map', which overrides the `map' provided from >> `typed-scheme'. ?That `map' doesn't have a type associated with it, >> and you didn't specify one with `require/typed', so you get the error >> you see. >> >> If you want to use a procedure from SRFI 1, or any other untyped >> library, you need to use `require/typed'. >> > > I see, so I can just require/typed every from srfi/1 and provide a type. > Now, > if I do > (require/typed srfi/1 > ? ? ? ? ? ? ? every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean)))) > Your syntax for `require/typed' is wrong. You mean: (require/typed srfi/1 [every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean)))]) plus I think your type syntax is wrong as well. Note that the ability to use `require/typed' with polymorphic types is very new, and may not work right yet. I'll be posting something about this soon. > but even if it worked... problem is that every has to receive a > procedure with as many arguments as lists... is this possible to > specify or is it not up to the type to specify this? See Stevie Strickland's recent paper on this: http://www.ccs.neu.edu/scheme/pubs/#esop09-sthf But these types cannot be converted to contracts. We don't know yet how to lift that restriction. -- sam th samth@ccs.neu.edu From jcoglan at googlemail.com Thu Apr 2 14:45:50 2009 From: jcoglan at googlemail.com (James Coglan) Date: Thu Apr 2 14:46:15 2009 Subject: [plt-scheme] [ANN] Heist 0.2.0, now with full list support Message-ID: Hi all, I just released the 0.2.0 version of Heist, my Ruby Scheme runtime. Changes in this release include: * Entirely revised to correctly support lists as linked pairs * Complete set of R5RS list functions * Syntax for dotted pairs and improper lists implemented * Rest-args for functions using dot notation * Almost-complete R5RS numeric library, including complexes and rationals * Some parser bugs regarding literals and quoting fixed * Many macro parsing and expansion bugs fixed, esp. concerning nested repeating patterns * Macro keywords and collisions with local variables now follow the spec * R6RS ellipsis escaping feature -- (... ...) -- implemented * All library syntax now implemented as macros, should all support call/cc * Ruby data can now be executed as Scheme code * Lots of inline documentation for the runtime More information on GitHub and my blog: http://github.com/jcoglan/heist http://blog.jcoglan.com/2009/04/02/april-fool-area-man-releases-worlds-slowest-scheme-interpreter/ Of particular interest to me is the Ruby-data-as-Scheme-code feature, for example: scheme = Heist::Runtime.new scheme.exec [:define, [:square, :x], [:*, :x, :x]] scheme.exec [:square, 9] #=> 81 Once I've settled on a nice way to expose the macro system to Ruby, this could be used with ParseTree to rewrite Ruby code, like raganwald's 'rewrite' gem. Also, there's a possibility for someone to write a new Ruby interpreter by taking ParseTree and adding a new set of built-in functions to the Heist runtime to execute its output. If someone has a serious stab at this I'd love to see the results. -- James Coglan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090402/7e3a41ec/attachment.htm From pocmatos at gmail.com Thu Apr 2 17:52:58 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 17:53:35 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> Message-ID: <11b141710904021452i45c76305tfdbbc6899bbda8e1@mail.gmail.com> On Thu, Apr 2, 2009 at 7:22 PM, Sam TH wrote: > On Thu, Apr 2, 2009 at 2:09 PM, Paulo J. Matos wrote: >> On Thu, Apr 2, 2009 at 4:31 PM, Sam TH wrote: >>> SRFI 1 provides `map', which overrides the `map' provided from >>> `typed-scheme'. That `map' doesn't have a type associated with it, >>> and you didn't specify one with `require/typed', so you get the error >>> you see. >>> >>> If you want to use a procedure from SRFI 1, or any other untyped >>> library, you need to use `require/typed'. >>> >> >> I see, so I can just require/typed every from srfi/1 and provide a type. >> Now, >> if I do >> (require/typed srfi/1 >> every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean)))) >> > > Your syntax for `require/typed' is wrong. You mean: > > (require/typed srfi/1 > [every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean)))]) > Ah of course, in fact, I was trying to use the other form but didn't notice the module name should come last. Thanks. > plus I think your type syntax is wrong as well. Why? It seems to mimic the requirements for the every function provided by the srfi... > Note that the ability > to use `require/typed' with polymorphic types is very new, and may not > work right yet. I'll be posting something about this soon. > ok, thanks. >> but even if it worked... problem is that every has to receive a >> procedure with as many arguments as lists... is this possible to >> specify or is it not up to the type to specify this? > > See Stevie Strickland's recent paper on this: > http://www.ccs.neu.edu/scheme/pubs/#esop09-sthf > great, thanks for the reference. > But these types cannot be converted to contracts. We don't know yet > how to lift that restriction. > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Thu Apr 2 20:59:55 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 21:00:37 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> Message-ID: <11b141710904021759y70bca653k4832176e2f263f63@mail.gmail.com> On Thu, Apr 2, 2009 at 6:22 PM, Sam TH wrote: > On Thu, Apr 2, 2009 at 2:09 PM, Paulo J. Matos wrote: >> On Thu, Apr 2, 2009 at 4:31 PM, Sam TH wrote: >>> SRFI 1 provides `map', which overrides the `map' provided from >>> `typed-scheme'. ?That `map' doesn't have a type associated with it, >>> and you didn't specify one with `require/typed', so you get the error >>> you see. >>> >>> If you want to use a procedure from SRFI 1, or any other untyped >>> library, you need to use `require/typed'. >>> >> >> I see, so I can just require/typed every from srfi/1 and provide a type. >> Now, >> if I do >> (require/typed srfi/1 >> ? ? ? ? ? ? ? every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean)))) >> > > Your syntax for `require/typed' is wrong. ?You mean: > > (require/typed srfi/1 > ? ? ? ? ? ? ?[every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean)))]) > > plus I think your type syntax is wrong as well. ?Note that the ability > to use `require/typed' with polymorphic types is very new, and may not > work right yet. ?I'll be posting something about this soon. > So the reason why this fails: (require/typed srfi/1 (every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean))))) with typecheck: not a valid type: (((a * -> Boolean) (Listof a) * -> Boolean)) in: (((a * -> Boolean) (Listof a) * -> Boolean)) or a problem with unsupported polymorphic types in require/typed? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Thu Apr 2 21:09:29 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 21:10:06 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <11b141710904021759y70bca653k4832176e2f263f63@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> <11b141710904021759y70bca653k4832176e2f263f63@mail.gmail.com> Message-ID: <11b141710904021809n1dbadf2y895b6db22ae04d78@mail.gmail.com> On Fri, Apr 3, 2009 at 12:59 AM, Paulo J. Matos wrote: > > So the reason why this fails: > (require/typed srfi/1 > ? ? ? ? ? ? ? (every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean))))) > > ?with > typecheck: not a valid type: (((a * -> Boolean) (Listof a) * -> > Boolean)) in: (((a * -> Boolean) (Listof a) * -> Boolean)) > > or a problem with unsupported polymorphic types in require/typed? > It seems that my type was wrong but typed-scheme still returns the same with the following type which seems to match the function definition: (require/typed srfi/1 (every (All (a) (((a * -> Boolean) (Listof a) (Listof a) * -> Boolean))))) > > Cheers, > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Thu Apr 2 21:14:23 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 2 21:14:41 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <11b141710904021809n1dbadf2y895b6db22ae04d78@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> <11b141710904021759y70bca653k4832176e2f263f63@mail.gmail.com> <11b141710904021809n1dbadf2y895b6db22ae04d78@mail.gmail.com> Message-ID: <63bb19ae0904021814u83ef1bbjc59f358c5d939990@mail.gmail.com> On Thu, Apr 2, 2009 at 9:09 PM, Paulo J. Matos wrote: > On Fri, Apr 3, 2009 at 12:59 AM, Paulo J. Matos wrote: >> >> So the reason why this fails: >> (require/typed srfi/1 >> ? ? ? ? ? ? ? (every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean))))) >> >> ?with >> typecheck: not a valid type: (((a * -> Boolean) (Listof a) * -> >> Boolean)) in: (((a * -> Boolean) (Listof a) * -> Boolean)) >> >> or a problem with unsupported polymorphic types in require/typed? >> > > It seems that my type was wrong but typed-scheme still returns the > same with the following type which seems to match the function > definition: > (require/typed srfi/1 > ? ? ? ? ? ? ? (every (All (a) (((a * -> Boolean) (Listof a) (Listof > a) * -> Boolean))))) Try this, which has the correct number of () (require/typed srfi/1 (every (All (a) ((a * -> Boolean) (Listof a) (Listof a) * -> Boolean)))) -- sam th samth@ccs.neu.edu From dvanhorn at ccs.neu.edu Thu Apr 2 21:15:58 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Apr 2 21:16:24 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <11b141710904021809n1dbadf2y895b6db22ae04d78@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> <11b141710904021759y70bca653k4832176e2f263f63@mail.gmail.com> <11b141710904021809n1dbadf2y895b6db22ae04d78@mail.gmail.com> Message-ID: <49D5634E.6030907@ccs.neu.edu> Paulo J. Matos wrote: > On Fri, Apr 3, 2009 at 12:59 AM, Paulo J. Matos wrote: >> So the reason why this fails: >> (require/typed srfi/1 >> (every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean))))) >> >> with >> typecheck: not a valid type: (((a * -> Boolean) (Listof a) * -> >> Boolean)) in: (((a * -> Boolean) (Listof a) * -> Boolean)) >> >> or a problem with unsupported polymorphic types in require/typed? >> > > It seems that my type was wrong but typed-scheme still returns the > same with the following type which seems to match the function > definition: > (require/typed srfi/1 > (every (All (a) (((a * -> Boolean) (Listof a) (Listof > a) * -> Boolean))))) In both cases, you have a syntax error. There is an extra set of parentheses around the type under (All (a) ...). After fixing that problem, it still may not be possible to convert such a type to a contract, however. David From pocmatos at gmail.com Thu Apr 2 21:18:59 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 21:19:56 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <63bb19ae0904021814u83ef1bbjc59f358c5d939990@mail.gmail.com> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> <11b141710904021759y70bca653k4832176e2f263f63@mail.gmail.com> <11b141710904021809n1dbadf2y895b6db22ae04d78@mail.gmail.com> <63bb19ae0904021814u83ef1bbjc59f358c5d939990@mail.gmail.com> Message-ID: <11b141710904021818n2487ed76j6be8922f1f6b1464@mail.gmail.com> On Fri, Apr 3, 2009 at 1:14 AM, Sam TH wrote: > On Thu, Apr 2, 2009 at 9:09 PM, Paulo J. Matos wrote: >> On Fri, Apr 3, 2009 at 12:59 AM, Paulo J. Matos wrote: >>> >>> So the reason why this fails: >>> (require/typed srfi/1 >>> ? ? ? ? ? ? ? (every (All (a) (((a * -> Boolean) (Listof a) * -> Boolean))))) >>> >>> ?with >>> typecheck: not a valid type: (((a * -> Boolean) (Listof a) * -> >>> Boolean)) in: (((a * -> Boolean) (Listof a) * -> Boolean)) >>> >>> or a problem with unsupported polymorphic types in require/typed? >>> >> >> It seems that my type was wrong but typed-scheme still returns the >> same with the following type which seems to match the function >> definition: >> (require/typed srfi/1 >> ? ? ? ? ? ? ? (every (All (a) (((a * -> Boolean) (Listof a) (Listof >> a) * -> Boolean))))) > > Try this, which has the correct number of () > Argh, thanks a lot! I missed that! > (require/typed srfi/1 > ? ? ? ? ? ? ?(every (All (a) ((a * -> Boolean) (Listof a) (Listof > a) * -> Boolean)))) > > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Thu Apr 2 21:19:14 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 2 21:20:00 2009 Subject: [plt-scheme] srfi/1 messes typed-scheme In-Reply-To: <49D5634E.6030907@ccs.neu.edu> References: <11b141710904020845q1775c0f3of80283a90043c68d@mail.gmail.com> <63bb19ae0904020931j66addd54ne941d76c0c62b9da@mail.gmail.com> <11b141710904021109o54a2cc92nc3d14cf8c30c41e4@mail.gmail.com> <63bb19ae0904021122o38ff828q68a364b8b4ae4419@mail.gmail.com> <11b141710904021759y70bca653k4832176e2f263f63@mail.gmail.com> <11b141710904021809n1dbadf2y895b6db22ae04d78@mail.gmail.com> <49D5634E.6030907@ccs.neu.edu> Message-ID: <11b141710904021819n27ce5afbg4cc8458d0ca0ad1c@mail.gmail.com> On Fri, Apr 3, 2009 at 1:15 AM, David Van Horn wrote: > Paulo J. Matos wrote: >> >> On Fri, Apr 3, 2009 at 12:59 AM, Paulo J. Matos >> wrote: >>> >>> So the reason why this fails: >>> (require/typed srfi/1 >>> ? ? ? ? ? ? ?(every (All (a) (((a * -> Boolean) (Listof a) * -> >>> Boolean))))) >>> >>> ?with >>> typecheck: not a valid type: (((a * -> Boolean) (Listof a) * -> >>> Boolean)) in: (((a * -> Boolean) (Listof a) * -> Boolean)) >>> >>> or a problem with unsupported polymorphic types in require/typed? >>> >> >> It seems that my type was wrong but typed-scheme still returns the >> same with the following type which seems to match the function >> definition: >> (require/typed srfi/1 >> ? ? ? ? ? ? ? (every (All (a) (((a * -> Boolean) (Listof a) (Listof >> a) * -> Boolean))))) > > In both cases, you have a syntax error. ?There is an extra set of > parentheses around the type under (All (a) ...). > > After fixing that problem, it still may not be possible to convert such a > type to a contract, however. > > David > Ok, thanks! :) -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From grettke at acm.org Fri Apr 3 07:52:39 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Apr 3 07:52:56 2009 Subject: [plt-scheme] HtDP 12.4.2 question details Message-ID: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> Hi, I?ve got a few questions about 12.4.2: In my first attempt, I went through the problem and came up with the wishlist that I would like a function which, given a symbol and a word, would create a list of words where the symbol was inserted at the beginning, end, and in between every character once. I surely didn?t follow the recipe, though, because it didn't work: (arrangements (cons 'e (cons 'r empty))) does not produce (cons (cons 'e (cons 'r empty)) (cons (cons 'r (cons 'e empty)) empty)) as the problem describes. The thing is that I ignored what I saw and defined (insert-everywhere char word) first: (define (insert-everywhere char word) (insert-everywhere-h char word 0)) ; insert-everywhere-h : symbol word integer -> list-of-words ; to generate a list-of-words by inserting char into ; word in every possible position This function is like the insert functions in this chapter, and stops when it reaches the length of the word (which is the last position). The examples defines that insert-everywhere/in-all-words consumes a symbol and a list of words, and the example reveals that the first time you call insert-everywhere/in-all-words, the list-of-words that you pass it is: (insert-everywhere/in-all-words 'r (cons empty empty)) According to this: ; A list-of-words is either ; ; 1. empty, or ; ; 2. (cons w low) where w is a word and low is a list-of-words. That is valid, but why did you pass that rather than empty, which also would have been a list-of-words? Is it OK to use the list function in this question? Should we? The book mentions its use, but technically doesn't introduce it until Chapter 13. Does one of the wishlist functions insert a symbol into a word? I was happy with the function that did not, but not sure of the pattern where I have to pass in the "start index" for insertions, 0, and increment on each recursion, until it reaches the end of the word. From loldrup at gmail.com Fri Apr 3 09:56:57 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Fri Apr 3 09:57:37 2009 Subject: [plt-scheme] *const Message-ID: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> Hi I'm working through The Little Schemer and I've comed to the point where they introduce types (page 181). They use terms like: *const *quote *identifier *lambda *cond but I wonder how I type these names in DrScheme? When I try to implement the atom-to-action function (see below) DrScheme says this: "*const: name is not defined, not a parameter, and not a primitive name" this is the function: (define atom-to-action (lambda (e) (cond ((number? e) *const) ((eq? e #t) *const) ((eq? e #f) *const) ((eq? e '(cons)) *const) ((eq? e '(car)) *const) ((eq? e '(cdr)) *const) ((eq? e '(null?)) *const) ((eq? e '(eq?)) *const) ((eq? e '(atom?)) *const) ((eq? e '(zero?)) *const) ((eq? e '(add1)) *const) ((eq? e '(sub1)) *const) ((eq? e '(number?)) *const) (else *identifier)))) kind regards Jon Loldrup, Denmark -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090403/f2cba7c4/attachment.htm From marcin.karpinski at gmail.com Fri Apr 3 18:55:52 2009 From: marcin.karpinski at gmail.com (Marcin Karpinski) Date: Fri Apr 3 19:02:44 2009 Subject: [plt-scheme] Unpredictable behaviour of plt Scheme 4.1.5 Message-ID: <1bbbbae50904031555n2e70c053n8345e9e414d201e1@mail.gmail.com> I have encountered a really weird issue in the current version of PLT scheme: I'm implementing a compiler which takes sexps as input, performs transformations (making occasional use of set!) and outputs the result to repl (sexps + structures). For the very same input the program returns a faulty result every few times I run it. Normally, I would consider it my own bug but: - I just keep pressing ctrl+T in drscheme (run) and I get faulty results every now and then - there's no pattern as to when the results go wrong - the program uses no concurrency, no special libraries, only the basic stuff from the scheme and scheme/base libs - the program uses no randomisation, no gui - the program uses no input, output, nor any OS-related primitives So my guess, is that if the bug is mine, I should at least be getting the same output every time I press ctrl+T. The faulty results are related to the following: I've implemented ML type inference and I have I module implementing unification of terms with the use of the union-find data structure. The union-find algorithm makes extensive use of set! on mutable structure fields (set-struct-name-field-name!) in order to connect type variables in different ways. Variables are stored sometimes in mutable hash tables. As it seems to me, the bug is related to certain type variables getting connected in a wrong way resulting in a unification error (as if there was a real typing error). I have a test input that I know should go through but every few executions the unifier reports an error. The only reasonable cause that comes to my mind is some flaw in garbage collection but I don't know how to suppress it or to take a closer look at it. I know this is a pretty high-level explanation, but I can't for now isolate the problem to few lines of code. Any clues? Best regards, Marcin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090403/e287419c/attachment.htm From samth at ccs.neu.edu Fri Apr 3 19:05:18 2009 From: samth at ccs.neu.edu (Sam TH) Date: Fri Apr 3 19:05:36 2009 Subject: [plt-scheme] Typechecking command-line In-Reply-To: <11b141710903171744l79e5d1aoa42035e6b7fb268a@mail.gmail.com> References: <11b141710903171744l79e5d1aoa42035e6b7fb268a@mail.gmail.com> Message-ID: <63bb19ae0904031605r4e6ba214h5f2313cf3bbec3a2@mail.gmail.com> On Tue, Mar 17, 2009 at 8:44 PM, Paulo J. Matos wrote: > Hi, > > Trying to typecheck a file containing a call to command line fails. > Here's a short version exemplifying the issue: This works now, provided that you annotate the binding instance of `filename' with an appropriate type: #:args #{filename : String} -- sam th samth@ccs.neu.edu From eli at barzilay.org Fri Apr 3 19:36:52 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Apr 3 19:37:14 2009 Subject: [plt-scheme] Unpredictable behaviour of plt Scheme 4.1.5 In-Reply-To: <1bbbbae50904031555n2e70c053n8345e9e414d201e1@mail.gmail.com> References: <1bbbbae50904031555n2e70c053n8345e9e414d201e1@mail.gmail.com> Message-ID: <18902.40340.897850.544483@winooski.ccs.neu.edu> On Apr 3, Marcin Karpinski wrote: > > I know this is a pretty high-level explanation, but I can't for now > isolate the problem to few lines of code. Any clues? Perhaps you're using some kind of hash iteration, and side effects in the wrong order lead to bad results? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From marcin.karpinski at gmail.com Fri Apr 3 19:45:13 2009 From: marcin.karpinski at gmail.com (karpik) Date: Fri Apr 3 19:45:35 2009 Subject: [plt-scheme] Re: Unpredictable behaviour of plt Scheme 4.1.5 In-Reply-To: <18902.40340.897850.544483@winooski.ccs.neu.edu> References: <1bbbbae50904031555n2e70c053n8345e9e414d201e1@mail.gmail.com> <18902.40340.897850.544483@winooski.ccs.neu.edu> Message-ID: <7d2088a5-bc82-4251-b16e-1b4cf0526d46@e38g2000yqa.googlegroups.com> unfortunately not, I use hash tables just as maps and sometimes as storage. No part of the code depends on the order of items in the hash table... On Apr 4, 12:36?am, Eli Barzilay wrote: > On Apr ?3, Marcin Karpinski wrote: > > > > > I know this is a pretty high-level explanation, but I can't for now > > isolate the problem to few lines of code. Any clues? > > Perhaps you're using some kind of hash iteration, and side effects in > the wrong order lead to bad results? > > -- > ? ? ? ? ? ((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: > ? ? ? ? ? ? ? ? ?http://www.barzilay.org/? ? ? ? ? ? ? ? Maze is Life! > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Fri Apr 3 20:45:25 2009 From: eli at barzilay.org (Eli Barzilay) Date: Fri Apr 3 20:45:46 2009 Subject: [plt-scheme] Re: Unpredictable behaviour of plt Scheme 4.1.5 In-Reply-To: <7d2088a5-bc82-4251-b16e-1b4cf0526d46@e38g2000yqa.googlegroups.com> References: <1bbbbae50904031555n2e70c053n8345e9e414d201e1@mail.gmail.com> <18902.40340.897850.544483@winooski.ccs.neu.edu> <7d2088a5-bc82-4251-b16e-1b4cf0526d46@e38g2000yqa.googlegroups.com> Message-ID: <18902.44453.495778.22436@winooski.ccs.neu.edu> On Apr 3, karpik wrote: > unfortunately not, I use hash tables just as maps and sometimes as > storage. No part of the code depends on the order of items in the > hash table... Well, if you do any kind of mapping on the hash table, you may introduce a dependency on the order which you don't know about. It's just that the most obvious source of potential trouble in your message is "hash tables" and "extensive use of set!". It might not be a direct use of `hash-map' -- in your message you refer to a `union-find', perhaps that depends somehow on the order of items in the table? To try out these things, I would try to: (a) find any iteration over a hash table and try to make it go over it in some ordered way; (b) alternatively, I'd try to switch to a deterministic dictionary implementation to see if the problem is in the hash table to begin with; (c) print various objects in the algorithm, and compare a faulty output with a good one (for this, I'd add an `identifier' field to structs, and make each struct allocation use a counter, so I can identify the structs). BTW, I doubt that the problem is with the GC -- these kind of problems usually look much more serious than "wrong result"... But if you're using a weak hash table then you're introducing another source of potential problems -- with results that might depend on GC timings. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From toddobryan at gmail.com Fri Apr 3 21:20:13 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Fri Apr 3 21:20:35 2009 Subject: [plt-scheme] HtDP 12.4.2 question details In-Reply-To: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> Message-ID: <904774730904031820jb841987g1f341386087e045a@mail.gmail.com> 1. Yes, use list. Trying to do this problem without list is painful, but the pain serves no useful learning purpose. 2. You're on the right track with this function: ;; insert-everywhere-in-one-word: symbol word -> list-of-word ;; consumes: a symbol and a word ;; produces: the list of words you get by inserting the symbol in every position in the word Take a look at the template for a word-function. Since a word is really just a list-of-symbol, you get (define (word-fun a-word) (cond [(empty? a-word) ...] [(cons? a-word) (first a-word) (word-fun (rest a-word))])) In this case, in other words, the template already gives you (insert-everywhere-in-one-word sym (rest a-word)) If you take an example, say (insert-everywhere-in-one-word 'a (list 'x 'y 'z)), the recursive call will give you (list (list 'a 'y 'z) (list 'y 'a 'z) (list 'y 'z 'a)) What you want for the final answer is (list (list 'a 'x 'y 'z) (list 'x 'a 'y 'z) (list 'x 'y 'a 'z) (list 'x 'y 'z 'a)) If you can figure out how to get from what the template gives you to what you want, you're done. (By the way, one of the really interesting things about this problem is that longer examples make it easier to see the pattern. You may be having trouble because you're trying things like (list 'e 'r) which aren't long enough to make you see the whole thing.) Hope that helps, Todd On Fri, Apr 3, 2009 at 7:52 AM, Grant Rettke wrote: > Hi, > I?ve got a few questions about 12.4.2: > In my first attempt, I went through the problem and came up with the > wishlist that I would like a function which, given a symbol and a > word, would create a list of words where the symbol was inserted at > the beginning, end, and in between every character once. ?I surely > didn?t follow the recipe, though, because it didn't work: > > (arrangements (cons 'e (cons 'r empty))) > > does not produce > > (cons (cons 'e (cons 'r empty)) > ? ? ? (cons (cons 'r (cons 'e empty)) > ? ? ? ? ? ? empty)) > > as the problem describes. > > The thing is that I ignored what I saw and defined (insert-everywhere > char word) first: > > (define (insert-everywhere char word) > ?(insert-everywhere-h char word 0)) > > ; insert-everywhere-h : symbol word integer -> list-of-words > ; to generate a list-of-words by inserting char into > ; word in every possible position > > This function is like the insert functions in this chapter, and stops > when it reaches the length of the word (which is the last position). > > The examples defines that insert-everywhere/in-all-words consumes a > symbol and a list of words, and the example > reveals that the first time you call insert-everywhere/in-all-words, > the list-of-words that you pass it is: > > (insert-everywhere/in-all-words 'r (cons empty empty)) > > According to this: > > ; A list-of-words is either > ; > ; 1. empty, or > ; > ; 2. (cons w low) where w is a word and low is a list-of-words. > > That is valid, but why did you pass that rather than empty, which also > would have been a list-of-words? > > Is it OK to use the list function in this question? Should we? The > book mentions its use, but technically doesn't introduce it until > Chapter 13. > > Does one of the wishlist functions insert a symbol into a word? I was > happy with the function that did not, but not sure of the pattern > where I have to pass in the "start index" for insertions, 0, and > increment on each recursion, until it reaches the end of the word. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From wand at ccs.neu.edu Sat Apr 4 11:14:35 2009 From: wand at ccs.neu.edu (Mitchell Wand) Date: Sat Apr 4 11:15:03 2009 Subject: [plt-scheme] on-tick in 2htdp/universe.ss Message-ID: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> What is the correct contract for an on-tick handler in the universe teachpack? I'm playing with the universe teachpack, and I'm having trouble writing an on-tick clause for a universe. The help files says clearly: (on-tick tick-expr) tick-expr : (-> [listof world?] UniverseState bundle?) The one example I could find of a universe with an on-tick handler (in universe.ss) says (universe '() (on-new nu) (on-msg process) #; (on-tick (lambda (u x) (printf "hello!\n") (list u)) 1))) This clearly supplies a function of 2 arguments, though not one that apparently matches the contract in the help file. But when I try to say (define (on-tick-fn worlds s-state) (make-bundle worlds s-state empty)) (define (run-server d) (universe '* (on-new on-new-fn) (on-msg on-msg-fn) (on-tick on-tick-fn 1) )) I get: > (run-server 1) on-tick: procedure of one argument expected as first argument; given procedure of 2 arguments What's up with this? What values are actually sent to the on-tick handler? --Mitch -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090404/dae824af/attachment.htm From loldrup at gmail.com Sat Apr 4 12:11:38 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Sat Apr 4 12:12:15 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library Message-ID: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> Hi I'm trying to import theminikanren library to my PLT-Scheme 4.1.5. Does a relatively simple method exist for getting to know how to import libraries into DrScheme? Will I have to read all this http://docs.plt-scheme.org/reference/require.html to be able to do it? The file I'm trying to load is the minikanren.ss - I created the file by copying the source code from the link into a new text-file, naming it minikanren.ssand placing it on my harddrive. I just need a document describing where to put the minikanren.ss file and how to write the path to this file in the include-sentence. The minikanren sitesays this: "To load: *(require (planet dfriedman/miniKanren:1:1/minikanren))" * Which doesn't tell me how to load it as it seems it has to be modified before it will work. I've tried it as-is with no luck, while placing the minikanren.ss in C:\Program Files\PLT\collects\minikanren. I also tried theese require sentences: *(require (planet ~/minikanren/minikanren.ss:1:1/minikanren)) (require (planet C:\Program Files\PLT\collects\minikanren.ss:1:1/minikanren)) *and some others, with no luck either. I also tried simply opening the minikanren.ss file in DrScheme, choosing the language "Pretty Big". It runs fine, but then I can't run simple test cases like: (run #f (q) fail) which results in: ". . reference to undefined identifier: run" What does a Schemer do? kind regards Jon Loldrup -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090404/f308b07f/attachment.htm From morazanm at gmail.com Sat Apr 4 13:04:38 2009 From: morazanm at gmail.com (Marco Morazan) Date: Sat Apr 4 13:04:58 2009 Subject: [plt-scheme] HtDP 12.4.2 question details In-Reply-To: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> Message-ID: <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> > > The thing is that I ignored what I saw and defined (insert-everywhere > char word) first: > > (define (insert-everywhere char word) > ?(insert-everywhere-h char word 0)) > > ; insert-everywhere-h : symbol word integer -> list-of-words > ; to generate a list-of-words by inserting char into > ; word in every possible position > > This function is like the insert functions in this chapter, and stops > when it reaches the length of the word (which is the last position). Hmmm....what is the role of that integer? Do you really need it? If the integer is redundant get rid of it and eliminate that helper function (i.e. the *-h function). My suggestions: 1. Start with the template for functions on words. 2. Ask yourself: a. What do you expect from (insert-everywhere-h char (rest word))? b. What is missing from your answer to a. c. How do you build the needed answer from (first word) and the answer to a. Keep in mind that if you need to build a result of arbitrary length for c, then you probably want to design an auxilary function to do that. -- Cheers, Marco From dyrueta at gmail.com Sat Apr 4 14:44:11 2009 From: dyrueta at gmail.com (David Yrueta) Date: Sat Apr 4 14:44:49 2009 Subject: [plt-scheme] HtDP 12.4.2 question details In-Reply-To: <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> Message-ID: <186df66b0904041144u7c4b1313v377c0d43d464312a@mail.gmail.com> Hi Grant -- A few suggestions: First, if you use the list function, make sure your data definitions for word and list-of-word use them too. More than any other problem I've encountered so far in HtDP, the interactions between contracts and data definition are what drive the design decisions that ultimately lead to the successful solution of this exercise. Second, when formulating the data definition for list-of-words, consider the data-definition for 'polygons' in section 12.3. Third, if you are thinking about introducing a third variable into one of the auxiliary functions, as this suggests (insert-everywhere-h char word 0)), don't. I made a similar mistake and it cost me dearly! Always refer to the template for structural recursion when designing auxiliary functions, which I think can be summed up as (first a-list).... (recursive-function (rest a-list)). Stick to that structure, and allow the data definitions and contracts to guide the function design. Hope that helps! Good luck! Dave Yrueta On Sat, Apr 4, 2009 at 10:04 AM, Marco Morazan wrote: > > > > The thing is that I ignored what I saw and defined (insert-everywhere > > char word) first: > > > > (define (insert-everywhere char word) > > (insert-everywhere-h char word 0)) > > > > ; insert-everywhere-h : symbol word integer -> list-of-words > > ; to generate a list-of-words by inserting char into > > ; word in every possible position > > > > This function is like the insert functions in this chapter, and stops > > when it reaches the length of the word (which is the last position). > > Hmmm....what is the role of that integer? Do you really need it? If > the integer is redundant get rid of it and eliminate that helper > function (i.e. the *-h function). > > My suggestions: > > 1. Start with the template for functions on words. > 2. Ask yourself: > a. What do you expect from (insert-everywhere-h char (rest word))? > b. What is missing from your answer to a. > c. How do you build the needed answer from (first word) and the answer > to a. > > Keep in mind that if you need to build a result of arbitrary length > for c, then you probably want to design an auxilary function to do > that. > > -- > > Cheers, > > Marco > _________________________________________________ > 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/20090404/e153ab3d/attachment.htm From noelwelsh at gmail.com Sat Apr 4 15:01:03 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sat Apr 4 15:01:21 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> Message-ID: To load miniKanren you just have to evaluate the Planet require statement from the website: (require (planet dfriedman/miniKanren:1:1/minikanren)) I did this, and it installed without error. I didn't run anything after this as I don't recall how Kanren works. What did you evaluate that makes you think it doesn't work? N. On Sat, Apr 4, 2009 at 5:11 PM, Jon Loldrup wrote: > Hi > > I'm trying to import the minikanren library to my PLT-Scheme 4.1.5. Does a > relatively simple method exist for getting to know how to import libraries > into DrScheme?... From ryanc at ccs.neu.edu Sat Apr 4 15:12:05 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Sat Apr 4 15:12:26 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> Message-ID: <49D7B105.5030402@ccs.neu.edu> PLaneT is designed so you don't have to download files and fiddle with names and paths yourself. DrScheme will download the files, put them in the right place, compile them, install their documentation, etc automatically. 1 Open a fresh DrScheme window (make sure the language is Module or Pretty Big) 2 Go to the Interactions area (the bottom part of the editor, with the prompt) 3 Execute that require line: (require (planet dfriedman/miniKanren:1:1/minikanren)) That's it! You now have minikanren installed (DrScheme shows a message saying so at the bottom of the window), and you can use it immediately in the interactions area. To develop a program with minikanren, copy the require line up to the definitions area (the top part). Take a look at the Quick Introduction to PLT Scheme with Pictures, especially the part about modules: http://docs.plt-scheme.org/quick/index.html#(part._.Modules) And then perhapse browse the Guide for more information: http://docs.plt-scheme.org/guide/index.html You have local copies of this documentation and more: select the "Help" menu and click "Help Desk". Hope that helps! Ryan Jon Loldrup wrote: > Hi > > I'm trying to import > theminikanren > library to my PLT-Scheme 4.1.5. Does a relatively simple method > exist for getting to know how to import libraries into DrScheme? Will I have > to read all this http://docs.plt-scheme.org/reference/require.html to be > able to do it? The file I'm trying to load is the minikanren.ss - I created > the file by copying the source code from the link into a new text-file, > naming it minikanren.ssand > placing it on my harddrive. > > I just need a document describing where to put the minikanren.ss file and > how to write the path to this file in the include-sentence. > The minikanren sitesays > this: > > "To load: *(require (planet dfriedman/miniKanren:1:1/minikanren))" > * > Which doesn't tell me how to load it as it seems it has to be modified > before it will work. I've tried it as-is with no luck, while placing the > minikanren.ss in C:\Program Files\PLT\collects\minikanren. I also tried > theese require sentences: > *(require (planet ~/minikanren/minikanren.ss:1:1/minikanren)) > (require (planet C:\Program > Files\PLT\collects\minikanren.ss:1:1/minikanren)) > *and some others, with no luck either. > > > I also tried simply opening the minikanren.ss file in DrScheme, choosing the > language "Pretty Big". It runs fine, but then I can't run simple test cases > like: > > (run #f (q) fail) > > which results in: ". . reference to undefined identifier: run" > > > What does a Schemer do? > > kind regards Jon Loldrup > > > > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at eecs.northwestern.edu Sat Apr 4 15:57:37 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 4 15:58:02 2009 Subject: [plt-scheme] on-tick in 2htdp/universe.ss In-Reply-To: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> References: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> Message-ID: <932b2f1f0904041257k72bc419atd62eed09ccc3be4f@mail.gmail.com> I'm not sure, but it looks like that is a buggy error check. You might try changing the 1 to a 2 in collects/2htdp/universe.ss and seeing what happens. (Search for "(define-keywords AllSpec" and go down two lines, I think.) Robby On Sat, Apr 4, 2009 at 10:14 AM, Mitchell Wand wrote: > What is the correct contract for an on-tick handler in the universe > teachpack? > > I'm playing with the universe teachpack, and I'm having trouble writing an > on-tick clause for a universe. > > The help files says clearly: > > (on-tick?tick-expr) > ?? tick-expr?:?(->?[listof?world?]?UniverseState?bundle?) > > The one example I could find of a universe with an on-tick handler (in > universe.ss) says > > ?(universe '() > ??????????? (on-new nu) > ??????????? (on-msg process) > ??????????? #; > ??????????? (on-tick (lambda (u x) (printf "hello!\n") (list u)) 1))) > > This clearly supplies a function of 2 arguments, though not one that > apparently matches the contract > in the help file. > > But when I try to say > > (define (on-tick-fn worlds s-state) > ? (make-bundle worlds s-state empty)) > > (define (run-server d) > ? (universe > ?? '* > ?? (on-new on-new-fn) > ?? (on-msg on-msg-fn) > ?? (on-tick on-tick-fn 1) > ?? )) > > I get: > >> (run-server 1) > on-tick: procedure of one argument expected as first argument; given > procedure of 2 arguments > > What's up with this?? What values are actually sent to the on-tick handler? > > --Mitch > > > > > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From dyrueta at gmail.com Sat Apr 4 16:12:09 2009 From: dyrueta at gmail.com (dave yrueta) Date: Sat Apr 4 16:12:29 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? Message-ID: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> Hi All -- After creating function 'create-tests,' I ran the following per HtDP exercise 26.3.6 -- (define test-case (create-tests 10000)) (collect-garbage) (time (sort test-case)) (collect-garbage) (time (quick-sort test-case)) -- which returned this: collect-garbage: name is not defined, not a parameter, and not a primitive name I tried changing the teaching language to Advanced Student and still received the same error message. Is there something I need to do to enable the collect-garbage function? Also, what does collect-garbage do? Thanks! Dave Yrueta From jensaxel at soegaard.net Sat Apr 4 16:16:28 2009 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Sat Apr 4 16:16:49 2009 Subject: [plt-scheme] Pasteboard in pasteboard and the error: here: I am Message-ID: <49D7C01C.1030404@soegaard.net> Hi All, I am still playing around with pasteboards, snips and friends, but progress is slow. Can anyone provide a simple example of a pasteboard containing another pasteboard? Preferably where the containing pasteboard is diplayable (via an editor-snip) in the DrScheme REPL? Anyways, while playing I came upon this error, here: I am which, well, is not too informative. What does it mean, and why does it occur? To reproduce the error, run the program below. #lang scheme/gui (require mrlib/aligned-pasteboard) (define current-pasteboard (make-parameter #f)) (define current-editor (make-parameter #f)) (define current-frame (make-parameter #f)) (define current-canvas (make-parameter #f)) ;;; COMMON (define (make-string-snip string) (make-object string-snip% string)) (define (make-image-snip filename) (make-object image-snip% filename)) (define (insert-snip editor snip) (send editor insert snip)) (define (insert-snips editor snips) (for-each (? (s) (insert-snip editor s)) snips)) (define (realign aligned-pasteboard) (let ([min-width (send aligned-pasteboard get-aligned-min-width)] [min-height (send aligned-pasteboard get-aligned-min-height)]) (send aligned-pasteboard realign min-width min-height))) (define (element->snip e f c) (cond [(string? e) (make-string-snip e)] [(column? e) (column->snip e f c)] ;[(row? e) (row->snip e)] [(image? e) (image->snip e)] [else (error 'element->snip "Unknown element type")])) ;;; IMAGE (define (image-writer col port write?) (display (image->snip col) port)) (define-struct image (filename) #:property prop:custom-write image-writer) (define (image->snip img) (make-image-snip (image-filename img))) ;;; COLUMN (define (column-writer col port write?) (display (column->snip col #f #f) port)) (define-struct column (elements) #:property prop:custom-write column-writer) (define (column->snip col frame canvas) (let* ([pasteboard (new vertical-pasteboard%)] [editor-snip (new editor-snip% [editor pasteboard] [min-width 1] [min-height 1])] [frame (if frame frame (new frame% [label "never shown, needed by canvas"]))] [canvas (if canvas canvas (new aligned-editor-canvas% [parent frame] [editor pasteboard]))]) (insert-snips pasteboard (reverse (map (? (e) (element->snip e frame canvas)) (column-elements col)))) (realign pasteboard) editor-snip)) #;(define (column->snip col frame canvas) (let* ([pasteboard (new vertical-pasteboard%)] [editor-snip (new editor-snip% [editor pasteboard] [min-width 1] [min-height 1])] [frame (new frame% [label "never shown, needed by canvas"])] [canvas (new aligned-editor-canvas% [parent frame] [editor pasteboard])]) ;(send editor-snip show-border #f) (insert-snips pasteboard (reverse (map (? (e) (element->snip e frame canvas)) (column-elements col)))) (realign pasteboard) editor-snip)) ;;; TEST ;; works (make-column (list "Foo" "Bar" "Baz")) ;(make-row (list "Foo" "Bar" "Baz")) ;(make-image "face-smile.png") ;(make-column (list "FOO" (make-image "face-smile.png") "BAR")) ; broken (make-column (list "a" (make-column (list "1" "2" "3")) "b" (make-column (list "x" "y" "z")) "c" (make-column (list "!" "?" "@")))) #;(make-row (list "Foo" (make-image "face-smile.png") (make-column (list "Foo" "Bar" "Baz")) "Baz")) ;(make-column (list "Foo" (make-row (list "123" "456" "789")) "@@@")) From beratn at gmail.com Sat Apr 4 16:21:59 2009 From: beratn at gmail.com (=?ISO-8859-9?Q?emre_berat_nebio=F0lu?=) Date: Sat Apr 4 16:22:23 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> Message-ID: it works in pretty big ,lazy scheme and also FRtime plus it works in PLAI scheme. My drscheme version : 4.1.4 On Sat, Apr 4, 2009 at 11:12 PM, dave yrueta wrote: > Hi All -- > > After creating function 'create-tests,' I ran the following per HtDP > exercise 26.3.6 -- > > (define test-case (create-tests 10000)) > (collect-garbage) > (time (sort test-case)) > (collect-garbage) > (time (quick-sort test-case)) > > -- which returned this: > > collect-garbage: name is not defined, not a parameter, and not a > primitive name > > I tried changing the teaching language to Advanced Student and still > received the same error message. Is there something I need to do to > enable the collect-garbage function? Also, what does collect-garbage > do? > > Thanks! > > Dave Yrueta > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090404/b45e7e85/attachment.html From dyrueta at gmail.com Sat Apr 4 16:31:23 2009 From: dyrueta at gmail.com (David Yrueta) Date: Sat Apr 4 16:31:59 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> Message-ID: <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> Thank you. I'm not working on any of those platforms, just on Dr. Scheme. Can you explain to me what collect-garbage does? On Sat, Apr 4, 2009 at 1:21 PM, emre berat nebio?lu wrote: > it works in pretty big ,lazy scheme and also FRtime plus it works in PLAI > scheme. > My drscheme version : 4.1.4 > > On Sat, Apr 4, 2009 at 11:12 PM, dave yrueta wrote: > >> Hi All -- >> >> After creating function 'create-tests,' I ran the following per HtDP >> exercise 26.3.6 -- >> >> (define test-case (create-tests 10000)) >> (collect-garbage) >> (time (sort test-case)) >> (collect-garbage) >> (time (quick-sort test-case)) >> >> -- which returned this: >> >> collect-garbage: name is not defined, not a parameter, and not a >> primitive name >> >> I tried changing the teaching language to Advanced Student and still >> received the same error message. Is there something I need to do to >> enable the collect-garbage function? Also, what does collect-garbage >> do? >> >> Thanks! >> >> Dave Yrueta >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090404/d6736918/attachment.htm From dvanhorn at ccs.neu.edu Sat Apr 4 16:51:02 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Sat Apr 4 16:51:29 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> Message-ID: <49D7C836.6040609@ccs.neu.edu> David Yrueta wrote: > Thank you. I'm not working on any of those platforms, just on Dr. > Scheme. Can you explain to me what collect-garbage does? Hi David, I've attached a teachpack that makes collect-garbage available. Save the file, open DrScheme, select Language > Add Teachpack ..., Add Teachpack to List... Navigate to the saved file and select it. You should now be able to run your program. DrScheme will implicitly collect values that are no longer in use during the running of your program so that their memory can be re-used (this process is called "garbage collection"). This process takes time, so in order for your timings to be more accurate, you should explicitly cause this process to happen just before collecting timing information. David -------------- next part -------------- #lang scheme (provide collect-garbage) From jensaxel at soegaard.net Sat Apr 4 17:15:38 2009 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Sat Apr 4 17:15:57 2009 Subject: [plt-scheme] cue-text% Message-ID: <49D7CDFA.7070504@soegaard.net> A cue-text: Gives a text% an instantiation argument of a string that is displayed in the text% initially in grey; the text disappears when the text gets focus. This technique is useful for labeling texts without needing to take up space. If I put the cue-text into an editor-snip%, the cue is not cleared. Is this a bug, or is this to be expected? #lang scheme/gui (require embedded-gui framework) (new editor-snip% [editor (new cue-text% (cue-text "Hello World"))]) Note, that if the cue-text is displayed in its own frame, then the cue is cleared: #lang scheme/gui (require embedded-gui framework) (define f (new frame% (label "f") (width 400) (height 400))) (define e (new text%)) (define c (new editor-canvas% (editor e) (parent f))) (define t (new cue-text% (cue-text "Hello, World!"))) (define s (new editor-snip% (editor t))) (send e insert s) (send f show #t) -- Jens Axel S?gaard From dyrueta at gmail.com Sat Apr 4 17:56:15 2009 From: dyrueta at gmail.com (David Yrueta) Date: Sat Apr 4 17:56:54 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: <49D7C836.6040609@ccs.neu.edu> References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> Message-ID: <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> David -- Thank you for the teachpack and the explanation. Much appreciated! Dave Yrueta 2009/4/4 David Van Horn > David Yrueta wrote: > >> Thank you. I'm not working on any of those platforms, just on Dr. Scheme. >> Can you explain to me what collect-garbage does? >> > > Hi David, > > I've attached a teachpack that makes collect-garbage available. Save the > file, open DrScheme, select Language > Add Teachpack ..., Add Teachpack to > List... Navigate to the saved file and select it. You should now be able to > run your program. > > DrScheme will implicitly collect values that are no longer in use during > the running of your program so that their memory can be re-used (this > process is called "garbage collection"). This process takes time, so in > order for your timings to be more accurate, you should explicitly cause this > process to happen just before collecting timing information. > > David > > > #lang scheme > (provide collect-garbage) > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090404/8b4195a5/attachment.htm From beratn at gmail.com Sat Apr 4 18:43:33 2009 From: beratn at gmail.com (=?ISO-8859-9?Q?emre_berat_nebio=F0lu?=) Date: Sat Apr 4 18:43:54 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> Message-ID: i heard something about garbage collector. Someone said to me Drscheme has 3 or 4 garbage collector.Is it true ? If it is true.How it works and how drscheme uses tese. On Sun, Apr 5, 2009 at 12:56 AM, David Yrueta wrote: > David -- > Thank you for the teachpack and the explanation. Much appreciated! > > Dave Yrueta > > 2009/4/4 David Van Horn > >> David Yrueta wrote: >> >>> Thank you. I'm not working on any of those platforms, just on Dr. >>> Scheme. Can you explain to me what collect-garbage does? >>> >> >> Hi David, >> >> I've attached a teachpack that makes collect-garbage available. Save the >> file, open DrScheme, select Language > Add Teachpack ..., Add Teachpack to >> List... Navigate to the saved file and select it. You should now be able to >> run your program. >> >> DrScheme will implicitly collect values that are no longer in use during >> the running of your program so that their memory can be re-used (this >> process is called "garbage collection"). This process takes time, so in >> order for your timings to be more accurate, you should explicitly cause this >> process to happen just before collecting timing information. >> >> David >> >> >> #lang scheme >> (provide collect-garbage) >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/c42bad77/attachment.html From marek at xivilization.net Sat Apr 4 18:59:18 2009 From: marek at xivilization.net (Marek Kubica) Date: Sat Apr 4 18:59:39 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> Message-ID: <20090405005918.76dee424@halmanfloyd.lan.local> On Sun, 5 Apr 2009 01:43:33 +0300 emre berat nebio?lu wrote: > Someone said to me Drscheme has 3 or 4 garbage collector.Is it true ? > If it is true.How it works and how drscheme uses tese. MzScheme (the actual Scheme implementation that runs in the background of DrScheme) supports two different Garbage Collectors: the older CGC collector and the newer 3m collector. But the collector-selection happens on compile time - that is when MzScheme runs, there can only be one collector active, which is usually 3m since it is the default. regards, Marek From beratn at gmail.com Sat Apr 4 19:10:06 2009 From: beratn at gmail.com (=?ISO-8859-9?Q?emre_berat_nebio=F0lu?=) Date: Sat Apr 4 19:10:25 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: <20090405005918.76dee424@halmanfloyd.lan.local> References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> <20090405005918.76dee424@halmanfloyd.lan.local> Message-ID: What are the difference between CGC and 3m.Both has some advantage or disadvantage ? Or It is just about running time or compilation time.I know that garbage collector is responsible for clearing up the shared memory. I dont know the whole issue on running time and compilation time. Running time is same with compilation time.? Or running time is the time about caring algorithm. For example running time of merge sort is nlogn .This nlogn include only time until array is sorted(I assume array is unsorted in first time) or include this plus "clearing shared memory".Anyway sorry for my bad english i hope i can tell my point. But i just wonder about CGC and 3m. What do we exactly focus on "garbage collector". On Sun, Apr 5, 2009 at 1:59 AM, Marek Kubica wrote: > On Sun, 5 Apr 2009 01:43:33 +0300 > emre berat nebio?lu wrote: > > > Someone said to me Drscheme has 3 or 4 garbage collector.Is it true ? > > If it is true.How it works and how drscheme uses tese. > > MzScheme (the actual Scheme implementation that runs in the background > of DrScheme) supports two different Garbage Collectors: the older CGC > collector and the newer 3m collector. But the collector-selection > happens on compile time - that is when MzScheme runs, there can only be > one collector active, which is usually 3m since it is the default. > > regards, > Marek > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/1d7a974a/attachment.htm From marek at xivilization.net Sat Apr 4 19:38:49 2009 From: marek at xivilization.net (Marek Kubica) Date: Sat Apr 4 19:39:15 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> <20090405005918.76dee424@halmanfloyd.lan.local> Message-ID: <20090405013849.434d1a43@halmanfloyd.lan.local> Hi, Sorry, while digging in the sources I found another GC backend which is the SenoraGC (SGC) but it is not really recommended to use and not mentioned very much. On Sun, 5 Apr 2009 02:10:06 +0300 emre berat nebio?lu wrote: > What are the difference between CGC and 3m.Both has some advantage or > disadvantage ? Or It is just about running time or compilation time. Yes, they have both some advantages and other disadvantages, for more details you could take a look at this mail which explains how 3m works. > I dont know the whole issue on running time and compilation time. > Running time is same with compilation time.? No, to run MzScheme, you first have to compile it. At that point, you can decide whether your to-be-compiled MzScheme should use CGC, SGC or 3m as garbage collector [1]. You then compile MzScheme with your desired GC and then can run programs on MzScheme. The garbage collector is fixed by this time, so you cannot just switch in the middle of the program which Garbage Collector to use. > For example running time of merge sort is nlogn .This nlogn include > only time until array is sorted(I assume array is unsorted in first > time) or include this plus "clearing shared memory". The Big-O notation describes the time-complexity of an algorithm, not actually how long it will take exactly. As such, your algorithm will be O(n log n) on 3m and on CGC. The actual time that your program runs will change too, for course but usually not in a way that you'd get another time-complexity. What also changes is the amount of memory that MzScheme will use while it runs your program/algorithm. > But i just wonder about CGC and 3m. What do we exactly focus on > "garbage collector". On the efficient management of memory. regards, Marek [1] technically, even when selecting 3m, a CGC-version of MzScheme will be built, too From loldrup at gmail.com Sat Apr 4 19:55:08 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Sat Apr 4 19:55:50 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <49D7B105.5030402@ccs.neu.edu> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> Message-ID: <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> Hi Ryan and thank you for the clarification! Now I just tried this: I made a new drscheme-file, choose the language "Module", saved it, and pasted the following into it: #lang scheme (require (planet dfriedman/miniKanren:1:1/minikanren)) (run #f (q) fail) the first two lines succeeded, but the third failed with this error: expand: unbound identifier in module in: fail the third line was taken from the file mktests.scmwhich I think is designed to test a minikanren implementation. Therefor I think that that third line is valid minikanren-syntax and should run without errors. Jon Loldrup using DrScheme 4.1.5 2009/4/4 Ryan Culpepper > PLaneT is designed so you don't have to download files and fiddle with > names and paths yourself. DrScheme will download the files, put them in the > right place, compile them, install their documentation, etc automatically. > > 1 Open a fresh DrScheme window (make sure the language is Module or Pretty > Big) > 2 Go to the Interactions area (the bottom part of the editor, with the > prompt) > 3 Execute that require line: > (require (planet dfriedman/miniKanren:1:1/minikanren)) > > That's it! You now have minikanren installed (DrScheme shows a message > saying so at the bottom of the window), and you can use it immediately in > the interactions area. To develop a program with minikanren, copy the > require line up to the definitions area (the top part). > > Take a look at the Quick Introduction to PLT Scheme with Pictures, > especially the part about modules: > > http://docs.plt-scheme.org/quick/index.html#(part._.Modules) > > And then perhapse browse the Guide for more information: > > http://docs.plt-scheme.org/guide/index.html > > You have local copies of this documentation and more: select the "Help" > menu and click "Help Desk". > > Hope that helps! > Ryan > > > Jon Loldrup wrote: > >> Hi >> >> I'm trying to import >> the< >> http://planet.plt-scheme.org/display.ss?package=miniKanren.plt&owner=dfriedman >> >minikanren >> library to my PLT-Scheme 4.1.5. Does a relatively simple method >> exist for getting to know how to import libraries into DrScheme? Will I >> have >> to read all this http://docs.plt-scheme.org/reference/require.html to be >> able to do it? The file I'm trying to load is the minikanren.ss - I >> created >> the file by copying the source code from the link into a new text-file, >> naming it minikanren.ss< >> http://planet.plt-scheme.org/display.ss?package=miniKanren.plt&owner=dfriedman >> >and >> placing it on my harddrive. >> >> I just need a document describing where to put the minikanren.ss file and >> how to write the path to this file in the include-sentence. >> The minikanren site< >> http://planet.plt-scheme.org/display.ss?package=miniKanren.plt&owner=dfriedman >> >says >> this: >> >> "To load: *(require (planet dfriedman/miniKanren:1:1/minikanren))" >> * >> Which doesn't tell me how to load it as it seems it has to be modified >> before it will work. I've tried it as-is with no luck, while placing the >> minikanren.ss in C:\Program Files\PLT\collects\minikanren. I also tried >> theese require sentences: >> *(require (planet ~/minikanren/minikanren.ss:1:1/minikanren)) >> (require (planet C:\Program >> Files\PLT\collects\minikanren.ss:1:1/minikanren)) >> *and some others, with no luck either. >> >> >> I also tried simply opening the minikanren.ss file in DrScheme, choosing >> the >> language "Pretty Big". It runs fine, but then I can't run simple test >> cases >> like: >> >> (run #f (q) fail) >> >> which results in: ". . reference to undefined identifier: run" >> >> >> What does a Schemer do? >> >> kind regards Jon Loldrup >> >> >> >> ------------------------------------------------------------------------ >> >> _________________________________________________ >> 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/20090405/cecaa502/attachment.html From marek at xivilization.net Sat Apr 4 20:13:00 2009 From: marek at xivilization.net (Marek Kubica) Date: Sat Apr 4 20:13:22 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> Message-ID: <20090405021300.76971bad@halmanfloyd.lan.local> On Sun, 5 Apr 2009 01:55:08 +0200 Jon Loldrup wrote: > #lang scheme > (require (planet dfriedman/miniKanren:1:1/minikanren)) > (run #f (q) fail) > > the first two lines succeeded, but the third failed with this error: > > expand: unbound identifier in module in: fail > > the third line was taken from the file > mktests.scmwhich > I think is designed to test a minikanren implementation. Therefor I > think that that third line is valid minikanren-syntax and should run > without errors. True, but ``fail`` is most likely not a term from miniKANREN but rather something that is provided by the Scheme implementation (in that example code I think it is MIT Scheme). PLT doesn't have ``fail`` built-in. As I don't know what ``fail`` is supposed to do anyway (I don't want to look up MIT Scheme or KANREN) here's a dumb implementation of ``fail``: #lang scheme (require (planet dfriedman/miniKanren:1:1/minikanren)) (define (fail arg) #f) (run #f (q) fail) regards, Marek From goetter at mazama.net Sat Apr 4 20:47:55 2009 From: goetter at mazama.net (Ben Goetter) Date: Sat Apr 4 20:48:18 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> Message-ID: <49D7FFBB.9050902@mazama.net> Jon Loldrup wrote: > > [...] the third line was taken from the file mktests.scm > > which I think is designed to test a minikanren implementation. That file tests the particular version of minikanren currently on Sourceforge, which is not the same as the version on PLaneT. You cannot necessarily mix and match the two. Still, (run #f (q) fail) seems like a reasonable command to issue... isn't that out of the book? Inspecting minikanren.ss reveals that, indeed, it doesn't export any "fail." The mk.scm on Sourceforge includes the following two definitions (define succeed (lambdag@ (s) (unit s))) (define fail (lambdag@ (s) (mzero))) which you can't issue yourself, because the version on PLaneT exports neither lambdag@ nor mzero. Try instead #lang scheme (require (planet dfriedman/miniKanren:1:1/minikanren)) (define succeed (== #t #t)) (define fail (== #t #f)) (run #f (q) fail) That seems to fail correctly. I don't have my copy of TRS at hand, so I can't opine further. Hope that helps, Ben From grettke at acm.org Sun Apr 5 01:03:46 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Apr 5 01:04:04 2009 Subject: [plt-scheme] HtDP 12.4.2 question details In-Reply-To: <186df66b0904041144u7c4b1313v377c0d43d464312a@mail.gmail.com> References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> <186df66b0904041144u7c4b1313v377c0d43d464312a@mail.gmail.com> Message-ID: <756daca50904042203j1e89ff85h26120ef6907c4a5b@mail.gmail.com> Thanks guys. I won't be abusing the function contract by keeping that integer in there. I am back to work. From martindemello at gmail.com Sun Apr 5 02:15:36 2009 From: martindemello at gmail.com (Martin DeMello) Date: Sun Apr 5 02:16:31 2009 Subject: [plt-scheme] can't get undo (from add-text-keymap-functions) working Message-ID: I have inherited a class from text%, and assigned it a keymap. The keymap has been seeded with add-text-keymap-functions. However, undo/redo don't work - is there anything extra I need to add to get undo support? Here's the relevant code (I've pasted the full class in, in case something else is interfering with undo): (define editor-keymap (let ((keymap (make-object keymap%))) (add-text-keymap-functions keymap) (send keymap map-function "c:left" "backward-word") (send keymap map-function "c:right" "forward-word") (send keymap map-function "s:c:left" "backward-select-word") (send keymap map-function "s:c:right" "forward-select-word") (send keymap map-function "c:insert" "copy-clipboard") (send keymap map-function "s:insert" "paste-clipboard") (send keymap map-function "c:z" "undo") (send keymap map-function "c:y" "redo") keymap)) (define editable-text% (class text% (init-field on-height-changed) (init-field next-editor) (init-field prev-editor) (init-field set-active) (init-field (initial-text "")) ;; height acts as a cache for the number of lines ;; so we can tell if insert/delete has changed it (define height 0) (define (set-height) (set! height (last-line))) (define (check-height) (when (<> height (last-line)) (on-height-changed))) (inherit last-line position-line get-start-position insert set-keymap) (define (current-line) (position-line (get-start-position))) (define (last-line?) (= (current-line) (last-line))) (define (first-line?) (= (current-line) 0)) (define/public (nlines) (+ 1 (last-line))) (define/augment (on-insert a b) (set-height)) (define/augment (on-delete a b) (set-height)) (define/augment (after-insert a b) (check-height)) (define/augment (after-delete a b) (check-height)) (define/override (on-focus on?) (when on? (set-active))) (define/override (on-local-char key) (let ([code (send key get-key-code)]) (cond [(and (equal? code 'down) (last-line?)) (next-editor) ] [(and (equal? code 'up) (first-line?)) (prev-editor) ] [else (super on-local-char key)]))) ;; initialize (super-instantiate ()) (set-keymap editor-keymap) (insert initial-text 0) )) martin From andrew-scheme at areilly.bpc-users.org Sun Apr 5 00:21:02 2009 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Sun Apr 5 02:27:59 2009 Subject: [plt-scheme] Unpredictable behaviour of plt Scheme 4.1.5 In-Reply-To: <18902.40340.897850.544483@winooski.ccs.neu.edu> References: <1bbbbae50904031555n2e70c053n8345e9e414d201e1@mail.gmail.com> <18902.40340.897850.544483@winooski.ccs.neu.edu> Message-ID: <20090405142102.03a99c46@duncan.reilly.home> On Fri, 3 Apr 2009 19:36:52 -0400 Eli Barzilay wrote: > On Apr 3, Marcin Karpinski wrote: > > > > I know this is a pretty high-level explanation, but I can't for now > > isolate the problem to few lines of code. Any clues? > > Perhaps you're using some kind of hash iteration, and side effects in > the wrong order lead to bad results? > Just as a data-point: my project uses a hash-table based "set" implementation, and one mode of operation is to collect a unique set of things and then iterate over the resulting list. It completely surprised me that this produced essentially random results, until I realized that the hash keys could very easily be based on things like object addresses, which could be different on each run. For the moment I've decided to leave the non-determinism in there, because it'll probably help me to find unexpected order-dependency bugs, but ultimately I might need to add a regularization step (like a sort), or change from a hash to a tree or similar, so that users of the program aren't surprised by getting different answers to the same question. Cheers, -- Andrew From loldrup at gmail.com Sun Apr 5 03:23:25 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Sun Apr 5 03:24:01 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <49D7FFBB.9050902@mazama.net> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> <49D7FFBB.9050902@mazama.net> Message-ID: <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> Well it sure does evaluate successfully now, and testing the first 4 expressions on page 4 in "The Reasoned Schemer" makes them all return the same value as the ones in that book. Only thing is, the book doesn't mention the definitions of fail and succeed (only that they are longs for #u and #s), so I'm not sure whether this solution is some crude hack or the official way to do it. Now this code: #lang scheme (require (planet dfriedman/miniKanren:1:1/minikanren)) (define succeed (== #t #t)) (define fail (== #t #f)) (run #f (q) fail) (run #f (q) (== #t q)) (run #f (q) fail (== #t q)) (run #f (q) succeed (== #t q)) returns this: () (#t) () (#t) Jon Loldrup 2009/4/5 Ben Goetter > Jon Loldrup wrote: > >> >> [...] the third line was taken from the file mktests.scm < >> http://kanren.cvs.sourceforge.net/viewvc/kanren/kanren/mini/mktests.scm?revision=1.6&view=markup> >> which I think is designed to test a minikanren implementation. >> > That file tests the particular version of minikanren currently on > Sourceforge, which is not the same as the version on PLaneT. You cannot > necessarily mix and match the two. Still, (run #f (q) fail) seems like a > reasonable command to issue... isn't that out of the book? > > Inspecting minikanren.ss reveals that, indeed, it doesn't export any > "fail." The mk.scm on Sourceforge includes the following two definitions > > (define succeed (lambdag@ (s) (unit s))) > (define fail (lambdag@ (s) (mzero))) > > which you can't issue yourself, because the version on PLaneT exports > neither lambdag@ nor mzero. Try instead > > #lang scheme > (require (planet dfriedman/miniKanren:1:1/minikanren)) > (define succeed (== #t #t)) > (define fail (== #t #f)) > (run #f (q) fail) > > That seems to fail correctly. I don't have my copy of TRS at hand, so I > can't opine further. > > Hope that helps, > Ben > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/34b78124/attachment.htm From wookiz at hotmail.com Sun Apr 5 06:18:11 2009 From: wookiz at hotmail.com (wooks) Date: Sun Apr 5 06:18:31 2009 Subject: [plt-scheme] Completely Off-Topic but interesting Message-ID: <618d9bd5-4eb6-4013-9aa9-ea2e47e818be@k41g2000yqh.googlegroups.com> http://www.guardian.co.uk/commentisfree/2009/apr/05/google-internet-piracy From jadudm at gmail.com Sun Apr 5 08:55:43 2009 From: jadudm at gmail.com (Matt Jadud) Date: Sun Apr 5 08:56:02 2009 Subject: [plt-scheme] Confusing web-server interaction Message-ID: Hi all, (This is probably a question for Jay, though...) I don't update the XML-RPC library as often as I should. Perhaps if I was more diligent, it would be easier to keep up on how the internals have changed. On the server side, I apparently no longer need "response.ss" from the "private" portion of the web-server. After getting rid of this require from "server-core.ss" in the library, things run, but I get the following error from within the web-server: ../apps/plt413/collects/web-server/dispatchers/dispatch-files.ss:27:18: string-ref: expects type as 2nd argument, given: -1; other arguments were: "" I haven't really dug into things since the insta and dispatch libraries were rolled into the web-server collection itself. I'm not sure what I should be doing in the XML-RPC library to avoid this error. What follows are my server and client code. I'm wondering: do I need a custom dispatcher, or should I be able to run the XML-RPC library as a simple servlet, given that it provides "interface-version", "manager", "timeout", and "start"? Either way, I thought asking a question would be the quicker route to getting things rolling again, as there are enough new things that I'm not quite sure where best to start. Cheers, Matt [BEGIN SERVER] #lang scheme (require (planet schematics/xmlrpc:4:0/xmlrpc-module-servlet) web-server/servlet web-server/servlet-env) (define (add x y) (+ x y)) (add-handler 'math.add add) (serve/servlet start #:port 9000 #:servlet-path "/RPC" #:launch-browser? false ) [END SERVER] [BEGIN CLIENT] #lang scheme (require (planet schematics/xmlrpc:4:0/xmlrpc)) (define local (xmlrpc-server "localhost" 9000 "/RPC")) (define remote-add (local 'math.add)) (remote-add 3 5) [END CLIENT] From robby at eecs.northwestern.edu Sun Apr 5 09:12:21 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 5 09:12:42 2009 Subject: [plt-scheme] can't get undo (from add-text-keymap-functions) working In-Reply-To: References: Message-ID: <932b2f1f0904050612ia3fc000h8712f3f1009540b@mail.gmail.com> Yes, the undo history is, by default, 0. See set-max-undo-history. Robby On Sun, Apr 5, 2009 at 1:15 AM, Martin DeMello wrote: > I have inherited a class from text%, and assigned it a keymap. The > keymap has been seeded with add-text-keymap-functions. However, > undo/redo don't work - is there anything extra I need to add to get > undo support? Here's the relevant code (I've pasted the full class in, > in case something else is interfering with undo): > > (define editor-keymap > ?(let ((keymap (make-object keymap%))) > ? ?(add-text-keymap-functions keymap) > ? ?(send keymap map-function "c:left" "backward-word") > ? ?(send keymap map-function "c:right" "forward-word") > ? ?(send keymap map-function "s:c:left" "backward-select-word") > ? ?(send keymap map-function "s:c:right" "forward-select-word") > ? ?(send keymap map-function "c:insert" "copy-clipboard") > ? ?(send keymap map-function "s:insert" "paste-clipboard") > ? ?(send keymap map-function "c:z" "undo") > ? ?(send keymap map-function "c:y" "redo") > ? ?keymap)) > > (define editable-text% > ?(class text% > ? ?(init-field on-height-changed) > ? ?(init-field next-editor) > ? ?(init-field prev-editor) > ? ?(init-field set-active) > ? ?(init-field (initial-text "")) > ? ?;; height acts as a cache for the number of lines > ? ?;; so we can tell if insert/delete has changed it > ? ?(define height 0) > ? ?(define (set-height) (set! height (last-line))) > ? ?(define (check-height) > ? ? ?(when (<> height (last-line)) (on-height-changed))) > ? ?(inherit last-line position-line get-start-position insert set-keymap) > ? ?(define (current-line) (position-line (get-start-position))) > ? ?(define (last-line?) (= (current-line) (last-line))) > ? ?(define (first-line?) (= (current-line) 0)) > ? ?(define/public (nlines) (+ 1 (last-line))) > ? ?(define/augment (on-insert a b) (set-height)) > ? ?(define/augment (on-delete a b) (set-height)) > ? ?(define/augment (after-insert a b) (check-height)) > ? ?(define/augment (after-delete a b) (check-height)) > ? ?(define/override (on-focus on?) (when on? (set-active))) > ? ?(define/override (on-local-char key) > ? ? ?(let ([code (send key get-key-code)]) > ? ? ? ?(cond [(and (equal? code 'down) (last-line?)) (next-editor) ] > ? ? ? ? ? ? ?[(and (equal? code 'up) (first-line?)) (prev-editor) ] > ? ? ? ? ? ? ?[else (super on-local-char key)]))) > > ? ?;; initialize > ? ?(super-instantiate ()) > ? ?(set-keymap editor-keymap) > ? ?(insert initial-text 0) > ? ?)) > > martin > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Sun Apr 5 09:58:57 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sun Apr 5 09:59:20 2009 Subject: [plt-scheme] Confusing web-server interaction In-Reply-To: References: Message-ID: On Sun, Apr 5, 2009 at 6:55 AM, Matt Jadud wrote: > Hi all, > > (This is probably a question for Jay, though...) > > I don't update the XML-RPC library as often as I should. Perhaps if I > was more diligent, it would be easier to keep up on how the internals > have changed. > > On the server side, I apparently no longer need "response.ss" from the > "private" portion of the web-server. Yes, you'll using web-server/http. The signature of make-response/full is different though, so you'll need to update the code. > After getting rid of this require > from "server-core.ss" in the library, things run, but I get the > following error from within the web-server: > > ../apps/plt413/collects/web-server/dispatchers/dispatch-files.ss:27:18: > string-ref: expects type as 2nd argument, > given: -1; other arguments were: "" This is a Web server bug that is now fixed in SVN. The problem is that an empty URL is being browsed to and when the path is added to it, it is a directory, so the server is testing if the URL "looks like" a directory (by having a trailing slash) --- if it does, we show an index, otherwise, we add the / and redirect. I expect, however, that you don't really want this to happen at all. > I haven't really dug into things since the insta and dispatch > libraries were rolled into the web-server collection itself. I'm not > sure what I should be doing in the XML-RPC library to avoid this > error. > > What follows are my server and client code. I'm wondering: do I need a > custom dispatcher, or should I be able to run the XML-RPC library as a > simple servlet, given that it provides "interface-version", "manager", > "timeout", and ?"start"? Either way, I thought asking a question would > be the quicker route to getting things rolling again, as there are > enough new things that I'm not quite sure where best to start. You do *not* need to write a dispatcher for this. Also, the *timeout* export is ignored when interface-version is 'v2. And, all these exports are ignored when you are using serve/servlet. It has an additional #:manager keyword argument to set what the manager should be. > > Cheers, > Matt > > [BEGIN SERVER] > #lang scheme > > (require (planet schematics/xmlrpc:4:0/xmlrpc-module-servlet) This hasn't been updated on planet so it errors for different reasons than you describe in the email. > ? ? ? ? web-server/servlet > ? ? ? ? web-server/servlet-env) > > (define (add x y) (+ x y)) > (add-handler 'math.add add) > > (serve/servlet start > ? ? ? ? ? ? ? #:port 9000 > ? ? ? ? ? ? ? #:servlet-path "/RPC" > ? ? ? ? ? ? ? #:launch-browser? false > ? ? ? ? ? ? ? ) > [END SERVER] > > [BEGIN CLIENT] > #lang scheme > (require (planet schematics/xmlrpc:4:0/xmlrpc)) > > (define local (xmlrpc-server "localhost" 9000 "/RPC")) > (define remote-add (local 'math.add)) > > (remote-add 3 5) > [END CLIENT] > _________________________________________________ > ?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 dvanhorn at ccs.neu.edu Sun Apr 5 11:44:28 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Sun Apr 5 11:44:55 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> <49D7FFBB.9050902@mazama.net> <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> Message-ID: <49D8D1DC.4030501@ccs.neu.edu> Jon Loldrup wrote: > Well it sure does evaluate successfully now, and testing the first 4 > expressions on page 4 in "The Reasoned Schemer" makes them all return > the same value as the ones in that book. Only thing is, the book doesn't > mention the definitions of fail and succeed (only that they are longs > for #u and #s), so I'm not sure whether this solution is some crude hack > or the official way to do it. The book gives definitions of #s and #u, both in English and Scheme. See the code at the end of the book. The definitions you gave are equivalent, so this is no crude hack. David From wand at ccs.neu.edu Sun Apr 5 12:34:32 2009 From: wand at ccs.neu.edu (Mitchell Wand) Date: Sun Apr 5 12:34:56 2009 Subject: [plt-scheme] on-tick in 2htdp/universe.ss In-Reply-To: <932b2f1f0904041257k72bc419atd62eed09ccc3be4f@mail.gmail.com> References: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> <932b2f1f0904041257k72bc419atd62eed09ccc3be4f@mail.gmail.com> Message-ID: <1bd18ad50904050934i699b2d2di8590a32083fac0ee@mail.gmail.com> On Sat, Apr 4, 2009 at 3:57 PM, Robby Findler wrote: > I'm not sure, but it looks like that is a buggy error check. You might > try changing the 1 to a 2 in collects/2htdp/universe.ss and seeing > what happens. (Search for "(define-keywords AllSpec" and go down two > lines, I think.) > > Robby > > Yup, that was it, but it wasn't the obvious occurrence of 1. The correct patch is as follows: (define-keywords AllSpec [on-tick (function-with-arity 1 except [(x rate) #'(list (proc> 'on-tick (f2h x) 2) ; last arg was 1 (num> 'on-tick rate positive? "pos. number" "rate"))])]) Changing the number on line 3 doesn't do anything, but changing the one in the line that says proc> does the trick. Perhaps somebody can install this patch? --Mitch -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/217e1013/attachment.html From loldrup at gmail.com Sun Apr 5 12:34:48 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Sun Apr 5 12:35:25 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <49D8D1DC.4030501@ccs.neu.edu> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> <49D7FFBB.9050902@mazama.net> <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> <49D8D1DC.4030501@ccs.neu.edu> Message-ID: <90eacde30904050934n323391a2mf9a5caf68078ddb4@mail.gmail.com> 2009/4/5 David Van Horn > Jon Loldrup wrote: > >> Well it sure does evaluate successfully now, and testing the first 4 >> expressions on page 4 in "The Reasoned Schemer" makes them all return the >> same value as the ones in that book. Only thing is, the book doesn't mention >> the definitions of fail and succeed (only that they are longs for #u and >> #s), so I'm not sure whether this solution is some crude hack or the >> official way to do it. >> > > The book gives definitions of #s and #u, both in English and Scheme. See > the code at the end of the book. The definitions you gave are equivalent, > so this is no crude hack. > That doesn't make sense in my mind: If #u and #s are actually defined how come I can't use them and have to use the longs "fail" and "succeed"? eg.: the line (run #f (q) #u (== #t q)) results in Module Language: invalid module text read: bad syntax `#u' mvh Jon Loldrup -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/81b15dac/attachment.htm From beratn at gmail.com Sun Apr 5 12:40:52 2009 From: beratn at gmail.com (=?ISO-8859-9?Q?emre_berat_nebio=F0lu?=) Date: Sun Apr 5 12:41:16 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: <20090405013849.434d1a43@halmanfloyd.lan.local> References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> <20090405005918.76dee424@halmanfloyd.lan.local> <20090405013849.434d1a43@halmanfloyd.lan.local> Message-ID: I have two more things to say firstly i wonna talk about some misunderstanding point in the links that you gave.What does "make conservative guess" mean ? In the sentence i read from mail said that. "The "conservative" part means "guess a bit about which stack, heap, and register words represent live pointers" i dont know anything how to be used heap or register by garbage collector.But fortunately i know something about stack. Stack is a structure that works with LIFO sense.Let say we wrote a factorial function that takes 50 as input.In that stack factorial makes a job until finding fact of 50.But after some point machine cant make any calculation because stack will be full.But if we write that function CPS version,tail recursive version machine works until finding fact of 50.I mean stack is filled until it is full.When it is full,garbage collector starts clearing up that stack.I dunno my knowledge is true with 100 percentage.If i make a mistake please let me know.But that mail talks about "whick stack or heap or register represent live pointers.So i have two question ? How many stack or heap or register are there in memory ? If There are more than one.Why machine cannot calculate some value or having trouble in calculating s some value ? And If more than one stack there are,How can it be decided,which one is used ? Are there some rules ? Thats why it is concervative because of rules ?Sorry for my bad english.I hope i can tell my point.I am just newbie in programming.I try to learn the environment. "The advantage of conservative garbage collection (CGC) is that it's relatively easy to interoperate with C. For that reason, CGC was a reasonable choice for the way that we originally constructed DrScheme, and it remains extremely useful to those of you who develop C-based extensions to import C libraries." I know that Drscheme was written in C language.And mail said it is using CGC and said easy to interprete with C. My question is Drscheme is written in C and mail said CGC is easy to interprete in C.So both drscheme and CGC is suitable foe each other. Because both of them is written in C. "[Boehm, POPL'02]" Can someone explain this problem more clearly or can someone suggest anything because i wonder that problem. And mail said the problem is for for GUI program why is that ? I dont understand shot-living-object and long-living object.I try to understand that mail but i am newbie so there are lots of foreign thing for me. But can queue be used for Garbage collector.I mean instead of Lifo using fifo ca be reasonable choice. Anyway sorry for being busing mailling list. On Sun, Apr 5, 2009 at 2:38 AM, Marek Kubica wrote: > Hi, > > Sorry, while digging in the sources I found another GC backend which is > the SenoraGC (SGC) but it is not really recommended to use and not > mentioned very much. > > On Sun, 5 Apr 2009 02:10:06 +0300 > emre berat nebio?lu wrote: > > > What are the difference between CGC and 3m.Both has some advantage or > > disadvantage ? Or It is just about running time or compilation time. > > Yes, they have both some advantages and other disadvantages, for more > details you could take a look at this mail > > which explains how 3m works. > > > I dont know the whole issue on running time and compilation time. > > Running time is same with compilation time.? > > No, to run MzScheme, you first have to compile it. At that point, you > can decide whether your to-be-compiled MzScheme should use CGC, SGC or > 3m as garbage collector [1]. You then compile MzScheme with your > desired GC and then can run programs on MzScheme. The garbage collector > is fixed by this time, so you cannot just switch in the middle of the > program which Garbage Collector to use. > > > For example running time of merge sort is nlogn .This nlogn include > > only time until array is sorted(I assume array is unsorted in first > > time) or include this plus "clearing shared memory". > > The Big-O notation describes the time-complexity of an algorithm, not > actually how long it will take exactly. As such, your algorithm will > be O(n log n) on 3m and on CGC. The actual time that your program runs > will change too, for course but usually not in a way that you'd get > another time-complexity. What also changes is the amount of memory that > MzScheme will use while it runs your program/algorithm. > > > But i just wonder about CGC and 3m. What do we exactly focus on > > "garbage collector". > > On the efficient management of memory. > > regards, > Marek > > [1] technically, even when selecting 3m, a CGC-version of MzScheme will > be built, too > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/bf1da203/attachment.html From pocmatos at gmail.com Sun Apr 5 13:57:08 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Apr 5 13:57:49 2009 Subject: [plt-scheme] Typed-Scheme and car Message-ID: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> Hi all, Just trying this example I got two unexpected error: #lang typed-scheme (: x (Listof (Pair Symbol Integer))) (define x '((one . 1) (two . 2) (three . 3))) (: y (Listof Symbol)) (define y (map car x)) . typecheck: Expected (Listof (Pair Symbol Integer)), but got (List Any Any Any) in: (quote ((one . 1) (two . 2) (three . 3))) . typecheck: Polymorphic function map could not be applied to arguments: Domain: (a b ... b -> c) (Listof a) (Listof b) ... b Arguments: (All (a b) (case-lambda ((Pair a b) -> a) ((Listof a) -> a))) (Listof (Pair Symbol Integer)) Result type: (Listof c) Expected result: (Listof Symbol) in: (map car x) if I replace x define with: (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) the first error disappears but the second remains. The second error goes away with: (define y (map (lambda: ((p : (Pair Symbol Integer))) (car p)) x)) But this is MUCH more annoying to write and the program gets much more verbose and I have to say that after rewriting a couple of 'big' modules in typed-scheme, the scheme simplicity and elegance starts to fade. Making typed-scheme support things such as a (map car x) is for me a big requirement. Currently my code is full of lambda: in maps, filters, etc for no good reason. I hope that there is work to improve this in the future. I guess it is possible to make the type inference mechanism to detect this. Still, cheers and kudos to Sam and other for the current state of typed-scheme. It is a very nice language to program in even though its current state still has some quirks. -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From matthias at ccs.neu.edu Sun Apr 5 14:05:19 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 5 14:06:32 2009 Subject: [plt-scheme] on-tick in 2htdp/universe.ss In-Reply-To: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> References: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> Message-ID: <10DAE42D-4EEC-49E7-B619-5C97E9F89332@ccs.neu.edu> It's a bug that Viera's students discovered and that I plan on fixing for the next release of universe. -- Matthias P.S. I gave her students a (really bad, hacky) patch but it's too ugly to post in public. On Apr 4, 2009, at 11:14 AM, Mitchell Wand wrote: > What is the correct contract for an on-tick handler in the universe > teachpack? > > I'm playing with the universe teachpack, and I'm having trouble > writing an on-tick clause for a universe. > > The help files says clearly: > > (on-tick tick-expr) > tick-expr : (-> [listof world?] UniverseState bundle?) > > The one example I could find of a universe with an on-tick handler > (in universe.ss) says > > (universe '() > (on-new nu) > (on-msg process) > #; > (on-tick (lambda (u x) (printf "hello!\n") (list u)) 1))) > > This clearly supplies a function of 2 arguments, though not one > that apparently matches the contract > in the help file. > > But when I try to say > > (define (on-tick-fn worlds s-state) > (make-bundle worlds s-state empty)) > > (define (run-server d) > (universe > '* > (on-new on-new-fn) > (on-msg on-msg-fn) > (on-tick on-tick-fn 1) > )) > > I get: > > > (run-server 1) > on-tick: procedure of one argument expected as first argument; > given procedure of 2 arguments > > What's up with this? What values are actually sent to the on-tick > handler? > > --Mitch > > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Sun Apr 5 14:05:58 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 5 14:07:10 2009 Subject: [plt-scheme] on-tick in 2htdp/universe.ss In-Reply-To: <1bd18ad50904050934i699b2d2di8590a32083fac0ee@mail.gmail.com> References: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> <932b2f1f0904041257k72bc419atd62eed09ccc3be4f@mail.gmail.com> <1bd18ad50904050934i699b2d2di8590a32083fac0ee@mail.gmail.com> Message-ID: <1C65268B-7989-454E-83BE-0F645A1E8603@ccs.neu.edu> Wrong!!!! This will disable other things. On Apr 5, 2009, at 12:34 PM, Mitchell Wand wrote: > On Sat, Apr 4, 2009 at 3:57 PM, Robby Findler > wrote: > I'm not sure, but it looks like that is a buggy error check. You might > try changing the 1 to a 2 in collects/2htdp/universe.ss and seeing > what happens. (Search for "(define-keywords AllSpec" and go down two > lines, I think.) > > Robby > > > Yup, that was it, but it wasn't the obvious occurrence of 1. The > correct patch is as follows: > > (define-keywords AllSpec > [on-tick (function-with-arity > 1 > except > [(x rate) > #'(list (proc> 'on-tick (f2h x) 2) ; last arg was 1 > (num> 'on-tick rate positive? "pos. number" > "rate"))])]) > > Changing the number on line 3 doesn't do anything, but changing the > one in the line that says proc> does the trick. > > Perhaps somebody can install this patch? > > --Mitch > _________________________________________________ > 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/20090405/8399859b/attachment.htm From matthias at ccs.neu.edu Sun Apr 5 14:18:05 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 5 14:19:18 2009 Subject: [plt-scheme] Typed-Scheme and car In-Reply-To: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> References: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> Message-ID: <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> Would this > #lang typed-scheme > > (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) > > (define y ({inst map Symbol (Pair Symbol Integer)} car x)) make you happier? Local inference can't infer at which type map is used here. That's why you need to declare it. -- Matthias On Apr 5, 2009, at 1:57 PM, Paulo J. Matos wrote: > Hi all, > > Just trying this example I got two unexpected error: > #lang typed-scheme > > (: x (Listof (Pair Symbol Integer))) > (define x '((one . 1) (two . 2) (three . 3))) > > (: y (Listof Symbol)) > (define y (map car x)) > > . typecheck: Expected (Listof (Pair Symbol Integer)), but got (List > Any Any Any) in: (quote ((one . 1) (two . 2) (three . 3))) > . typecheck: Polymorphic function map could not be applied to > arguments: > Domain: (a b ... b -> c) (Listof a) (Listof b) ... b > Arguments: (All (a b) (case-lambda ((Pair a b) -> a) ((Listof a) -> > a))) (Listof (Pair Symbol Integer)) > Result type: (Listof c) > Expected result: (Listof Symbol) > in: (map car x) > > if I replace x define with: > (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) > > the first error disappears but the second remains. The second error > goes away with: > (define y (map (lambda: ((p : (Pair Symbol Integer))) (car p)) x)) > > But this is MUCH more annoying to write and the program gets much more > verbose and I have to say that after rewriting a couple of 'big' > modules in typed-scheme, the scheme simplicity and elegance starts to > fade. Making typed-scheme support things such as a (map car x) is for > me a big requirement. Currently my code is full of lambda: in maps, > filters, etc for no good reason. I hope that there is work to improve > this in the future. I guess it is possible to make the type inference > mechanism to detect this. > > Still, cheers and kudos to Sam and other for the current state of > typed-scheme. It is a very nice language to program in even though its > current state still has some quirks. > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dvanhorn at ccs.neu.edu Sun Apr 5 14:30:26 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Sun Apr 5 14:31:10 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904050934n323391a2mf9a5caf68078ddb4@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> <49D7FFBB.9050902@mazama.net> <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> <49D8D1DC.4030501@ccs.neu.edu> <90eacde30904050934n323391a2mf9a5caf68078ddb4@mail.gmail.com> Message-ID: <49D8F8C2.4050200@ccs.neu.edu> Jon Loldrup wrote: > > 2009/4/5 David Van Horn > > > Jon Loldrup wrote: > > Well it sure does evaluate successfully now, and testing the > first 4 expressions on page 4 in "The Reasoned Schemer" makes > them all return the same value as the ones in that book. Only > thing is, the book doesn't mention the definitions of fail and > succeed (only that they are longs for #u and #s), so I'm not > sure whether this solution is some crude hack or the official > way to do it. > > > The book gives definitions of #s and #u, both in English and Scheme. > See the code at the end of the book. The definitions you gave are > equivalent, so this is no crude hack. > > > That doesn't make sense in my mind: If #u and #s are actually defined > how come I can't use them and have to use the longs "fail" and "succeed"? > > eg.: > the line > (run #f (q) #u (== #t q)) > results in > Module Language: invalid module text > read: bad syntax `#u' The book gives definitions in the sense that it tells you what the meaning of these things are. The book also gives definitions in the sense that it provides Scheme code representing this meaning. You are correct that you cannot use #u and #s directly (remember that #u and #s are written `fail' and `succeed', as stated p3). These are notational shorthands used for the purpose of presentation in the book. You cannot, in any standard way, define such constants since it would involve extending the concrete syntax of Scheme. However, you can bind the names `fail' and `succeed' to the meaning #u and #s. The code you are using does not provide such bindings, however since you know the meaning, it is easy to create such bindings yourself. To say that the book does not mention the definition of fail and succeed is clearly incorrect. It does. You asked whether the definitions you provided were some crude hack or the official way to do it. If you can convince yourself that the meanings you assigned fail and succeed are equivalent to those given in the book, the answer is no, it is not just a crude hack. David From pocmatos at gmail.com Sun Apr 5 14:30:24 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Apr 5 14:31:16 2009 Subject: [plt-scheme] Typed-Scheme and car In-Reply-To: <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> References: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> Message-ID: <11b141710904051130g4951e841o23ed1179677aa24f@mail.gmail.com> On Sun, Apr 5, 2009 at 6:18 PM, Matthias Felleisen wrote: > > Would this > >> #lang typed-scheme >> >> (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) >> >> (define y ({inst map Symbol (Pair Symbol Integer)} car x)) > > make you happier? Local inference can't infer at which type map is used > here. That's why you need to declare it. > If no inference is possible that's definitely better. Seems I am still learning my way around typed-scheme. :) Thanks, Paulo Matos > -- Matthias > > > > On Apr 5, 2009, at 1:57 PM, Paulo J. Matos wrote: > >> Hi all, >> >> Just trying this example I got two unexpected error: >> #lang typed-scheme >> >> (: x (Listof (Pair Symbol Integer))) >> (define x '((one . 1) (two . 2) (three . 3))) >> >> (: y (Listof Symbol)) >> (define y (map car x)) >> >> . typecheck: Expected (Listof (Pair Symbol Integer)), but got (List >> Any Any Any) in: (quote ((one . 1) (two . 2) (three . 3))) >> . typecheck: Polymorphic function map could not be applied to arguments: >> Domain: (a b ... b -> c) (Listof a) (Listof b) ... b >> Arguments: (All (a b) (case-lambda ((Pair a b) -> a) ((Listof a) -> >> a))) (Listof (Pair Symbol Integer)) >> Result type: (Listof c) >> Expected result: (Listof Symbol) >> ?in: (map car x) >> >> if I replace x define with: >> (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) >> >> the first error disappears but the second remains. The second error >> goes away with: >> (define y (map (lambda: ((p : (Pair Symbol Integer))) (car p)) x)) >> >> But this is MUCH more annoying to write and the program gets much more >> verbose and I have to say that after rewriting a couple of 'big' >> modules in typed-scheme, the scheme simplicity and elegance starts to >> fade. Making typed-scheme support things such as a (map car x) is for >> me a big requirement. Currently my code is full of lambda: in maps, >> filters, etc for no good reason. I hope that there is work to improve >> this in the future. I guess it is possible to make the type inference >> mechanism to detect this. >> >> Still, cheers and kudos to Sam and other for the current state of >> typed-scheme. It is a very nice language to program in even though its >> current state still has some quirks. >> >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From wand at ccs.neu.edu Sun Apr 5 14:37:35 2009 From: wand at ccs.neu.edu (Mitchell Wand) Date: Sun Apr 5 14:38:01 2009 Subject: [plt-scheme] on-tick in 2htdp/universe.ss In-Reply-To: <1C65268B-7989-454E-83BE-0F645A1E8603@ccs.neu.edu> References: <1bd18ad50904040814p12426e18n7d507656c5b10fbe@mail.gmail.com> <932b2f1f0904041257k72bc419atd62eed09ccc3be4f@mail.gmail.com> <1bd18ad50904050934i699b2d2di8590a32083fac0ee@mail.gmail.com> <1C65268B-7989-454E-83BE-0F645A1E8603@ccs.neu.edu> Message-ID: <1bd18ad50904051137j36854d63yfd9d88bbe5266b8b@mail.gmail.com> Ahh, interesting. Like what? --Mitch On Sun, Apr 5, 2009 at 2:05 PM, Matthias Felleisen wrote: > > Wrong!!!! This will disable other things. > > > On Apr 5, 2009, at 12:34 PM, Mitchell Wand wrote: > > On Sat, Apr 4, 2009 at 3:57 PM, Robby Findler > wrote: > >> I'm not sure, but it looks like that is a buggy error check. You might >> try changing the 1 to a 2 in collects/2htdp/universe.ss and seeing >> what happens. (Search for "(define-keywords AllSpec" and go down two >> lines, I think.) >> >> Robby >> >> > Yup, that was it, but it wasn't the obvious occurrence of 1. The correct > patch is as follows: > > (define-keywords AllSpec > [on-tick (function-with-arity > 1 > except > [(x rate) > #'(list (proc> 'on-tick (f2h x) 2) ; last arg was 1 > (num> 'on-tick rate positive? "pos. number" > "rate"))])]) > > Changing the number on line 3 doesn't do anything, but changing the one in > the line that says proc> does the trick. > > Perhaps somebody can install this patch? > > --Mitch > _________________________________________________ > 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/20090405/b9e16f67/attachment.html From pocmatos at gmail.com Sun Apr 5 14:38:59 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Apr 5 14:39:38 2009 Subject: [plt-scheme] Typed-Scheme and car In-Reply-To: <11b141710904051130g4951e841o23ed1179677aa24f@mail.gmail.com> References: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> <11b141710904051130g4951e841o23ed1179677aa24f@mail.gmail.com> Message-ID: <11b141710904051138p520779f2ve383fca694a0e2c4@mail.gmail.com> On Sun, Apr 5, 2009 at 6:30 PM, Paulo J. Matos wrote: > On Sun, Apr 5, 2009 at 6:18 PM, Matthias Felleisen wrote: >> >> Would this >> >>> #lang typed-scheme >>> >>> (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) >>> >>> (define y ({inst map Symbol (Pair Symbol Integer)} car x)) >> >> make you happier? Local inference can't infer at which type map is used >> here. That's why you need to declare it. >> > > If no inference is possible that's definitely better. Seems I am still > learning my way around typed-scheme. :) > Something else I would say is that it's not really clear why you type map with Symbol and (Pair Symbol Integer), since map receives in this case a function (Pair Symbol Integer) returning a Symbol and a (Listof (Pair Symbol Integer)) itself returns a (Listof Symbol). So, having {inst map Symbol (Pair Symbol Integer)} is quite unclear. I understand that we are assigning specific types to the polymorphic types of the type definition for map, but the problem is that the user needs to know how the type of a specific function is written (order of types and polymorphic variables used) and none of this seems written anywhere. For example, even if know that map needs to be explicitly typed in this case, why {inst map Symbol (Pair Symbol Integer)} and not {inst map (Pair Symbol Integer) Symbol} ? Cheers, Paulo Matos > Thanks, > > Paulo Matos > >> -- Matthias >> >> >> >> On Apr 5, 2009, at 1:57 PM, Paulo J. Matos wrote: >> >>> Hi all, >>> >>> Just trying this example I got two unexpected error: >>> #lang typed-scheme >>> >>> (: x (Listof (Pair Symbol Integer))) >>> (define x '((one . 1) (two . 2) (three . 3))) >>> >>> (: y (Listof Symbol)) >>> (define y (map car x)) >>> >>> . typecheck: Expected (Listof (Pair Symbol Integer)), but got (List >>> Any Any Any) in: (quote ((one . 1) (two . 2) (three . 3))) >>> . typecheck: Polymorphic function map could not be applied to arguments: >>> Domain: (a b ... b -> c) (Listof a) (Listof b) ... b >>> Arguments: (All (a b) (case-lambda ((Pair a b) -> a) ((Listof a) -> >>> a))) (Listof (Pair Symbol Integer)) >>> Result type: (Listof c) >>> Expected result: (Listof Symbol) >>> ?in: (map car x) >>> >>> if I replace x define with: >>> (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) >>> >>> the first error disappears but the second remains. The second error >>> goes away with: >>> (define y (map (lambda: ((p : (Pair Symbol Integer))) (car p)) x)) >>> >>> But this is MUCH more annoying to write and the program gets much more >>> verbose and I have to say that after rewriting a couple of 'big' >>> modules in typed-scheme, the scheme simplicity and elegance starts to >>> fade. Making typed-scheme support things such as a (map car x) is for >>> me a big requirement. Currently my code is full of lambda: in maps, >>> filters, etc for no good reason. I hope that there is work to improve >>> this in the future. I guess it is possible to make the type inference >>> mechanism to detect this. >>> >>> Still, cheers and kudos to Sam and other for the current state of >>> typed-scheme. It is a very nice language to program in even though its >>> current state still has some quirks. >>> >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> Webpage: http://www.personal.soton.ac.uk/pocm >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From dvanhorn at ccs.neu.edu Sun Apr 5 14:44:01 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Sun Apr 5 14:44:26 2009 Subject: [plt-scheme] Typed-Scheme and car In-Reply-To: <11b141710904051138p520779f2ve383fca694a0e2c4@mail.gmail.com> References: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> <11b141710904051130g4951e841o23ed1179677aa24f@mail.gmail.com> <11b141710904051138p520779f2ve383fca694a0e2c4@mail.gmail.com> Message-ID: <49D8FBF1.9050808@ccs.neu.edu> Paulo J. Matos wrote: > On Sun, Apr 5, 2009 at 6:30 PM, Paulo J. Matos wrote: >> On Sun, Apr 5, 2009 at 6:18 PM, Matthias Felleisen wrote: >>> Would this >>> >>>> #lang typed-scheme >>>> >>>> (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) >>>> >>>> (define y ({inst map Symbol (Pair Symbol Integer)} car x)) >>> make you happier? Local inference can't infer at which type map is used >>> here. That's why you need to declare it. >>> >> If no inference is possible that's definitely better. Seems I am still >> learning my way around typed-scheme. :) >> > > Something else I would say is that it's not really clear why you type > map with Symbol and (Pair Symbol Integer), since map receives in this > case a function (Pair Symbol Integer) returning a Symbol and a (Listof > (Pair Symbol Integer)) itself returns a (Listof Symbol). So, having > {inst map Symbol (Pair Symbol Integer)} is quite unclear. I understand > that we are assigning specific types to the polymorphic types of the > type definition for map, but the problem is that the user needs to > know how the type of a specific function is written (order of types > and polymorphic variables used) and none of this seems written > anywhere. For example, even if know that map needs to be explicitly > typed in this case, why {inst map Symbol (Pair Symbol Integer)} and > not {inst map (Pair Symbol Integer) Symbol} ? You can read the type of map to see this: Welcome to DrScheme, version 4.1.5.3-svn2apr2009 [3m]. Language: Module custom; memory limit: 512 megabytes. > map - : (All (c a b ...) ((a b ... b -> c) (Listof a) (Listof b) ... b -> (Listof c))) # David From pocmatos at gmail.com Sun Apr 5 14:51:05 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Apr 5 14:51:42 2009 Subject: [plt-scheme] Typed-Scheme and car In-Reply-To: <49D8FBF1.9050808@ccs.neu.edu> References: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> <11b141710904051130g4951e841o23ed1179677aa24f@mail.gmail.com> <11b141710904051138p520779f2ve383fca694a0e2c4@mail.gmail.com> <49D8FBF1.9050808@ccs.neu.edu> Message-ID: <11b141710904051151l4f4d0992h1868e7cdabfc108e@mail.gmail.com> On Sun, Apr 5, 2009 at 6:44 PM, David Van Horn wrote: > Paulo J. Matos wrote: >> >> On Sun, Apr 5, 2009 at 6:30 PM, Paulo J. Matos wrote: >>> >>> On Sun, Apr 5, 2009 at 6:18 PM, Matthias Felleisen >>> wrote: >>>> >>>> Would this >>>> >>>>> #lang typed-scheme >>>>> >>>>> (define x (list (cons 'one 1) (cons 'two 2) (cons 'three 3))) >>>>> >>>>> (define y ({inst map Symbol (Pair Symbol Integer)} car x)) >>>> >>>> make you happier? Local inference can't infer at which type map is used >>>> here. That's why you need to declare it. >>>> >>> If no inference is possible that's definitely better. Seems I am still >>> learning my way around typed-scheme. :) >>> >> >> Something else I would say is that it's not really clear why you type >> map with Symbol and (Pair Symbol Integer), since map receives in this >> case a function (Pair Symbol Integer) returning a Symbol and a (Listof >> ?(Pair Symbol Integer)) itself returns a (Listof Symbol). So, having >> {inst map Symbol (Pair Symbol Integer)} is quite unclear. I understand >> that we are assigning specific types to the polymorphic types of the >> type definition for map, but the problem is that the user needs to >> know how the type of a specific function is written (order of types >> and polymorphic variables used) and none of this seems written >> anywhere. For example, even if know that map needs to be explicitly >> typed in this case, why {inst map Symbol (Pair Symbol Integer)} and >> not {inst map (Pair Symbol Integer) Symbol} ? > > You can read the type of map to see this: > > Welcome to DrScheme, version 4.1.5.3-svn2apr2009 [3m]. > Language: Module custom; memory limit: 512 megabytes. >> map > - : (All (c a b ...) ((a b ... b -> c) (Listof a) (Listof b) ... b -> > (Listof c))) > # > You are right, thanks for reminding me of that... Anyway, in the future will the documentation contain the types for each function ? For example, current doc: (map proc lst ...+) ? list? proc : procedure? lst : list? Future doc: (map proc lst ...+) ? list? proc : procedure? lst : list? typed-scheme: (All (c a b ...) ((a b ... b -> c) (Listof a) (Listof b) ... b -> (Listof c))) On other issue... how does this happen in Haskell, doesn't haskell figure the types out for map? What's the major difference between haskell and typed-scheme in this case? Cheers, Paulo Matos > David > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From sk at cs.brown.edu Sun Apr 5 15:12:30 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Apr 5 15:13:05 2009 Subject: [plt-scheme] Completely Off-Topic but interesting In-Reply-To: <618d9bd5-4eb6-4013-9aa9-ea2e47e818be@k41g2000yqh.googlegroups.com> References: <618d9bd5-4eb6-4013-9aa9-ea2e47e818be@k41g2000yqh.googlegroups.com> Message-ID: If you're going to post a COMPLETELY off-topic message, please at least have the courtesy to provide a one-para summary. On Sun, Apr 5, 2009 at 6:18 AM, wooks wrote: > http://www.guardian.co.uk/commentisfree/2009/apr/05/google-internet-piracy > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Sun Apr 5 15:29:37 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 5 15:30:51 2009 Subject: [plt-scheme] *const In-Reply-To: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> References: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> Message-ID: I forgot what we did there. But we either mean '*const or (define *const '*const). -- Matthias (not anywhere near a copy of the book) On Apr 3, 2009, at 9:56 AM, Jon Loldrup wrote: > Hi > > I'm working through The Little Schemer and I've comed to the point > where they introduce types (page 181). They use terms like: > > *const > *quote > *identifier > *lambda > *cond > > but I wonder how I type these names in DrScheme? When I try to > implement the atom-to-action function (see below) DrScheme says > this: "*const: name is not defined, not a parameter, and not a > primitive name" > > this is the function: > > (define atom-to-action > (lambda (e) > (cond > ((number? e) *const) > ((eq? e #t) *const) > ((eq? e #f) *const) > ((eq? e '(cons)) *const) > ((eq? e '(car)) *const) > ((eq? e '(cdr)) *const) > ((eq? e '(null?)) *const) > ((eq? e '(eq?)) *const) > ((eq? e '(atom?)) *const) > ((eq? e '(zero?)) *const) > ((eq? e '(add1)) *const) > ((eq? e '(sub1)) *const) > ((eq? e '(number?)) *const) > (else *identifier)))) > > kind regards Jon Loldrup, Denmark > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From samth at ccs.neu.edu Sun Apr 5 15:44:36 2009 From: samth at ccs.neu.edu (Sam TH) Date: Sun Apr 5 15:44:54 2009 Subject: [plt-scheme] Typed-Scheme and car In-Reply-To: <11b141710904051151l4f4d0992h1868e7cdabfc108e@mail.gmail.com> References: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> <11b141710904051130g4951e841o23ed1179677aa24f@mail.gmail.com> <11b141710904051138p520779f2ve383fca694a0e2c4@mail.gmail.com> <49D8FBF1.9050808@ccs.neu.edu> <11b141710904051151l4f4d0992h1868e7cdabfc108e@mail.gmail.com> Message-ID: <63bb19ae0904051244o240efbc5u99ffe105169a9ce5@mail.gmail.com> On Sun, Apr 5, 2009 at 2:51 PM, Paulo J. Matos wrote: > What's the major difference between haskell and typed-scheme in this case? Haskell doesn't have subtyping, so the type inference problem is totally different there. -- sam th samth@ccs.neu.edu From dvanhorn at ccs.neu.edu Sun Apr 5 15:45:47 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Sun Apr 5 15:46:13 2009 Subject: [plt-scheme] *const In-Reply-To: References: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> Message-ID: <49D90A6B.7020603@ccs.neu.edu> On Apr 3, 2009, at 9:56 AM, Jon Loldrup wrote: > Hi > > I'm working through The Little Schemer and I've comed to the point > where they introduce types (page 181). They use terms like: > > *const > *quote > *identifier > *lambda > *cond > > but I wonder how I type these names in DrScheme? When I try to > implement the atom-to-action function (see below) DrScheme says this: > "*const: name is not defined, not a parameter, and not a primitive > name" Matthias Felleisen wrote: > I forgot what we did there. But we either mean '*const or (define *const > '*const). -- Matthias (not anywhere near a copy of the book) Nope; I have a copy -- there are definitions given for *const, *quote, etc. They start on page 182. Here is an example: (define *const (lambda (e table) (cond ((number? e) e) ((eq? e #t) #t) ((eq? e #f) #f) (else (build (quote primitive) e))))) Jon, if you want to use atom-to-action function, you'll need to define each of these *-functions as given in the book. Rereading this part of TLS, I can only conclude that this was written before Matthias visited the pope. David From matthias at ccs.neu.edu Sun Apr 5 16:05:35 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 5 16:06:59 2009 Subject: [plt-scheme] *const In-Reply-To: <49D90A6B.7020603@ccs.neu.edu> References: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> <49D90A6B.7020603@ccs.neu.edu> Message-ID: On Apr 5, 2009, at 3:45 PM, David Van Horn wrote: Thanks for looking it up. > Rereading this part of TLS, I can only conclude that this was > written before Matthias visited the pope. I suspect you're wrong. Again no where close to a book, but look at the copy right. ;; --- The exercise in 10 is quite interesting in some strange way. Get the interpreter to work in the language of the book so that it behaves just like the book, regardless of which Scheme you run in. (There was some silly nil-#f issue in the air back then ... another one of those discussions on 'standards' that generated a lot of heat.) -- Matthias From noelwelsh at gmail.com Sun Apr 5 16:10:04 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sun Apr 5 16:10:26 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> <20090405005918.76dee424@halmanfloyd.lan.local> <20090405013849.434d1a43@halmanfloyd.lan.local> Message-ID: 2009/4/5 emre berat nebio?lu : > I have two more things to say firstly i wonna talk about some > misunderstanding point in the links that you gave.What does "make > conservative guess" mean ? A garbage collector has to figure out which pieces of memory are live data the should be saved, and which pieces of memory are garbage and can be reused. It does this by tracing all the pointers starting from the "root set" and finishing when there are no pointers left to follow. To do this it must know which pieces of memory -- the registers, heap, and stack -- represent pointers, and which represent other values in the program. Typically this is done by using a predefined memory layout which includes various tags that are tell the GC what is what. This requires all code cooperates with the GC, by using this layout. Now code that is written without the GC in mind will not work, as it won't use the correct layout. A conservative GC doesn't require a predefined layout -- it takes a guess as to what is a pointer and what isn't. Sometimes it gets the guess wrong and a piece of memory that should be reused isn't. Thus a conservative GC is good for interoperating with code that wasn't written for the garbage collector (most C code) but it leaks memory. > I know that Drscheme was written in C language.And mail said it is using CGC > and said easy to interprete with C. Some of DrScheme is written in C. I would say most of it is written in Scheme. A textbook on programming language implementation will have a more complete discussion of GC. I think there is material in PLAI: http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ HTH, N. From loldrup at gmail.com Sun Apr 5 16:21:24 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Sun Apr 5 16:22:00 2009 Subject: [plt-scheme] *const In-Reply-To: References: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> <49D90A6B.7020603@ccs.neu.edu> Message-ID: <90eacde30904051321v3747906ck7354d7287c32f6a@mail.gmail.com> Oh, sorry, me and some person on the list named Danny forgot to cc our conversation the other day to the list. Danny wrote: 2009/4/3 Danny Yoo > On Fri, Apr 3, 2009 at 9:56 AM, Jon Loldrup wrote: > > Hi > > > > I'm working through The Little Schemer and I've comed to the point where > > they introduce types (page 181). They use terms like: > > Keep going a few more pages. The book's dialogue turns toward what > shape the actions need to have. After that, it finally starts > introducing those definitions on Page 183. > To which I replied: Ahh - smart :) Jon Loldrup 2009/4/5 Matthias Felleisen > > On Apr 5, 2009, at 3:45 PM, David Van Horn wrote: > > Thanks for looking it up. > > > Rereading this part of TLS, I can only conclude that this was written >> before Matthias visited the pope. >> > > I suspect you're wrong. Again no where close to a book, but look at the > copy right. > > ;; --- > > The exercise in 10 is quite interesting in some strange way. Get the > interpreter to work in the language of the book so that it behaves just like > the book, regardless of which Scheme you run in. (There was some silly > nil-#f issue in the air back then ... another one of those discussions on > 'standards' that generated a lot of heat.) > > -- Matthias > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/f781ff56/attachment.html From loldrup at gmail.com Sun Apr 5 16:21:43 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Sun Apr 5 16:22:26 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <49D8F8C2.4050200@ccs.neu.edu> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> <49D7FFBB.9050902@mazama.net> <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> <49D8D1DC.4030501@ccs.neu.edu> <90eacde30904050934n323391a2mf9a5caf68078ddb4@mail.gmail.com> <49D8F8C2.4050200@ccs.neu.edu> Message-ID: <90eacde30904051321q7a8496c9jc553de1ff976f96f@mail.gmail.com> > To say that the book does not mention the definition of fail and succeed is > clearly incorrect. Yep, I know they are in the beginning of the book, I was thinking of the code on page 160 and 161. They aren't there, but #s and #u are. Maybe this question is a bit philosophical and maybe I should just read the book and then ask more questions (if still needed) : Is "the meaning" a part of the programming language, or is it our human interpretation of specific structures of the language? I think I will get a better holistic understanding of it all by simply reading the book. So thats what I will do. Thanks to all of you for your help in getting my DrScheme to work with Minikanren! Jon Loldrup -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/442a4420/attachment.htm From dvanhorn at ccs.neu.edu Sun Apr 5 16:22:17 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Sun Apr 5 16:22:49 2009 Subject: [plt-scheme] *const In-Reply-To: References: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> <49D90A6B.7020603@ccs.neu.edu> Message-ID: <49D912F9.6030300@ccs.neu.edu> Matthias Felleisen wrote: > On Apr 5, 2009, at 3:45 PM, David Van Horn wrote: > > Thanks for looking it up. > > >> Rereading this part of TLS, I can only conclude that this was written >> before Matthias visited the pope. > > I suspect you're wrong. Again no where close to a book, but look at the > copy right. Well, the Little LISPer is (c) 1986, 1974. The first MIT edition is 1987. My copy of TLS, which is ed 4, is from 1996. I guess the important thing for Jon to note, since he wrote this is "the point where they introduce types", is that "types" here doesn't mean what is typically meant by "types" in the context of a programming language. The book uses "type" to mean the different grammatical forms of expressions. There are 6: constants, identifiers, applications, etc. This is different from what is meant by "types" in Typed Scheme, for example. David From matthias at ccs.neu.edu Sun Apr 5 16:24:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 5 16:25:38 2009 Subject: [plt-scheme] *const In-Reply-To: <49D912F9.6030300@ccs.neu.edu> References: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> <49D90A6B.7020603@ccs.neu.edu> <49D912F9.6030300@ccs.neu.edu> Message-ID: On Apr 5, 2009, at 4:22 PM, David Van Horn wrote: > Matthias Felleisen wrote: >> On Apr 5, 2009, at 3:45 PM, David Van Horn wrote: >> Thanks for looking it up. >>> Rereading this part of TLS, I can only conclude that this was >>> written before Matthias visited the pope. >> I suspect you're wrong. Again no where close to a book, but look >> at the copy right. > > Well, the Little LISPer is (c) 1986, 1974. The first MIT edition > is 1987. My copy of TLS, which is ed 4, is from 1996. [After popeism :-)] > I guess the important thing for Jon to note, since he wrote this is > "the point where they introduce types", is that "types" here > doesn't mean what is typically meant by "types" in the context of a > programming language. The book uses "type" to mean the different > grammatical forms of expressions. There are 6: constants, > identifiers, applications, etc. > > This is different from what is meant by "types" in Typed Scheme, > for example. Yeap :-) From loldrup at gmail.com Sun Apr 5 16:42:18 2009 From: loldrup at gmail.com (Jon Loldrup) Date: Sun Apr 5 16:42:55 2009 Subject: [plt-scheme] *const In-Reply-To: References: <90eacde30904030656w65fa93d4g91aee32459574030@mail.gmail.com> <49D90A6B.7020603@ccs.neu.edu> <49D912F9.6030300@ccs.neu.edu> Message-ID: <90eacde30904051342v4b360e23y8622d87e037200e0@mail.gmail.com> > > > I guess the important thing for Jon to note, since he wrote this is "the >> point where they introduce types", is that "types" here doesn't mean what is >> typically meant by "types" in the context of a programming language. The >> book uses "type" to mean the different grammatical forms of expressions. >> There are 6: constants, identifiers, applications, etc. >> >> This is different from what is meant by "types" in Typed Scheme, for >> example. >> > > Yeap :-) > > Yeap :-) Jon Loldrup -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/00cdbb61/attachment-0001.html From pocmatos at gmail.com Sun Apr 5 17:48:49 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sun Apr 5 17:49:26 2009 Subject: [plt-scheme] Typed-Scheme and car In-Reply-To: <63bb19ae0904051244o240efbc5u99ffe105169a9ce5@mail.gmail.com> References: <11b141710904051057va15bb8bm5e81df7b3593a627@mail.gmail.com> <8CBEE997-C0E8-4EC2-B3F8-5F75552BDAB6@ccs.neu.edu> <11b141710904051130g4951e841o23ed1179677aa24f@mail.gmail.com> <11b141710904051138p520779f2ve383fca694a0e2c4@mail.gmail.com> <49D8FBF1.9050808@ccs.neu.edu> <11b141710904051151l4f4d0992h1868e7cdabfc108e@mail.gmail.com> <63bb19ae0904051244o240efbc5u99ffe105169a9ce5@mail.gmail.com> Message-ID: <11b141710904051448i5cfe3074q93e7feea621458d3@mail.gmail.com> On Sun, Apr 5, 2009 at 8:44 PM, Sam TH wrote: > On Sun, Apr 5, 2009 at 2:51 PM, Paulo J. Matos wrote: >> What's the major difference between haskell and typed-scheme in this case? > > Haskell doesn't have subtyping, so the type inference problem is > totally different there. > I see... thank you very much for clearing it up. > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From marek at xivilization.net Sun Apr 5 17:55:03 2009 From: marek at xivilization.net (Marek Kubica) Date: Sun Apr 5 17:55:23 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> <20090405005918.76dee424@halmanfloyd.lan.local> <20090405013849.434d1a43@halmanfloyd.lan.local> Message-ID: <20090405235503.44cba52c@halmanfloyd.lan.local> Hi, First let me say that I don't know enough on garbage collectors as I always viewed them from the user perspective, where one just does not have to care about the garbage generated since someone will clean it up anyway. A good exercise would be probably implementing a garbage collector oneself, but I'm not yet up to the task (and except for learning, see no need for it), but I'll try to answer some of your questions. Fortunately this list is also read by the authors of MzScheme and 3m so they can give you some more information. On Sun, 5 Apr 2009 19:40:52 +0300 emre berat nebio?lu wrote: > But if we write that function CPS version,tail recursive version > machine works until finding fact of 50.I mean stack is filled until > it is full.When it is full,garbage collector starts clearing up that > stack. No, not really. A tail call optimized function does not take any additional space on the stack so it does not fill up. There is no need to collect garbage in that exact case, since no garbage is created. > How many stack or heap or register are there in memory ? There is usually one stack per process. Having multiple stacks (say, 2 times 8 MB) is the same as chaining them into one bigger (1 x 16 MB). The problem is, that memory is finite so you can't recurse forever unless you do TCO, since memory runs out - it is that simple. And registers are not part of the regular memory (RAM), they are built into your CPU. Depending on your CPU you have more or less registers. There are also a distinction general purpose registers and special registers (for example SSE) and especially the old Lisp machines have some rather unusual registers, as for the standards of today. > I dont understand shot-living-object and long-living object.I try to > understand that mail but i am newbie so there are lots of > foreign thing for me. Well, short-lived-objects and long-lived-objects are meaningful when you have a generational GC. Basically, the GC is a program that scans your whole program memory for unused chunks. As this takes time, it is often useful to divide the memory into slices for generations. I'll try to explain it on a short example: for (i = 0; i < 100; i++) { for (j = 0; j < 100; j++) { printf("%d %d\n", i, j); } } You have two loops here and two variables (let's assume they are objects - in C there are no objects, but I'm speaking about the concepts), i and j. They are bound to the number objects 0 to 99 but the outer variable, i changes less often than j. So we put the object i in the memory slice reserved for generation 0, and j into the memory slice for generation 1. Now, when we reach the end of the first iteration of the inner for-loop, we'd like to run the GC. As we assume to have a generational GC, it only needs to scan the memory slice for generation 1 leaving the slice of generation 0 alone, thus saving time that is needed for scanning the memory. Basically it boils down to this, that the GC does inspect the memory slices with newer objects more often than the memory slices with older objects, as newer objects are less likely to be short-lived then older objects. > But can queue be used for Garbage collector.I mean instead of Lifo > using fifo ca be reasonable choice. No, a garbage collector is an program (or algorithm), a queue is a data structure. > Anyway sorry for being busing mailling list. No problem, the folks here are usually very helpful, so that having a good mail exchange does not hurt at all. If you are interested in the topic, you could look at the book "Structure and Interpretation of Computer Programs", chapter 5 or watch the SICP videos (especially 9a to 10b). regards, Marek From dvanhorn at ccs.neu.edu Sun Apr 5 18:17:38 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Sun Apr 5 18:18:03 2009 Subject: [plt-scheme] Typed Scheme and substructures Message-ID: <49D92E02.4090607@ccs.neu.edu> Shouldn't this be OK? #lang typed-scheme (define-struct: (A) s ([x : A])) (define-struct: (A) (t s) ()) (: f (All (A) ((t A) -> A))) (define (f z) (s-x z)) Welcome to DrScheme, version 4.1.5.3-svn2apr2009 [3m]. Language: Module custom; memory limit: 512 megabytes. typecheck: Polymorphic function s-x could not be applied to arguments: Domain: (s A) Arguments: (t A) Result type: A Expected result: A in: (s-x z) David From martindemello at gmail.com Mon Apr 6 02:53:23 2009 From: martindemello at gmail.com (Martin DeMello) Date: Mon Apr 6 02:53:42 2009 Subject: [plt-scheme] passing multiple "values" between functions Message-ID: If I have a function returning two values, how do I write a function that consumes them? Two failed tries below, to explain what I'm attempting. #lang scheme (define (foo) (values 1 2)) (define (bar inp) (let-values ([(x y) inp]) (list x y))) (define (baz x y) (list x y)) ;(bar (foo)) ;(baz (foo)) From matthias at ccs.neu.edu Mon Apr 6 03:06:13 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 6 03:07:26 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: Message-ID: Here are two alternatives that work: #lang scheme (define (foo) (values 1 2)) (define (bar inp) (let-values ([(x y) inp]) (list x y))) (define (baz x y) (list x y)) (call-with-values foo baz) (define (moo f) (let-values ([(x y) (f)]) (list x y))) (moo foo) -- Matthias On Apr 6, 2009, at 2:53 AM, Martin DeMello wrote: > If I have a function returning two values, how do I write a function > that consumes them? Two failed tries below, to explain what I'm > attempting. > > #lang scheme > > (define (foo) > (values 1 2)) > > (define (bar inp) > (let-values ([(x y) inp]) > (list x y))) > > (define (baz x y) > (list x y)) > > ;(bar (foo)) > ;(baz (foo)) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From neil at neilvandyke.org Mon Apr 6 03:16:09 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Apr 6 03:16:43 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: Message-ID: <49D9AC39.4000900@neilvandyke.org> Also, don't forget the Help Desk, which probably answers your questions: http://docs.plt-scheme.org/reference/eval-model.html#(part._values-model) http://docs.plt-scheme.org/reference/values.html http://docs.plt-scheme.org/reference/let.html#(form._((quote._~23~25kernel)._let-values)) -- http://www.neilvandyke.org/ From martindemello at gmail.com Mon Apr 6 03:19:38 2009 From: martindemello at gmail.com (Martin DeMello) Date: Mon Apr 6 03:20:00 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: <49D9AC39.4000900@neilvandyke.org> References: <49D9AC39.4000900@neilvandyke.org> Message-ID: On Mon, Apr 6, 2009 at 12:46 PM, Neil Van Dyke wrote: > Also, don't forget the Help Desk, which probably answers your questions: > > http://docs.plt-scheme.org/reference/eval-model.html#(part._values-model) > http://docs.plt-scheme.org/reference/values.html > http://docs.plt-scheme.org/reference/let.html#(form._((quote._~23~25kernel)._let-values)) Yeah, I looked at 1.1 and 2.3, but managed to pass over call-with-values because it referred to continuations. Clicking through, I note it's actually explained very clearly there. martin From martindemello at gmail.com Mon Apr 6 03:23:17 2009 From: martindemello at gmail.com (Martin DeMello) Date: Mon Apr 6 03:23:35 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: Message-ID: On Mon, Apr 6, 2009 at 12:36 PM, Matthias Felleisen wrote: > > Here are two alternatives that work: Thanks. I infer from the failure of the bar example > (define (bar inp) > ?(let-values ([(x y) inp]) > ? ?(list x y))) that there is no "values" object that you can pass around till you're ready to unpack it. Do values offer any advantage over using lists and let-match? martin From neil at neilvandyke.org Mon Apr 6 04:09:36 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Mon Apr 6 04:10:10 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: Message-ID: <49D9B8C0.9030604@neilvandyke.org> Martin DeMello wrote at 04/06/2009 03:23 AM: > that there is no "values" object that you can pass around till you're > ready to unpack it. Correct. You can put multiple values into a list, vector, struct, or whatever, to aggregate multiple values into a single value, of course. But "values" creates truly separate values, not a single value like an object. > Do values offer any advantage over using lists and > let-match? > Absolutely. They are especially useful when writing pure functional algorithms, such as when you have an "if" and each branch produces more than one value. You will encounter such situations when you avoid using "set!". It's quite elegant once you get the hang of it. The only inelegant part is syntactic: "let-values" has too long a name and too many parentheses. Multiple values are also convenient when implementing a function that "naturally" produces multiple values. In many other languages, you'd probably end up defining a new record type just to package up the return values of that particular function, or you'd return an ordered collection of the values and then have to destructure it. Incidentally, there is an arguable incongruity in the multiple-values support in Scheme, in that, if "foo" produces 2 values, and "bar" has two arguments, you can't just do "(bar (foo))". As a 4am amusement, I kludged up a new application syntax that does support this, though I strongly discourage using it. #lang scheme/base (define-syntax app (syntax-rules () ((_ PROC) (PROC)) ((_ PROC ARG ...) (%app:1 (ARG ...) () (PROC))))) (define-syntax %app:1 (syntax-rules () ((_ () (BIND ...) (PROC VAR ...)) (let (BIND ...) (apply PROC (append VAR ...)))) ((_ (ARG0 ARG1 ...) (BIND ...) (PROC VAR ...)) (%app:1 (ARG1 ...) (BIND ... (actual (call-with-values (lambda () ARG0) list))) (PROC VAR ... actual))))) (app vector 1 (values 2 3) 4 (list 5) (values 6 7)) ;;==> #(1 2 3 4 (5) 6 7) -- http://www.neilvandyke.org/ From jpc-ml at zenburn.net Mon Apr 6 04:24:15 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Mon Apr 6 04:24:36 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: Message-ID: <49D9BC2F.3080602@zenburn.net> On 4/6/09 9:23 AM, Martin DeMello wrote: > that there is no "values" object that you can pass around till you're > ready to unpack it. Do values offer any advantage over using lists and > let-match? AFAIK returning multiple values does not require allocation (no consing) and destructuring (the values go straight to the bindings). -- regards, Jakub Piotr C?apa From erich at snafu.de Mon Apr 6 06:12:00 2009 From: erich at snafu.de (Erich Rast) Date: Mon Apr 6 06:05:53 2009 Subject: [plt-scheme] Parameters in sqlite Message-ID: <1239012720.12095.13.camel@darkstar> Hi, Is anyone using the Planet sqlite package successfully in 4.1.5 with the scheme language? I don't have a machine with examples here, but (from memory) the following things don't seem to work: 1.) Using exec/ignore or any other function with optional parameters produces a contract violation, indicating that in contrast to the manual only (exec/ignore db "sql-statement as string") without parameters is allowed. Strange enough, I've looked at the source code and it looks alright to me---optional parameters are passed as rest like in (define (fun arg1 arg2 . rest). I can't any problem with that. Something with the contracts? 2.) Preparing a statement like "CREATE TABLE ? (id INTEGER PRIMARY KEY, name TEXT);" using prepare, and then loading the parameter like in (load-params stm "test") yields an SQL syntax error near "?". But AFAIK, the ? is perfectly valid for an unnamed parameter in SQLITE3. It's as if the unicode string is incorrectly converted to something invalid in SQLITE. I've filed a bug report on PLanet, but still wonder whether I'm not doing something obviously wrong or just misunderstood the docs. Or is this a sort of Plt Scheme version incompatibility? Best regards, Erich From matthias at ccs.neu.edu Mon Apr 6 07:49:42 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 6 07:50:55 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: <49D9BC2F.3080602@zenburn.net> References: <49D9BC2F.3080602@zenburn.net> Message-ID: On Apr 6, 2009, at 4:24 AM, Jakub Piotr C?apa wrote: > On 4/6/09 9:23 AM, Martin DeMello wrote: >> that there is no "values" object that you can pass around till you're >> ready to unpack it. Do values offer any advantage over using lists >> and >> let-match? > > AFAIK returning multiple values does not require allocation (no > consing) and destructuring (the values go straight to the bindings). See Dybvig's analysis and experiments concerning this 'conjecture.' Turns out that for an 'optimizing' compiler (such as Chez) the major difference concern error reporting. (Think (let* ((x f returns (cons 1 2))) (a (car x)) (d (cdr x))) ...) can be optimized reasonably w/o allocation.) -- Matthias From noelwelsh at gmail.com Mon Apr 6 09:24:00 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Apr 6 09:24:23 2009 Subject: [plt-scheme] Twitter's experience Ruby -> Scala (dynamic to static typing) Message-ID: Given the current push to develop Typed Scheme (and building on contracts) I thought the following might be interesting: http://www.artima.com/scalazine/articles/twitter_on_scala.html Key quote: "Bill Venners: I?m curious, and the Ruby folks will want it spelled out: Can you elaborate on what you felt the Ruby language lacked in the area of reliable, high performance code? Steve Jenson: ... Another thing we really like about Scala is static typing that?s not painful. Sometimes it would be really nice in Ruby to say things like, here?s an optional type annotation. This is the type we really expect to see here. And we find that really useful in Scala, to be able to specify the type information. ... Alex Payne: I?d definitely want to hammer home what Steve said about typing. As our system has grown, a lot of the logic in our Ruby system sort of replicates a type system, either in our unit tests or as validations on models. I think it may just be a property of large systems in dynamic languages, that eventually you end up rewriting your own type system, and you sort of do it badly. You?re checking for null values all over the place. There?s lots of calls to Ruby?s kind_of? method, which asks, ?Is this a kind of User object? Because that?s what we?re expecting. If we don?t get that, this is going to explode.? It is a shame to have to write all that when there is a solution that has existed in the world of programming languages for decades now." N. From pocmatos at gmail.com Mon Apr 6 09:53:06 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Apr 6 09:53:46 2009 Subject: [plt-scheme] Recognizing Listof in typed-scheme Message-ID: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> Hi all, I stumbled upon an issue that can be simplified into: #lang typed-scheme (require scheme/match) (define-struct: foo ()) (define-struct: bar ()) (define-struct: foo1 ()) (define-struct: bar1 ()) (define-struct: foolist ((lst : (Listof foo)))) (define-struct: foolist1 ((lst : (Listof foo1)))) (define-type-alias foobar (U foo bar)) (define-type-alias foobar1 (U foo1 bar1)) (: funct (foobar -> foobar1)) (define (funct f) (match f ((struct foo _) (make-foo1)) ((struct bar _) (make-bar1)))) (: prob (foolist -> foolist1)) (define (prob fl) (let ([lst (map (lambda: ((f : foo)) (funct f)) (foolist-lst fl))]) (make-foolist1 lst))) I get: typecheck: Wrong function argument type, expected (Listof foo1), got (Listof foobar1) for argument 1 in: lst I understand the problem... but I cannot find a workaround. I don't want to change funct and it doesn't make sense to create another function with just: (define (funct1 f) (make-foo1)) with typing (: funct1 (foo -> foo1)). I tried: (: every (All (a) ((a -> Boolean) (Listof a) -> Boolean))) (define (every p xs) (or (null? xs) (and (p (car xs)) (every p (cdr xs))))) (: prob (foolist -> foolist1)) (define (prob fl) (let ([lst (map (lambda: ((f : foo)) (funct f)) (foolist-lst fl))]) (if (every foo1? lst) (make-foolist1 lst) (error 'buh "")))) But I still get the error... Then I remembered that I should let typed-scheme know that every is a predicate for (Listof a), so I changed the typing to: (: every (All (a) ((a -> Boolean) (Listof a) -> Boolean : (Listof a)))) But now I get an error in match: match: no matching clause for Unknown Type: #(struct:Error 23 #f) Have no idea what to do now... :( Any suggestions? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From spdegabrielle at gmail.com Mon Apr 6 10:18:11 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Mon Apr 6 10:18:43 2009 Subject: [plt-scheme] DrScheme project/tabs tool projectmgr.plt Message-ID: <595b9ab20904060718r788c848aq39fbc589e3875a5a@mail.gmail.com> I've just posted an update to the PLaneT package for the DrScheme tool projectmgr.plt for working with tabs. Added * now uses a Project menu item * will save all tabs (requested) Deleted * buttons removed * items in file menu removed It's a simple beast - one file - but I'd appreciate *any* feedback; * on my code * on the interface (such that it is) * on functionality - existing or desired. Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From dvanhorn at ccs.neu.edu Mon Apr 6 10:20:13 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Apr 6 10:20:51 2009 Subject: [plt-scheme] Recognizing Listof in typed-scheme In-Reply-To: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> References: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> Message-ID: <49DA0F9D.5060708@ccs.neu.edu> Paulo J. Matos wrote: > (: funct (foobar -> foobar1)) > (define (funct f) > (match f > ((struct foo _) > (make-foo1)) > ((struct bar _) > (make-bar1)))) > > (: prob (foolist -> foolist1)) > (define (prob fl) > (let ([lst (map (lambda: ((f : foo)) (funct f)) > (foolist-lst fl))]) > (make-foolist1 lst))) > > I get: > typecheck: Wrong function argument type, expected (Listof foo1), got > (Listof foobar1) for argument 1 in: lst Is this sufficient? (: funct* (foobar1 -> foo1)) (define (funct* f) (cond [(foo? f) f] [else (error "should not happen")])) (: prob (foolist -> foolist1)) (define (prob fl) (let ([lst (map (lambda: ((f : foo)) (funct* (funct f))) (foolist-lst fl))]) (make-foolist1 lst))) Basically, you are capable of reasoning that funct always returns a foo1 when given a foo. But TS only know that funct goes from (U foo bar) -> (U foo1 bar1), which is not enough to conclude that. The funct* is a noop, but convinces TS that the result really is a foo1. A stronger type you could assign your funct is: (U (foo -> foo1) (bar -> bar1)) Which would give you the right info, but I don't think TS allows these sorts of things: (: f (U (Number -> Number) (String -> String))) (define (f x) (cond [(number? x) 1] [(string? x) "a"])) David From samth at ccs.neu.edu Mon Apr 6 10:20:50 2009 From: samth at ccs.neu.edu (Sam TH) Date: Mon Apr 6 10:21:12 2009 Subject: [plt-scheme] Recognizing Listof in typed-scheme In-Reply-To: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> References: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> Message-ID: <63bb19ae0904060720x7cd50a8fu6b135b6a41922ee9@mail.gmail.com> On Mon, Apr 6, 2009 at 9:53 AM, Paulo J. Matos wrote: > > Then I remembered that I should let typed-scheme know that every is a > predicate for (Listof a), so I changed the typing to: > (: every (All (a) ((a -> Boolean) (Listof a) -> Boolean : (Listof a)))) > > But now I get an error in match: > match: no matching clause for Unknown Type: #(struct:Error 23 #f) This is definitely a bug in Typed Scheme. I'll try to fix it soon. The rest of your problem is that there's no predicate for a list of some element type, and no way to write one at the moment. I have ideas on how to allow this, but they aren't done yet. Right now, the only way to get a list of type A from a list of type B is `filter': (filter A? listofb) : (Listof A) -- sam th samth@ccs.neu.edu From samth at ccs.neu.edu Mon Apr 6 10:27:25 2009 From: samth at ccs.neu.edu (Sam TH) Date: Mon Apr 6 10:27:50 2009 Subject: [plt-scheme] Recognizing Listof in typed-scheme In-Reply-To: <49DA0F9D.5060708@ccs.neu.edu> References: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> <49DA0F9D.5060708@ccs.neu.edu> Message-ID: <63bb19ae0904060727u1c88a85dt57dbd4224410f0c6@mail.gmail.com> On Mon, Apr 6, 2009 at 10:20 AM, David Van Horn wrote: > > Which would give you the right info, but I don't think TS allows these sorts > of things: > > (: f (U (Number -> Number) (String -> String))) > (define (f x) > ?(cond [(number? x) 1] > ? ? ? ?[(string? x) "a"])) This is a pretty common mistake ... (: f (case-lambda (Number -> Number) (String -> String)) is the type you want. The union type you wrote up there is useless, that function can never be applied (apart from the fact that TS won't let you give that function that type). It would require an argument that is both a Number and a String, because of contravariance. -- sam th samth@ccs.neu.edu From marek at xivilization.net Mon Apr 6 10:28:37 2009 From: marek at xivilization.net (Marek Kubica) Date: Mon Apr 6 10:28:59 2009 Subject: [plt-scheme] Twitter's experience Ruby -> Scala (dynamic to static typing) In-Reply-To: References: Message-ID: <20090406162837.789ec8b9@halmanfloyd.lan.local> On Mon, 6 Apr 2009 14:24:00 +0100 Noel Welsh wrote: > Steve Jenson: ... Another thing we really like about Scala is static > typing that?s not painful. Sometimes it would be really nice in Ruby > to say things like, here?s an optional type annotation. This is the > type we really expect to see here. And we find that really useful in > Scala, to be able to specify the type information. Optional run-time type checking is trivial to implement, actually. So there are two choices: either they want types to get more performance (and I doubt that optional type checking in Ruby would give better performance unless someone will do a lot of work to optimize the VMs for that) or they want type checking on compile-time but I imagine that it would be quite tricky to fuse a static type system with dynamic types since you can never know for sure what types one would get from non-annotated code. regards, Marek From dvanhorn at ccs.neu.edu Mon Apr 6 10:29:27 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Apr 6 10:29:52 2009 Subject: [plt-scheme] Recognizing Listof in typed-scheme In-Reply-To: <63bb19ae0904060727u1c88a85dt57dbd4224410f0c6@mail.gmail.com> References: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> <49DA0F9D.5060708@ccs.neu.edu> <63bb19ae0904060727u1c88a85dt57dbd4224410f0c6@mail.gmail.com> Message-ID: <49DA11C7.5030903@ccs.neu.edu> Sam TH wrote: > On Mon, Apr 6, 2009 at 10:20 AM, David Van Horn wrote: >> Which would give you the right info, but I don't think TS allows these sorts >> of things: >> >> (: f (U (Number -> Number) (String -> String))) >> (define (f x) >> (cond [(number? x) 1] >> [(string? x) "a"])) > > This is a pretty common mistake ... > > (: f (case-lambda (Number -> Number) (String -> String)) > > is the type you want. The union type you wrote up there is useless, > that function can never be applied (apart from the fact that TS won't > let you give that function that type). It would require an argument > that is both a Number and a String, because of contravariance. Ah, right! So this makes Paulo's program go through as written: (: funct (case-lambda (foo -> foo1) (bar -> bar1))) (define (funct f) ...) David From pocmatos at gmail.com Mon Apr 6 10:30:45 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Apr 6 10:31:26 2009 Subject: [plt-scheme] Recognizing Listof in typed-scheme In-Reply-To: <49DA11C7.5030903@ccs.neu.edu> References: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> <49DA0F9D.5060708@ccs.neu.edu> <63bb19ae0904060727u1c88a85dt57dbd4224410f0c6@mail.gmail.com> <49DA11C7.5030903@ccs.neu.edu> Message-ID: <11b141710904060730i43df5e45v213fbfcb8144c6a1@mail.gmail.com> On Mon, Apr 6, 2009 at 2:29 PM, David Van Horn wrote: > Sam TH wrote: >> >> On Mon, Apr 6, 2009 at 10:20 AM, David Van Horn >> wrote: >>> >>> Which would give you the right info, but I don't think TS allows these >>> sorts >>> of things: >>> >>> (: f (U (Number -> Number) (String -> String))) >>> (define (f x) >>> ?(cond [(number? x) 1] >>> ? ? ? [(string? x) "a"])) >> >> This is a pretty common mistake ... >> >> (: f (case-lambda (Number -> Number) (String -> String)) >> >> is the type you want. ?The union type you wrote up there is useless, >> that function can never be applied (apart from the fact that TS won't >> let you give that function that type). ?It would require an argument >> that is both a Number and a String, because of contravariance. > > Ah, right! ?So this makes Paulo's program go through as written: > > (: funct (case-lambda (foo -> foo1) (bar -> bar1))) > (define (funct f) ...) > Indeed, thanks very much for all the help everyone! :) > David > > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Mon Apr 6 10:31:30 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Mon Apr 6 10:32:06 2009 Subject: [plt-scheme] Recognizing Listof in typed-scheme In-Reply-To: <63bb19ae0904060720x7cd50a8fu6b135b6a41922ee9@mail.gmail.com> References: <11b141710904060653p1d323029w632fbc9128315498@mail.gmail.com> <63bb19ae0904060720x7cd50a8fu6b135b6a41922ee9@mail.gmail.com> Message-ID: <11b141710904060731k52126ba3saadb6ee6124c7b18@mail.gmail.com> On Mon, Apr 6, 2009 at 2:20 PM, Sam TH wrote: > On Mon, Apr 6, 2009 at 9:53 AM, Paulo J. Matos wrote: >> >> Then I remembered that I should let typed-scheme know that every is a >> predicate for (Listof a), so I changed the typing to: >> (: every (All (a) ((a -> Boolean) (Listof a) -> Boolean : (Listof a)))) >> >> But now I get an error in match: >> match: no matching clause for Unknown Type: #(struct:Error 23 #f) > > This is definitely a bug in Typed Scheme. ?I'll try to fix it soon. > Should I report it? If not, please let me know once it's fixed. Thanks :) -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From jay.mccarthy at gmail.com Mon Apr 6 11:02:54 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Apr 6 11:03:16 2009 Subject: [plt-scheme] Parameters in sqlite In-Reply-To: <1239012720.12095.13.camel@darkstar> References: <1239012720.12095.13.camel@darkstar> Message-ID: I've replied to your bug report. Short version: You are looking at the version 4 docs but using the version 3 package. Jay On Mon, Apr 6, 2009 at 4:12 AM, Erich Rast wrote: > Hi, > > Is anyone using the Planet sqlite package successfully in 4.1.5 with the > scheme language? I don't have a machine with examples here, but (from > memory) the following things don't seem to work: > > 1.) Using exec/ignore or any other function with optional parameters > produces a contract violation, indicating that in contrast to the manual > only (exec/ignore db "sql-statement as string") without parameters is > allowed. Strange enough, I've looked at the source code and it looks > alright to me---optional parameters are passed as rest like in (define > (fun arg1 arg2 . rest). I can't any problem with that. Something with > the contracts? > > 2.) Preparing a statement like "CREATE TABLE ? (id INTEGER PRIMARY KEY, > name TEXT);" using prepare, and then loading the parameter like in > (load-params stm "test") yields an SQL syntax error near "?". But AFAIK, > the ? is perfectly valid for an unnamed parameter in SQLITE3. It's as if > the unicode string is incorrectly converted to something invalid in > SQLITE. > > I've filed a bug report on PLanet, but still wonder whether I'm not > doing something obviously wrong or just misunderstood the docs. Or is > this a sort of Plt Scheme version incompatibility? > > Best regards, > > Erich > > _________________________________________________ > ?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 samth at ccs.neu.edu Mon Apr 6 11:32:08 2009 From: samth at ccs.neu.edu (Sam TH) Date: Mon Apr 6 11:32:31 2009 Subject: [plt-scheme] Twitter's experience Ruby -> Scala (dynamic to static typing) In-Reply-To: <20090406162837.789ec8b9@halmanfloyd.lan.local> References: <20090406162837.789ec8b9@halmanfloyd.lan.local> Message-ID: <63bb19ae0904060832g154ecec2q224e9d6a69949901@mail.gmail.com> On Mon, Apr 6, 2009 at 10:28 AM, Marek Kubica wrote: > it would be quite tricky to fuse a static type system with dynamic > types since you can never know for sure what types one would get from > non-annotated code. This is precisely what the Typed Scheme work is all about. In Typed Scheme, you have a precise gaurantee about what you can assume in the typed code, and what the obligations are in the untyped code. For details, you can see our recent papers in the Dynamic Languages Symposium 2006 and in POPL 2008, linked from here: http://www.ccs.neu.edu/~samth/ As for integration between Scala and Ruby, I'm not sure how that would work out. -- sam th samth@ccs.neu.edu From erich at snafu.de Mon Apr 6 12:01:48 2009 From: erich at snafu.de (Erich Rast) Date: Mon Apr 6 11:55:41 2009 Subject: [plt-scheme] Parameters in sqlite In-Reply-To: References: <1239012720.12095.13.camel@darkstar> Message-ID: <1239033708.6669.3.camel@darkstar> > Short version: You are looking at the version 4 docs but using the > version 3 package. That explains it....my mistake and I'm sorry for having bothered you with it! Thanks a lot! --Erich From dfried00 at gmail.com Sun Apr 5 04:34:49 2009 From: dfried00 at gmail.com (Dan Friedman) Date: Mon Apr 6 12:54:15 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> <49D7FFBB.9050902@mazama.net> <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> Message-ID: <97b474890904050134o2f7cc72p9df73fcf1f1745c1@mail.gmail.com> Looks good to me. We write a macro for (run #f (q) ...), which we call (run* (q) ...) You might want to add it. ... Dan On Sun, Apr 5, 2009 at 3:23 AM, Jon Loldrup wrote: > Well it sure does evaluate successfully now, and testing the first 4 > expressions on page 4 in "The Reasoned Schemer" makes them all return the > same value as the ones in that book. Only thing is, the book doesn't mention > the definitions of fail and succeed (only that they are longs for #u and > #s), so I'm not sure whether this solution is some crude hack or the > official way to do it. > > Now this code: > > #lang scheme > (require (planet dfriedman/miniKanren:1:1/minikanren)) > (define succeed (== #t #t)) > (define fail (== #t #f)) > (run #f (q) fail) > (run #f (q) (== #t q)) > (run #f (q) fail (== #t q)) > (run #f (q) succeed (== #t q)) > > returns this: > > () > (#t) > () > (#t) > > > Jon Loldrup > > > 2009/4/5 Ben Goetter > > Jon Loldrup wrote: >> >>> >>> [...] the third line was taken from the file mktests.scm < >>> http://kanren.cvs.sourceforge.net/viewvc/kanren/kanren/mini/mktests.scm?revision=1.6&view=markup> >>> which I think is designed to test a minikanren implementation. >>> >> That file tests the particular version of minikanren currently on >> Sourceforge, which is not the same as the version on PLaneT. You cannot >> necessarily mix and match the two. Still, (run #f (q) fail) seems like a >> reasonable command to issue... isn't that out of the book? >> >> Inspecting minikanren.ss reveals that, indeed, it doesn't export any >> "fail." The mk.scm on Sourceforge includes the following two definitions >> >> (define succeed (lambdag@ (s) (unit s))) >> (define fail (lambdag@ (s) (mzero))) >> >> which you can't issue yourself, because the version on PLaneT exports >> neither lambdag@ nor mzero. Try instead >> >> #lang scheme >> (require (planet dfriedman/miniKanren:1:1/minikanren)) >> (define succeed (== #t #t)) >> (define fail (== #t #f)) >> (run #f (q) fail) >> >> That seems to fail correctly. I don't have my copy of TRS at hand, so I >> can't opine further. >> >> Hope that helps, >> Ben >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/73d5c9c3/attachment.html From dfried00 at gmail.com Sun Apr 5 17:03:38 2009 From: dfried00 at gmail.com (Dan Friedman) Date: Mon Apr 6 12:54:25 2009 Subject: [plt-scheme] question from a newbie regarding the import of a library In-Reply-To: <90eacde30904051321q7a8496c9jc553de1ff976f96f@mail.gmail.com> References: <90eacde30904040911r69e3ec4qc7aba3289cddbbe4@mail.gmail.com> <49D7B105.5030402@ccs.neu.edu> <90eacde30904041655r18aa7bf1ge0dcc8f5afd2e953@mail.gmail.com> <49D7FFBB.9050902@mazama.net> <90eacde30904050023u6f00e8fcj5e1bfbdeec924226@mail.gmail.com> <49D8D1DC.4030501@ccs.neu.edu> <90eacde30904050934n323391a2mf9a5caf68078ddb4@mail.gmail.com> <49D8F8C2.4050200@ccs.neu.edu> <90eacde30904051321q7a8496c9jc553de1ff976f96f@mail.gmail.com> Message-ID: <97b474890904051403v468ae1bdqae71e0d4b8da1bb0@mail.gmail.com> The #u and #s were to be reminiscent of #f and #t. The idea was to have you think about #f and #t without being concerned about how they might be spelled. The book is about a mythical language, but that just means that you have to know how to spell some of the words. As you will discover, we use lots of super scripts. One reason was as a reminder. So, cond^e, which is spelled conde was to remind the reader about the syntax of Lisp's/Scheme's cond. It was to cause the reader to say, "Oh, I at least remember the syntax of cond." run's use of a superscript is different (run^4 (q) ...) is spelled (run 4 (q) ...), so here the 4 is separated by a space from the "n" in run, whereas, for conde, there is no such separation. Most have very little difficulty adjusting to the two kinds of superscipts (the touching and the ones separated by a space). In the index, we have shown the correct spellings of every name, except for some of those that end with superscript o (the touching variety, since only run has separation). Thanks to all for participating in the discussion, .... Dan On Sun, Apr 5, 2009 at 4:21 PM, Jon Loldrup wrote: > > To say that the book does not mention the definition of fail and succeed is >> clearly incorrect. > > > Yep, I know they are in the beginning of the book, I was thinking of the > code on page 160 and 161. They aren't there, but #s and #u are. > > Maybe this question is a bit philosophical and maybe I should just read the > book and then ask more questions (if still needed) : Is "the meaning" a part > of the programming language, or is it our human interpretation of specific > structures of the language? > > I think I will get a better holistic understanding of it all by simply > reading the book. So thats what I will do. Thanks to all of you for your > help in getting my DrScheme to work with Minikanren! > > Jon Loldrup > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090405/490bb5aa/attachment.htm From acowley at seas.upenn.edu Mon Apr 6 13:37:05 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Mon Apr 6 13:37:28 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: <49D9BC2F.3080602@zenburn.net> Message-ID: <81addec70904061037y5d6fd120g6e1a4e1dc99003e@mail.gmail.com> On Mon, Apr 6, 2009 at 7:49 AM, Matthias Felleisen wrote: > > On Apr 6, 2009, at 4:24 AM, Jakub Piotr C?apa wrote: > >> On 4/6/09 9:23 AM, Martin DeMello wrote: >>> >>> that there is no "values" object that you can pass around till you're >>> ready to unpack it. Do values offer any advantage over using lists and >>> let-match? >> >> AFAIK returning multiple values does not require allocation (no consing) >> and destructuring (the values go straight to the bindings). > > See Dybvig's analysis and experiments concerning this 'conjecture.' Turns > out that for an 'optimizing' compiler (such as Chez) the major difference > concern error reporting. (Think (let* ((x f returns (cons 1 2))) (a (car x)) > (d (cdr x))) ...) can be optimized reasonably w/o allocation.) > > -- Matthias There was an interesting discussion of this on comp.lang.scheme a while ago which yielded this set of benchmarks: Anthony From grettke at acm.org Mon Apr 6 14:06:49 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Apr 6 14:07:07 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: Message-ID: <756daca50904061106w529d04bfu4f9054a852c346ea@mail.gmail.com> On Mon, Apr 6, 2009 at 2:23 AM, Martin DeMello wrote: > Do values offer any advantage over using lists and let-match? This thread delves into this topic: http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/ba8873b2f955af67/44c99c8e11279ffd Seemingly it communicates more to the reader of the code. From matthias at ccs.neu.edu Mon Apr 6 14:41:42 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 6 14:42:58 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: <81addec70904061037y5d6fd120g6e1a4e1dc99003e@mail.gmail.com> References: <49D9BC2F.3080602@zenburn.net> <81addec70904061037y5d6fd120g6e1a4e1dc99003e@mail.gmail.com> Message-ID: On Apr 6, 2009, at 1:37 PM, Anthony Cowley wrote: > On Mon, Apr 6, 2009 at 7:49 AM, Matthias Felleisen > wrote: >> >> On Apr 6, 2009, at 4:24 AM, Jakub Piotr C?apa wrote: >> >>> On 4/6/09 9:23 AM, Martin DeMello wrote: >>>> >>>> that there is no "values" object that you can pass around till >>>> you're >>>> ready to unpack it. Do values offer any advantage over using >>>> lists and >>>> let-match? >>> >>> AFAIK returning multiple values does not require allocation (no >>> consing) >>> and destructuring (the values go straight to the bindings). >> >> See Dybvig's analysis and experiments concerning this >> 'conjecture.' Turns >> out that for an 'optimizing' compiler (such as Chez) the major >> difference >> concern error reporting. (Think (let* ((x f returns (cons 1 2))) >> (a (car x)) >> (d (cdr x))) ...) can be optimized reasonably w/o allocation.) >> >> -- Matthias > > There was an interesting discussion of this on comp.lang.scheme a > while ago which yielded this set of benchmarks: > Thanks I wonder what it means when computer scientists have to re- benchmark such a result every so many years. Kent published his paper nearly 10 years ago. -- Matthias From acowley at seas.upenn.edu Mon Apr 6 15:12:44 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Mon Apr 6 15:13:02 2009 Subject: [plt-scheme] passing multiple "values" between functions In-Reply-To: References: <49D9BC2F.3080602@zenburn.net> <81addec70904061037y5d6fd120g6e1a4e1dc99003e@mail.gmail.com> Message-ID: <81addec70904061212k107c89f8ofca9aba1d58ae1dd@mail.gmail.com> > > Thanks I wonder what it means when computer scientists have to re-benchmark > such a result every so many years. Kent published his paper nearly 10 years > ago. -- Matthias > It's a ramification of people offering an abstraction and claiming that it is amenable to static analysis and optimization before having actually implemented that optimization. Re-benchmarking is our way of reinforcing our skepticism of such pleas :) Anthony From noelwelsh at gmail.com Mon Apr 6 15:16:40 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Apr 6 15:17:00 2009 Subject: [plt-scheme] Confusing web-server interaction In-Reply-To: References: Message-ID: Last time I looked at the code, the Moby Scheme -> Android compiler had an XML-RPC implementation based, I believe, on ours. Perhaps Danny Yoo and you can work on merging the two efforts? N. On Sun, Apr 5, 2009 at 1:55 PM, Matt Jadud wrote: > Hi all, > > (This is probably a question for Jay, though...) > > I don't update the XML-RPC library as often as I should. Perhaps if I > was more diligent, it would be easier to keep up on how the internals > have changed. ... From jadudm at gmail.com Mon Apr 6 15:55:51 2009 From: jadudm at gmail.com (Matt Jadud) Date: Mon Apr 6 15:56:14 2009 Subject: [plt-scheme] Confusing web-server interaction In-Reply-To: References: Message-ID: On Mon, Apr 6, 2009 at 3:16 PM, Noel Welsh wrote: > Last time I looked at the code, the Moby Scheme -> Android compiler > had an XML-RPC implementation based, I believe, on ours. ?Perhaps > Danny Yoo and you can work on merging the two efforts? I think they're using the client-side, which is fine---the client-side doesn't rely on the PLT web-server at all. The server-side needs work to bring it in line with the current web-server changes. (The reason I was poking at it recently was I had hoped to use it with students on PLT 4.1.3. The bug discovery in the server means I won't be using it this semester. Most of my own usage of the XML-RPC library in the past few years has been locked against PLT 372, since too many libraries I depended on hadn't made the 4.x transition, and I needed the server for robust data collection. It simply wasn't an option for quite some time.) As a side-effect of bringing the library up-to-speed, I'll try and add some tests that 1. Launch a PLT server process 2. Run tests against it 3. Take it back down. I don't track HEAD, and don't intend to start just to support the library. But, some tests that automate the full cycle should at least make it easier to download the library and find out if it works against the current web-server API. Cheers, M From jay.mccarthy at gmail.com Mon Apr 6 17:56:37 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Apr 6 17:57:01 2009 Subject: [plt-scheme] Twitter in PLT demo Message-ID: 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 From rafkind at cs.utah.edu Mon Apr 6 18:16:47 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Mon Apr 6 18:17:09 2009 Subject: [plt-scheme] Twitter in PLT demo In-Reply-To: References: Message-ID: <49DA7F4F.3010607@cs.utah.edu> 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 > > It was main.ss but this is what I got anyway. $ mzscheme -t main.ss test.ss:3:9: schemeunit: standard-module-name-resolver: collection not found: "schemeunit" in any of: (# #) in: schemeunit setup-plt: error: during making for /jaymccarthy/ring-buffer.plt/1/0 (Ring Buffer) setup-plt: test.ss:3:9: schemeunit: standard-module-name-resolver: collection not found: "schemeunit" in any of: (# #) in: schemeunit main.ss:14:3: compile: unbound identifier in module in: hash-ref! Is my mzscheme now new enough? $ mzscheme -v Welcome to MzScheme v4.1.4.3 [3m], Copyright (c) 2004-2009 PLT Scheme Inc. From jay.mccarthy at gmail.com Mon Apr 6 18:18:56 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Mon Apr 6 18:19:19 2009 Subject: [plt-scheme] Twitter in PLT demo In-Reply-To: <49DA7F4F.3010607@cs.utah.edu> References: <49DA7F4F.3010607@cs.utah.edu> Message-ID: On Mon, Apr 6, 2009 at 4:16 PM, Jon Rafkind wrote: > $ mzscheme -t main.ss > test.ss:3:9: schemeunit: standard-module-name-resolver: collection not > found: "schemeunit" in any of: > (# > #) in: schemeunit Not sure when Noel added this, but earlier than ... > setup-plt: error: during making for /jaymccarthy/ring-buffer.plt/1/0 > (Ring Buffer) > setup-plt: ? test.ss:3:9: schemeunit: standard-module-name-resolver: > collection not found: "schemeunit" in any of: > (# > #) in: schemeunit > main.ss:14:3: compile: unbound identifier in module in: hash-ref! Eli added this Sun, Apr 5, 2009 at 8:07 PM Jay -- 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 Mon Apr 6 18:48:41 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Apr 6 18:49:00 2009 Subject: [plt-scheme] DrScheme project/tabs tool projectmgr.plt In-Reply-To: <595b9ab20904060718r788c848aq39fbc589e3875a5a@mail.gmail.com> References: <595b9ab20904060718r788c848aq39fbc589e3875a5a@mail.gmail.com> Message-ID: <756daca50904061548r68788176p12d4ec4efbf68ce7@mail.gmail.com> On Mon, Apr 6, 2009 at 9:18 AM, Stephen De Gabrielle wrote: > It's a simple beast - one file - but I'd appreciate *any* feedback; > * on functionality - existing or desired. It is great! Thanks. From anesward at mac.com Tue Apr 7 00:10:15 2009 From: anesward at mac.com (mike) Date: Tue Apr 7 00:10:44 2009 Subject: [plt-scheme] Re: HtDP 12.4.2 question details In-Reply-To: <756daca50904042203j1e89ff85h26120ef6907c4a5b@mail.gmail.com> References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> <186df66b0904041144u7c4b1313v377c0d43d464312a@mail.gmail.com> <756daca50904042203j1e89ff85h26120ef6907c4a5b@mail.gmail.com> Message-ID: For the professors out there; I cruised through sec12 until i got to problem 12.4.2(spent hours and i just don't get it!!).I just want to move on but my question is : Is 12.4.2 a pivotal problem in gauging one's understanding of the design recipe??? Does failure to solve the problem indicate a serious flaw in understanding that will impede under- standing of subsequent sections of the book? mike On Apr 4, 10:03?pm, Grant Rettke wrote: > Thanks guys. I won't be abusing the function contract by keeping that > integer in there. I am back to work. > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Tue Apr 7 07:38:41 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Apr 7 07:39:58 2009 Subject: [plt-scheme] Re: HtDP 12.4.2 question details In-Reply-To: References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> <186df66b0904041144u7c4b1313v377c0d43d464312a@mail.gmail.com> <756daca50904042203j1e89ff85h26120ef6907c4a5b@mail.gmail.com> Message-ID: 12.4 is not pivotal. You can move one and return whenever you feel like tackling it again. However, 12.4 is a good test of whether (1) you have understood and absorbed the design recipe (2) you have understood and absorbed the idea of "making a wish" when you're stuck (3) you have the persistence to apply the design recipe over a series of four five six auxiliary functions. It is particularly heavy on (3). (Once you understand that (1) and (2) give you (3), you will also see that the exercise takes 10-20 minutes at most.) -- Matthias On Apr 7, 2009, at 12:10 AM, mike wrote: > For the professors out there; I cruised through sec12 until i got > to problem 12.4.2(spent hours and i just don't get it!!).I just want > to move on but my question is : Is 12.4.2 a pivotal problem in gauging > one's understanding of the design recipe??? Does failure to solve the > problem indicate a serious flaw in understanding that will impede > under- > standing of subsequent sections of the book? > mike > > > On Apr 4, 10:03 pm, Grant Rettke wrote: >> Thanks guys. I won't be abusing the function contract by keeping that >> integer in there. I am back to work. >> _________________________________________________ >> 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 pocmatos at gmail.com Tue Apr 7 08:03:14 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 08:03:59 2009 Subject: [plt-scheme] Typed-Scheme with Default and Keyword Arguments Message-ID: <11b141710904070503s1d714f1dnf46b8671ba351f7d@mail.gmail.com> Hi all, Is it possible to have typed-scheme work with default and keyword args? I may be missing it but can't find anything in the docs. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Tue Apr 7 08:18:52 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 7 08:19:10 2009 Subject: [plt-scheme] Typed-Scheme with Default and Keyword Arguments In-Reply-To: <11b141710904070503s1d714f1dnf46b8671ba351f7d@mail.gmail.com> References: <11b141710904070503s1d714f1dnf46b8671ba351f7d@mail.gmail.com> Message-ID: <63bb19ae0904070518x1a0153fet2ebe881eb52a2f1@mail.gmail.com> On Tue, Apr 7, 2009 at 8:03 AM, Paulo J. Matos wrote: > Hi all, > > Is it possible to have typed-scheme work with default and keyword > args? I may be missing it but can't find anything in the docs. No, that's not available at the moment. -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Tue Apr 7 08:23:12 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 08:23:49 2009 Subject: [plt-scheme] Typed-Scheme with Default and Keyword Arguments In-Reply-To: <63bb19ae0904070518x1a0153fet2ebe881eb52a2f1@mail.gmail.com> References: <11b141710904070503s1d714f1dnf46b8671ba351f7d@mail.gmail.com> <63bb19ae0904070518x1a0153fet2ebe881eb52a2f1@mail.gmail.com> Message-ID: <11b141710904070523l11b09babk8089edf67dd110ba@mail.gmail.com> On Tue, Apr 7, 2009 at 12:18 PM, Sam TH wrote: > On Tue, Apr 7, 2009 at 8:03 AM, Paulo J. Matos wrote: >> Hi all, >> >> Is it possible to have typed-scheme work with default and keyword >> args? I may be missing it but can't find anything in the docs. > > No, that's not available at the moment. > OK, thank you. > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From keiko at kurims.kyoto-u.ac.jp Tue Apr 7 08:21:53 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Tue Apr 7 08:46:51 2009 Subject: [plt-scheme] units implementation Message-ID: <20090407.212153.68545280.keiko@kurims.kyoto-u.ac.jp> Hello, Are units implemented using macros? I am attempting to experimentally implement a language, which is quite close to the unit system, using macros; so I would like to learn a little about how units are implemented. Best regards, Keiko From noelwelsh at gmail.com Tue Apr 7 08:54:13 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Apr 7 08:54:35 2009 Subject: [plt-scheme] units implementation In-Reply-To: <20090407.212153.68545280.keiko@kurims.kyoto-u.ac.jp> References: <20090407.212153.68545280.keiko@kurims.kyoto-u.ac.jp> Message-ID: On Tue, Apr 7, 2009 at 1:21 PM, Keiko Nakata wrote: > Hello, > > Are units implemented using macros? Yes, I believe units are built on macros and structure. The code starts here: http://svn.plt-scheme.org/plt/trunk/collects/scheme/unit.ss N. From samth at ccs.neu.edu Tue Apr 7 08:58:48 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 7 08:59:10 2009 Subject: [plt-scheme] units implementation In-Reply-To: References: <20090407.212153.68545280.keiko@kurims.kyoto-u.ac.jp> Message-ID: <63bb19ae0904070558q6446877y4cd7ba56843f4374@mail.gmail.com> On Tue, Apr 7, 2009 at 8:54 AM, Noel Welsh wrote: > On Tue, Apr 7, 2009 at 1:21 PM, Keiko Nakata wrote: >> Hello, >> >> Are units implemented using macros? > > Yes, I believe units are built on macros and structure. The code starts here: > > http://svn.plt-scheme.org/plt/trunk/collects/scheme/unit.ss There's a paper which discusses the implementation by Culpepper, Owens and Flatt: http://www.ccs.neu.edu/scheme/pubs/#gpce05-cof -- sam th samth@ccs.neu.edu From anesward at mac.com Tue Apr 7 09:33:44 2009 From: anesward at mac.com (mike) Date: Tue Apr 7 09:34:05 2009 Subject: [plt-scheme] Re: HtDP 12.4.2 question details In-Reply-To: References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> <186df66b0904041144u7c4b1313v377c0d43d464312a@mail.gmail.com> <756daca50904042203j1e89ff85h26120ef6907c4a5b@mail.gmail.com> Message-ID: thank you, mike On Apr 7, 4:38?am, Matthias Felleisen wrote: > 12.4 is not pivotal. You can move one and return whenever you feel ? > like tackling it again. > > However, 12.4 is a good test of whether > > ? (1) you have understood and absorbed the design recipe > ? (2) you have understood and absorbed the idea of "making a wish" ? > when you're stuck > ? (3) you have the persistence to apply the design recipe over a ? > series of four five six auxiliary functions. > > It is particularly heavy on (3). (Once you understand that (1) and ? > (2) give you (3), you will also see that the exercise takes 10-20 ? > minutes at most.) > > -- Matthias > > On Apr 7, 2009, at 12:10 AM, mike wrote: > > > > > For the professors out there; I cruised through sec12 until i got > > to problem 12.4.2(spent hours and i just don't get it!!).I just want > > to move on but my question is : Is 12.4.2 a pivotal problem in gauging > > one's understanding of the design recipe??? Does failure to solve the > > problem indicate a serious flaw in understanding that will impede > > under- > > standing of subsequent sections of the book? > > mike > > > On Apr 4, 10:03 pm, Grant Rettke wrote: > >> Thanks guys. I won't be abusing the function contract by keeping that > >> integer in there. I am back to work. > >> _________________________________________________ > >> ? 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 icfp.publicity at googlemail.com Tue Apr 7 10:50:06 2009 From: icfp.publicity at googlemail.com (Matthew Fluet (ICFP Publicity Chair)) Date: Tue Apr 7 10:50:31 2009 Subject: [plt-scheme] CFP: JFP Special Issue on Generic Programming Message-ID: <53ff55480904070750w478fba7dxb4edc32b3d36a09c@mail.gmail.com> OPEN CALL FOR PAPERS JFP Special Issue on Generic Programming Deadline: 1 October 2009 http://www.comlab.ox.ac.uk/ralf.hinze/JFP/cfp.html Scope ----- Generic programming is about making programs more adaptable by making them more general. Generic programs often embody non-traditional kinds of polymorphism; ordinary programs are obtained from them by suitably instantiating their parameters. In contrast to normal programs, the parameters of a generic program are often quite rich in structure; for example they may be other programs, types or type constructors, classes, concepts, or even programming paradigms. This special issue aims at documenting state-of-the-art research, new developments and directions for future investigation in the broad field of Generic Programming. It is an outgrowth of the series of Workshops on Generic Programming, which started in 1998 and which continues this year with an ICFP affiliated workshop in Edinburgh. Participants of the workshops are invited to submit a suitably revised and expanded version of their paper to the special issue. The call for papers is, however, open. Other contributions are equally welcome and are, indeed, encouraged. All submitted papers will be subjected to the same quality criteria, meeting the standards of the Journal of Functional Programming. The special issue seeks original contributions on all aspects of generic programming including but not limited to o adaptive object-oriented programming, o aspect-oriented programming, o case studies, o concepts (as in the STL/C++ sense), o component-based programming, o datatype-generic programming, o generic programming with dependent types, o meta-programming, o polytypic programming, and o programming with modules. Submission details ------------------ Manuscripts should be unpublished works and not submitted elsewhere. Revised versions of papers published in conference or workshop proceedings that have not appeared in archival journals are eligible for submission. Deadline for submission: 1 October 2009 Notification of acceptance or rejection: 15 January 2010 Revised version due: 15 March 2010 For submission details, please consult http://www.comlab.ox.ac.uk/ralf.hinze/JFP/cfp.html or see the Journal's web page http://journals.cambridge.org/jfp Guest Editor ------------ Ralf Hinze University of Oxford Computing Laboratory Wolfson Building, Parks Road, Oxford OX1 3QD, UK. Telephone: +44 (1865) 610700 Fax: +44 (1865) 283531 Email: ralf.hinze@comlab.ox.ac.uk WWW: http://www.comlab.ox.ac.uk/ralf.hinze/ ------------------------------------------------------------------------------- From farr at MIT.EDU Tue Apr 7 11:23:23 2009 From: farr at MIT.EDU (Will M Farr) Date: Tue Apr 7 11:23:51 2009 Subject: [plt-scheme] Dependent Contracts for Structures? Message-ID: Hello all, Is it possible to create "dependent" contracts (in the spirit of '->d) for structs in a provide/contract form? I'm thinking something like (struct matrix ((rows natural-number/c) (cols natural-number/c) (elts (vector-of-length/c (* rows cols))))) When I try this now, I get that 'rows and 'cols are not bound in the (vector-of-length/c ...) contract. I don't see anything about this in the documentation for the (struct ...) form in (provide/contract ...). It's not really strictly necessary, but it would be nice to have.... Thanks! Will -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 203 bytes Desc: This is a digitally signed message part Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090407/46ec5b4e/PGP-0001.pgp From matthias at ccs.neu.edu Tue Apr 7 12:21:23 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Apr 7 12:22:37 2009 Subject: [plt-scheme] Dependent Contracts for Structures? In-Reply-To: References: Message-ID: You might want to try "lazy data-structure contracts". See section in the contract chapter -- Matthias On Apr 7, 2009, at 11:23 AM, Will M Farr wrote: > Hello all, > > Is it possible to create "dependent" contracts (in the spirit of '- > >d) for structs in a provide/contract form? I'm thinking something > like > > (struct matrix > ((rows natural-number/c) > (cols natural-number/c) > (elts (vector-of-length/c (* rows cols))))) > > When I try this now, I get that 'rows and 'cols are not bound in > the (vector-of-length/c ...) contract. I don't see anything about > this in the documentation for the (struct ...) form in (provide/ > contract ...). > > It's not really strictly necessary, but it would be nice to have.... > > Thanks! > Will > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Tue Apr 7 13:47:59 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 13:48:35 2009 Subject: [plt-scheme] Typed-Scheme and call-with-input-file Message-ID: <11b141710904071047v19a4606dp46cecd49a36bffc1@mail.gmail.com> Hi all, I am trying call-with-input-file and I am getting a very unclear error: #lang typed-scheme (: read-char/file (String -> (U Char EOF))) (define (read-char/file filename) (call-with-input-file filename (lambda: ((ip : Input-Port)) (read ip)) #:mode 'text)) typecheck: Cannot apply expression of type #(struct:tc-result (All (a) (case-lambda (String ((U Output-Port Input-Port) -> a) -> a) (String ((U Output-Port Input-Port) -> a) Symbol -> a))) ((var #t read-char/file)) ((var #f read-char/file))), since it is not a function type in: (call-with-input-file filename (lambda: ((ip : Input-Port)) (read ip)) #:mode (quote text)) What's the issue here? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Tue Apr 7 13:51:10 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 13:51:46 2009 Subject: [plt-scheme] Typechecking command-line In-Reply-To: <63bb19ae0904031605r4e6ba214h5f2313cf3bbec3a2@mail.gmail.com> References: <11b141710903171744l79e5d1aoa42035e6b7fb268a@mail.gmail.com> <63bb19ae0904031605r4e6ba214h5f2313cf3bbec3a2@mail.gmail.com> Message-ID: <11b141710904071051r34566626q7580e8b4459507c1@mail.gmail.com> On Fri, Apr 3, 2009 at 11:05 PM, Sam TH wrote: > On Tue, Mar 17, 2009 at 8:44 PM, Paulo J. Matos wrote: >> Hi, >> >> Trying to typecheck a file containing a call to command line fails. >> Here's a short version exemplifying the issue: > > This works now, provided that you annotate the binding instance of > `filename' with an appropriate type: > > #:args #{filename : String} > -- > sam th > samth@ccs.neu.edu > Hi Sam, >From SVN 14441 using this doesn't work: #lang typed-scheme (require scheme/cmdline) ;; Command Line Arguments Parsing (: verbose-mode (Parameter Boolean)) (define verbose-mode (make-parameter #t)) (: optimize-level (Parameter Integer)) (define optimize-level (make-parameter 0)) (: model-checking-mode (Parameter Symbol)) (define model-checking-mode (make-parameter 'sat)) (: file-to-model-check String) (define file-to-model-check (command-line #:program "eboc" ;; Should be name of executable #:once-each [("-v" "--verbose") "Compile with verbose messages" (verbose-mode #t)] [("-m" "--mode") #{mode : String} "Mode to run the model checker on (sat, satbin)" (model-checking-mode (string->symbol mode))] #:once-any [("-o" "--optimize-1") "Compile with optimization level 1" (optimize-level 1)] ["--optimize-2" (; show help on separate lines "Compile with optimization level 2," "which includes all of level 1") (optimize-level 2)] #:args #{filename : String} ; expect one command-line argument: ; return the argument as a filename to compile filename)) I get: typecheck: Polymorphic function parse-command-line could not be applied to arguments: Domain: (U String Path) (U (Vectorof String) (Listof String)) (Listof (Pair (U 'once-each 'once-any 'multi 'final 'help-labels) (Listof (Listof Any)))) (Any a ... a -> b) (Listof String) Arguments: String (Vectorof String) (List (List 'once-each (List (List String String) (Any -> Void) (Listof (List String))) (List (List String String) (Any String -> Void) (Listof (U String (List String))))) (List 'once-any (List (List String String) (Any -> Void) (Listof (List String))) (List (List String) (Any -> Void) (Listof (List String String))))) (Any String* -> (Listof String)) (List String) Result type: b Expected result: String in: (define file-to-model-check (command-line #:program "eboc" #:once-each (("-v" "--verbose") "Compile with verbose messages" (verbose-mode #t)) (("-m" "--mode") mode "Mode to run the model checker on (sat, satbin)" (model-checking-mode (string->symbol mode))) #:once-any (("-o" "--optimize-1") "Compile with optimization level 1" (optimize-level 1)) ("--optimize-2" ("Compile with optimization level 2," "which includes all of level 1") (optimize-level 2)) #:args filename filename)) Am I missing something? -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Tue Apr 7 14:03:57 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 7 14:04:21 2009 Subject: [plt-scheme] Typechecking command-line In-Reply-To: <11b141710904071051r34566626q7580e8b4459507c1@mail.gmail.com> References: <11b141710903171744l79e5d1aoa42035e6b7fb268a@mail.gmail.com> <63bb19ae0904031605r4e6ba214h5f2313cf3bbec3a2@mail.gmail.com> <11b141710904071051r34566626q7580e8b4459507c1@mail.gmail.com> Message-ID: <63bb19ae0904071103t715c8d75m9dff9e6afa499366@mail.gmail.com> You are missing the parentheses around `filename'. It should be #:args (#{filename : String}) I'm not yet sure how to give a better error message here. sam th On Tue, Apr 7, 2009 at 1:51 PM, Paulo J. Matos wrote: > On Fri, Apr 3, 2009 at 11:05 PM, Sam TH wrote: >> On Tue, Mar 17, 2009 at 8:44 PM, Paulo J. Matos wrote: >>> Hi, >>> >>> Trying to typecheck a file containing a call to command line fails. >>> Here's a short version exemplifying the issue: >> >> This works now, provided that you annotate the binding instance of >> `filename' with an appropriate type: >> >> #:args #{filename : String} >> -- >> sam th >> samth@ccs.neu.edu >> > > Hi Sam, > > From SVN 14441 using this doesn't work: > #lang typed-scheme > > (require scheme/cmdline) > > ;; Command Line Arguments Parsing > (: verbose-mode (Parameter Boolean)) > (define verbose-mode (make-parameter #t)) > > (: optimize-level (Parameter Integer)) > (define optimize-level (make-parameter 0)) > > (: model-checking-mode (Parameter Symbol)) > (define model-checking-mode (make-parameter 'sat)) > > (: file-to-model-check String) > (define file-to-model-check > ?(command-line > ? #:program "eboc" ;; Should be name of executable > ? #:once-each > ? [("-v" "--verbose") "Compile with verbose messages" > ? ? ? ? ? ? ? ? ? ? ? (verbose-mode #t)] > ? [("-m" "--mode") #{mode : String} ?"Mode to run the model checker > on (sat, satbin)" > ? ? ? ? ? ? ? ? ? ?(model-checking-mode (string->symbol mode))] > ? #:once-any > ? [("-o" "--optimize-1") "Compile with optimization level 1" > ? ? ? ? ? ? ? ? ? ? ? ? ?(optimize-level 1)] > ? ["--optimize-2" ? ? ? ?(; show help on separate lines > ? ? ? ? ? ? ? ? ? ? ? ? ? "Compile with optimization level 2," > ? ? ? ? ? ? ? ? ? ? ? ? ? "which includes all of level 1") > ? ? ? ? ? ? ? ? ? ? ? ? ?(optimize-level 2)] > ? #:args #{filename : String} ; expect one command-line argument: > ? ; return the argument as a filename to compile > ? filename)) > > I get: > typecheck: Polymorphic function parse-command-line could not be > applied to arguments: > Domain: (U String Path) (U (Vectorof String) (Listof String)) (Listof > (Pair (U 'once-each 'once-any 'multi 'final 'help-labels) (Listof > (Listof Any)))) (Any a ... a -> b) (Listof String) > Arguments: String (Vectorof String) (List (List 'once-each (List (List > String String) (Any -> Void) (Listof (List String))) (List (List > String String) (Any String -> Void) (Listof (U String (List > String))))) (List 'once-any (List (List String String) (Any -> Void) > (Listof (List String))) (List (List String) (Any -> Void) (Listof > (List String String))))) (Any String* -> (Listof String)) (List > String) > Result type: b > Expected result: String > ?in: (define file-to-model-check (command-line #:program "eboc" > #:once-each (("-v" "--verbose") "Compile with verbose messages" > (verbose-mode #t)) (("-m" "--mode") mode "Mode to run the model > checker on (sat, satbin)" (model-checking-mode (string->symbol mode))) > #:once-any (("-o" "--optimize-1") "Compile with optimization level 1" > (optimize-level 1)) ("--optimize-2" ("Compile with optimization level > 2," "which includes all of level 1") (optimize-level 2)) #:args > filename filename)) > > Am I missing something? > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Tue Apr 7 14:12:04 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 14:12:43 2009 Subject: [plt-scheme] Typechecking command-line In-Reply-To: <63bb19ae0904071103t715c8d75m9dff9e6afa499366@mail.gmail.com> References: <11b141710903171744l79e5d1aoa42035e6b7fb268a@mail.gmail.com> <63bb19ae0904031605r4e6ba214h5f2313cf3bbec3a2@mail.gmail.com> <11b141710904071051r34566626q7580e8b4459507c1@mail.gmail.com> <63bb19ae0904071103t715c8d75m9dff9e6afa499366@mail.gmail.com> Message-ID: <11b141710904071112m5fa66bf5w34122f5ca70fcfc6@mail.gmail.com> On Tue, Apr 7, 2009 at 6:03 PM, Sam TH wrote: > You are missing the parentheses around `filename'. ?It should be > > #:args (#{filename : String}) > > I'm not yet sure how to give a better error message here. > Sorry, guess I missed that! Thanks for the help. > sam th > > On Tue, Apr 7, 2009 at 1:51 PM, Paulo J. Matos wrote: >> On Fri, Apr 3, 2009 at 11:05 PM, Sam TH wrote: >>> On Tue, Mar 17, 2009 at 8:44 PM, Paulo J. Matos wrote: >>>> Hi, >>>> >>>> Trying to typecheck a file containing a call to command line fails. >>>> Here's a short version exemplifying the issue: >>> >>> This works now, provided that you annotate the binding instance of >>> `filename' with an appropriate type: >>> >>> #:args #{filename : String} >>> -- >>> sam th >>> samth@ccs.neu.edu >>> >> >> Hi Sam, >> >> From SVN 14441 using this doesn't work: >> #lang typed-scheme >> >> (require scheme/cmdline) >> >> ;; Command Line Arguments Parsing >> (: verbose-mode (Parameter Boolean)) >> (define verbose-mode (make-parameter #t)) >> >> (: optimize-level (Parameter Integer)) >> (define optimize-level (make-parameter 0)) >> >> (: model-checking-mode (Parameter Symbol)) >> (define model-checking-mode (make-parameter 'sat)) >> >> (: file-to-model-check String) >> (define file-to-model-check >> ?(command-line >> ? #:program "eboc" ;; Should be name of executable >> ? #:once-each >> ? [("-v" "--verbose") "Compile with verbose messages" >> ? ? ? ? ? ? ? ? ? ? ? (verbose-mode #t)] >> ? [("-m" "--mode") #{mode : String} ?"Mode to run the model checker >> on (sat, satbin)" >> ? ? ? ? ? ? ? ? ? ?(model-checking-mode (string->symbol mode))] >> ? #:once-any >> ? [("-o" "--optimize-1") "Compile with optimization level 1" >> ? ? ? ? ? ? ? ? ? ? ? ? ?(optimize-level 1)] >> ? ["--optimize-2" ? ? ? ?(; show help on separate lines >> ? ? ? ? ? ? ? ? ? ? ? ? ? "Compile with optimization level 2," >> ? ? ? ? ? ? ? ? ? ? ? ? ? "which includes all of level 1") >> ? ? ? ? ? ? ? ? ? ? ? ? ?(optimize-level 2)] >> ? #:args #{filename : String} ; expect one command-line argument: >> ? ; return the argument as a filename to compile >> ? filename)) >> >> I get: >> typecheck: Polymorphic function parse-command-line could not be >> applied to arguments: >> Domain: (U String Path) (U (Vectorof String) (Listof String)) (Listof >> (Pair (U 'once-each 'once-any 'multi 'final 'help-labels) (Listof >> (Listof Any)))) (Any a ... a -> b) (Listof String) >> Arguments: String (Vectorof String) (List (List 'once-each (List (List >> String String) (Any -> Void) (Listof (List String))) (List (List >> String String) (Any String -> Void) (Listof (U String (List >> String))))) (List 'once-any (List (List String String) (Any -> Void) >> (Listof (List String))) (List (List String) (Any -> Void) (Listof >> (List String String))))) (Any String* -> (Listof String)) (List >> String) >> Result type: b >> Expected result: String >> ?in: (define file-to-model-check (command-line #:program "eboc" >> #:once-each (("-v" "--verbose") "Compile with verbose messages" >> (verbose-mode #t)) (("-m" "--mode") mode "Mode to run the model >> checker on (sat, satbin)" (model-checking-mode (string->symbol mode))) >> #:once-any (("-o" "--optimize-1") "Compile with optimization level 1" >> (optimize-level 1)) ("--optimize-2" ("Compile with optimization level >> 2," "which includes all of level 1") (optimize-level 2)) #:args >> filename filename)) >> >> Am I missing something? >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> > > > > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Tue Apr 7 14:53:04 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 14:53:41 2009 Subject: [plt-scheme] Type Explanation Message-ID: <11b141710904071153x540e46ferdad5bfa7cdb6f60e@mail.gmail.com> Hi, I was trying to check the predicate for type Integer and tested integer?. I got: > integer? - : (Any -> Boolean : ((restrict Number)) ((remove Integer))) What's the meaning of ": ((restrict Number)) ((remove Integer)))" Are these possibilities documented? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Tue Apr 7 15:03:31 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 7 15:03:53 2009 Subject: [plt-scheme] Type Explanation In-Reply-To: <11b141710904071153x540e46ferdad5bfa7cdb6f60e@mail.gmail.com> References: <11b141710904071153x540e46ferdad5bfa7cdb6f60e@mail.gmail.com> Message-ID: <63bb19ae0904071203q7adf4694x6347f35e43a7fdec@mail.gmail.com> It means that anything that answers #t to `integer?' is a Number, and anything that answers #f is not an Integer. These aren't documented, and they're going to change substantially in the near future. On Tue, Apr 7, 2009 at 2:53 PM, Paulo J. Matos wrote: > Hi, > > I was trying to check the predicate for type Integer and tested integer?. I got: >> integer? > - : (Any -> Boolean : ((restrict Number)) ((remove Integer))) > > What's the meaning of ?": ((restrict Number)) ((remove Integer)))" > > Are these possibilities documented? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Tue Apr 7 15:08:10 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 15:08:46 2009 Subject: [plt-scheme] Type Explanation In-Reply-To: <63bb19ae0904071203q7adf4694x6347f35e43a7fdec@mail.gmail.com> References: <11b141710904071153x540e46ferdad5bfa7cdb6f60e@mail.gmail.com> <63bb19ae0904071203q7adf4694x6347f35e43a7fdec@mail.gmail.com> Message-ID: <11b141710904071208i380e6390jd361f665a0ffeff3@mail.gmail.com> On Tue, Apr 7, 2009 at 7:03 PM, Sam TH wrote: > It means that anything that answers #t to `integer?' is a Number, and > anything that answers #f is not an Integer. ?These aren't documented, > and they're going to change substantially in the near future. > OK, thanks... if they're changing then better to keep them undocumented. :) > On Tue, Apr 7, 2009 at 2:53 PM, Paulo J. Matos wrote: >> Hi, >> >> I was trying to check the predicate for type Integer and tested integer?. I got: >>> integer? >> - : (Any -> Boolean : ((restrict Number)) ((remove Integer))) >> >> What's the meaning of ?": ((restrict Number)) ((remove Integer)))" >> >> Are these possibilities documented? >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Tue Apr 7 15:15:08 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 15:15:45 2009 Subject: [plt-scheme] Typed-Scheme, cond, match and wierd behaviour with non-disjoint types Message-ID: <11b141710904071215x47e6cbafv114b360040896ec1@mail.gmail.com> Hi, I met yet another issue. But to build up the context, lets define something that works as expected. #lang typed-scheme (require scheme/match) (define-type-alias mytype1 (U Integer Char)) (define-type-alias mytype2 (U Integer String)) (: test (case-lambda [Integer -> Integer] [Char -> String] [mytype1 -> mytype2])) (define (test x) (cond [(integer? x) x] [(char? x) (make-string 1 x)])) You might be thinking... why the [mytype1 -> mytype2] in the typing but that will come quickly. I am however, using match in my program so I assumed the following would be equivalent: (: test2 (case-lambda [Integer -> Integer] [Char -> String])) [mytype1 -> mytype2])) (define (test2 x) (match x ((? integer?) x) ((? char?) (make-string 1 x)))) However, it is not... . typecheck: No function domains matched in function application: Domains: Integer Integer Char Arguments: Integer mytype1 in: (make-string 1 x) . typecheck: Expected mytype2, but got mytype1 in: x If I change the typing of test2 to remove the last line, it works... :) (: test2 (case-lambda [Integer -> Integer] [Char -> String])) (define (test2 x) (match x ((? integer?) x) ((? char?) (make-string 1 x)))) But then again, there's a reason why I need that line.... Because some functions expect a mytype2 as result and if it is not there explicitly it fails... For example: (: test3 (mytype1 -> mytype2)) (define (test3 x) (test2 x)) with the last version of test2 gives: . typecheck: No function domains matched in function application: Domains: Integer Char Arguments: mytype1 in: (test2 x) Now, I am not sure where the problem lies but the last error message is suspicious... if the domains are Integer or Char then a mytype1 should do it since a mytype1 is exactly that... an Integer or a Char... Any workaround on something like this? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From jcriddle4 at yahoo.com Mon Apr 6 23:22:43 2009 From: jcriddle4 at yahoo.com (Jay Riddle) Date: Tue Apr 7 15:35:26 2009 Subject: [plt-scheme] Scheme behavior Message-ID: <500858.65925.qm@web36505.mail.mud.yahoo.com> In order to learn scheme and macros a little better I was attempting to write a macro that would allow me make a slighty simpler stuct-copy. My version of the struct-copy would require one few parameters. This is sort of like what ocaml has using the 'with' statement on a structure(?I am not sure I used the correct terms there?). So instead of writting (struct-copy my-struct some-mystruct (fieldN valueN)) I would write (with some-mystruct (fieldN valueN)) Scheme wasn't too happy with some of my primitive attempts with (define-syntax....) so I attempted with define-macro. I came up with this (define-macro with (? (s . body) (list 'cond (list (list 'myvar? s) (append (list 'struct-copy 'myvar s) body)) (list (list 'myfun? s) (append (list 'struct-copy 'myfun s) body)) (list (list 'myexp? s) (append (list 'struct-copy 'myexp s) body)) '(else (raise "091-33 'with' not defined for struct type"))))) The error I am getting is "struct-copy: accessor name not associated with the given structure type in:..." In order to narrow down what I was doing wrong I did a simple test case that should be simular to what my macro was doing and I noticed that this code would fail to compile in drscheme. 1 (define (test e) 2 (cond 3 ((myvar? e) (struct-copy myvar e (name "tom")(isfunc #t))) 4 ((myfun? e) (struct-copy myfun e (name "tom")(isfunc #t))) 5 ((myexp? e) (struct-copy myexp e (name "tom")(isfunc #t))) 6 (else (raise 091-33 'with' not defined for struct type))) 7 ) Basically the only structure that has the field 'isfunc' is the myexp structure. Is scheme doing some type checking or something? Why does scheme care about line 3 and 4 at compile time? From victor at topmost.se Tue Apr 7 05:20:17 2009 From: victor at topmost.se (geon) Date: Tue Apr 7 15:35:31 2009 Subject: [plt-scheme] Two new PLT Scheme web server tutorials Message-ID: <915e4d7e-2156-421f-a7d5-a9c57f00b67b@s20g2000yqh.googlegroups.com> I've written a pair of tutorials on the PLT Scheme web server: The first part covers how to output valid XHTML. http://www.topmost.se/personal/articles/web-programming-with-plt-scheme/serving-xhtml.htm The second part covers how to write a custom dispatcher. http://www.topmost.se/personal/articles/web-programming-with-plt-scheme/custom-dispatchers.htm If you have any comments or questions, feel free to contact me. From clements at brinckerhoff.org Tue Apr 7 11:59:52 2009 From: clements at brinckerhoff.org (John Clements) Date: Tue Apr 7 15:35:41 2009 Subject: [plt-scheme] No More Boring Code Message-ID: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090407/9c378043/smime-0001.bin From tobias at dsv.su.se Tue Apr 7 15:06:51 2009 From: tobias at dsv.su.se (Tobias Wrigstad) Date: Tue Apr 7 15:35:48 2009 Subject: [plt-scheme] STOP 2009 [Deadline Extension] Message-ID: <20090407190651.573BC479A0@triton.localdomain> [N.B. Deadline extended to April 13th] Call for Papers Script to Program Evolution (STOP) at ECOOP 2009 July 6th, 2009, Genova, Italy Recent years have seen increased use of scripting languages in large applications. Scripting languages optimize development time, especially early in the software life cycle, over safety and robustness. As the understanding of the system reaches a critical point and requirements stabilize, scripting languages become less appealing. Compromises made to optimize development time make it harder to reason about program correctness, harder to do semantic-preserving refactorings, and harder to optimize execution speed. Lack of type information makes code harder to navigate and to use correctly. In the worst cases, this situation leads to a costly and potentially error-prone rewrite of a program in a compiled language, losing the flexibility of scripting languages for future extension. Recently, pluggable type systems and annotation systems have been proposed. Such systems add compile-time checkable annotations without changing a program's run-time semantics which facilitates early error checking and program analysis. It is believed that untyped scripts can be retrofitted to work with such systems. Furthermore, integration of typed and untyped code, for example, through use of gradual typing, allows scripts to evolve into safer programs more suitable for program analysis and compile-time optimisations. With very few exceptions, practical reports are yet to be found. The STOP workshop focuses on the evolution of scripts, largely untyped code, into safer programs, with more rigid structure and more constrained behaviour through the use of gradual/hybrid/ pluggable typing, optional contract checking, extensible languages, refactoring tools, and the like. The goal is to further the understanding and use of such systems in practise, and connect practise and theory. To this end, we encourage not only submissions presenting original research results, but also papers that attempt to establish links between different approaches and/or papers that include survey material, experience reports and tool demonstrations. Original research results should be clearly described, and their usefulness to practitioners outlined. Paper selection will be based on the quality of the submitted material, including surveys. Demos will judged on the perceived relevance for the intended audience. The accepted papers will be made available through ACM's digital library. Important Dates =============== Submission: April 13, 2009 (23.59 Apia, Samoa) Notification: May 8, 2009 Final Version: June 8, 2009 Workshop: July 6, 2009 Programme Committee =================== Cormac Flanagan, University of California Santa Cruz Jan Vitek, Purdue University Jeff Foster, University of Maryland Jeremy Siek, University of Colorado Kostis Sagonas, Uppsala University Nate Nystrom, IBM T.J. Watson Research Peter Thiemann, Universitat Freiburg Philip Wadler, University of Edinburgh Tobias Wrigstad, Purdue University (Chair) Todd Millstein, UCLA Organizers ========== Nate Nystrom, IBM T.J. Watson Research Center Jan Vitek, Purdue University Tobias Wrigstad, Purdue University Selection Process ================= Both full papers (up to 12 pages LNCS) and position papers (1-2 pages LNCS) are welcome. All submissions will be reviewed by the programme committee. The accepted papers, after rework by the authors, will be published in the Workshop Proceedings, which will be distributed at the workshop. All accepted submissions shall remain available from the workshop web page. Papers should be submitted through EasyChair by April 13, 2009. (https://www.easychair.org/login.cgi?conf=stop09) Questions may be directed to Tobias Wrigstad (wrigstad AT cs DOT purdue DOT edu). From acowley at seas.upenn.edu Tue Apr 7 15:38:32 2009 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Tue Apr 7 15:38:54 2009 Subject: [plt-scheme] Typed-Scheme, cond, match and wierd behaviour with non-disjoint types In-Reply-To: <11b141710904071215x47e6cbafv114b360040896ec1@mail.gmail.com> References: <11b141710904071215x47e6cbafv114b360040896ec1@mail.gmail.com> Message-ID: <81addec70904071238y1a98cd3bk8f822c76c30e0e89@mail.gmail.com> On Tue, Apr 7, 2009 at 3:15 PM, Paulo J. Matos wrote: > Hi, > > I met yet another issue. But to build up the context, lets define > something that works as expected. Paulo, It's not entirely clear what the issue is with the function that needs a mytype2. Does the following do what you want? #lang typed-scheme (require scheme/match) (define-type-alias mytype1 (U Integer Char)) (define-type-alias mytype2 (U Integer String)) (: test (mytype1 -> mytype2)) (define (test x) (cond ((integer? x) x) ((char? x) (make-string 1 x)))) (: test-alt (mytype1 -> mytype2)) (define (test-alt x) (match x ((? integer? x) x) ((? char? x) (make-string 1 x)))) (: test5 (mytype2 -> Boolean)) (define (test5 y) (cond ((integer? y) #t) ((and (string? y) (= (string-length y) 1)) #t) (else #f))) (test5 (test 42)) (test5 (test #\a)) (test5 "yoyo") (newline) (test5 (test-alt 42)) (test5 (test-alt #\a)) Anthony > #lang typed-scheme > > (require scheme/match) > > (define-type-alias mytype1 (U Integer Char)) > (define-type-alias mytype2 (U Integer String)) > > (: test (case-lambda > ? ? ? ? ?[Integer -> Integer] > ? ? ? ? ?[Char -> String] > ? ? ? ? ?[mytype1 -> mytype2])) > (define (test x) > ?(cond [(integer? x) > ? ? ? ? x] > ? ? ? ?[(char? x) > ? ? ? ? (make-string 1 x)])) > > You might be thinking... why the [mytype1 -> mytype2] in the typing > but that will come quickly. > I am however, using match in my program so I assumed the following > would be equivalent: > (: test2 (case-lambda > ? ? ? ? ?[Integer -> Integer] > ? ? ? ? ?[Char -> String])) > ? ? ? ? ?[mytype1 -> mytype2])) > (define (test2 x) > ?(match x > ? ?((? integer?) > ? ? x) > ? ?((? char?) > ? ? (make-string 1 x)))) > > However, it is not... > . typecheck: No function domains matched in function application: > Domains: Integer > ? ? ? ?Integer Char > Arguments: Integer mytype1 > ?in: (make-string 1 x) > . typecheck: Expected mytype2, but got mytype1 in: x > > If I change the typing of test2 to remove the last line, it works... :) > (: test2 (case-lambda > ? ? ? ? ?[Integer -> Integer] > ? ? ? ? ?[Char -> String])) > (define (test2 x) > ?(match x > ? ?((? integer?) > ? ? x) > ? ?((? char?) > ? ? (make-string 1 x)))) > > But then again, there's a reason why I need that line.... Because some > functions expect a mytype2 as result and if it is not there explicitly > it fails... For example: > (: test3 (mytype1 -> mytype2)) > (define (test3 x) > ?(test2 x)) > > with the last version of test2 gives: > . typecheck: No function domains matched in function application: > Domains: Integer > ? ? ? ?Char > Arguments: mytype1 > ?in: (test2 x) > > Now, I am not sure where the problem lies but the last error message > is suspicious... if the domains are Integer or Char then a mytype1 > should do it since a mytype1 is exactly that... an Integer or a > Char... Any workaround on something like this? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Tue Apr 7 15:43:49 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Apr 7 15:44:10 2009 Subject: [plt-scheme] Collect-Garbage not enabled on Dr. Scheme? In-Reply-To: References: <5a0b0991-5887-4166-87f9-d5bfc72613e5@w35g2000prg.googlegroups.com> <186df66b0904041331y6cb99ff6hffff77c5e1943a0f@mail.gmail.com> <49D7C836.6040609@ccs.neu.edu> <186df66b0904041456gd233211qef42ed7eae0b9fbc@mail.gmail.com> <20090405005918.76dee424@halmanfloyd.lan.local> <20090405013849.434d1a43@halmanfloyd.lan.local> Message-ID: <20090407194349.B77246500B1@mail-svr1.cs.utah.edu> At Sun, 5 Apr 2009 19:40:52 +0300, emre berat nebio?lu wrote: > "[Boehm, POPL'02]" Can someone explain this problem more clearly or > can someone suggest anything because i wonder that problem. > And mail said the problem is for for GUI program why is that ? Suppose that your program allocates a bunch of little objects that don't point to each other: . ---- ---- ---- ---- . ---- | | | | | | | | . | | ---- ---- ---- ---- . ---- . <<< GC-able . in use >>> . And suppose further that the program stops using each object soon after it's allocated. If the conservative collector accidentally holds onto 1 out of 5 objects that it should collect at any given then, that's not a big problem. A GC will be triggered every time there are N objects total, and roughly N/5 objects will hang around to the left of the dotted line. You just have a constant overhead on your heap usage due to imprecision. Now, suppose instead that the objects can point to each other, and when you allocate an object, you make the previous one point to the new one to form a linked list: . ---- ---- ---- ---- . ---- | |->| |-->| |-->| |-.->| | ---- ---- ---- ---- . ---- . <<< GC-able . in use >>> . Note that links don't go from the "in use" area to the "GC-able" area (otherwise its wouldn't be GCable). Still, it now matters which objects to the left of the dotted line a conservative GC accidentally retains. An object far to the left of the picture references many other nodes, so far more than N/5 nodes will remain to the left of the dotteed line after a GC. That will make GCs less frequent, so that even more is retained after the next GC, and so on. This linked-list problem happens for threads in our system. It often happens with GUIs, and DrScheme is a particularly extreme example. Each time you click execute in DrScheme, a new thread is created. Swapping out a thread captures the state of registers, and a register can easily refer to the thread being swapped in. Even if DrScheme stops referring to all the old threads, if the GC accidentally retains one of the threads, it can easily hold on to many future threads, and so on. If the programmer knows when threads die, then the problem is easily solved by "zeroing out" the dead threads so they do not refer to other threads. But we don't want to keep track of when threads die; relying on GC lets us create simpler and more reliable synchronization abstractions. From pocmatos at gmail.com Tue Apr 7 15:45:03 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 15:45:40 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues Message-ID: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> Hi, I have been using typed-scheme for a bit now and my code base in typed scheme is now involving [only] 4 modules with a total of 3000 loc. Unfortunately, though things have been pretty slow for me lately since evaluating the main module of my project takes something in the order of minutes requesting over 2Gb of memory. Since I [only] have 2 Gb of memory, swapping starts and things get even slower. About this I don't know what to do but it needs to be improved. I have taken a few screenshots so you can check how the memory evolves while drscheme is interpreting a typed-scheme module [svn 14441]: Idle: Values http://users.ecs.soton.ac.uk/pocm06r/values_idle.png Graph http://users.ecs.soton.ac.uk/pocm06r/graph_idle.png On Load: Values http://users.ecs.soton.ac.uk/pocm06r/values_load.png Graph http://users.ecs.soton.ac.uk/pocm06r/graph_load.png Note that I have mostly nothing else running besides the gnome desktop... I sincerely don't know what to do. I hope this is just a bug regarding memory handling and can be easily fixed. If I can provide more info on this so it can be analyzed please let me know. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Tue Apr 7 15:51:30 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 7 15:51:53 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> Message-ID: <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> That's certainly quite a lot of memory use - and a lot of Typed Scheme code! I don't know why it should take that much memory, but the one thing I do recommend is compiling your files to byte code. DrScheme does this automatically in some cases, and you can do it manually with 'mzc -k'. Once the file is compiled, typechecking is complete, and subsequent uses of that file should be much faster. For example, if you have files A.ss, B.ss and C.ss, each of which depends on the preceding, then if you are changing C.ss a lot, then % mzc -k A.ss B.ss will likely improve your speed/memory issues. If that doesn't help, let me know, and I'll try to see if there's something in particular that's going wrong while typechecking your code. sam th On Tue, Apr 7, 2009 at 3:45 PM, Paulo J. Matos wrote: > Hi, > > I have been using typed-scheme for a bit now and my code base in typed > scheme is now involving [only] 4 modules with a total of 3000 loc. > > Unfortunately, though things have been pretty slow for me lately since > evaluating the main module of my project takes something in the order > of minutes requesting over 2Gb of memory. Since I [only] have 2 Gb of > memory, swapping starts and things get even slower. > > About this I don't know what to do but it needs to be improved. I have > taken a few screenshots so you can check how the memory evolves while > drscheme is interpreting a typed-scheme module [svn 14441]: > Idle: > Values http://users.ecs.soton.ac.uk/pocm06r/values_idle.png > Graph http://users.ecs.soton.ac.uk/pocm06r/graph_idle.png > > On Load: > Values http://users.ecs.soton.ac.uk/pocm06r/values_load.png > Graph http://users.ecs.soton.ac.uk/pocm06r/graph_load.png > > Note that I have mostly nothing else running besides the gnome > desktop... I sincerely don't know what to do. I hope this is just a > bug regarding memory handling and can be easily fixed. > If I can provide more info on this so it can be analyzed please let me know. > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Tue Apr 7 16:06:48 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 16:07:29 2009 Subject: [plt-scheme] Re: Typed-Scheme, cond, match and wierd behaviour with non-disjoint types In-Reply-To: <11b141710904071215x47e6cbafv114b360040896ec1@mail.gmail.com> References: <11b141710904071215x47e6cbafv114b360040896ec1@mail.gmail.com> Message-ID: <11b141710904071306r1d4fe578j2193bc52c95f5277@mail.gmail.com> While replying to Anthony message I noticed that the version he had worked and mine would also work if I changed my match syntax: (: test2 (case-lambda [Integer -> Integer] [Char -> String] [mytype1 -> mytype2])) (define (test2 x) (match x ((? integer? x) x) ((? char? x) (make-string 1 x)))) This now works, but the error persists in my case... and I know why. I should repost soon with a more specific example. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From grettke at acm.org Tue Apr 7 16:12:56 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Apr 7 16:13:15 2009 Subject: [plt-scheme] XML Docs typo bug Message-ID: <756daca50904071312n18712cddxdecb058243f0ab03@mail.gmail.com> In In /doc/xml/index.html it says: "It does interpret namespaces either." From grettke at acm.org Tue Apr 7 16:19:47 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Apr 7 16:20:06 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? Message-ID: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> What is your favorite library for parsing XML in PLT 4? If nothing is available, then what do you use for PLT<4, R5 or R6 Scheme? From grettke at acm.org Tue Apr 7 16:30:09 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Apr 7 16:30:27 2009 Subject: [plt-scheme] Re: Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: <756daca50904071330yc9d8853p7a4f2b43e050a3bb@mail.gmail.com> On Tue, Apr 7, 2009 at 3:19 PM, Grant Rettke wrote: > What is your favorite library for parsing XML in PLT 4? > > If nothing is available, then what do you use for PLT<4, R5 or R6 Scheme? Clarification: I know that some of you have a lot of experience working with XML in Scheme. I am interested in those that you would recommend specifically for working with PLT 4. Google does a fine job in helping me find libaries; but it does a terrible job at recommending them :). From benderjg2 at aol.com Tue Apr 7 16:41:38 2009 From: benderjg2 at aol.com (Jim Bender) Date: Tue Apr 7 16:44:10 2009 Subject: [plt-scheme] Re: Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <756daca50904071330yc9d8853p7a4f2b43e050a3bb@mail.gmail.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> <756daca50904071330yc9d8853p7a4f2b43e050a3bb@mail.gmail.com> Message-ID: <5964E83B-23DE-418D-A7D8-EC94ADCFBE25@aol.com> SSAX, mainly because of it's completeness and tools available to manipulate the SXML produced by SSAX. Sent from my iPhone On Apr 7, 2009, at 3:30 PM, Grant Rettke wrote: > On Tue, Apr 7, 2009 at 3:19 PM, Grant Rettke wrote: >> What is your favorite library for parsing XML in PLT 4? >> >> If nothing is available, then what do you use for PLT<4, R5 or R6 >> Scheme? > > Clarification: > > I know that some of you have a lot of experience working with XML in > Scheme. I am interested in those that you would recommend specifically > for working with PLT 4. Google does a fine job in helping me find > libaries; but it does a terrible job at recommending them :). > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jay.mccarthy at gmail.com Tue Apr 7 16:59:14 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Apr 7 16:59:35 2009 Subject: [plt-scheme] XML Docs typo bug In-Reply-To: <756daca50904071312n18712cddxdecb058243f0ab03@mail.gmail.com> References: <756daca50904071312n18712cddxdecb058243f0ab03@mail.gmail.com> Message-ID: Fixed in SVN. Thanks. On Tue, Apr 7, 2009 at 2:12 PM, Grant Rettke wrote: > In In /doc/xml/index.html it says: > > "It does interpret namespaces either." > _________________________________________________ > ?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 Tue Apr 7 17:01:32 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Apr 7 17:01:53 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: For dirt simple XML tasks, I use the xml collect. If I want to use obvious XPath queries, like when I am polling a Web service, I use SXML and the SXPath implementation. Otherwise, I just use the xml collect, convert to an xexpr, and write the query by hand. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From spdegabrielle at gmail.com Tue Apr 7 17:05:38 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Tue Apr 7 17:06:00 2009 Subject: [plt-scheme] Two new PLT Scheme web server tutorials In-Reply-To: <915e4d7e-2156-421f-a7d5-a9c57f00b67b@s20g2000yqh.googlegroups.com> References: <915e4d7e-2156-421f-a7d5-a9c57f00b67b@s20g2000yqh.googlegroups.com> Message-ID: <595b9ab20904071405x1fd614e1qc0672f5aa50eb15e@mail.gmail.com> Thanks, I've only just started, but I like it. Cheers, Stephen On Tue, Apr 7, 2009 at 10:20 AM, geon wrote: > I've written a pair of tutorials on the PLT Scheme web server: > > The first part covers how to output valid XHTML. > http://www.topmost.se/personal/articles/web-programming-with-plt-scheme/serving-xhtml.htm > > The second part covers how to write a custom dispatcher. > http://www.topmost.se/personal/articles/web-programming-with-plt-scheme/custom-dispatchers.htm > > If you have any comments or questions, feel free to contact me. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Tue Apr 7 17:09:01 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Apr 7 17:09:24 2009 Subject: [plt-scheme] Two new PLT Scheme web server tutorials In-Reply-To: <915e4d7e-2156-421f-a7d5-a9c57f00b67b@s20g2000yqh.googlegroups.com> References: <915e4d7e-2156-421f-a7d5-a9c57f00b67b@s20g2000yqh.googlegroups.com> Message-ID: This is cool. Suggestions: - In your "The page dispatcher", prefix-in might be simpler. - redirect is already in http/redirect http://docs.plt-scheme.org/web-server/http.html#(part._redirect..ss) Jay On Tue, Apr 7, 2009 at 3:20 AM, geon wrote: > I've written a pair of tutorials on the PLT Scheme web server: > > The first part covers how to output valid XHTML. > http://www.topmost.se/personal/articles/web-programming-with-plt-scheme/serving-xhtml.htm > > The second part covers how to write a custom dispatcher. > http://www.topmost.se/personal/articles/web-programming-with-plt-scheme/custom-dispatchers.htm > > If you have any comments or questions, feel free to contact me. > _________________________________________________ > ?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 ryanc at ccs.neu.edu Tue Apr 7 17:56:19 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Tue Apr 7 17:56:46 2009 Subject: [plt-scheme] Scheme behavior In-Reply-To: <500858.65925.qm@web36505.mail.mud.yahoo.com> References: <500858.65925.qm@web36505.mail.mud.yahoo.com> Message-ID: <7ED92B50-870A-4259-91CB-3DCE021C98FD@ccs.neu.edu> On Apr 6, 2009, at 11:22 PM, Jay Riddle wrote: > In order to learn scheme and macros a little better I was attempting > to write a macro that would allow me make a slighty simpler stuct- > copy. My version of the struct-copy would require one few > parameters. This is sort of like what ocaml has using the 'with' > statement on a structure(?I am not sure I used the correct terms > there?). > > So instead of writting > > (struct-copy my-struct some-mystruct (fieldN valueN)) > > I would write > > (with some-mystruct (fieldN valueN)) > > > Scheme wasn't too happy with some of my primitive attempts with > (define-syntax....) so I attempted with define-macro. > > I came up with this > > (define-macro with > (? (s . body) > (list 'cond > (list (list 'myvar? s) (append (list 'struct-copy 'myvar s) > body)) > (list (list 'myfun? s) (append (list 'struct-copy 'myfun s) > body)) > (list (list 'myexp? s) (append (list 'struct-copy 'myexp s) > body)) > '(else (raise "091-33 'with' not defined for struct type"))))) > > > The error I am getting is "struct-copy: accessor name not associated > with the given structure type in:..." > > In order to narrow down what I was doing wrong I did a simple test > case that should be simular to what my macro was doing and I noticed > that this code would fail to compile in drscheme. > > 1 (define (test e) > 2 (cond > 3 ((myvar? e) (struct-copy myvar e (name "tom")(isfunc #t))) > 4 ((myfun? e) (struct-copy myfun e (name "tom")(isfunc #t))) > 5 ((myexp? e) (struct-copy myexp e (name "tom")(isfunc #t))) > 6 (else (raise 091-33 'with' not defined for struct type))) > 7 ) > > Basically the only structure that has the field 'isfunc' is the > myexp structure. Is scheme doing some type checking or something? > Why does scheme care about line 3 and 4 at compile time? It's not type checking, but 'struct-copy' does require that the fields belong to the struct name, and that is checked at compile time. It does that because the names of the fields aren't actually remembered by the struct type at run time. There's not really a good way to make 'struct-copy' more dynamic, but here's a hack that will let you get by for now: ;; (with-dynamic-syntax-error expr) ;; Catches syntax errors in 'expr' and delays them until run time. (define-syntax (with-dynamic-syntax-error stx) (if (eq? (syntax-local-context) 'expression) (syntax-case stx () [(with-dynamic-syntax-error expr) (with-handlers ([exn:fail? (lambda (exn) (with-syntax ([msg (exn-message exn)]) (syntax/loc #'expr (error 'msg))))]) (local-expand #'expr 'expression null))]) #`(#%expression #,stx))) Now you can produce bad uses of 'struct-copy', as long as you wrap them in the macro above. Here's 'with' rewritten: (define-syntax (with stx) (syntax-case stx () [(with struct-expr (field value) ...) (with-syntax ([(tmp ...) (generate-temporaries #'(field ...))]) #'(let ([x struct-expr] [tmp value] ...) (cond [(myvar? x) (with-dynamic-syntax-error (struct-copy myvar x (field tmp) ...))] [(myexp? x) (with-dynamic-syntax-error (struct-copy myexp x (field tmp) ...))] [(myfun? x) (with-dynamic-syntax-error (struct-copy myfun x (field tmp) ...))] [else (raise-type-error 'with "myvar, myexp, or myfun" x)])))])) Ryan From pocmatos at gmail.com Tue Apr 7 18:05:54 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 18:06:31 2009 Subject: [plt-scheme] make-struct-type in typed scheme Message-ID: <11b141710904071505q48d2761al4fad6fd692a5c713@mail.gmail.com> Hi all, Is there any way to use make-struct-type inside typed-scheme? If not, is there a way to install a custom printer for a structure in typed-scheme? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Tue Apr 7 18:10:03 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 7 18:10:21 2009 Subject: [plt-scheme] make-struct-type in typed scheme In-Reply-To: <11b141710904071505q48d2761al4fad6fd692a5c713@mail.gmail.com> References: <11b141710904071505q48d2761al4fad6fd692a5c713@mail.gmail.com> Message-ID: <63bb19ae0904071510l3fd09c9bm4ee1e616ed8b527f@mail.gmail.com> On Tue, Apr 7, 2009 at 6:05 PM, Paulo J. Matos wrote: > Hi all, > > Is there any way to use make-struct-type inside typed-scheme? If not, > is there a way to install a custom printer for a structure in > typed-scheme? No, and not at the moment, respectively. -- sam th samth@ccs.neu.edu From pocmatos at gmail.com Tue Apr 7 18:13:28 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 18:14:04 2009 Subject: [plt-scheme] make-struct-type in typed scheme In-Reply-To: <63bb19ae0904071510l3fd09c9bm4ee1e616ed8b527f@mail.gmail.com> References: <11b141710904071505q48d2761al4fad6fd692a5c713@mail.gmail.com> <63bb19ae0904071510l3fd09c9bm4ee1e616ed8b527f@mail.gmail.com> Message-ID: <11b141710904071513o165f20aem2699ad543599a9ca@mail.gmail.com> On Tue, Apr 7, 2009 at 11:10 PM, Sam TH wrote: > On Tue, Apr 7, 2009 at 6:05 PM, Paulo J. Matos wrote: >> Hi all, >> >> Is there any way to use make-struct-type inside typed-scheme? If not, >> is there a way to install a custom printer for a structure in >> typed-scheme? > > No, and not at the moment, respectively. > I can always define a structure with a custom printer in a scheme module, then create another module that types the structure with require/opaque-type and re-export it as if it had been typed by typed-scheme, right? > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Tue Apr 7 18:16:06 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 18:16:44 2009 Subject: [plt-scheme] make-struct-type in typed scheme In-Reply-To: <11b141710904071513o165f20aem2699ad543599a9ca@mail.gmail.com> References: <11b141710904071505q48d2761al4fad6fd692a5c713@mail.gmail.com> <63bb19ae0904071510l3fd09c9bm4ee1e616ed8b527f@mail.gmail.com> <11b141710904071513o165f20aem2699ad543599a9ca@mail.gmail.com> Message-ID: <11b141710904071516y4faa910bme9e29335e318bc8e@mail.gmail.com> On Tue, Apr 7, 2009 at 11:13 PM, Paulo J. Matos wrote: > On Tue, Apr 7, 2009 at 11:10 PM, Sam TH wrote: >> On Tue, Apr 7, 2009 at 6:05 PM, Paulo J. Matos wrote: >>> Hi all, >>> >>> Is there any way to use make-struct-type inside typed-scheme? If not, >>> is there a way to install a custom printer for a structure in >>> typed-scheme? >> >> No, and not at the moment, respectively. >> > > I can always define a structure with a custom printer in a scheme > module, then create another module that types the structure with > require/opaque-type and re-export it as if it had been typed by > typed-scheme, right? > here it would be require-typed-structure instead of require/opaque-type... right? >> -- >> sam th >> samth@ccs.neu.edu >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Tue Apr 7 18:20:51 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 7 18:21:11 2009 Subject: [plt-scheme] make-struct-type in typed scheme In-Reply-To: <11b141710904071516y4faa910bme9e29335e318bc8e@mail.gmail.com> References: <11b141710904071505q48d2761al4fad6fd692a5c713@mail.gmail.com> <63bb19ae0904071510l3fd09c9bm4ee1e616ed8b527f@mail.gmail.com> <11b141710904071513o165f20aem2699ad543599a9ca@mail.gmail.com> <11b141710904071516y4faa910bme9e29335e318bc8e@mail.gmail.com> Message-ID: <63bb19ae0904071520r11db99e4mffab92da1520c0a7@mail.gmail.com> On Tue, Apr 7, 2009 at 6:16 PM, Paulo J. Matos wrote: > On Tue, Apr 7, 2009 at 11:13 PM, Paulo J. Matos wrote: >> On Tue, Apr 7, 2009 at 11:10 PM, Sam TH wrote: >>> On Tue, Apr 7, 2009 at 6:05 PM, Paulo J. Matos wrote: >>>> Hi all, >>>> >>>> Is there any way to use make-struct-type inside typed-scheme? If not, >>>> is there a way to install a custom printer for a structure in >>>> typed-scheme? >>> >>> No, and not at the moment, respectively. >>> >> >> I can always define a structure with a custom printer in a scheme >> module, then create another module that types the structure with >> require/opaque-type and re-export it as if it had been typed by >> typed-scheme, right? Yes. > here it would be require-typed-structure instead of > require/opaque-type... right? Yes. In fact, `require-typed-struct' expands into `require/opaque-type'. -- sam th samth@ccs.neu.edu From dvanhorn at ccs.neu.edu Tue Apr 7 18:32:33 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Tue Apr 7 18:33:01 2009 Subject: [plt-scheme] Making a fast list like sequence Message-ID: <49DBD481.7070406@ccs.neu.edu> I see dramatic differences in running times between the built-in list sequence and a naive implementation of list sequencing. What can I do to make this naive implementation run faster? (I have a cons-like structure I want to provide a prop:sequence for, but I would like it to be nearly as fast as the real cons if possible). Thanks, David #lang scheme (define ls (build-list 100000 (lambda (i) i))) (define (ls->seq ls) (make-do-sequence (lambda () (values first rest ls (compose not empty?) (lambda (p) true) (lambda (p v) true))))) (define seq (ls->seq ls)) (collect-garbage) (time (for ([i seq]) (void i))) (collect-garbage) (time (for ([i ls]) (void i))) cpu time: 2009 real time: 2032 gc time: 0 cpu time: 685 real time: 700 gc time: 0 From geoff at knauth.org Tue Apr 7 18:34:47 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Tue Apr 7 18:35:10 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> Message-ID: <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> On Apr 7, 2009, at 11:59, John Clements wrote: > Reading and writing Java is, by and large, boring. Boring code is > boring to write, and genuinely difficult to read without glossing > over details. This is an observation made by Yaron Minsky at his > Cam(e)l Trading talk at CMU. This resonated strongly for me, and > got pretty close to the root of what I think functional languages > are about: providing the abstraction tools to obviate the need for > Boring Code. > > Hence, the Anti-Boring Code League. I plan to make T-Shirts. > Anyone feel like improving the logo? Sign me up. I like the idea. Here's an alternate idea for a T- shirt. Gather all the Java code you can find, filter and sort it to produce a top 20 list of the most inane things people have to put again and again and again in their Java code, and then produce a tag map. Make that the background. At the center should be something that visually symbolizes extreme boredom. Put the red circle with the line through it over that image. Put the words "ban boring code" in some artsy font on the slanted line. BBC! I image-googled boredom. That was not easy. I came up with: - http://knauth.org/random/visualizing-boredom.html I'd like to see the Cam(e)l Trading talk, if it is available. Geoff From mflatt at cs.utah.edu Tue Apr 7 18:48:11 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Apr 7 18:48:31 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <49DBD481.7070406@ccs.neu.edu> References: <49DBD481.7070406@ccs.neu.edu> Message-ID: <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote: > I see dramatic differences in running times between the built-in list > sequence and a naive implementation of list sequencing. What can I do > to make this naive implementation run faster? If you use use `car', `cdr', and `pair? instead of `first', `rest', and `(compose not empty?)', you should get the same performance as for lists. I note that using `in-list' in the right-hand side of `for' is much faster than using a list directly. To get that kind of performance, you define a new form with `define-sequence-syntax'. From carl.eastlund at gmail.com Tue Apr 7 18:55:40 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Tue Apr 7 18:56:02 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> References: <49DBD481.7070406@ccs.neu.edu> <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> Message-ID: <990e0c030904071555v4a2d5653v6693a370d1268e35@mail.gmail.com> On Tue, Apr 7, 2009 at 6:48 PM, Matthew Flatt wrote: > At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote: >> I see dramatic differences in running times between the built-in list >> sequence and a naive implementation of list sequencing. ?What can I do >> to make this naive implementation run faster? > > If you use use `car', `cdr', and `pair? instead of `first', `rest', and > `(compose not empty?)', you should get the same performance as for > lists. I can certainly see why pair? will be faster than (compose not empty?), but why would car/cdr/pair?/null? be significantly faster than first/rest/cons?/empty? ? Is there extra contract wrapping or something? -- Carl Eastlund From clements at brinckerhoff.org Tue Apr 7 19:05:38 2009 From: clements at brinckerhoff.org (John Clements) Date: Tue Apr 7 19:06:18 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> Message-ID: <4A9FD2D4-6168-40C4-A8E9-89972EBF3857@brinckerhoff.org> On Apr 7, 2009, at 3:34 PM, Geoffrey S. Knauth wrote: > On Apr 7, 2009, at 11:59, John Clements wrote: > >> Reading and writing Java is, by and large, boring. Boring code is >> boring to write, and genuinely difficult to read without glossing >> over details. This is an observation made by Yaron Minsky at his >> Cam(e)l Trading talk at CMU. This resonated strongly for me, and >> got pretty close to the root of what I think functional languages >> are about: providing the abstraction tools to obviate the need for >> Boring Code. >> >> Hence, the Anti-Boring Code League. I plan to make T-Shirts. >> Anyone feel like improving the logo? > > Sign me up. I like the idea. Here's an alternate idea for a T- > shirt. Gather all the Java code you can find, filter and sort it to > produce a top 20 list of the most inane things people have to put > again and again and again in their Java code, and then produce a tag > map. Make that the background. At the center should be something > that visually symbolizes extreme boredom. Put the red circle with > the line through it over that image. Put the words "ban boring > code" in some artsy font on the slanted line. BBC! > > I image-googled boredom. That was not easy. I came up with: > - http://knauth.org/random/visualizing-boredom.html > > I'd like to see the Cam(e)l Trading talk, if it is available. Yes, it's online: http://ocaml.janestreet.com/?q=node/61 John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090407/fc40790c/smime.bin From dvanhorn at ccs.neu.edu Tue Apr 7 19:09:27 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Tue Apr 7 19:10:11 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> References: <49DBD481.7070406@ccs.neu.edu> <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> Message-ID: <49DBDD27.5050806@ccs.neu.edu> Matthew Flatt wrote: > At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote: >> I see dramatic differences in running times between the built-in list >> sequence and a naive implementation of list sequencing. What can I do >> to make this naive implementation run faster? > > If you use use `car', `cdr', and `pair? instead of `first', `rest', and > `(compose not empty?)', you should get the same performance as for > lists. This didn't improve the running time very much. It's still not nearly as fast as just a direct list value. Here are the timings for a list sequence built with car/cdr/pair?, a list-like structure sequence, a direct list, and an list in in-list: cpu time: 2036 real time: 2327 gc time: 0 cpu time: 2179 real time: 2387 gc time: 0 cpu time: 686 real time: 720 gc time: 0 cpu time: 690 real time: 694 gc time: 0 David #lang scheme (define ls (build-list 100000 (lambda (i) i))) (define-struct kons (first rest)) (define (ks->seq ks) (make-do-sequence (lambda () (values kons-first kons-rest ks kons? (lambda (p) true) (lambda (p v) true))))) (define ks (foldr make-kons empty ls)) (define (ls->seq ls) (make-do-sequence (lambda () (values car cdr ls pair? (lambda (p) true) (lambda (p v) true))))) (define lseq (ls->seq ls)) (define kseq (ks->seq ks)) (collect-garbage) (time (for ([i lseq]) i)) (collect-garbage) (time (for ([i kseq]) i)) (collect-garbage) (time (for ([i ls]) i)) (collect-garbage) (time (for ([i (in-list ls)]) i)) From mflatt at cs.utah.edu Tue Apr 7 19:09:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Apr 7 19:10:15 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <990e0c030904071555v4a2d5653v6693a370d1268e35@mail.gmail.com> References: <49DBD481.7070406@ccs.neu.edu> <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> <990e0c030904071555v4a2d5653v6693a370d1268e35@mail.gmail.com> Message-ID: <20090407230936.599A86500A8@mail-svr1.cs.utah.edu> At Tue, 7 Apr 2009 18:55:40 -0400, Carl Eastlund wrote: > On Tue, Apr 7, 2009 at 6:48 PM, Matthew Flatt wrote: > > At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote: > >> I see dramatic differences in running times between the built-in list > >> sequence and a naive implementation of list sequencing. ?What can I do > >> to make this naive implementation run faster? > > > > If you use use `car', `cdr', and `pair? instead of `first', `rest', and > > `(compose not empty?)', you should get the same performance as for > > lists. > > I can certainly see why pair? will be faster than (compose not > empty?), but why would car/cdr/pair?/null? be significantly faster > than first/rest/cons?/empty? ? Is there extra contract wrapping or > something? The `first' and `rest' functions work only on lists, so there's an extra test. The test is constant-time due to immutable pairs, but it's still extra compared to `car' and `cdr'. From eli at barzilay.org Tue Apr 7 19:14:41 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Apr 7 19:15:03 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <20090407230936.599A86500A8@mail-svr1.cs.utah.edu> References: <49DBD481.7070406@ccs.neu.edu> <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> <990e0c030904071555v4a2d5653v6693a370d1268e35@mail.gmail.com> <20090407230936.599A86500A8@mail-svr1.cs.utah.edu> Message-ID: <18907.56929.688964.90759@winooski.ccs.neu.edu> On Apr 7, Matthew Flatt wrote: > At Tue, 7 Apr 2009 18:55:40 -0400, Carl Eastlund wrote: > > > > I can certainly see why pair? will be faster than (compose not > > empty?), but why would car/cdr/pair?/null? be significantly faster > > than first/rest/cons?/empty? ? Is there extra contract wrapping > > or something? > > The `first' and `rest' functions work only on lists, so there's an > extra test. The test is constant-time due to immutable pairs, but > it's still extra compared to `car' and `cdr'. You can also see the effect of amortizing the `list?'-ness of a list. When I try out David's example I get the car/cdr version about 3.5 faster than the first/rest one, but when I run it 20 times, it's only 2.3 times faster. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From mflatt at cs.utah.edu Tue Apr 7 19:18:31 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Tue Apr 7 19:18:55 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <49DBDD27.5050806@ccs.neu.edu> References: <49DBD481.7070406@ccs.neu.edu> <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> <49DBDD27.5050806@ccs.neu.edu> Message-ID: <20090407231834.43090650085@mail-svr1.cs.utah.edu> At Tue, 07 Apr 2009 19:09:27 -0400, David Van Horn wrote: > Matthew Flatt wrote: > > At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote: > >> I see dramatic differences in running times between the built-in list > >> sequence and a naive implementation of list sequencing. What can I do > >> to make this naive implementation run faster? > > > > If you use use `car', `cdr', and `pair? instead of `first', `rest', and > > `(compose not empty?)', you should get the same performance as for > > lists. > > This didn't improve the running time very much. It's still not nearly > as fast as just a direct list value. > > Here are the timings for a list sequence built with car/cdr/pair?, a > list-like structure sequence, a direct list, and an list in in-list: > > cpu time: 2036 real time: 2327 gc time: 0 > cpu time: 2179 real time: 2387 gc time: 0 > cpu time: 686 real time: 720 gc time: 0 > cpu time: 690 real time: 694 gc time: 0 How are you running this (platform, environment, language, etc.)? I didn't pay attention to the scale of your numbers versus mine before, but even in DrScheme with debugging enabled in the Module language for v4.1.5 on Mac OS X, I get much smaller numbers: cpu time: 16 real time: 16 gc time: 0 cpu time: 20 real time: 25 gc time: 0 cpu time: 22 real time: 22 gc time: 0 cpu time: 1 real time: 1 gc time: 0 From eli at barzilay.org Tue Apr 7 19:23:52 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Apr 7 19:24:15 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <49DBDD27.5050806@ccs.neu.edu> References: <49DBD481.7070406@ccs.neu.edu> <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> <49DBDD27.5050806@ccs.neu.edu> Message-ID: <18907.57480.230470.251285@winooski.ccs.neu.edu> On Apr 7, David Van Horn wrote: > Matthew Flatt wrote: > > At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote: > >> I see dramatic differences in running times between the built-in list > >> sequence and a naive implementation of list sequencing. What can I do > >> to make this naive implementation run faster? > > > > If you use use `car', `cdr', and `pair? instead of `first', `rest', and > > `(compose not empty?)', you should get the same performance as for > > lists. > > This didn't improve the running time very much. It's still not nearly > as fast as just a direct list value. > > Here are the timings for a list sequence built with car/cdr/pair?, a > list-like structure sequence, a direct list, and an list in in-list: > > cpu time: 2036 real time: 2327 gc time: 0 > cpu time: 2179 real time: 2387 gc time: 0 > cpu time: 686 real time: 720 gc time: 0 > cpu time: 690 real time: 694 gc time: 0 I get comparable results for the car/cdr/pair? version. Actually, the surprising thing is that I get a significant improvement if I use `void' for the redundant predicates: #lang scheme (define ls (build-list 100000 (lambda (i) i))) (define (ls->seq ls) (make-do-sequence (lambda () (values car cdr ls pair? void void)))) (define seq (ls->seq ls)) (collect-garbage) (time (for* ([n (in-range 100)] [i seq]) (void i))) ;; cpu time: 493 real time: 494 gc time: 0 (collect-garbage) (time (for* ([n (in-range 100)] [i ls]) (void i))) ;; cpu time: 716 real time: 716 gc time: 0 -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From dvanhorn at ccs.neu.edu Tue Apr 7 19:27:06 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Tue Apr 7 19:27:34 2009 Subject: [plt-scheme] Making a fast list like sequence In-Reply-To: <20090407231834.43090650085@mail-svr1.cs.utah.edu> References: <49DBD481.7070406@ccs.neu.edu> <20090407224811.AD9306500A2@mail-svr1.cs.utah.edu> <49DBDD27.5050806@ccs.neu.edu> <20090407231834.43090650085@mail-svr1.cs.utah.edu> Message-ID: <49DBE14A.3040708@ccs.neu.edu> Matthew Flatt wrote: > At Tue, 07 Apr 2009 19:09:27 -0400, David Van Horn wrote: >> Matthew Flatt wrote: >>> At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote: >>>> I see dramatic differences in running times between the built-in list >>>> sequence and a naive implementation of list sequencing. What can I do >>>> to make this naive implementation run faster? >>> If you use use `car', `cdr', and `pair? instead of `first', `rest', and >>> `(compose not empty?)', you should get the same performance as for >>> lists. >> This didn't improve the running time very much. It's still not nearly >> as fast as just a direct list value. >> >> Here are the timings for a list sequence built with car/cdr/pair?, a >> list-like structure sequence, a direct list, and an list in in-list: >> >> cpu time: 2036 real time: 2327 gc time: 0 >> cpu time: 2179 real time: 2387 gc time: 0 >> cpu time: 686 real time: 720 gc time: 0 >> cpu time: 690 real time: 694 gc time: 0 > > How are you running this (platform, environment, language, etc.)? > > I didn't pay attention to the scale of your numbers versus mine before, > but even in DrScheme with debugging enabled in the Module language for > v4.1.5 on Mac OS X, I get much smaller numbers: > > cpu time: 16 real time: 16 gc time: 0 > cpu time: 20 real time: 25 gc time: 0 > cpu time: 22 real time: 22 gc time: 0 > cpu time: 1 real time: 1 gc time: 0 Ah... I had profiling turned on from a while back and forgot about that. I'm using 4.1.5.3-svn2apr2009, Module, Mac OS X, 512 mb memory limit. With profiling turned off, I see numbers similar to yours: cpu time: 23 real time: 28 gc time: 0 cpu time: 30 real time: 41 gc time: 0 cpu time: 19 real time: 20 gc time: 0 cpu time: 1 real time: 1 gc time: 0 David From pocmatos at gmail.com Tue Apr 7 19:55:39 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 7 19:56:16 2009 Subject: [plt-scheme] make-struct-type in typed scheme In-Reply-To: <63bb19ae0904071520r11db99e4mffab92da1520c0a7@mail.gmail.com> References: <11b141710904071505q48d2761al4fad6fd692a5c713@mail.gmail.com> <63bb19ae0904071510l3fd09c9bm4ee1e616ed8b527f@mail.gmail.com> <11b141710904071513o165f20aem2699ad543599a9ca@mail.gmail.com> <11b141710904071516y4faa910bme9e29335e318bc8e@mail.gmail.com> <63bb19ae0904071520r11db99e4mffab92da1520c0a7@mail.gmail.com> Message-ID: <11b141710904071655jf11d2c5v35457cec8638d5d7@mail.gmail.com> On Tue, Apr 7, 2009 at 10:20 PM, Sam TH wrote: > On Tue, Apr 7, 2009 at 6:16 PM, Paulo J. Matos wrote: >> On Tue, Apr 7, 2009 at 11:13 PM, Paulo J. Matos wrote: >>> On Tue, Apr 7, 2009 at 11:10 PM, Sam TH wrote: >>>> On Tue, Apr 7, 2009 at 6:05 PM, Paulo J. Matos wrote: >>>>> Hi all, >>>>> >>>>> Is there any way to use make-struct-type inside typed-scheme? If not, >>>>> is there a way to install a custom printer for a structure in >>>>> typed-scheme? >>>> >>>> No, and not at the moment, respectively. >>>> >>> >>> I can always define a structure with a custom printer in a scheme >>> module, then create another module that types the structure with >>> require/opaque-type and re-export it as if it had been typed by >>> typed-scheme, right? > > Yes. > >> here it would be require-typed-structure instead of >> require/opaque-type... right? > > Yes. ?In fact, `require-typed-struct' expands into `require/opaque-type'. > OK, thanks. :) > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From yminsky at janestcapital.com Tue Apr 7 22:20:08 2009 From: yminsky at janestcapital.com (yminsky) Date: Tue Apr 7 22:56:43 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> Message-ID: <61fc77c5ae015b6fb5b03a92d00971c9@janestcapital.com> On Tue, 7 Apr 2009 18:34:47 -0400, "Geoffrey S. Knauth" wrote: > I'd like to see the Cam(e)l Trading talk, if it is available. It is: http://ocaml.janestreet.com/?q=node/61 y From alexm at nus.edu.sg Tue Apr 7 23:29:05 2009 From: alexm at nus.edu.sg (alex mitchell) Date: Tue Apr 7 23:29:31 2009 Subject: [plt-scheme] Draggable panel divider? Message-ID: Hi, I'd like to be able to create a window with two panels which can be resized using a "draggable panel divider", similar to the divider between the Interactions and Definitions panels in the main DrScheme window. Has anyone implemented something like this which can be easily reused, such as a subclass of panel% ? I suppose the code is there somewhere in the DrScheme IDE code, but I couldn't find it. Pointers to where the code is would also be helpful. thanks, Alex From DekuDekuplex at Yahoo.com Tue Apr 7 23:36:01 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Tue Apr 7 23:36:40 2009 Subject: [plt-scheme] Re: No More Boring Code References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <399FBBD5-C37D-47B1-8AC3-3E816707A315-USm5ewCNdr/ECKqllllIWg@public.gmane.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> Message-ID: On Tue, 7 Apr 2009 18:34:47 -0400, "Geoffrey S. Knauth" wrote: >On Apr 7, 2009, at 11:59, John Clements wrote: > >> Reading and writing Java is, by and large, boring. Boring code is >> boring to write, and genuinely difficult to read without glossing >> over details. This is an observation made by Yaron Minsky at his >> Cam(e)l Trading talk at CMU. This resonated strongly for me, and >> got pretty close to the root of what I think functional languages >> are about: providing the abstraction tools to obviate the need for >> Boring Code. >> >> Hence, the Anti-Boring Code League. I plan to make T-Shirts. >> Anyone feel like improving the logo? > >Sign me up. I like the idea. Here's an alternate idea for a T- >shirt. Gather all the Java code you can find, filter and sort it to >produce a top 20 list of the most inane things people have to put >again and again and again in their Java code, and then produce a tag >map. Make that the background. At the center should be something >that visually symbolizes extreme boredom. Put the red circle with the >line through it over that image. Put the words "ban boring code" in >some artsy font on the slanted line. BBC! > >I image-googled boredom. That was not easy. I came up with: >- http://knauth.org/random/visualizing-boredom.html > >I'd like to see the Cam(e)l Trading talk, if it is available. I'm not an artist, and therefore I can only make suggestions, but how about an idea similar to the following: Since code tends to be boring if it both does not require any imagination, but is too difficult to be purely mechanical, divide the T-shirt image into two halves: a top half symbolizing boring code, and a bottom half symbolizing abstraction tools to obviate the need for Boring Code. Find an example of code that is very boring when written in Java, but can be abstracted into something very concise and interesting in PLT Scheme. For the top half of the background, put the boring Java code, and color that code in a light gray color to allow superimposing. Put the red circle with the line through it over that top half. For the bottom half, put the interesting PLT Scheme abstraction, and similarly color that code in the light gray color to allow superimposing. Over that bottom half, put the chart at the following URL, listed at Knauth's above-mentioned site, depicting the relation between boredom and task complexity: http://the-programmers-stone.com/wp-content/uploads/2008/05/MechBoredom.png In Zapfino (see http://en.wikipedia.org/wiki/Zapfino) cursive font, below the chart on the bottom half, put the phrase "Ban Boring Code!" -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From carl.eastlund at gmail.com Tue Apr 7 23:41:06 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Tue Apr 7 23:41:29 2009 Subject: [plt-scheme] Draggable panel divider? In-Reply-To: References: Message-ID: <990e0c030904072041t5659d455i381ee815de851467@mail.gmail.com> On Tue, Apr 7, 2009 at 11:29 PM, alex mitchell wrote: > Hi, > > I'd like to be able to create a window with two panels which can be resized > using a "draggable panel divider", similar to the divider between the > Interactions and Definitions panels in the main DrScheme window. Has anyone > implemented something like this which can be easily reused, such as a > subclass of panel% ? > > I suppose the code is there somewhere in the DrScheme IDE code, but I > couldn't find it. Pointers to where the code is would also be helpful. If you do a Help Desk search for "drag panel", you'll get the following hits: panel:dragable-mixin provided from framework panel:dragable<%> provided from framework panel:horizontal-dragable% provided from framework panel:horizontal-dragable-mixin provided from framework panel:horizontal-dragable<%> provided from framework panel:vertical-dragable% provided from framework panel:vertical-dragable-mixin provided from framework panel:vertical-dragable<%> provided from framework You probably want either panel:horizontal-dragable% or panel:vertical-dragable% for your purposes; here are the URLs to their online documentation: http://docs.plt-scheme.org/framework/Panel.html#(def._((lib._framework/main..ss)._panel~3ahorizontal-dragable~25)) http://docs.plt-scheme.org/framework/Panel.html#(def._((lib._framework/main..ss)._panel~3avertical-dragable~25)) Good luck! -- Carl Eastlund From alexm at nus.edu.sg Tue Apr 7 23:45:10 2009 From: alexm at nus.edu.sg (alex mitchell) Date: Tue Apr 7 23:46:03 2009 Subject: [plt-scheme] Draggable panel divider? In-Reply-To: <990e0c030904072041t5659d455i381ee815de851467@mail.gmail.com> Message-ID: That's perfect, thanks! Sorry for the spam, I must have missed this... Alex On 4/8/09 11:41 AM, "Carl Eastlund" wrote: > On Tue, Apr 7, 2009 at 11:29 PM, alex mitchell wrote: >> Hi, >> >> I'd like to be able to create a window with two panels which can be resized >> using a "draggable panel divider", similar to the divider between the >> Interactions and Definitions panels in the main DrScheme window. Has anyone >> implemented something like this which can be easily reused, such as a >> subclass of panel% ? >> >> I suppose the code is there somewhere in the DrScheme IDE code, but I >> couldn't find it. Pointers to where the code is would also be helpful. > > If you do a Help Desk search for "drag panel", you'll get the following hits: > > panel:dragable-mixin provided from framework > panel:dragable<%> provided from framework > panel:horizontal-dragable% provided from framework > panel:horizontal-dragable-mixin provided from framework > panel:horizontal-dragable<%> provided from framework > panel:vertical-dragable% provided from framework > panel:vertical-dragable-mixin provided from framework > panel:vertical-dragable<%> provided from framework > > You probably want either panel:horizontal-dragable% or > panel:vertical-dragable% for your purposes; here are the URLs to their > online documentation: > > http://docs.plt-scheme.org/framework/Panel.html#(def._((lib._framework/main..s > s)._panel~3ahorizontal-dragable~25)) > > http://docs.plt-scheme.org/framework/Panel.html#(def._((lib._framework/main..s > s)._panel~3avertical-dragable~25)) > > Good luck! From hendrik at topoi.pooq.com Tue Apr 7 23:46:12 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Tue Apr 7 23:48:51 2009 Subject: [plt-scheme] Re: No More Boring Code In-Reply-To: References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <399FBBD5-C37D-47B1-8AC3-3E816707A315-USm5ewCNdr/ECKqllllIWg@public.gmane.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> Message-ID: <20090408034612.GC2137@topoi.pooq.com> On Wed, Apr 08, 2009 at 12:36:01PM +0900, Benjamin L.Russell wrote: > > I'm not an artist, and therefore I can only make suggestions, but how > about an idea similar to the following: > > Since code tends to be boring if it both does not require any > imagination, but is too difficult to be purely mechanical, divide the > T-shirt image into two halves: a top half symbolizing boring code, > and a bottom half symbolizing abstraction tools to obviate the need > for Boring Code. > > Find an example of code that is very boring when written in Java, but > can be abstracted into something very concise and interesting in PLT > Scheme. > > For the top half of the background, put the boring Java code, and > color that code in a light gray color to allow superimposing. Put the > red circle with the line through it over that top half. > > For the bottom half, put the interesting PLT Scheme abstraction, and > similarly color that code in the light gray color to allow > superimposing. Isn't a green circle the symbol for something being allowed? Why not use that? -- hendrik From DekuDekuplex at Yahoo.com Wed Apr 8 00:27:46 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Wed Apr 8 00:28:30 2009 Subject: [plt-scheme] Re: No More Boring Code References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <399FBBD5-C37D-47B1-8AC3-3E816707A315-USm5ewCNdr/ECKqllllIWg@public.gmane.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> <20090408034612.GC2137@topoi.pooq.com> Message-ID: On Tue, 7 Apr 2009 23:46:12 -0400, hendrik@topoi.pooq.com wrote: >On Wed, Apr 08, 2009 at 12:36:01PM +0900, Benjamin L.Russell wrote: >> >> I'm not an artist, and therefore I can only make suggestions, but how >> about an idea similar to the following: >> >> Since code tends to be boring if it both does not require any >> imagination, but is too difficult to be purely mechanical, divide the >> T-shirt image into two halves: a top half symbolizing boring code, >> and a bottom half symbolizing abstraction tools to obviate the need >> for Boring Code. >> >> Find an example of code that is very boring when written in Java, but >> can be abstracted into something very concise and interesting in PLT >> Scheme. >> >> For the top half of the background, put the boring Java code, and >> color that code in a light gray color to allow superimposing. Put the >> red circle with the line through it over that top half. >> >> For the bottom half, put the interesting PLT Scheme abstraction, and >> similarly color that code in the light gray color to allow >> superimposing. > >Isn't a green circle the symbol for something being allowed? > >Why not use that? Okay, in that case, substitute the green circle for the chart. Alternatively, to keep the chart depicting the relation between boredom and task complexity, additionally move both halves down by a third of the height of the logo space, and put the chart vertically above the two halves. I.e., the top one-third would be the chart, the middle one-third would be the boring code with the red circle with the line though it superimposed, and the bottom one-third would be the interesting code with the green circle superimposed and the phrase "Ban Boring Code!" in Zapfino just below it. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From matthias at ccs.neu.edu Wed Apr 8 02:26:32 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Apr 8 02:27:55 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> Message-ID: <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> It might still be worth examining why TS uses so much memory. Type checking should be linear in space in the source code, though I suspect that this is not quite true when you use unions and other commutative/associative things that require extra work. But, type checking 3000 lines of code should never use 2GB. -- Matthias On Apr 7, 2009, at 3:51 PM, Sam TH wrote: > That's certainly quite a lot of memory use - and a lot of Typed > Scheme code! > > I don't know why it should take that much memory, but the one thing I > do recommend is compiling your files to byte code. DrScheme does this > automatically in some cases, and you can do it manually with 'mzc -k'. > Once the file is compiled, typechecking is complete, and subsequent > uses of that file should be much faster. For example, if you have > files A.ss, B.ss and C.ss, each of which depends on the preceding, > then if you are changing C.ss a lot, then > > % mzc -k A.ss B.ss > > will likely improve your speed/memory issues. > > If that doesn't help, let me know, and I'll try to see if there's > something in particular that's going wrong while typechecking your > code. > > sam th > > On Tue, Apr 7, 2009 at 3:45 PM, Paulo J. Matos > wrote: >> Hi, >> >> I have been using typed-scheme for a bit now and my code base in >> typed >> scheme is now involving [only] 4 modules with a total of 3000 loc. >> >> Unfortunately, though things have been pretty slow for me lately >> since >> evaluating the main module of my project takes something in the order >> of minutes requesting over 2Gb of memory. Since I [only] have 2 Gb of >> memory, swapping starts and things get even slower. >> >> About this I don't know what to do but it needs to be improved. I >> have >> taken a few screenshots so you can check how the memory evolves while >> drscheme is interpreting a typed-scheme module [svn 14441]: >> Idle: >> Values http://users.ecs.soton.ac.uk/pocm06r/values_idle.png >> Graph http://users.ecs.soton.ac.uk/pocm06r/graph_idle.png >> >> On Load: >> Values http://users.ecs.soton.ac.uk/pocm06r/values_load.png >> Graph http://users.ecs.soton.ac.uk/pocm06r/graph_load.png >> >> Note that I have mostly nothing else running besides the gnome >> desktop... I sincerely don't know what to do. I hope this is just a >> bug regarding memory handling and can be easily fixed. >> If I can provide more info on this so it can be analyzed please >> let me know. >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Wed Apr 8 05:03:42 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Wed Apr 8 05:04:01 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> Message-ID: On Tue, Apr 7, 2009 at 4:59 PM, John Clements wrote: > Hence, the Anti-Boring Code League. Code not Kafka! Functions not five-year plans! Programming Java feels like navigating a Soviet-era bureaucracy: So, you want to implement a class? Well, you'll need to implement this interface. Oh you've done that? I'm sorry, we require you edit this XML file. And on it goes... N. From pocmatos at gmail.com Wed Apr 8 05:23:42 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 8 05:24:21 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> Message-ID: <11b141710904080223r31bb9e06l39488189862c7075@mail.gmail.com> On Tue, Apr 7, 2009 at 7:51 PM, Sam TH wrote: > That's certainly quite a lot of memory use - and a lot of Typed Scheme code! > > I don't know why it should take that much memory, but the one thing I > do recommend is compiling your files to byte code. ?DrScheme does this > automatically in some cases, and you can do it manually with 'mzc -k'. > ?Once the file is compiled, typechecking is complete, and subsequent > uses of that file should be much faster. ?For example, if you have > files A.ss, B.ss and C.ss, each of which depends on the preceding, > then if you are changing C.ss a lot, then > > % mzc -k A.ss B.ss > > will likely improve your speed/memory issues. > > If that doesn't help, let me know, and I'll try to see if there's > something in particular that's going wrong while typechecking your > code. > Hi. Something must be wrong. mzc compiles the files to bytecode in less than 6 seconds (compared to more than a minute inside drscheme) and it takes 5% of my memory (compared to 100%). So the question is, what happens inside DrScheme that generates this issue? After compiling the files to bytecode interepreting my main module in DrScheme is a snap... so I guess this issue should be checked... Doesn't seem to be a problem particular to Typed-Scheme but something with the interaction between 'tools'. TypedScheme vs DrScheme. Maybe the Dr doesn't like it typed?!? ;) Cheers, Paulo Matos > sam th > > On Tue, Apr 7, 2009 at 3:45 PM, Paulo J. Matos wrote: >> Hi, >> >> I have been using typed-scheme for a bit now and my code base in typed >> scheme is now involving [only] 4 modules with a total of 3000 loc. >> >> Unfortunately, though things have been pretty slow for me lately since >> evaluating the main module of my project takes something in the order >> of minutes requesting over 2Gb of memory. Since I [only] have 2 Gb of >> memory, swapping starts and things get even slower. >> >> About this I don't know what to do but it needs to be improved. I have >> taken a few screenshots so you can check how the memory evolves while >> drscheme is interpreting a typed-scheme module [svn 14441]: >> Idle: >> Values http://users.ecs.soton.ac.uk/pocm06r/values_idle.png >> Graph http://users.ecs.soton.ac.uk/pocm06r/graph_idle.png >> >> On Load: >> Values http://users.ecs.soton.ac.uk/pocm06r/values_load.png >> Graph http://users.ecs.soton.ac.uk/pocm06r/graph_load.png >> >> Note that I have mostly nothing else running besides the gnome >> desktop... I sincerely don't know what to do. I hope this is just a >> bug regarding memory handling and can be easily fixed. >> If I can provide more info on this so it can be analyzed please let me know. >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Wed Apr 8 05:25:15 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 8 05:25:52 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> Message-ID: <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> On Wed, Apr 8, 2009 at 6:26 AM, Matthias Felleisen wrote: > > It might still be worth examining why TS uses so much memory. > Type checking should be linear in space in the source code, > though I suspect that this is not quite true when you use > unions and other commutative/associative things that require > extra work. But, type checking 3000 lines of code should > never use 2GB. -- Matthias > > It seems it doesn't take that much space (if you use mzc)... I guess there's something wrong between typed-scheme and drscheme. Let me know what kind of debug I can provide to aid in your search for a problem [I have no problems in sending you the files I am working on, if you wish]. Cheers, Paulo Matos > > > > On Apr 7, 2009, at 3:51 PM, Sam TH wrote: > >> That's certainly quite a lot of memory use - and a lot of Typed Scheme >> code! >> >> I don't know why it should take that much memory, but the one thing I >> do recommend is compiling your files to byte code. ?DrScheme does this >> automatically in some cases, and you can do it manually with 'mzc -k'. >> ?Once the file is compiled, typechecking is complete, and subsequent >> uses of that file should be much faster. ?For example, if you have >> files A.ss, B.ss and C.ss, each of which depends on the preceding, >> then if you are changing C.ss a lot, then >> >> % mzc -k A.ss B.ss >> >> will likely improve your speed/memory issues. >> >> If that doesn't help, let me know, and I'll try to see if there's >> something in particular that's going wrong while typechecking your >> code. >> >> sam th >> >> On Tue, Apr 7, 2009 at 3:45 PM, Paulo J. Matos wrote: >>> >>> Hi, >>> >>> I have been using typed-scheme for a bit now and my code base in typed >>> scheme is now involving [only] 4 modules with a total of 3000 loc. >>> >>> Unfortunately, though things have been pretty slow for me lately since >>> evaluating the main module of my project takes something in the order >>> of minutes requesting over 2Gb of memory. Since I [only] have 2 Gb of >>> memory, swapping starts and things get even slower. >>> >>> About this I don't know what to do but it needs to be improved. I have >>> taken a few screenshots so you can check how the memory evolves while >>> drscheme is interpreting a typed-scheme module [svn 14441]: >>> Idle: >>> Values http://users.ecs.soton.ac.uk/pocm06r/values_idle.png >>> Graph http://users.ecs.soton.ac.uk/pocm06r/graph_idle.png >>> >>> On Load: >>> Values http://users.ecs.soton.ac.uk/pocm06r/values_load.png >>> Graph http://users.ecs.soton.ac.uk/pocm06r/graph_load.png >>> >>> Note that I have mostly nothing else running besides the gnome >>> desktop... I sincerely don't know what to do. I hope this is just a >>> bug regarding memory handling and can be easily fixed. >>> If I can provide more info on this so it can be analyzed please let me >>> know. >>> >>> Cheers, >>> >>> -- >>> Paulo Jorge Matos - pocmatos at gmail.com >>> Webpage: http://www.personal.soton.ac.uk/pocm >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> >> >> -- >> sam th >> samth@ccs.neu.edu >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Wed Apr 8 05:33:27 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 8 05:34:11 2009 Subject: [plt-scheme] Typed-Scheme, cond, match and wierd behaviour with non-disjoint types In-Reply-To: <81addec70904071238y1a98cd3bk8f822c76c30e0e89@mail.gmail.com> References: <11b141710904071215x47e6cbafv114b360040896ec1@mail.gmail.com> <81addec70904071238y1a98cd3bk8f822c76c30e0e89@mail.gmail.com> Message-ID: <11b141710904080233s22cd9a43u8f6200036062e429@mail.gmail.com> On Tue, Apr 7, 2009 at 7:38 PM, Anthony Cowley wrote: > On Tue, Apr 7, 2009 at 3:15 PM, Paulo J. Matos wrote: >> Hi, >> >> I met yet another issue. But to build up the context, lets define >> something that works as expected. > > Paulo, > > It's not entirely clear what the issue is with the function that needs > a mytype2. Does the following do what you want? > Hi, Thanks for your reply which indeed works and then I thought I had found another small example showing why mine is not working yet but didn't yet. Still, this module has a couple of features unsupported in typed-scheme so I will just keep it untyped and type it when typed-scheme supports more features. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From sbloch at adelphi.edu Tue Apr 7 08:56:26 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Wed Apr 8 08:27:16 2009 Subject: [plt-scheme] Re: HtDP 12.4.2 question details In-Reply-To: References: <756daca50904030452w67781f72x3c2a320c819722b5@mail.gmail.com> <9b1fff280904041004u47facb11h16e3a0a5979bf027@mail.gmail.com> <186df66b0904041144u7c4b1313v377c0d43d464312a@mail.gmail.com> <756daca50904042203j1e89ff85h26120ef6907c4a5b@mail.gmail.com> Message-ID: <73E15C39-7702-4BD7-AE43-FD639EF66F6C@adelphi.edu> On Apr 7, 2009, at 0:10, mike wrote: > For the professors out there; I cruised through sec12 until i got > to problem 12.4.2(spent hours and i just don't get it!!).I just want > to move on but my question is : Is 12.4.2 a pivotal problem in gauging > one's understanding of the design recipe??? Does failure to solve the > problem indicate a serious flaw in understanding that will impede > under-standing of subsequent sections of the book? The short answer, unfortunately, is "yes". Nothing else depends *directly* on 12.4.2, but that problem is a real test of how well you've internalized the design recipe. Make sure you've got all the input and output datatypes right (they can be confusing in this problem), make sure you've got a good suite of test cases (to many of which the "right answer" isn't what you think at first), fill out the function template, pick a not-too-simple example and write the value of each template item for that example, and ask yourself how to combine the values you've got to get the "right answer" for that example. This will probably require a helper function; lather, rinse, repeat. The exercise really will teach you a lot. Steve Bloch From mflatt at cs.utah.edu Wed Apr 8 08:54:27 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Apr 8 08:54:50 2009 Subject: [plt-scheme] Pasteboard in pasteboard and the error: here: I am In-Reply-To: <49D7C01C.1030404@soegaard.net> References: <49D7C01C.1030404@soegaard.net> Message-ID: <20090408125429.73CB16500C6@mail-svr1.cs.utah.edu> At Sat, 04 Apr 2009 22:16:28 +0200, Jens Axel Soegaard wrote: > Can anyone provide a simple example of a > pasteboard containing another pasteboard? > Preferably where the containing pasteboard > is diplayable (via an editor-snip) in the DrScheme REPL? Like this? (let ([pb1 (new pasteboard%)] [pb2 (new pasteboard%)]) (send pb1 insert (new editor-snip% [editor pb2]) 0 0) (let ([e (new editor-snip% [editor pb1])]) (send e resize 100 100) e)) > Anyways, while playing I came upon this error, > > here: I am > > which, well, is not too informative. > > What does it mean, and why does it occur? Based on the surrounding `when' in the source, I've changed the error message to allotted width or height is not positive But the root of the problem seems to be in adding to a column without first putting the column's snip into an editor (and so that's still not a good error message). I hacked `column->snip' like this: (define (column->snip col frame canvas parent) (let* ([pasteboard (new vertical-pasteboard%)] [editor-snip (new aligned-editor-snip% [editor pasteboard] [min-width 1] [min-height 1])] [frame (if frame frame (new frame% [label "never shown, needed by canvas"]))] [canvas (if canvas canvas (new aligned-editor-canvas% [parent frame] [editor pasteboard]))]) (when parent (send parent insert editor-snip)) (insert-snips pasteboard (reverse (map (lambda (e) (element->snip e frame canvas pasteboard)) (column-elements col)))) (realign pasteboard) editor-snip)) and `element->snip' propagates the parent in the obvious way, while `column-write' supplies #f as the parent. That seems to make it work. From mflatt at cs.utah.edu Wed Apr 8 08:59:41 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Apr 8 09:00:07 2009 Subject: [plt-scheme] cue-text% In-Reply-To: <49D7CDFA.7070504@soegaard.net> References: <49D7CDFA.7070504@soegaard.net> Message-ID: <20090408125943.3F5E365009C@mail-svr1.cs.utah.edu> It appears that `cue-text%' doesn't override `copy-self', so you get a plain `text%' back. I've added an overriding `copy-self' in SVN. At Sat, 04 Apr 2009 23:15:38 +0200, Jens Axel Soegaard wrote: > A cue-text: > > Gives a text% an instantiation argument of a string that is displayed > in the text% initially in grey; the text disappears when the text gets > focus. This technique is useful for labeling texts without needing to > take up space. > > If I put the cue-text into an editor-snip%, the cue is not cleared. > Is this a bug, or is this to be expected? > > #lang scheme/gui > (require embedded-gui framework) > (new editor-snip% > [editor (new cue-text% (cue-text "Hello World"))]) > > Note, that if the cue-text is displayed in its own frame, then > the cue is cleared: > > #lang scheme/gui > (require embedded-gui framework) > > (define f (new frame% (label "f") (width 400) (height 400))) > (define e (new text%)) > (define c (new editor-canvas% (editor e) (parent f))) > (define t (new cue-text% (cue-text "Hello, World!"))) > (define s (new editor-snip% (editor t))) > (send e insert s) > (send f show #t) > > > > -- > Jens Axel S?gaard > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From carl.eastlund at gmail.com Wed Apr 8 09:09:51 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Wed Apr 8 09:10:10 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> Message-ID: <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> On Wed, Apr 8, 2009 at 5:25 AM, Paulo J. Matos wrote: > On Wed, Apr 8, 2009 at 6:26 AM, Matthias Felleisen wrote: >> >> It might still be worth examining why TS uses so much memory. >> Type checking should be linear in space in the source code, >> though I suspect that this is not quite true when you use >> unions and other commutative/associative things that require >> extra work. But, type checking 3000 lines of code should >> never use 2GB. -- Matthias > > It seems it doesn't take that much space (if you use mzc)... > I guess there's something wrong between typed-scheme and drscheme. > Let me know what kind of debug I can provide to aid in your search for > a problem [I have no problems in sending you the files I am working > on, if you wish]. Paulo, Have you tried writing untyped versions of the modules and compiling/running those? That would be a quick way to see whether Typed Scheme is involved in this issue or not. It could always be some other artifact of your code causing the blow-up in space and time. --Carl From robby at eecs.northwestern.edu Wed Apr 8 09:18:04 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Apr 8 09:18:26 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> Message-ID: <932b2f1f0904080618r41516c97g54909da9ce363380@mail.gmail.com> Is profiling turned on? (or maybe try disabling debugging?) Robby On Wednesday, April 8, 2009, Carl Eastlund wrote: > On Wed, Apr 8, 2009 at 5:25 AM, Paulo J. Matos wrote: >> On Wed, Apr 8, 2009 at 6:26 AM, Matthias Felleisen wrote: >>> >>> It might still be worth examining why TS uses so much memory. >>> Type checking should be linear in space in the source code, >>> though I suspect that this is not quite true when you use >>> unions and other commutative/associative things that require >>> extra work. But, type checking 3000 lines of code should >>> never use 2GB. -- Matthias >> >> It seems it doesn't take that much space (if you use mzc)... >> I guess there's something wrong between typed-scheme and drscheme. >> Let me know what kind of debug I can provide to aid in your search for >> a problem [I have no problems in sending you the files I am working >> on, if you wish]. > > Paulo, > > Have you tried writing untyped versions of the modules and > compiling/running those? ?That would be a quick way to see whether > Typed Scheme is involved in this issue or not. ?It could always be > some other artifact of your code causing the blow-up in space and > time. > > --Carl > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From pocmatos at gmail.com Wed Apr 8 09:46:11 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 8 09:46:47 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> Message-ID: <11b141710904080646nb07928fmb21cb60e694754a1@mail.gmail.com> On Wed, Apr 8, 2009 at 1:09 PM, Carl Eastlund wrote: > On Wed, Apr 8, 2009 at 5:25 AM, Paulo J. Matos wrote: >> On Wed, Apr 8, 2009 at 6:26 AM, Matthias Felleisen wrote: >>> >>> It might still be worth examining why TS uses so much memory. >>> Type checking should be linear in space in the source code, >>> though I suspect that this is not quite true when you use >>> unions and other commutative/associative things that require >>> extra work. But, type checking 3000 lines of code should >>> never use 2GB. -- Matthias >> >> It seems it doesn't take that much space (if you use mzc)... >> I guess there's something wrong between typed-scheme and drscheme. >> Let me know what kind of debug I can provide to aid in your search for >> a problem [I have no problems in sending you the files I am working >> on, if you wish]. > > Paulo, > > Have you tried writing untyped versions of the modules and > compiling/running those? For that I would need to change the code again to untyped and that would be some work... which unfortunately I can't take the time to do now. > That would be a quick way to see whether > Typed Scheme is involved in this issue or not. ?It could always be > some other artifact of your code causing the blow-up in space and > time. > And it would happen under mzc? > --Carl > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Wed Apr 8 09:54:02 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 8 09:54:41 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <932b2f1f0904080618r41516c97g54909da9ce363380@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> <932b2f1f0904080618r41516c97g54909da9ce363380@mail.gmail.com> Message-ID: <11b141710904080654p4e65e9ebqa24f125a7671cd1c@mail.gmail.com> On Wed, Apr 8, 2009 at 1:18 PM, Robby Findler wrote: > Is profiling turned on? (or maybe try disabling debugging?) > You're right... debugging was enabled. Without debugging the performance is similar as mzc compilation. But with debugging on, my PC just goes nuts. Since I started working on this I had to increase my swap from 512Mb to 4.5Gb because my machine would just stop after DrScheme consumed all of the 2Gb of memory and the 512Mb of swap... > Robby > > On Wednesday, April 8, 2009, Carl Eastlund wrote: >> On Wed, Apr 8, 2009 at 5:25 AM, Paulo J. Matos wrote: >>> On Wed, Apr 8, 2009 at 6:26 AM, Matthias Felleisen wrote: >>>> >>>> It might still be worth examining why TS uses so much memory. >>>> Type checking should be linear in space in the source code, >>>> though I suspect that this is not quite true when you use >>>> unions and other commutative/associative things that require >>>> extra work. But, type checking 3000 lines of code should >>>> never use 2GB. -- Matthias >>> >>> It seems it doesn't take that much space (if you use mzc)... >>> I guess there's something wrong between typed-scheme and drscheme. >>> Let me know what kind of debug I can provide to aid in your search for >>> a problem [I have no problems in sending you the files I am working >>> on, if you wish]. >> >> Paulo, >> >> Have you tried writing untyped versions of the modules and >> compiling/running those? ?That would be a quick way to see whether >> Typed Scheme is involved in this issue or not. ?It could always be >> some other artifact of your code causing the blow-up in space and >> time. >> >> --Carl >> _________________________________________________ >> ??For list-related administrative tasks: >> ??http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From matthias at ccs.neu.edu Wed Apr 8 09:56:11 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Apr 8 09:57:49 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <11b141710904080654p4e65e9ebqa24f125a7671cd1c@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> <932b2f1f0904080618r41516c97g54909da9ce363380@mail.gmail.com> <11b141710904080654p4e65e9ebqa24f125a7671cd1c@mail.gmail.com> Message-ID: <73552B6C-BA78-4529-BED9-CC2DC65C6B81@ccs.neu.edu> So is the memory consumption all due to the debugging mode? That sounds bad, too -- Matthias On Apr 8, 2009, at 9:54 AM, Paulo J. Matos wrote: > On Wed, Apr 8, 2009 at 1:18 PM, Robby Findler > wrote: >> Is profiling turned on? (or maybe try disabling debugging?) >> > > You're right... debugging was enabled. Without debugging the > performance is similar as mzc compilation. But with debugging on, my > PC just goes nuts. Since I started working on this I had to increase > my swap from 512Mb to 4.5Gb because my machine would just stop after > DrScheme consumed all of the 2Gb of memory and the 512Mb of swap... > >> Robby >> >> On Wednesday, April 8, 2009, Carl Eastlund >> wrote: >>> On Wed, Apr 8, 2009 at 5:25 AM, Paulo J. Matos >>> wrote: >>>> On Wed, Apr 8, 2009 at 6:26 AM, Matthias Felleisen >>>> wrote: >>>>> >>>>> It might still be worth examining why TS uses so much memory. >>>>> Type checking should be linear in space in the source code, >>>>> though I suspect that this is not quite true when you use >>>>> unions and other commutative/associative things that require >>>>> extra work. But, type checking 3000 lines of code should >>>>> never use 2GB. -- Matthias >>>> >>>> It seems it doesn't take that much space (if you use mzc)... >>>> I guess there's something wrong between typed-scheme and drscheme. >>>> Let me know what kind of debug I can provide to aid in your >>>> search for >>>> a problem [I have no problems in sending you the files I am working >>>> on, if you wish]. >>> >>> Paulo, >>> >>> Have you tried writing untyped versions of the modules and >>> compiling/running those? That would be a quick way to see whether >>> Typed Scheme is involved in this issue or not. It could always be >>> some other artifact of your code causing the blow-up in space and >>> time. >>> >>> --Carl >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm From grettke at acm.org Wed Apr 8 10:18:51 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Apr 8 10:19:13 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> Message-ID: <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> Could a fun no-boring-code Scheme t-shirt be made without putting Java or any other language on it? Why bother wasting space with that thing you don't like be it Java or .NET or C++ or whatever? I wonder what percentage of PLT list folks make a living on those languages anyway :). From samth at ccs.neu.edu Wed Apr 8 11:05:16 2009 From: samth at ccs.neu.edu (Sam TH) Date: Wed Apr 8 11:05:34 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <11b141710904080646nb07928fmb21cb60e694754a1@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> <11b141710904080646nb07928fmb21cb60e694754a1@mail.gmail.com> Message-ID: <63bb19ae0904080805r5d4ea19by5dada72c00b67223@mail.gmail.com> On Wed, Apr 8, 2009 at 9:46 AM, Paulo J. Matos wrote: > >> Have you tried writing untyped versions of the modules and >> compiling/running those? > > For that I would need to change the code again to untyped and that > would be some work... which unfortunately I can't take the time to do > now. You can use the `typed-scheme/no-check' language to get the syntax of Typed Scheme without the typechecking, which would allow you to benchmark in this case. -- sam th samth@ccs.neu.edu From erich at snafu.de Wed Apr 8 11:12:59 2009 From: erich at snafu.de (Erich Rast) Date: Wed Apr 8 11:06:54 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> Message-ID: <1239203579.10062.3.camel@darkstar> Am Mittwoch, den 08.04.2009, 09:18 -0500 schrieb Grant Rettke: > Could a fun no-boring-code Scheme t-shirt be made without putting Java > or any other language on it? Oh...you've spoiled the fun. I was about to suggest "Too much Java doesn't help your thinking Scheme" as a slogan, but I'm not sure whether it's proper English. --Erich From pocmatos at gmail.com Wed Apr 8 12:40:25 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Wed Apr 8 12:41:03 2009 Subject: [plt-scheme] Typed-Scheme Memory Issues In-Reply-To: <63bb19ae0904080805r5d4ea19by5dada72c00b67223@mail.gmail.com> References: <11b141710904071245y2ce6f6a5pc6ccb2f090384198@mail.gmail.com> <63bb19ae0904071251m44b1eef5x3fb5a07a4450973f@mail.gmail.com> <2A42BFA4-7382-4B95-A6D0-E7451C90FF5B@ccs.neu.edu> <11b141710904080225h32ea45ddu4b05710e2fb0ee89@mail.gmail.com> <990e0c030904080609q35a6d871q29eff63df11d4f2f@mail.gmail.com> <11b141710904080646nb07928fmb21cb60e694754a1@mail.gmail.com> <63bb19ae0904080805r5d4ea19by5dada72c00b67223@mail.gmail.com> Message-ID: <11b141710904080940r56002e15i80fcdfd14e902824@mail.gmail.com> On Wed, Apr 8, 2009 at 4:05 PM, Sam TH wrote: > On Wed, Apr 8, 2009 at 9:46 AM, Paulo J. Matos wrote: >> >>> Have you tried writing untyped versions of the modules and >>> compiling/running those? >> >> For that I would need to change the code again to untyped and that >> would be some work... which unfortunately I can't take the time to do >> now. > > You can use the `typed-scheme/no-check' language to get the syntax of > Typed Scheme without the typechecking, which would allow you to > benchmark in this case. > I will try that. Thanks, Paulo Matos > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From clements at brinckerhoff.org Wed Apr 8 13:49:52 2009 From: clements at brinckerhoff.org (John Clements) Date: Wed Apr 8 13:50:28 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: On Apr 7, 2009, at 2:01 PM, Jay McCarthy wrote: > For dirt simple XML tasks, I use the xml collect. > > If I want to use obvious XPath queries, like when I am polling a Web > service, I use SXML and the SXPath implementation. Otherwise, I just > use the xml collect, convert to an xexpr, and write the query by hand. To clarify for those at home: when you refer to "SXML and SXPath", you're referring to the same PLaneT code that Jim Bender's referring to as "SSAX", AFAICT. John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090408/dc684411/smime.bin From clements at brinckerhoff.org Wed Apr 8 14:01:41 2009 From: clements at brinckerhoff.org (John Clements) Date: Wed Apr 8 14:02:02 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> Message-ID: <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> On Apr 8, 2009, at 7:18 AM, Grant Rettke wrote: > Could a fun no-boring-code Scheme t-shirt be made without putting Java > or any other language on it? > > Why bother wasting space with that thing you don't like be it Java or > .NET or C++ or whatever? Honestly, this has nothing to do with Scheme. There are *lots* of languages out there that have the abstraction tools available to get rid of the boring junk; Haskell, ML, Scheme, LISP, etc. In a perfect world, I'd like to create a rallying cry for *all* proponents of functional programming. "We Hate Boilerplate!" ... or something like that. Thanks! John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090408/45547e72/smime.bin From jacobm at gmail.com Wed Apr 8 16:10:25 2009 From: jacobm at gmail.com (Jacob Matthews) Date: Wed Apr 8 16:10:49 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: <46b603df0904081310r5121f888of0e31f7d62709412@mail.gmail.com> Unfortunately, the XML collection's lack of namespace-awareness is a deal-breaker for some of my current uses. I'd be very happy if it supported namespace-ey features, since I otherwise don't need fancier machinery. -jacob On Tue, Apr 7, 2009 at 2:01 PM, Jay McCarthy wrote: > For dirt simple XML tasks, I use the xml collect. > > If I want to use obvious XPath queries, like when I am polling a Web > service, I use SXML and the SXPath implementation. Otherwise, I just > use the xml collect, convert to an xexpr, and write the query by hand. > > Jay > > -- > 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 jmj at fellowhuman.com Wed Apr 8 17:40:59 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Wed Apr 8 17:41:15 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <6A257567-E4CC-4F79-B3E8-D10CE9F84009@sonic.net> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> <6A257567-E4CC-4F79-B3E8-D10CE9F84009@sonic.net> Message-ID: On Apr 7, 2009, at 3:34 PM, Geoffrey S. Knauth wrote: >> ...Hence, the Anti-Boring Code League. I plan to make T-Shirts. >> Anyone feel like improving the logo? > > Sign me up. I like the idea. Here's an alternate idea for a T- > shirt. Gather all the Java code you can find, filter and sort it > to produce a top 20 list of the most inane things people have to > put again and again and again in their Java code, and then produce > a tag map. Make that the background. At the center should be > something that visually symbolizes extreme boredom. Put the red > circle with the line through it over that image. Put the words > "ban boring code" in some artsy font on the slanted line. BBC! First thing that popped into my head, for the background: Get a dense block of code, color it grey, and selectively color characters black (or red?) to spell (in bigger words, a la DrScheme's "Insert Large Letters") "blah blah blah"... jmj From dvanhorn at ccs.neu.edu Wed Apr 8 20:05:58 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Wed Apr 8 20:06:32 2009 Subject: [plt-scheme] build-list for large lists Message-ID: <49DD3BE6.7050608@ccs.neu.edu> I was doing some benchmarking of my random-access list package and found that its build-list often outperformed scheme/base's build-list function for constructing large lists, which seemed curious. My data representation for a list is a list of complete binary trees, and build-list boils down to build-tree, which is defined by recursion on the size of the tree. I thought perhaps the performance boost was due to using recursion rather than iteration and reverse as done in scheme/base build-list, so I did some comparisons with a recursive definition of build-list, which indeed does better on large lists. Finally, the tree-based version still outperforms both the recursive build-list and the iterative build-list for really large lists. I'm not sure why. Anyway, I thought these numbers might be of interest. David #lang scheme (require (prefix-in ra: (planet dvanhorn/ralist:1:6))) (require (prefix-in mz: scheme/base)) (define (my:build-list i f) (let recr ([j 0] [i i]) (cond [(zero? i) empty] [else (cons (f j) (recr (add1 j) (sub1 i)))]))) (define id (lambda (i) i)) (define-syntax times (syntax-rules () ((times n e) (begin (collect-garbage) (time (for ([i (in-range n)]) e)))))) (let ((n 500000)) (times 5 (mz:build-list n id)) (times 5 (ra:build-list n id)) (times 5 (my:build-list n id))) ;; cpu time: 5482 real time: 5490 gc time: 5267 ;; cpu time: 836 real time: 858 gc time: 76 ;; cpu time: 392 real time: 429 gc time: 76 (let ((n 10000000)) (times 1 (mz:build-list n id)) (times 1 (ra:build-list n id)) (times 1 (my:build-list n id))) ;; cpu time: 7241 real time: 7271 gc time: 6367 ;; cpu time: 4920 real time: 4959 gc time: 1953 ;; cpu time: 5248 real time: 5283 gc time: 3305 From mflatt at cs.utah.edu Wed Apr 8 20:58:23 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Apr 8 20:58:46 2009 Subject: [plt-scheme] build-list for large lists In-Reply-To: <49DD3BE6.7050608@ccs.neu.edu> References: <49DD3BE6.7050608@ccs.neu.edu> Message-ID: <20090409005825.EC9C26500BE@mail-svr1.cs.utah.edu> At Wed, 08 Apr 2009 20:05:58 -0400, David Van Horn wrote: > I thought perhaps the performance boost was due to using recursion > rather than iteration and reverse as done in scheme/base build-list, so > I did some comparisons with a recursive definition of build-list, which > indeed does better on large lists. Yes. It's because the JIT builds a compact continuation (represented mostly as an array) that the GC can traverse more quickly than a list. > Finally, the tree-based version still outperforms both the recursive > build-list and the iterative build-list for really large lists. I'm not > sure why. Here's my theory: Although (deep) recursion is better than building a list and reversing it, shallow recursion is still better than very deep recursion. > Anyway, I thought these numbers might be of interest. Yes, thanks! I've committed your `my:build-list' as `build-list'. From hendrik at topoi.pooq.com Wed Apr 8 21:29:15 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Wed Apr 8 21:31:57 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <1239203579.10062.3.camel@darkstar> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <1239203579.10062.3.camel@darkstar> Message-ID: <20090409012915.GA9201@topoi.pooq.com> On Wed, Apr 08, 2009 at 04:12:59PM +0100, Erich Rast wrote: > Am Mittwoch, den 08.04.2009, 09:18 -0500 schrieb Grant Rettke: > > Could a fun no-boring-code Scheme t-shirt be made without putting Java > > or any other language on it? > > Oh...you've spoiled the fun. I was about to suggest "Too much Java > doesn't help your thinking Scheme" as a slogan, but I'm not sure whether > it's proper English. You know, of course, that Scheme was invented to replace several AI langauges whose names were in a similar semantic domain -- Planner and Conniver. -- hendrik From hendrik at topoi.pooq.com Wed Apr 8 21:30:52 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Wed Apr 8 21:33:34 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> Message-ID: <20090409013051.GB9201@topoi.pooq.com> On Wed, Apr 08, 2009 at 11:01:41AM -0700, John Clements wrote: > > Honestly, this has nothing to do with Scheme. There are *lots* of > languages out there that have the abstraction tools available to get > rid of the boring junk; Haskell, ML, Scheme, LISP, etc. In a perfect > world, I'd like to create a rallying cry for *all* proponents of > functional programming. And the abstraction tools aren't even in conceptual conflict with imperative programming. Why *do* all those languages leave tnem out? -- hendrik From dvanhorn at ccs.neu.edu Wed Apr 8 21:56:45 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Wed Apr 8 21:57:09 2009 Subject: [plt-scheme] build-list for large lists In-Reply-To: <20090409005825.EC9C26500BE@mail-svr1.cs.utah.edu> References: <49DD3BE6.7050608@ccs.neu.edu> <20090409005825.EC9C26500BE@mail-svr1.cs.utah.edu> Message-ID: <49DD55DD.8040406@ccs.neu.edu> Matthew Flatt wrote: > I've committed your `my:build-list' as `build-list'. What is the value in having build-list being specified to apply its function in order? If you drop that requirement, then an iterative version substantially outperforms all the other options. I can't think of a case where I've depended on build-list being applied in order. Anyway, here's a comparison with that option included. It also benchmarks building smaller lists. David #lang scheme (require (prefix-in ra: (planet dvanhorn/ralist:1:6))) (require (prefix-in mz: scheme/base)) (define (my:build-list i f) (let recr ([j 0] [i i]) (cond [(zero? i) empty] [else (cons (f j) (recr (add1 j) (sub1 i)))]))) (define (it:build-list i f) (let loop ([i (sub1 i)] [a empty]) (cond [(< i 0) a] [else (loop (sub1 i) (cons (f i) a))]))) (define id (lambda (i) i)) (define-syntax times (syntax-rules () ((times n e) (begin (collect-garbage) (time (for ([i (in-range n)]) e)))))) (let ((n 5000)) (times 500 (mz:build-list n id)) (times 500 (ra:build-list n id)) (times 500 (my:build-list n id)) (times 500 (it:build-list n id))) ;; cpu time: 843 real time: 853 gc time: 640 ;; cpu time: 764 real time: 794 gc time: 14 ;; cpu time: 184 real time: 209 gc time: 11 ;; cpu time: 133 real time: 136 gc time: 11 (let ((n 500000)) (times 5 (mz:build-list n id)) (times 5 (ra:build-list n id)) (times 5 (my:build-list n id)) (times 5 (it:build-list n id))) ;; cpu time: 873 real time: 880 gc time: 674 ;; cpu time: 806 real time: 836 gc time: 50 ;; cpu time: 297 real time: 323 gc time: 28 ;; cpu time: 147 real time: 155 gc time: 22 (let ((n 10000000)) (times 1 (mz:build-list n id)) (times 1 (ra:build-list n id)) (times 1 (my:build-list n id)) (times 1 (it:build-list n id))) ;; cpu time: 6421 real time: 6484 gc time: 5604 ;; cpu time: 7360 real time: 7452 gc time: 4420 ;; cpu time: 5426 real time: 5475 gc time: 3640 ;; cpu time: 3765 real time: 3818 gc time: 3233 From neil at neilvandyke.org Wed Apr 8 22:03:51 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Wed Apr 8 22:04:47 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <46b603df0904081310r5121f888of0e31f7d62709412@mail.gmail.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> <46b603df0904081310r5121f888of0e31f7d62709412@mail.gmail.com> Message-ID: <49DD5787.3080901@neilvandyke.org> Coincidentally, I'm working on some XML SRFIs right now. Everyone, please let me know any wishlist features you have for namespace support and such. For namespaces, I was thinking the default XML parser would represent all names with full qualification, and there would be an option to specify namespace names, very similar to what SSAX does. Neil Jacob Matthews wrote at 04/08/2009 04:10 PM: > Unfortunately, the XML collection's lack of namespace-awareness is a > deal-breaker for some of my current uses. I'd be very happy if it > supported namespace-ey features, since I otherwise don't need fancier > machinery. > -- http://www.neilvandyke.org/ From eli at barzilay.org Wed Apr 8 22:04:18 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Apr 8 22:04:52 2009 Subject: [plt-scheme] build-list for large lists In-Reply-To: <20090409005825.EC9C26500BE@mail-svr1.cs.utah.edu> References: <49DD3BE6.7050608@ccs.neu.edu> <20090409005825.EC9C26500BE@mail-svr1.cs.utah.edu> Message-ID: <18909.22434.46103.133015@winooski.ccs.neu.edu> On Apr 8, Matthew Flatt wrote: > At Wed, 08 Apr 2009 20:05:58 -0400, David Van Horn wrote: > > I thought perhaps the performance boost was due to using recursion > > rather than iteration and reverse as done in scheme/base > > build-list, so I did some comparisons with a recursive definition > > of build-list, which indeed does better on large lists. > > Yes. It's because the JIT builds a compact continuation (represented > mostly as an array) that the GC can traverse more quickly than a > list. I generally found that the iterate+reverse-vs-recursion costs keep changing -- IIRC, recursion used to be much slower then iteration plus `reverse!', then around 4.0 they were roughly the same. It's nice to see a big difference in favor of recursion now. > > Finally, the tree-based version still outperforms both the > > recursive build-list and the iterative build-list for really large > > lists. I'm not sure why. > > Here's my theory: Although (deep) recursion is better than building > a list and reversing it, shallow recursion is still better than very > deep recursion. FWIW, in my experiments the tree-based version was slower than the others (average of 7 runs each): times: 100000, length: 100 mz:build-list cpu time: 491 real time: 490 gc time: 30 ra:build-list cpu time: 2349 real time: 2350 gc time: 23 my:build-list cpu time: 408 real time: 408 gc time: 13 times: 5, length: 500000 mz:build-list cpu time: 411 real time: 411 gc time: 272 ra:build-list cpu time: 629 real time: 628 gc time: 146 my:build-list cpu time: 159 real time: 159 gc time: 9 times: 1, length: 10000000 mz:build-list cpu time: 3765 real time: 3765 gc time: 3221 ra:build-list cpu time: 4238 real time: 4269 gc time: 2337 my:build-list cpu time: 3746 real time: 3745 gc time: 2081 -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From stephen at degabrielle.name Thu Apr 9 06:44:33 2009 From: stephen at degabrielle.name (Stephen De Gabrielle) Date: Thu Apr 9 06:44:57 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <20090409013051.GB9201@topoi.pooq.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> Message-ID: <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> Is their any evidence that there are problems with providing these abstraction tools? It's not like the designers of java were unaware of lisps, haskel etc. On 4/9/09, hendrik@topoi.pooq.com wrote: > On Wed, Apr 08, 2009 at 11:01:41AM -0700, John Clements wrote: >> >> Honestly, this has nothing to do with Scheme. There are *lots* of >> languages out there that have the abstraction tools available to get >> rid of the boring junk; Haskell, ML, Scheme, LISP, etc. In a perfect >> world, I'd like to create a rallying cry for *all* proponents of >> functional programming. > > And the abstraction tools aren't even in conceptual conflict with > imperative programming. Why *do* all those languages leave tnem out? > > -- hendrik > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Sent from my mobile device Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From stephen at degabrielle.name Thu Apr 9 06:54:02 2009 From: stephen at degabrielle.name (Stephen De Gabrielle) Date: Thu Apr 9 06:54:25 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> <6A257567-E4CC-4F79-B3E8-D10CE9F84009@sonic.net> Message-ID: <595b9ab20904090354l24cbac1dk2dae6e9e840675d2@mail.gmail.com> That sounds good. Why not use a variety of languages. Php, SQL, VB? ps It's not fair to pick on java - it was a step in the right direction. On 4/8/09, Jordan Johnson wrote: > > On Apr 7, 2009, at 3:34 PM, Geoffrey S. Knauth wrote: >>> ...Hence, the Anti-Boring Code League. I plan to make T-Shirts. >>> Anyone feel like improving the logo? >> >> Sign me up. I like the idea. Here's an alternate idea for a T- >> shirt. Gather all the Java code you can find, filter and sort it >> to produce a top 20 list of the most inane things people have to >> put again and again and again in their Java code, and then produce >> a tag map. Make that the background. At the center should be >> something that visually symbolizes extreme boredom. Put the red >> circle with the line through it over that image. Put the words >> "ban boring code" in some artsy font on the slanted line. BBC! > > First thing that popped into my head, for the background: Get a > dense block of code, color it grey, and selectively color characters > black (or red?) to spell (in bigger words, a la DrScheme's "Insert > Large Letters") "blah blah blah"... > > jmj > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Sent from my mobile device Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From grettke at acm.org Thu Apr 9 07:23:37 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Apr 9 07:23:57 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> Message-ID: <756daca50904090423i476d64e9g92af2fdae2011c5c@mail.gmail.com> On Thu, Apr 9, 2009 at 5:44 AM, Stephen De Gabrielle wrote: > Is their any evidence that there are problems with providing these > abstraction tools? It's not like the designers of java were unaware of > lisps, haskel etc. The community seems to be adverse to any features provided outside of the standard language. doclet, which is a code generator, and inversion of control container bytecode manipulations, seem to be two of the few things that the Java community finds acceptable. From grettke at acm.org Thu Apr 9 07:28:59 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Apr 9 07:29:17 2009 Subject: [plt-scheme] No More Boring Code In-Reply-To: <595b9ab20904090354l24cbac1dk2dae6e9e840675d2@mail.gmail.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <2999EF70-3B97-4A7E-9FD1-39D70743830C@knauth.org> <6A257567-E4CC-4F79-B3E8-D10CE9F84009@sonic.net> <595b9ab20904090354l24cbac1dk2dae6e9e840675d2@mail.gmail.com> Message-ID: <756daca50904090428s7968be75qc651fb908d2f97ce@mail.gmail.com> On Thu, Apr 9, 2009 at 5:54 AM, Stephen De Gabrielle wrote: > That sounds good. Why not use a variety of languages. ?Php, SQL, VB? > > ps It's not fair to pick on java - it was a step in the right direction. The pattern where one defines something *at the expense* of another has a bad smell because it ends up making the former look like a jackass. For example: GNU/FSF -> Microsoft. Java -> C++ Pascal -> C Lisp -> Scheme Each of these rightfully stands on their own without the ill-will and meanness of their communities. Certainly I don't pick up any such thing regarding this t-shirt; but I don't expect that to be the case from outsiders looking in. From robby at eecs.northwestern.edu Thu Apr 9 08:31:24 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 9 08:31:43 2009 Subject: [plt-scheme] Dependent Contracts for Structures? In-Reply-To: References: Message-ID: <932b2f1f0904090531y7c96f25bu5f0ef208954dc882@mail.gmail.com> The only other alternative is to write the contracts for the fields manually. Robby On Tuesday, April 7, 2009, Will M Farr wrote: > Hello all, > > Is it possible to create "dependent" contracts (in the spirit of '->d) for structs in a provide/contract form? ?I'm thinking something like > > (struct matrix > ?((rows natural-number/c) > ? (cols natural-number/c) > ? (elts (vector-of-length/c (* rows cols))))) > > When I try this now, I get that 'rows and 'cols are not bound in the (vector-of-length/c ...) contract. I don't see anything about this in the documentation for the (struct ...) form in (provide/contract ...). > > It's not really strictly necessary, but it would be nice to have.... > > Thanks! > Will > From erich at snafu.de Thu Apr 9 10:12:34 2009 From: erich at snafu.de (Erich Rast) Date: Thu Apr 9 10:06:26 2009 Subject: [plt-scheme] Memory Use of Internal Representations Message-ID: <1239286355.8901.40.camel@darkstar> Suppose I have a huge hash-table in memory that maps strings to 64 bit values. Now I'm wondering what is the most memory-savvy way to store such a number in the hash-table. Should I use: (1) an _uint64 from the FFI, (2) an exact number, (3) two fixnums in a structure or vector, (4) a bytes string, or ? Another, somehow related question: (eq? (string->symbol "a") (string->symbol "a")) ==> #t Can I conclude from this that the two interned symbols occupy the same memory (plus constant overhead like a pointer) in Mzscheme? If yes, is there a similar memory-savvy encoding for strings? Best regards, Erich From pocmatos at gmail.com Thu Apr 9 12:08:07 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 9 12:08:47 2009 Subject: [plt-scheme] match doesn't recognize struct if typed Message-ID: <11b141710904090908v1f1a02ebo9e81e5e3dfc4e00e@mail.gmail.com> Hi all, I have two modules, one typed, one not in which the following occurs: foo.scm: #lang typed-scheme (provide (struct-out foo)) (define-struct: foo ((a : Integer) (b : Integer))) bar.scm: #lang scheme (require scheme/match "foo.scm") (define (bar x) (match x ((struct foo _) 'buh) (_ 'xpto))) I get: match: foo does not refer to a structure definition in: foo What's the issue here. if foo.scm was not typed, then everything would be fine. Am I missing something? I would think that if I require a typed module from an untyped one there would be no problem whatsoever and I would just have a contract check on module boundary. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Thu Apr 9 13:04:14 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 9 13:04:33 2009 Subject: [plt-scheme] match doesn't recognize struct if typed In-Reply-To: <11b141710904090908v1f1a02ebo9e81e5e3dfc4e00e@mail.gmail.com> References: <11b141710904090908v1f1a02ebo9e81e5e3dfc4e00e@mail.gmail.com> Message-ID: <63bb19ae0904091004p35ddb4as76e2c80d2679eec6@mail.gmail.com> On Thu, Apr 9, 2009 at 12:08 PM, Paulo J. Matos wrote: > > I get: > match: foo does not refer to a structure definition in: foo > > What's the issue here. if foo.scm was not typed, then everything would > be fine. Am I missing something? > I would think that if I require a typed module from an untyped one > there would be no problem whatsoever and I would just have a contract > check on module boundary. In general, a typed module cannot provide syntax bindings to an untyped module, because this could allow access to the values of the typed module without the contract checking. The static information about struct types is such a syntax binding, and thus isn't provided to the untyped module. It might be possible to do something special for struct information, but I'm not sure. -- sam th samth@ccs.neu.edu From noelwelsh at gmail.com Thu Apr 9 13:23:50 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Apr 9 13:24:09 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> Message-ID: On Thu, Apr 9, 2009 at 11:44 AM, Stephen De Gabrielle wrote: > Is their any evidence that there are problems with providing these > abstraction tools? It's not like the designers of java were unaware of > lisps, haskel etc. > I think the original designers of Java (when it was Oak) were concerned about the performance impact of closures (I think I read this is an interview a long time ago). N. From dherman at ccs.neu.edu Thu Apr 9 13:49:55 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Apr 9 13:50:14 2009 Subject: [plt-scheme] Re: Nothing to do with Scheme In-Reply-To: References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> Message-ID: <49DE3543.5000800@ccs.neu.edu> > I think the original designers of Java (when it was Oak) were > concerned about the performance impact of closures (I think I read > this is an interview a long time ago). http://article.gmane.org/gmane.comp.lang.lightweight/2274 Dave From raould at gmail.com Thu Apr 9 13:59:19 2009 From: raould at gmail.com (Raoul Duke) Date: Thu Apr 9 13:59:42 2009 Subject: [plt-scheme] Re: Nothing to do with Scheme In-Reply-To: <49DE3543.5000800@ccs.neu.edu> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> <49DE3543.5000800@ccs.neu.edu> Message-ID: <91a2ba3e0904091059i13c7f996s14900a970c13c67c@mail.gmail.com> >> I think the original designers of Java (when it was Oak) were >> concerned about the performance impact of closures (I think I read >> this is an interview a long time ago). > > http://article.gmane.org/gmane.comp.lang.lightweight/2274 furthermore, some implementations of closures really confuse the heck out of regular people. random e.g. http://blog.metawrap.com/blog/IEClosuresLeaks.aspx (i'm not saying that is proof that nobody should ever do any form of closures.) From pocmatos at gmail.com Thu Apr 9 14:15:29 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 9 14:16:06 2009 Subject: [plt-scheme] match doesn't recognize struct if typed In-Reply-To: <63bb19ae0904091004p35ddb4as76e2c80d2679eec6@mail.gmail.com> References: <11b141710904090908v1f1a02ebo9e81e5e3dfc4e00e@mail.gmail.com> <63bb19ae0904091004p35ddb4as76e2c80d2679eec6@mail.gmail.com> Message-ID: <11b141710904091115x4e773346jdbd84f7804a0e88a@mail.gmail.com> On Thu, Apr 9, 2009 at 5:04 PM, Sam TH wrote: > On Thu, Apr 9, 2009 at 12:08 PM, Paulo J. Matos wrote: > >> >> I get: >> match: foo does not refer to a structure definition in: foo >> >> What's the issue here. if foo.scm was not typed, then everything would >> be fine. Am I missing something? >> I would think that if I require a typed module from an untyped one >> there would be no problem whatsoever and I would just have a contract >> check on module boundary. > > In general, a typed module cannot provide syntax bindings to an > untyped module, because this could allow access to the values of the > typed module without the contract checking. ?The static information > about struct types is such a syntax binding, and thus isn't provided > to the untyped module. > > It might be possible to do something special for struct information, > but I'm not sure. OK, thanks for letting me know. It would be good to enable this kind of sharing though. If I have module A that provides structures and functions over these structures in typed-scheme and module B which is untyped because some of the features used are not yet supported by typed-scheme then I cannot use A in B and it makes me untype A till typed-scheme supports all features in scheme. By the way, do you envisage that in the future typed-scheme will support everything provided by PLT Scheme or there will be always things that won't be possible to type? Cheers, Paulo Matos Cheers, Paulo Matos > -- > sam th > samth@ccs.neu.edu > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Thu Apr 9 14:22:00 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 9 14:22:19 2009 Subject: [plt-scheme] match doesn't recognize struct if typed In-Reply-To: <11b141710904091115x4e773346jdbd84f7804a0e88a@mail.gmail.com> References: <11b141710904090908v1f1a02ebo9e81e5e3dfc4e00e@mail.gmail.com> <63bb19ae0904091004p35ddb4as76e2c80d2679eec6@mail.gmail.com> <11b141710904091115x4e773346jdbd84f7804a0e88a@mail.gmail.com> Message-ID: <63bb19ae0904091122q51a29262q541f3695a5ab912@mail.gmail.com> On Thu, Apr 9, 2009 at 2:15 PM, Paulo J. Matos wrote: > > By the way, do you envisage that in the future typed-scheme will > support everything provided by PLT Scheme or there will be always > things that won't be possible to type? If I already knew the answer to that question, it wouldn't be nearly as much fun. :) In all seriousness, I hope to support as much of PLT Scheme as possible, which is a lot more than is supported now. I don't yet know how much it is, though. It's certainly possible, and always will be possible, to write programs that can't be typechecked, yet will succeed when run without types - that's a simple consequence of uncomputability. Whether that's an important class of programs remains to be seen. -- sam th samth@ccs.neu.edu From matthias at ccs.neu.edu Thu Apr 9 02:50:45 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Apr 9 16:13:46 2009 Subject: [plt-scheme] build-list for large lists In-Reply-To: <18909.22434.46103.133015@winooski.ccs.neu.edu> References: <49DD3BE6.7050608@ccs.neu.edu> <20090409005825.EC9C26500BE@mail-svr1.cs.utah.edu> <18909.22434.46103.133015@winooski.ccs.neu.edu> Message-ID: Eli and I have had this long-running discussion. As Kent and Bob Hieb showed to me two decades ago, plain recursion usually wins in the context of an optimizing compiler because the compiler knows more about managing stacks and stuff than programmers do. I for one am happy to see that Eli is now wrong in the context of mzscheme :-) -- Matthias On Apr 8, 2009, at 10:04 PM, Eli Barzilay wrote: > On Apr 8, Matthew Flatt wrote: >> At Wed, 08 Apr 2009 20:05:58 -0400, David Van Horn wrote: >>> I thought perhaps the performance boost was due to using recursion >>> rather than iteration and reverse as done in scheme/base >>> build-list, so I did some comparisons with a recursive definition >>> of build-list, which indeed does better on large lists. >> >> Yes. It's because the JIT builds a compact continuation (represented >> mostly as an array) that the GC can traverse more quickly than a >> list. > > I generally found that the iterate+reverse-vs-recursion costs keep > changing -- IIRC, recursion used to be much slower then iteration plus > `reverse!', then around 4.0 they were roughly the same. It's nice to > see a big difference in favor of recursion now. > > >>> Finally, the tree-based version still outperforms both the >>> recursive build-list and the iterative build-list for really large >>> lists. I'm not sure why. >> >> Here's my theory: Although (deep) recursion is better than building >> a list and reversing it, shallow recursion is still better than very >> deep recursion. > > FWIW, in my experiments the tree-based version was slower than the > others (average of 7 runs each): > > times: 100000, length: 100 > mz:build-list cpu time: 491 real time: 490 gc time: 30 > ra:build-list cpu time: 2349 real time: 2350 gc time: 23 > my:build-list cpu time: 408 real time: 408 gc time: 13 > > times: 5, length: 500000 > mz:build-list cpu time: 411 real time: 411 gc time: 272 > ra:build-list cpu time: 629 real time: 628 gc time: 146 > my:build-list cpu time: 159 real time: 159 gc time: 9 > > times: 1, length: 10000000 > mz:build-list cpu time: 3765 real time: 3765 gc time: 3221 > ra:build-list cpu time: 4238 real time: 4269 gc time: 2337 > my:build-list cpu time: 3746 real time: 3745 gc time: 2081 > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli > Barzilay: > http://www.barzilay.org/ Maze is > Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Thu Apr 9 16:32:50 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Apr 9 16:33:11 2009 Subject: [plt-scheme] build-list for large lists In-Reply-To: References: <49DD3BE6.7050608@ccs.neu.edu> <20090409005825.EC9C26500BE@mail-svr1.cs.utah.edu> <18909.22434.46103.133015@winooski.ccs.neu.edu> Message-ID: <18910.23410.131413.911193@winooski.ccs.neu.edu> On Apr 9, Matthias Felleisen wrote: > > Eli and I have had this long-running discussion. As Kent and Bob > Hieb showed to me two decades ago, plain recursion usually wins in > the context of an optimizing compiler because the compiler knows > more about managing stacks and stuff than programmers do. > > I for one am happy to see that Eli is now wrong in the context of > mzscheme :-) Just to clarify "now" started probably more than a year ago, when I stopped writing iterative loops to get more speed. Iteration+`reverse!' was much faster for a really long time, then just faster (not "much") since 3m, and then `reverse!' went out leaving iteration+`reverse' or recursion at roughly the same speed. Together with improvements to the GC and the JIT, the recursive versions became increasingly faster, while the iterative ones got left behind. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From matthias at ccs.neu.edu Thu Apr 9 17:33:19 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Apr 9 17:34:30 2009 Subject: [plt-scheme] Memory Use of Internal Representations In-Reply-To: <1239286355.8901.40.camel@darkstar> References: <1239286355.8901.40.camel@darkstar> Message-ID: <016E5013-1DEE-49D4-86B8-F1F6B491CC8C@ccs.neu.edu> On Apr 9, 2009, at 10:12 AM, Erich Rast wrote: > Another, somehow related question: > > (eq? (string->symbol "a") (string->symbol "a")) > ==> #t > > Can I conclude from this that the two interned symbols occupy the same > memory (plus constant overhead like a pointer) in Mzscheme? If yes, is > there a similar memory-savvy encoding for strings? It used to be called "interning" (mapping it all to an "oblist" -- historical name) when people knew that Lisp existed. Now it's called "fly weight" pattern or something like that, because the OO community finally rediscovered it. -- Matthias From samth at ccs.neu.edu Thu Apr 9 17:39:35 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 9 17:39:53 2009 Subject: [plt-scheme] Memory Use of Internal Representations In-Reply-To: <1239286355.8901.40.camel@darkstar> References: <1239286355.8901.40.camel@darkstar> Message-ID: <63bb19ae0904091439j6f5b7e8epfb7db1c315e245@mail.gmail.com> On Thu, Apr 9, 2009 at 10:12 AM, Erich Rast wrote: > > Can I conclude from this that the two interned symbols occupy the same > memory (plus constant overhead like a pointer) in Mzscheme? If yes, is > there a similar memory-savvy encoding for strings? That's (basically) what symbols are. -- sam th samth@ccs.neu.edu From toddobryan at gmail.com Thu Apr 9 17:50:12 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Apr 9 17:50:31 2009 Subject: [plt-scheme] Baby steps in Typed Scheme Message-ID: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> I'm trying to figure out how to implement the earliest parts of HtDP in Typed Scheme, just to understand it for myself. So, we write something like ;; A list-of-number is: ;; empty, or ;; (cons number list-of-number) So, I tried this parameterized version in Typed Scheme #lang typed-scheme (require scheme/list) (define-type-alias (ListOf X) (U Empty (Cons X))) (define-struct: Empty ()) (define-struct: (X) Cons ((first : X) (rest : (ListOf X)))) (: sum ((ListOf Number) -> Number)) (define (sum alon) (cond [(Empty? alon) 0] [(Cons? alon) (+ (Cons-first alon) (sum (Cons-rest alon)))])) (make-Cons 5 (make-Cons 3 (make-Cons 2 (make-Empty)))) I get an error on the cond saying that it expected a Number, but got a Void. (I'm assuming it doesn't think I'm exhausting my type possibilities.) When I replace (Cons? alon) with else, it runs, but when I try to take the sum of the example, it says typecheck: Wrong function argument type, expected (U Empty (Cons Number)), got (Cons Integer) for argument 1 in: (make-Cons 5 (make-Cons 3 (make-Cons 2 (make-Empty)))) Can anybody shed some light? Todd From matthias at ccs.neu.edu Thu Apr 9 17:57:35 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Apr 9 17:58:47 2009 Subject: [plt-scheme] Baby steps in Typed Scheme In-Reply-To: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> References: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> Message-ID: <9DC0A4DF-6607-4A3D-9291-7E520C285B97@ccs.neu.edu> On Apr 9, 2009, at 5:50 PM, Todd O'Bryan wrote: > (make-Cons 5 (make-Cons 3 (make-Cons 2 (make-Empty)))) Try 5.0 or 3.0 or 2.0. You won't need all of them. Apparently (Listof Integer) < (Listof Number). Hmph. -- Matthias From samth at ccs.neu.edu Thu Apr 9 19:54:09 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 9 19:54:28 2009 Subject: [plt-scheme] Baby steps in Typed Scheme In-Reply-To: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> References: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> Message-ID: <63bb19ae0904091654g71b7ae5bv65b56e9dc7e2c1c8@mail.gmail.com> On Thu, Apr 9, 2009 at 5:50 PM, Todd O'Bryan wrote: > > Can anybody shed some light? That was a bug. It's fixed in SVN. Your program should now work. As for the first problem, that's also a bug, but it might take me a little longer to fix. -- sam th samth@ccs.neu.edu From samth at ccs.neu.edu Thu Apr 9 20:07:35 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Apr 9 20:07:54 2009 Subject: [plt-scheme] Baby steps in Typed Scheme In-Reply-To: <63bb19ae0904091654g71b7ae5bv65b56e9dc7e2c1c8@mail.gmail.com> References: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> <63bb19ae0904091654g71b7ae5bv65b56e9dc7e2c1c8@mail.gmail.com> Message-ID: <63bb19ae0904091707q4a14c4a2qdb99f98f684a2128@mail.gmail.com> On Thu, Apr 9, 2009 at 7:54 PM, Sam TH wrote: > > As for the first problem, that's also a bug, but it might take me a > little longer to fix. Now fixed in SVN. -- sam th samth@ccs.neu.edu From mflatt at cs.utah.edu Thu Apr 9 21:07:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Apr 9 21:07:57 2009 Subject: [plt-scheme] Memory Use of Internal Representations In-Reply-To: <1239286355.8901.40.camel@darkstar> References: <1239286355.8901.40.camel@darkstar> Message-ID: <20090410010737.0B3416500A8@mail-svr1.cs.utah.edu> At Thu, 09 Apr 2009 15:12:34 +0100, Erich Rast wrote: > Suppose I have a huge hash-table in memory that maps strings to 64 bit > values. Now I'm wondering what is the most memory-savvy way to store > such a number in the hash-table. > > Should I use: (1) an _uint64 from the FFI, (2) an exact number, (3) two > fixnums in a structure or vector, (4) a bytes string, or something else>? (1) and (2) are the same, and that's what I recommend. I think a vector of fixnums (three on a 32-bit platform or two on a 64-bit platform) could be slightly more compact, but it's not a big difference --- especially, I imagine, compared to the overhead of the string keys. From toddobryan at gmail.com Thu Apr 9 21:30:14 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Apr 9 21:30:35 2009 Subject: [plt-scheme] Baby steps in Typed Scheme In-Reply-To: <63bb19ae0904091707q4a14c4a2qdb99f98f684a2128@mail.gmail.com> References: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> <63bb19ae0904091654g71b7ae5bv65b56e9dc7e2c1c8@mail.gmail.com> <63bb19ae0904091707q4a14c4a2qdb99f98f684a2128@mail.gmail.com> Message-ID: <904774730904091830se69e576n44e9601b5a62fe5c@mail.gmail.com> Is there any way to check out just the updates to Typed Scheme, or do I have to check out and re-compile the whole PLT Scheme source tree? Todd On Thu, Apr 9, 2009 at 8:07 PM, Sam TH wrote: > On Thu, Apr 9, 2009 at 7:54 PM, Sam TH wrote: >> >> As for the first problem, that's also a bug, but it might take me a >> little longer to fix. > > Now fixed in SVN. > -- > sam th > samth@ccs.neu.edu > From carl.eastlund at gmail.com Thu Apr 9 21:38:26 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Apr 9 21:38:45 2009 Subject: [plt-scheme] Baby steps in Typed Scheme In-Reply-To: <904774730904091830se69e576n44e9601b5a62fe5c@mail.gmail.com> References: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> <63bb19ae0904091654g71b7ae5bv65b56e9dc7e2c1c8@mail.gmail.com> <63bb19ae0904091707q4a14c4a2qdb99f98f684a2128@mail.gmail.com> <904774730904091830se69e576n44e9601b5a62fe5c@mail.gmail.com> Message-ID: <990e0c030904091838g485cdb9cl86b5e98785eb27b5@mail.gmail.com> If you have it checked out from subversion and built in-place, you can probably just update collects/typed/ and collects/typed-scheme/ and run setup-plt to get the changes. I haven't tried this, though; there might be some dependency on changes in other directories. --Carl On Thu, Apr 9, 2009 at 9:30 PM, Todd O'Bryan wrote: > Is there any way to check out just the updates to Typed Scheme, or do > I have to check out and re-compile the whole PLT Scheme source tree? > > Todd From toddobryan at gmail.com Thu Apr 9 22:33:17 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Apr 9 22:33:35 2009 Subject: [plt-scheme] Question about Intermediate Student Message-ID: <904774730904091933p395cf149le5afd1d58905139b@mail.gmail.com> So, one of the things about Intermediate Student is that you can use functions as arguments and return functions. So, following along in section 23, we've been writing stuff like: (define (arithmetic-sequence a0 d) (local [(define (seq n) (cond [(zero? n) a0] [else (+ (seq (sub1 n)) d)]))] seq)) The problem is that you can pass the result of this function to other functions, but you can't call it. (build-list 5 (arithmetic-sequence 2 3)) --> (list 2 5 8 11 14) but ((arithmetic-sequence 2 3) 0) produces an error. Is this intended behavior? Intermediate with Lambda works fine, but it seems weird that you can create functions that you can't then use as functions except through other higher-order functions. Todd From robby at eecs.northwestern.edu Thu Apr 9 22:44:38 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 9 22:44:59 2009 Subject: [plt-scheme] Baby steps in Typed Scheme In-Reply-To: <904774730904091830se69e576n44e9601b5a62fe5c@mail.gmail.com> References: <904774730904091450r3897114bh7b80f41f332c9e56@mail.gmail.com> <63bb19ae0904091654g71b7ae5bv65b56e9dc7e2c1c8@mail.gmail.com> <63bb19ae0904091707q4a14c4a2qdb99f98f684a2128@mail.gmail.com> <904774730904091830se69e576n44e9601b5a62fe5c@mail.gmail.com> Message-ID: <932b2f1f0904091944tdba32b3n8d7d236a00cba42a@mail.gmail.com> That is not recommended. Robby On Thu, Apr 9, 2009 at 8:30 PM, Todd O'Bryan wrote: > Is there any way to check out just the updates to Typed Scheme, or do > I have to check out and re-compile the whole PLT Scheme source tree? > > Todd > > On Thu, Apr 9, 2009 at 8:07 PM, Sam TH wrote: >> On Thu, Apr 9, 2009 at 7:54 PM, Sam TH wrote: >>> >>> As for the first problem, that's also a bug, but it might take me a >>> little longer to fix. >> >> Now fixed in SVN. >> -- >> sam th >> samth@ccs.neu.edu >> > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From cce at ccs.neu.edu Thu Apr 9 22:45:39 2009 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Apr 9 22:45:57 2009 Subject: [plt-scheme] Question about Intermediate Student In-Reply-To: <904774730904091933p395cf149le5afd1d58905139b@mail.gmail.com> References: <904774730904091933p395cf149le5afd1d58905139b@mail.gmail.com> Message-ID: <990e0c030904091945q576ea83em22956bc392e980ef@mail.gmail.com> Todd, Thanks for the question. I'm happy to answer it, but first, the code you've posted looks an awful lot like the solution to a homework problem from HtDP -- in fact, one that was assigned recently in a course here at Northeastern University. I have no doubt your intentions were innocent, but please do not post complete solutions to homework problems on this mailing list. Students (at any school) may not be so noble in their intentions when looking up Scheme on the internet. On Thu, Apr 9, 2009 at 10:33 PM, Todd O'Bryan wrote: > > The problem is that you can pass the result of this function to other > functions, but you can't call it. > > (build-list 5 (arithmetic-sequence 2 3)) --> (list 2 5 8 11 14) > > but > > ((arithmetic-sequence 2 3) 0) produces an error. I pasted the code you provided and the expression above did not give me an error - it produced a value. I tried it in both the definitions window and the interactions window. What error message are you seeing? -- Carl Eastlund From toddobryan at gmail.com Thu Apr 9 23:18:17 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Apr 9 23:18:37 2009 Subject: [plt-scheme] Question about Intermediate Student In-Reply-To: <990e0c030904091945q576ea83em22956bc392e980ef@mail.gmail.com> References: <904774730904091933p395cf149le5afd1d58905139b@mail.gmail.com> <990e0c030904091945q576ea83em22956bc392e980ef@mail.gmail.com> Message-ID: <904774730904092018p17a6d76cq84216ad59d8c9a98@mail.gmail.com> Whoops, I had forgotten that that was a book problem. I do it in class with my students and then have them write geometric-function. (I'll check to make sure it's not on my website.) Are you in 4.1.5? Welcome to DrScheme, version 4.1.5 [3m]. Language: Intermediate Student; memory limit: 128 megabytes. This program should be tested. > ((arithmetic-sequence 5 2) 4) function call: expected a name after an open parenthesis, but found something else Todd On Thu, Apr 9, 2009 at 10:45 PM, Carl Eastlund wrote: > Todd, > > Thanks for the question. ?I'm happy to answer it, but first, the code > you've posted looks an awful lot like the solution to a homework > problem from HtDP -- in fact, one that was assigned recently in a > course here at Northeastern University. ?I have no doubt your > intentions were innocent, but please do not post complete solutions to > homework problems on this mailing list. ?Students (at any school) may > not be so noble in their intentions when looking up Scheme on the > internet. > > On Thu, Apr 9, 2009 at 10:33 PM, Todd O'Bryan wrote: >> >> The problem is that you can pass the result of this function to other >> functions, but you can't call it. >> >> (build-list 5 (arithmetic-sequence 2 3)) --> (list 2 5 8 11 14) >> >> but >> >> ((arithmetic-sequence 2 3) 0) produces an error. > > I pasted the code you provided and the expression above did not give > me an error - it produced a value. ?I tried it in both the definitions > window and the interactions window. ?What error message are you > seeing? > > -- > Carl Eastlund > From robby at eecs.northwestern.edu Thu Apr 9 23:30:20 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Apr 9 23:30:41 2009 Subject: [plt-scheme] Question about Intermediate Student In-Reply-To: <904774730904092018p17a6d76cq84216ad59d8c9a98@mail.gmail.com> References: <904774730904091933p395cf149le5afd1d58905139b@mail.gmail.com> <990e0c030904091945q576ea83em22956bc392e980ef@mail.gmail.com> <904774730904092018p17a6d76cq84216ad59d8c9a98@mail.gmail.com> Message-ID: <932b2f1f0904092030x36da41a2i99d9b584771e9a58@mail.gmail.com> Yes, I believe intermediate still requires an identifier in the function position of every application. Try intermediate+lambda. Robby On Thu, Apr 9, 2009 at 10:18 PM, Todd O'Bryan wrote: > Whoops, I had forgotten that that was a book problem. I do it in class > with my students and then have them write geometric-function. (I'll > check to make sure it's not on my website.) > > Are you in 4.1.5? > > Welcome to DrScheme, version 4.1.5 [3m]. > Language: Intermediate Student; memory limit: 128 megabytes. > This program should be tested. >> ((arithmetic-sequence 5 2) 4) > function call: expected a name after an open parenthesis, but found > something else > > Todd > > > On Thu, Apr 9, 2009 at 10:45 PM, Carl Eastlund wrote: >> Todd, >> >> Thanks for the question. ?I'm happy to answer it, but first, the code >> you've posted looks an awful lot like the solution to a homework >> problem from HtDP -- in fact, one that was assigned recently in a >> course here at Northeastern University. ?I have no doubt your >> intentions were innocent, but please do not post complete solutions to >> homework problems on this mailing list. ?Students (at any school) may >> not be so noble in their intentions when looking up Scheme on the >> internet. >> >> On Thu, Apr 9, 2009 at 10:33 PM, Todd O'Bryan wrote: >>> >>> The problem is that you can pass the result of this function to other >>> functions, but you can't call it. >>> >>> (build-list 5 (arithmetic-sequence 2 3)) --> (list 2 5 8 11 14) >>> >>> but >>> >>> ((arithmetic-sequence 2 3) 0) produces an error. >> >> I pasted the code you provided and the expression above did not give >> me an error - it produced a value. ?I tried it in both the definitions >> window and the interactions window. ?What error message are you >> seeing? >> >> -- >> Carl Eastlund >> > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From cce at ccs.neu.edu Thu Apr 9 23:49:57 2009 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Apr 9 23:50:17 2009 Subject: [plt-scheme] Question about Intermediate Student In-Reply-To: <904774730904092018p17a6d76cq84216ad59d8c9a98@mail.gmail.com> References: <904774730904091933p395cf149le5afd1d58905139b@mail.gmail.com> <990e0c030904091945q576ea83em22956bc392e980ef@mail.gmail.com> <904774730904092018p17a6d76cq84216ad59d8c9a98@mail.gmail.com> Message-ID: <990e0c030904092049p1a851ae6lb73b7eeceb1d030b@mail.gmail.com> On Thu, Apr 9, 2009 at 11:18 PM, Todd O'Bryan wrote: > Whoops, I had forgotten that that was a book problem. I do it in class > with my students and then have them write geometric-function. (I'll > check to make sure it's not on my website.) > > Are you in 4.1.5? > > Welcome to DrScheme, version 4.1.5 [3m]. > Language: Intermediate Student; memory limit: 128 megabytes. > This program should be tested. >> ((arithmetic-sequence 5 2) 4) > function call: expected a name after an open parenthesis, but found > something else > > Todd Ah, Robby makes a good point, Intermediate isn't high enough, you need Intermediate + Lambda. You can, however, do this in Intermediate: (define seq-2-3 (arithmetic-sequence 2 3)) (seq-2-3 0) Or the same thing with a local. -- Carl Eastlund From erich at snafu.de Fri Apr 10 07:12:13 2009 From: erich at snafu.de (Erich Rast) Date: Fri Apr 10 07:12:39 2009 Subject: [plt-scheme] Memory Use of Internal Representations In-Reply-To: <20090410010737.0B3416500A8@mail-svr1.cs.utah.edu> References: <1239286355.8901.40.camel@darkstar> <20090410010737.0B3416500A8@mail-svr1.cs.utah.edu> Message-ID: <4AE05D4D-1364-4BB6-AE45-11B3733D75D8@snafu.de> > > I think a vector of fixnums (three on a 32-bit platform or two on a > 64-bit platform) could be slightly more compact, but it's not a big > difference --- especially, I imagine, compared to the overhead of the > string keys. > Oops, I forgot that keys are also stored. I probably should implement my own, simpler hashtable using equal-hash-code then. --Erich -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090410/05e838b9/attachment.htm From ebellani at gmail.com Fri Apr 10 09:22:20 2009 From: ebellani at gmail.com (ebellani@gmail.com) Date: Fri Apr 10 09:23:06 2009 Subject: [plt-scheme] Maemo support Message-ID: Hey guys. I've recently acquired a nokia n810 (pretty good device imho). I'm curious about any info on plt in the maemo plataform. I've found http://garage.maemo.org/projects/plt-scheme/ that is run by Stephen De Gabrielle. How is the project going? Hugs -- Eduardo Bellani www.cnxs.com.br ?Only by protecting the citizen from being disqualified by anything in his career in school can a constitutional disestablishment of school become psychologically effective.? Ivan Illich -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090410/ecbe261a/signature.pgp From matthias at ccs.neu.edu Fri Apr 10 10:08:54 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Apr 10 10:12:09 2009 Subject: [plt-scheme] match doesn't recognize struct if typed In-Reply-To: <63bb19ae0904091122q51a29262q541f3695a5ab912@mail.gmail.com> References: <11b141710904090908v1f1a02ebo9e81e5e3dfc4e00e@mail.gmail.com> <63bb19ae0904091004p35ddb4as76e2c80d2679eec6@mail.gmail.com> <11b141710904091115x4e773346jdbd84f7804a0e88a@mail.gmail.com> <63bb19ae0904091122q51a29262q541f3695a5ab912@mail.gmail.com> Message-ID: For now, you need a better error message. (I have run into this problem too and I had no clue what I was doing wrong.) -- Matthias On Apr 9, 2009, at 2:22 PM, Sam TH wrote: > On Thu, Apr 9, 2009 at 2:15 PM, Paulo J. Matos > wrote: >> >> By the way, do you envisage that in the future typed-scheme will >> support everything provided by PLT Scheme or there will be always >> things that won't be possible to type? > > If I already knew the answer to that question, it wouldn't be nearly > as much fun. :) > > In all seriousness, I hope to support as much of PLT Scheme as > possible, which is a lot more than is supported now. I don't yet know > how much it is, though. It's certainly possible, and always will be > possible, to write programs that can't be typechecked, yet will > succeed when run without types - that's a simple consequence of > uncomputability. Whether that's an important class of programs > remains to be seen. > -- > sam th > samth@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From morazanm at gmail.com Fri Apr 10 11:59:11 2009 From: morazanm at gmail.com (Marco Morazan) Date: Fri Apr 10 11:59:54 2009 Subject: [plt-scheme] Schemers wanted at TFP 2009!! Message-ID: <9b1fff280904100859t52d3112v691ceab88327043f@mail.gmail.com> Dear PLTers and Schemers, Please consider making a submission to TFP 2009. TFP welcomes, encourages, and seeks submissions from Schemers and I can think of no better group to make contributions. The deadline for submission has been extended to MAY 10. We would be delighted to see many Scheme-based submissions. You may submit a full paper or an extended abstract. Submissions describing work-in-progress are fine given that TFP reviews papers for publication after the symposium. Papers in all areas of FP are welcomed including, but not limited to, implementation, applications, theory, and FP in education for many different types of submissions (see below). Below you can find the call for papers: 10th SYMPOSIUM ON TRENDS IN FUNCTIONAL PROGRAMMING TFP 2009 SELYE JANOS UNIVERSITY, KOMARNO, SLOVAKIA June 2-4, 2009 http://www.inf.elte.hu/tfp_cefp_2009 The symposium on Trends in Functional Programming (TFP) is an international forum for researchers with interests in all aspects of functional programming languages, focusing on providing a broad view of current and future trends in Functional Programming. It aspires to be a lively environment for presenting the latest research results. Acceptance for the conference is based on full papers or extended abstracts, and a formal post-symposium refereeing process selects the best articles presented at the symposium for publication in a high-profile volume. TFP 2009 is hosted by the Selye Janos University, Komarno, Slovakia, and it is co-located with the 3rd Central-European Functional Programming School (CEFP 2009), which is held immediately before TFP 2009 (May 25-30). IMPORTANT DATES (ALL 2009) * Paper Submission: March 15 * Notification of Acceptance: April 3 * Camera Ready Symposium Proceedings Paper: April 24 * TFP Symposium: June 2-4, 2009 * Post Symposium Paper Submission: June 30 * Notification of Acceptance: September 7 * Camera Ready Revised Paper: September 21 SCOPE OF THE SYMPOSIUM As part of the Symposium's focus on trends we therefore identify the following five article categories. High-quality articles are solicited in any of these categories: * Research: leading-edge, previously unpublished research. * Position: on what new trends should or should not be. * Project: descriptions of recently started new projects. * Evaluation: what lessons can be drawn from a finished project. * Overview: summarizing work with respect to a trendy subject. Articles must be original and not submitted for simultaneous publication to any other forum. They may consider any aspect of functional programming: theoretical, implementation-oriented, or more experience- oriented. Applications of functional programming techniques to other languages are also within the scope of the symposium. Contributions on the following subject areas are particularly welcomed: * Dependently Typed Functional Programming * Validation and Verification of Functional Programs * Debugging for Functional Languages * Functional Programming and Security * Functional Programming and Mobility * Functional Programming to Animate/Prototype/Implement Systems from Formal or Semi-Formal Specifications * Functional Languages for Telecommunications Applications * Functional Languages for Embedded Systems * Functional Programming Applied to Global Computing * Functional GRIDs * Functional Programming Ideas in Imperative or Object-Oriented Settings (and the converse) * Interoperability with Imperative Programming Languages * Novel Memory Management Techniques * Parallel/Concurrent Functional Languages * Program Transformation Techniques * Empirical Performance Studies * Abstract/Virtual Machines and Compilers for Functional Languages * New Implementation Strategies * Any new emerging trend in the functional programming area If you are in doubt on whether your article is within the scope of TFP, please contact the TFP 2009 program chairs, Zoltan Horvath and Viktoria Zsok at tfp2009@inf.elte.hu SUBMISSION AND DRAFT PROCEEDINGS Acceptance of articles for presentation at the symposium is based on the screening process of full papers (15 pages) and extended abstracts (at least 3 pages). TFP encourages PhD students to submit papers. PhD students may request the program committee to provide extensive feedback on their full papers at the time of submission. Full papers describing work accepted for presentation must be completed before the symposium for publication in the draft proceedings. Further details can be found at the TFP 2009 website. POST-SYMPOSIUM REFEREEING AND PUBLICATION In addition to the draft symposium proceedings, we continue the TFP tradition of publishing a high-quality subset of contributions in the Intellect series on Trends in Functional Programming. PROGRAM COMMITTEE * Peter Achten (symp-chair), Radboud University Nijmegen, NL * John Clements, California Polytechnic State University, USA * Cormac Flanagan, University of California at Santa Cruz, USA * Jurriaan Hage, Utrecht University, NL * Kevin Hammond, University of St. Andrews, UK * Michael Hanus, Christian-Albrechts University zu Kiel, DE * Ralf Hinze, University of Oxford, UK * Zoltan Horvath (PC co-chair), Eotvos Lorand University, HU * Graham Hutton, University of Nottingham, UK * Johan Jeuring, Utrecht University, NL * Pieter Koopman (symp-chair), Radboud University Nijmegen, NL * Hans-Wolfgang Loidl, Ludwig-Maximilians University Munchen, DE * Rita Loogen, Philipps-University Marburg, DE * Greg Michaelson, Heriot-Watt University, UK * Marco T. Morazan, Seton Hall University, USA * Rex L Page, University of Oklahoma, USA * Sven-Bodo Scholz, University of Hertfordshire, UK * Clara Segura, University Complutense de Madrid, ES * Mary Sheeran, Chalmers University of Technology, SE * Phil Trinder, Heriot-Watt University, UK * Marko van Eekelen, Radboud University Nijmegen, NL * Varmo Vene, University of Tartu, EE * Viktoria Zsok (PC co-chair), Eotvos Lorand University, HU LOCATION Conference Centre of Selye University, Komarno, Slovakia (http://www.selyeuni.sk/). It is a new and excellent conference centre with modern equipment, lecture rooms and computer labs. Komarno is on the north bank of river Danube, the northern part of the city Komarom / Komarno. It is a charming old city with about 30 000 inhabitants, 90 km away from Budapest (the capital of Hungary), with good highway and railway connections and 90 km away from Bratislava (the capital of Slovakia), about 100 km from Vienna International Airport. -- Cheers, Marco From mhcoffin at gmail.com Fri Apr 10 16:11:06 2009 From: mhcoffin at gmail.com (Michael Coffin) Date: Fri Apr 10 16:11:28 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> Message-ID: <8a96949d0904101311u835283eye65ad803f4b60b8c@mail.gmail.com> I used to be a huge fan of fancy abstraction tools. I still like them a lot when I program for fun. However, after working for a few years on a huge code base (Google's) written by thousands of programmers of varying skill, I'm not so convinced anymore. A couple things to remember: - Code is read a lot more often than it's written, and while boilerplate is a pain in the ass to write, it's easy to read precisely because it's trivial. - Reading code that makes heavy use of powerful abstraction mechanisms ( e.g., Haskel, and Python to a lesser extent) can be really hard to read because each abstraction layer essentially defines a problem-dependent language. That's nice when you have a program that uses a single such language, but it gets out of hand pretty quickly with a large code base, where you have dozens of subsystems, each written in its own idiosyncratic language. It's pretty wrenching to try to follow an execution path where each step requires you to learn a new language. - It often pretty easy to compensate for lack of powerful abstraction by using instead code generation tools to define new languages. This has the advantage that the languages are actually documented, and tend to get standardized pretty quickly, partly because it's not that easy to write them. I know this is all anecdotal, and I don't think it's conclusive at all. But I now suspect there are some practical issues with powerful abstraction mechanisms, especially with large, shared code bases. -mike On Thu, Apr 9, 2009 at 3:44 AM, Stephen De Gabrielle < stephen@degabrielle.name> wrote: > Is their any evidence that there are problems with providing these > abstraction tools? It's not like the designers of java were unaware of > lisps, haskel etc. > > On 4/9/09, hendrik@topoi.pooq.com wrote: > > On Wed, Apr 08, 2009 at 11:01:41AM -0700, John Clements wrote: > >> > >> Honestly, this has nothing to do with Scheme. There are *lots* of > >> languages out there that have the abstraction tools available to get > >> rid of the boring junk; Haskell, ML, Scheme, LISP, etc. In a perfect > >> world, I'd like to create a rallying cry for *all* proponents of > >> functional programming. > > > > And the abstraction tools aren't even in conceptual conflict with > > imperative programming. Why *do* all those languages leave tnem out? > > > > -- hendrik > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > > -- > Sent from my mobile device > > Cheers, > > Stephen > > -- > Stephen De Gabrielle > s.degabrielle@cs.ucl.ac.uk > Telephone +44 (0)20 7679 0693 (x30693) > Mobile 079 851 890 45 > Project: Making Sense of Information (MaSI) > Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html > Home:http://www.degabrielle.name/stephen > > > UCL Interaction Centre > MPEB 8th floor > University College London > Gower Street > London WC1E 6BT > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090410/23538770/attachment.htm From spdegabrielle at gmail.com Fri Apr 10 16:31:50 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Fri Apr 10 16:32:13 2009 Subject: [plt-scheme] Maemo support In-Reply-To: References: Message-ID: <595b9ab20904101331v40443905m1c578b7d66f1d2bc@mail.gmail.com> I did build mzscheme for the 770, but that is as far as it went. I've deleted the page. Sorry. I don't know about any other efforts on Maemo. Stephen On Fri, Apr 10, 2009 at 2:22 PM, wrote: > Hey guys. > > I've recently acquired a nokia n810 (pretty good device imho). I'm curious > about any info on plt in the maemo plataform. > > I've found http://garage.maemo.org/projects/plt-scheme/ that is run by > Stephen De Gabrielle. How is the project going? > Hugs > -- > Eduardo Bellani > > www.cnxs.com.br > > ?Only by protecting the citizen from being disqualified by anything in his > career in school can a constitutional disestablishment of school become > psychologically effective.? Ivan Illich > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090410/2025fd78/attachment.htm From clements at brinckerhoff.org Fri Apr 10 17:07:03 2009 From: clements at brinckerhoff.org (John Clements) Date: Fri Apr 10 17:07:35 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <8a96949d0904101311u835283eye65ad803f4b60b8c@mail.gmail.com> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> <8a96949d0904101311u835283eye65ad803f4b60b8c@mail.gmail.com> Message-ID: <55F2BD80-4B34-477A-AF88-B6F64789A5C6@brinckerhoff.org> On Apr 10, 2009, at 1:11 PM, Michael Coffin wrote: > I used to be a huge fan of fancy abstraction tools. I still like > them a lot when I program for fun. However, after working for a few > years on a huge code base (Google's) written by thousands of > programmers of varying skill, I'm not so convinced anymore. A couple > things to remember: > ? Code is read a lot more often than it's written, and while > boilerplate is a pain in the ass to write, it's easy to read > precisely because it's trivial. This is a little like saying that I'm reading much faster now that I put 30 copies of the word "the" at the beginning of each sentence. That is, the addition of the trivial code doesn't change the complexity of the non-trivial code; indeed, it serves to obscure it. It's hard to extract and focus on the important bits from the background noise of the boilerplate. > ? Reading code that makes heavy use of powerful abstraction > mechanisms ( e.g., Haskel, and Python to a lesser extent) can be > really hard to read because each abstraction layer essentially > defines a problem-dependent language. That's nice when you have a > program that uses a single such language, but it gets out of hand > pretty quickly with a large code base, where you have dozens of > subsystems, each written in its own idiosyncratic language. It's > pretty wrenching to try to follow an execution path where each step > requires you to learn a new language. Yep. That's not an argument against abstraction, though: it's an argument in favor of only letting a select, smart set of people design your abstractions. > > ? It often pretty easy to compensate for lack of powerful > abstraction by using instead code generation tools to define new > languages. This has the advantage that the languages are actually > documented, and tend to get standardized pretty quickly, partly > because it's not that easy to write them. > I know this is all anecdotal, and I don't think it's conclusive at > all. But I now suspect there are some practical issues with powerful > abstraction mechanisms, especially with large, shared code bases. Wait wait... code generation tools *are* a form of abstraction. What you're saying here is what I said 1 paragraph up: you want your abstractions to be designed by smart people. I agree with this completely. John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090410/40071ab1/smime.bin From raould at gmail.com Fri Apr 10 17:11:50 2009 From: raould at gmail.com (Raoul Duke) Date: Fri Apr 10 17:12:13 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <55F2BD80-4B34-477A-AF88-B6F64789A5C6@brinckerhoff.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> <8a96949d0904101311u835283eye65ad803f4b60b8c@mail.gmail.com> <55F2BD80-4B34-477A-AF88-B6F64789A5C6@brinckerhoff.org> Message-ID: <91a2ba3e0904101411w619febc8o698eabe88d5cd6f3@mail.gmail.com> > Yep. That's not an argument against abstraction, though: it's an argument > in favor of only letting a select, smart set of people design your > abstractions. as an aside, so far i think i fall in favor of Mr. Clements' line of thinking, but i'd like to say that it bugs me when the term "smart" is used. i've known smart people who write impenetrable abstractions. :-) if you mean smart as in "know your audience!" then i can agree, but that isn't the connotation of 'smart' that i think is usually used in programming disucission. sincerely, $0.02. From mhcoffin at gmail.com Fri Apr 10 17:28:12 2009 From: mhcoffin at gmail.com (Michael Coffin) Date: Fri Apr 10 17:28:37 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <55F2BD80-4B34-477A-AF88-B6F64789A5C6@brinckerhoff.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> <8a96949d0904101311u835283eye65ad803f4b60b8c@mail.gmail.com> <55F2BD80-4B34-477A-AF88-B6F64789A5C6@brinckerhoff.org> Message-ID: <8a96949d0904101428l6fbd7eadn4058cc9fa89fa953@mail.gmail.com> On Fri, Apr 10, 2009 at 2:07 PM, John Clements wrote: > On Apr 10, 2009, at 1:11 PM, Michael Coffin wrote: > > I used to be a huge fan of fancy abstraction tools. I still like them a >> lot when I program for fun. However, after working for a few years on a huge >> code base (Google's) written by thousands of programmers of varying skill, >> I'm not so convinced anymore. A couple things to remember: >> ? Code is read a lot more often than it's written, and while >> boilerplate is a pain in the ass to write, it's easy to read precisely >> because it's trivial. >> > > This is a little like saying that I'm reading much faster now that I put 30 > copies of the word "the" at the beginning of each sentence. That is, the > addition of the trivial code doesn't change the complexity of the > non-trivial code; indeed, it serves to obscure it. It's hard to extract and > focus on the important bits from the background noise of the boilerplate. I don't enjoy reading boilerplate any more than you do. I'm just saying that there are things that are much worse. > > > ? Reading code that makes heavy use of powerful abstraction >> mechanisms ( e.g., Haskel, and Python to a lesser extent) can be really hard >> to read because each abstraction layer essentially defines a >> problem-dependent language. That's nice when you have a program that uses a >> single such language, but it gets out of hand pretty quickly with a large >> code base, where you have dozens of subsystems, each written in its own >> idiosyncratic language. It's pretty wrenching to try to follow an execution >> path where each step requires you to learn a new language. >> > > Yep. That's not an argument against abstraction, though: it's an argument > in favor of only letting a select, smart set of people design your > abstractions. > First, "smart" is not the same as "good designer" -- the latter set is a small subset of the first. But more importantly, with thousands of programmers, it is really not practical to have all abstractions designed by only a few people. Institutionally, how do you do it? A smart programmer who isn't allowed to do any design is going to feel like a typist and just leave. At a place like Google, trying to do this would lead pretty quickly to a mass exodus. It just wouldn't be a fun place to work anymore. Programming is a social activity, not just a technical one. > > >> ? It often pretty easy to compensate for lack of powerful >> abstraction by using instead code generation tools to define new languages. >> This has the advantage that the languages are actually documented, and tend >> to get standardized pretty quickly, partly because it's not that easy to >> write them. >> I know this is all anecdotal, and I don't think it's conclusive at all. >> But I now suspect there are some practical issues with powerful abstraction >> mechanisms, especially with large, shared code bases. >> > > Wait wait... code generation tools *are* a form of abstraction. What > you're saying here is what I said 1 paragraph up: you want your abstractions > to be designed by smart people. I agree with this completely. Code generation is a form of abstraction, but it's self limiting because it isn't so easy. So it gets used to solve a few really troublesome problems, but it's too much work to use on smallish problems. > > > John Clements > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090410/71d90f45/attachment.htm From hendrik at topoi.pooq.com Fri Apr 10 19:54:30 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Fri Apr 10 19:57:22 2009 Subject: Nothing to do with Scheme (was: Re: [plt-scheme] No More Boring Code) In-Reply-To: <55F2BD80-4B34-477A-AF88-B6F64789A5C6@brinckerhoff.org> References: <399FBBD5-C37D-47B1-8AC3-3E816707A315@brinckerhoff.org> <756daca50904080718r3223ad31t18e2bf42a1a3c6a1@mail.gmail.com> <2CC3DE24-239F-4C53-8724-C7325F273D22@brinckerhoff.org> <20090409013051.GB9201@topoi.pooq.com> <595b9ab20904090344k59d1cce1y4795f746d3bb5592@mail.gmail.com> <8a96949d0904101311u835283eye65ad803f4b60b8c@mail.gmail.com> <55F2BD80-4B34-477A-AF88-B6F64789A5C6@brinckerhoff.org> Message-ID: <20090410235430.GA20576@topoi.pooq.com> On Fri, Apr 10, 2009 at 02:07:03PM -0700, John Clements wrote: > On Apr 10, 2009, at 1:11 PM, Michael Coffin wrote: > > >I used to be a huge fan of fancy abstraction tools. I still like > >them a lot when I program for fun. However, after working for a few > >years on a huge code base (Google's) written by thousands of > >programmers of varying skill, I'm not so convinced anymore. A couple > >things to remember: > > ? Code is read a lot more often than it's written, and while > >boilerplate is a pain in the ass to write, it's easy to read > >precisely because it's trivial. > > This is a little like saying that I'm reading much faster now that I > put 30 copies of the word "the" at the beginning of each sentence. > That is, the addition of the trivial code doesn't change the > complexity of the non-trivial code; indeed, it serves to obscure it. > It's hard to extract and focus on the important bits from the > background noise of the boilerplate. The big problem with boilerplate is when you make it *almost* the same. You glance at it, figure it is the same, and never see that it's quite different. -- hendrik From clements at brinckerhoff.org Fri Apr 10 20:52:15 2009 From: clements at brinckerhoff.org (John Clements) Date: Fri Apr 10 20:52:44 2009 Subject: [plt-scheme] stepper interface suggestion for "start-from-here"? Message-ID: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> A few weeks ago Jay McCarthy suggested a feature for the stepper that was so obvious that I had to implement it (also, I have a sneaking suspicion that others must have suggested it): starting to step at a specified expression, rather than from the beginning. As I expected, it wasn't too hard, except for this one problem: how should it be enabled? Here's what I've been able to come up with: 1) It's always enabled: the stepper starts from wherever the cursor is (or the beginning of the selection) 2) It's a menu entry in the "Scheme" Menu. 3) Clicking on the stepper button always brings up a dialog. 4) It's a preference. 5) You right-click on a selected expression. Choices 1 & 3 seem too intrusive. Choices 2,4, and 5 seem not intrusive enough (a.k.a. they'll never be discovered). Any other suggestions? Thanks in advance, John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090410/e4c8de70/smime.bin From carl.eastlund at gmail.com Fri Apr 10 21:40:49 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri Apr 10 21:41:08 2009 Subject: [plt-scheme] stepper interface suggestion for "start-from-here"? In-Reply-To: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> References: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> Message-ID: <990e0c030904101840j61cba0a5o925b13a71d01d329@mail.gmail.com> On Fri, Apr 10, 2009 at 8:52 PM, John Clements wrote: > A few weeks ago Jay McCarthy suggested a feature for the stepper that was so > obvious that I had to implement it (also, I have a sneaking suspicion that > others must have suggested it): starting to step at a specified expression, > rather than from the beginning. ?As I expected, it wasn't too hard, except > for this one problem: how should it be enabled? ?Here's what I've been able > to come up with: > > 1) It's always enabled: the stepper starts from wherever the cursor is (or > the beginning of the selection) > 2) It's a menu entry in the "Scheme" Menu. > 3) Clicking on the stepper button always brings up a dialog. > 4) It's a preference. > 5) You right-click on a selected expression. > > Choices 1 & 3 seem too intrusive. ?Choices 2,4, and 5 seem not intrusive > enough (a.k.a. they'll never be discovered). ?Any other suggestions? How about giving the stepper a "jump to selected expression" button? It's obvious, but you don't have to use it; if you want to use it, you just select something in the definitions window and press the button. You could even add the right-click option to go straight from definitions to specific-stepper, and a note when clicking the "jump to selected expression" button that explains about right-clicking. -- Carl Eastlund From jay.mccarthy at gmail.com Fri Apr 10 22:21:44 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Apr 10 22:22:19 2009 Subject: [plt-scheme] stepper interface suggestion for "start-from-here"? In-Reply-To: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> References: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> Message-ID: One special case: a button on a test case that steps through the test. In general I like a right click. Sent from my iPhone On Apr 10, 2009, at 8:52 PM, John Clements wrote: > A few weeks ago Jay McCarthy suggested a feature for the stepper > that was so obvious that I had to implement it (also, I have a > sneaking suspicion that others must have suggested it): starting to > step at a specified expression, rather than from the beginning. As > I expected, it wasn't too hard, except for this one problem: how > should it be enabled? Here's what I've been able to come up with: > > 1) It's always enabled: the stepper starts from wherever the cursor > is (or the beginning of the selection) > 2) It's a menu entry in the "Scheme" Menu. > 3) Clicking on the stepper button always brings up a dialog. > 4) It's a preference. > 5) You right-click on a selected expression. > > Choices 1 & 3 seem too intrusive. Choices 2,4, and 5 seem not > intrusive enough (a.k.a. they'll never be discovered). Any other > suggestions? > > Thanks in advance, > > John > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jmj at fellowhuman.com Sat Apr 11 02:40:12 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sat Apr 11 02:40:38 2009 Subject: [plt-scheme] dual-editor snip Message-ID: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> Hi all, I'm trying to implement a snip similar to DrScheme's comment and XML boxes, but containing two distinct text boxes rather than one. Before I invest more time searching for the right way -- I've put in enough time that my this-*must*-be-easier alarm bells are going off -- I need to ask which classes/methods are the ones I'm after, or, at very least, if there's a relevant tutorial out there. Here's what I want to accomplish: 1) When both parts are visible, the user should be able to click into either one to edit its text; the contents will be independent, but the boxes should remain stacked (i.e., one should display above the other, in fixed order). 2) When the snip does not have focus, only one of the two text boxes should be visible. 3) Ultimately I want to hook into DrScheme and be able to create these snips by highlighting text in another editor and selecting a menu item, much like "Comment Out with a Box", to populate one of the snip's two fields with the selection. Currently I'm just trying a simple precursor to (1): getting DrScheme to draw the snip with both areas visible. Code is below; it does not successfully draw the snip. What is an appropriate way to manage the two editors the snip contains? Thanks, Jordan === code === #lang scheme/gui (define PAD 4) (define my-snip% (class snip% (init-field [has-focus? #f] [area1-text (new editor-snip% [editor (new text%)] [min-width 20] [max-width 600])] [area2-text (new editor-snip% [editor (new text%)] [min-width 20] [max-width 600])]) (define/override get-extent (lambda (dc x y w h descent space lspace rspace) (when (box? w) (let ([area2-w (box #f)] [area1-w (box #f)] [area1-h (box #f)]) (send area1-text get-extent dc x y area1-w area1-h) (send area2-text get-extent dc x (+ y area1-h PAD) area2-w) (set-box! w (max (unbox area2-w area1-w))))) (when (box? h) (let ([area2-h (box #f)] [area1-h (box #f)]) (send area1-text get-extent dc x y #f area1-h) (send area2-text get-extent dc x (+ y area1-h PAD) #f area2-h) (set-box! h (+ area2-h area1-h PAD)))) )) (define/override (draw dc x y left top right bottom dx dy draw-caret?) (let ([area1-bottom (box #f)]) (send area1-text get-extent dc x y #f area1-bottom) (send area1-text draw dc x y left top right area1-bottom dx dy draw-caret?) (send area2-text draw dc x (+ area1-bottom PAD) left (+ area1-bottom PAD) dx dy draw-caret?))) (super-new) )) (define s (new my-snip%)) ;; s doesn't render. From spdegabrielle at gmail.com Sat Apr 11 07:02:00 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Sat Apr 11 07:02:25 2009 Subject: [plt-scheme] dual-editor snip In-Reply-To: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> References: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> Message-ID: <595b9ab20904110402r1f72c3c8v9c7bd447e63363fe@mail.gmail.com> I think someone else was asking about something similar composite snips problem a couple of weeks ago for a grid. I don't know if they were successful? Have you tried using the 'File->search in files' menu item to search the collects/ dir to see how the XML box works? (though if I remember correctly- it is just one snip - not two) Cheers, Stephen On Sat, Apr 11, 2009 at 7:40 AM, Jordan Johnson wrote: > Hi all, > > I'm trying to implement a snip similar to DrScheme's comment and XML boxes, > but containing two distinct text boxes rather than one. Before I invest > more time searching for the right way -- I've put in enough time that my > this-*must*-be-easier alarm bells are going off -- I need to ask which > classes/methods are the ones I'm after, or, at very least, if there's a > relevant tutorial out there. > > Here's what I want to accomplish: > 1) When both parts are visible, the user should be able to click > into either one to edit its text; the contents will be independent, but the > boxes should remain stacked (i.e., one should display above the other, in > fixed order). > 2) When the snip does not have focus, only one of the two text boxes > should be visible. > 3) Ultimately I want to hook into DrScheme and be able to create > these snips by highlighting text in another editor and selecting a menu > item, much like "Comment Out with a Box", to populate one of the snip's two > fields with the selection. > > Currently I'm just trying a simple precursor to (1): getting DrScheme to > draw the snip with both areas visible. Code is below; it does not > successfully draw the snip. > > What is an appropriate way to manage the two editors the snip contains? > > Thanks, > Jordan > > === code === > #lang scheme/gui > > > (define PAD 4) > > (define my-snip% > (class snip% > (init-field [has-focus? #f] > [area1-text (new editor-snip% > [editor (new text%)] > [min-width 20] > [max-width 600])] > [area2-text (new editor-snip% > [editor (new text%)] > [min-width 20] > [max-width 600])]) > > (define/override get-extent > (lambda (dc x y w h descent space lspace rspace) > (when (box? w) > (let ([area2-w (box #f)] > [area1-w (box #f)] > [area1-h (box #f)]) > (send area1-text get-extent dc x y area1-w area1-h) > (send area2-text get-extent dc x (+ y area1-h PAD) area2-w) > (set-box! w (max (unbox area2-w area1-w))))) > (when (box? h) > (let ([area2-h (box #f)] > [area1-h (box #f)]) > (send area1-text get-extent dc x y #f area1-h) > (send area2-text get-extent dc x (+ y area1-h PAD) #f area2-h) > (set-box! h (+ area2-h area1-h PAD)))) > )) > > (define/override (draw dc x y left top right bottom > dx dy draw-caret?) > (let ([area1-bottom (box #f)]) > (send area1-text get-extent dc x y #f area1-bottom) > (send area1-text draw dc > x y left top right area1-bottom > dx dy draw-caret?) > (send area2-text draw dc > x (+ area1-bottom PAD) > left (+ area1-bottom PAD) > dx dy draw-caret?))) > (super-new) > )) > > (define s (new my-snip%)) ;; s doesn't render. > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/6086e1ae/attachment.html From erich at snafu.de Sat Apr 11 09:43:42 2009 From: erich at snafu.de (Erich Rast) Date: Sat Apr 11 09:44:05 2009 Subject: [plt-scheme] Fixnum Conversion Message-ID: <68F125E9-ACC2-400F-921B-4986A3DBE212@snafu.de> Hi all, I'm a bit confused about numbers. A fixnum can hold numbers that fit into 31 or 63 bits depending on whether the machine is 32 bit or 64 bit, right? How do I convert a positive integer number in the range from 0...4294967295 (inclusive) on any machine to a little-endian encoded 4- element bytes string? Best regards, Erich -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/a86458c8/attachment.htm From eli at barzilay.org Sat Apr 11 09:52:08 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Apr 11 09:52:37 2009 Subject: [plt-scheme] Fixnum Conversion In-Reply-To: <68F125E9-ACC2-400F-921B-4986A3DBE212@snafu.de> References: <68F125E9-ACC2-400F-921B-4986A3DBE212@snafu.de> Message-ID: <18912.41096.737856.705450@winooski.ccs.neu.edu> On Apr 11, Erich Rast wrote: > Hi all, > > I'm a bit confused about numbers. A fixnum can hold numbers that fit > into 31 or 63 bits depending on whether the machine is 32 bit or 64 > bit, right? > > How do I convert a positive integer number in the range from > 0...4294967295 (inclusive) on any machine to a little-endian encoded 4- > element bytes string? You can use (integer->integer-bytes 4294967295 4 #f #f) -- with #f for the `signed?' flag, since otherwise it doesn't fit into 4 bytes. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jmj at fellowhuman.com Sat Apr 11 11:24:41 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sat Apr 11 11:25:02 2009 Subject: [plt-scheme] dual-editor snip In-Reply-To: <595b9ab20904110402r1f72c3c8v9c7bd447e63363fe@mail.gmail.com> References: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> <595b9ab20904110402r1f72c3c8v9c7bd447e63363fe@mail.gmail.com> Message-ID: <5AA3A00F-B262-4D1E-BA99-0E174FA9A7B5@fellowhuman.com> On Apr 11, 2009, at 4:02 AM, Stephen De Gabrielle wrote: > Have you tried using the 'File->search in files' menu item to > search the collects/ dir to see how the XML box works? (though if I > remember correctly- it is just one snip - not two) Yeah, and that's the crux of the problem: what's going to let me work with the two sub-parts? ...where, by "work with" I mean, create one object that handles drawing one or both editors. Thanks, jmj From robby at eecs.northwestern.edu Sat Apr 11 12:01:09 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 12:01:46 2009 Subject: [plt-scheme] dual-editor snip In-Reply-To: <5AA3A00F-B262-4D1E-BA99-0E174FA9A7B5@fellowhuman.com> References: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> <595b9ab20904110402r1f72c3c8v9c7bd447e63363fe@mail.gmail.com> <5AA3A00F-B262-4D1E-BA99-0E174FA9A7B5@fellowhuman.com> Message-ID: <932b2f1f0904110901r296bd840qfe11d1b58f474e7a@mail.gmail.com> I'm sorry I'm just quickly tuning in, but did you try making a pasteboard with two editor-snip%s that contain the two text%s? You can show and remove them as you wish (but you will have to do some work to make sure the editor-snip%s are always the right size). Robby On Sat, Apr 11, 2009 at 10:24 AM, Jordan Johnson wrote: > > On Apr 11, 2009, at 4:02 AM, Stephen De Gabrielle wrote: >> >> Have you tried using the 'File->search in files' menu item to search the >> collects/ dir to see how the XML box works? (though if I remember correctly- >> it is just one snip - not two) > > Yeah, and that's the crux of the problem: ?what's going to let me work with > the two sub-parts? ?...where, by "work with" I mean, create one object that > handles drawing one or both editors. > > Thanks, > jmj > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From marc.chamly at gmail.com Sat Apr 11 13:25:29 2009 From: marc.chamly at gmail.com (CHAMLY) Date: Sat Apr 11 13:25:59 2009 Subject: [plt-scheme] Double buffer (scheme/gui) Message-ID: HI! I am programming a game on scheme using #lang scheme/gui, the game is made of: 1) an object (copter) that when you click moves up, otherwise it falls down, and does not move horizontaly. 2) a tunnel that moves from right to left, giving the impression that the object is moving forward (moving to the right reaching the end of the tunnel). I have a little problem with my double buffer, I'm using two bitmaps one to draw the copter, and one to draw my tunnel Here is what i have in the paint-callback of my canvas: (send BITMAP-DC-1 clear) ; i move my tunnel (send TUNNEL draw-tunnel1 BITMAP-DC-1 y1) (send dc draw-bitmap BITMAP-1 (- x-canvas) 0 'solid)) (send BITMAP-DC-2 clear) ; i move my copter (send BITMAP-DC-2 draw-bitmap copterUp 0 0 'solid) (send dc draw-bitmap BITMAP-2 150 (send COPTER get-y- copter) 'solid)) The problem is that my copter still flickers, and i don't know why?? (i don't draw my copter in BITMAP-DC-1 because afterwords i also use other bitmaps to draw my tunnel) thanks Marc From robby at eecs.northwestern.edu Sat Apr 11 13:31:46 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 13:32:24 2009 Subject: [plt-scheme] Double buffer (scheme/gui) In-Reply-To: References: Message-ID: <932b2f1f0904111031v306a72ffqd4c9dbf182da58e9@mail.gmail.com> Probably you want to pass the 'no-autoclear style to the canvas% object when you create it (I may have got the precise name wrong, but it is listed in the docs for the initialization arguments to canvas%). But you also probably want to only recreate the bitmaps when their content changes, not every time the window is refreshed. In other words, all but the last line below should be somewhere else, not in the on-paint method. Robby On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY wrote: > HI! > > I am programming a game on scheme using #lang scheme/gui, the game is ?made > of: > 1) an object (copter) that when you click moves up, otherwise it falls down, > and does not move horizontaly. > 2) a tunnel that moves from right to left, giving the impression that the > object is moving forward (moving to the right reaching the end of the > tunnel). > > > I have a little problem with my double buffer, > I'm using two bitmaps one to draw the copter, and one to draw my tunnel > > Here is what i have in the paint-callback of my canvas: > > ? ? ? ? ? ? (send BITMAP-DC-1 clear) ? ? ? ? ? ? ?; i move my tunnel > ? ? ? ? ? ? (send TUNNEL draw-tunnel1 ?BITMAP-DC-1 ?y1) > ? ? ? ? ? ? (send dc draw-bitmap BITMAP-1 ?(- x-canvas) 0 'solid)) > > > ? ? ? ? ? ? (send BITMAP-DC-2 clear) ? ? ; i move my copter > ? ? ? ? ? ? (send BITMAP-DC-2 draw-bitmap copterUp ?0 0 'solid) > > ? ? ? ? ? ? (send dc draw-bitmap BITMAP-2 ?150 (send COPTER get-y-copter) > ?'solid)) > > The problem is that my copter still flickers, and i don't know why?? > (i don't draw my copter in BITMAP-DC-1 because afterwords i also use other > bitmaps to draw my tunnel) > > thanks > > > Marc > ? ? ? ? ? ?_________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From mflatt at cs.utah.edu Sat Apr 11 13:31:54 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sat Apr 11 13:32:29 2009 Subject: [plt-scheme] Double buffer (scheme/gui) In-Reply-To: References: Message-ID: <20090411173157.04A5C6500C2@mail-svr1.cs.utah.edu> At Sat, 11 Apr 2009 19:25:29 +0200, CHAMLY wrote: > Here is what i have in the paint-callback of my canvas: > > (send BITMAP-DC-1 clear) ; i move my tunnel > (send TUNNEL draw-tunnel1 BITMAP-DC-1 y1) > (send dc draw-bitmap BITMAP-1 (- x-canvas) 0 'solid)) > > > (send BITMAP-DC-2 clear) ; i move my copter > (send BITMAP-DC-2 draw-bitmap copterUp 0 0 'solid) > > (send dc draw-bitmap BITMAP-2 150 (send COPTER get-y- > copter) 'solid)) > > The problem is that my copter still flickers, and i don't know why?? Does it help to specify the 'no-autoclear style when creating the canvas%? From marc.chamly at gmail.com Sat Apr 11 13:59:24 2009 From: marc.chamly at gmail.com (CHAMLY) Date: Sat Apr 11 13:59:50 2009 Subject: [plt-scheme] Double buffer (scheme/gui) In-Reply-To: <932b2f1f0904111031v306a72ffqd4c9dbf182da58e9@mail.gmail.com> References: <932b2f1f0904111031v306a72ffqd4c9dbf182da58e9@mail.gmail.com> Message-ID: <71D652D4-8B45-4750-B2FB-3FFB63DC5789@gmail.com> Well I already put the 'no-autoclear to the canvas, my BITMAP-DC-1 (tunnel) doesn't flicker only my BITMAP-DC-2(Object) flickers, I will try to put the 'no-autoclear somewhere else, and see if it works. Thank you. On Apr 11, 2009, at 7:31 PM, Robby Findler wrote: > Probably you want to pass the 'no-autoclear style to the canvas% > object when you create it (I may have got the precise name wrong, but > it is listed in the docs for the initialization arguments to canvas%). > > But you also probably want to only recreate the bitmaps when their > content changes, not every time the window is refreshed. In other > words, all but the last line below should be somewhere else, not in > the on-paint method. > > Robby > > On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY > wrote: >> HI! >> >> I am programming a game on scheme using #lang scheme/gui, the game >> is made >> of: >> 1) an object (copter) that when you click moves up, otherwise it >> falls down, >> and does not move horizontaly. >> 2) a tunnel that moves from right to left, giving the impression >> that the >> object is moving forward (moving to the right reaching the end of the >> tunnel). >> >> >> I have a little problem with my double buffer, >> I'm using two bitmaps one to draw the copter, and one to draw my >> tunnel >> >> Here is what i have in the paint-callback of my canvas: >> >> (send BITMAP-DC-1 clear) ; i move my tunnel >> (send TUNNEL draw-tunnel1 BITMAP-DC-1 y1) >> (send dc draw-bitmap BITMAP-1 (- x-canvas) 0 'solid)) >> >> >> (send BITMAP-DC-2 clear) ; i move my copter >> (send BITMAP-DC-2 draw-bitmap copterUp 0 0 'solid) >> >> (send dc draw-bitmap BITMAP-2 150 (send COPTER get-y- >> copter) >> 'solid)) >> >> The problem is that my copter still flickers, and i don't know why?? >> (i don't draw my copter in BITMAP-DC-1 because afterwords i also >> use other >> bitmaps to draw my tunnel) >> >> thanks >> >> >> Marc >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> From m.douglas.williams at gmail.com Sat Apr 11 14:17:12 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Apr 11 14:17:31 2009 Subject: [plt-scheme] ->d Performance Message-ID: I would like to use ->d to impose a precondition for a function. For example: (matrix-ref (->d ((matrix matrix?) (i (and/c exact-nonnegative-integer? (d ((matrix matrix?) (i exact-nonnegative-integer?) (j exact-nonnegative-integer?)) () #:pre-cond (and (< i (matrix-rows matrix)) (< j (matrix-cols matrix))) (result any/c))) instead of just (matrix-ref (-> matrix? exact-nonnegative-integer? exact-nonnegative-integer? any/c)) The first two do work, but are really, really slow. I like having the bounds check in the contract (as opposed to bounds check in the matrix-ref code, but can't accept the performance hit. Any ideas? Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/b5d13f6b/attachment.html From robby at eecs.northwestern.edu Sat Apr 11 14:46:03 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 14:46:24 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: References: Message-ID: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> ->d is definitely substantially slower than the other because the wrappers are more complex. Are you finding the performance overhead of the ordinary -> acceptable? Robby On Sat, Apr 11, 2009 at 1:17 PM, Doug Williams wrote: > I would like to use ->d to impose a precondition for a function.? For > example: > > ?(matrix-ref > ? (->d ((matrix matrix?) > ??????? (i (and/c exact-nonnegative-integer? ( ??????? (j (and/c exact-nonnegative-integer? ( ?????? () > ?????? (result any/c))) > > or > > ?(matrix-ref > ? (->d ((matrix matrix?) > ??????? (i exact-nonnegative-integer?) > ??????? (j exact-nonnegative-integer?)) > ?????? () > ?????? #:pre-cond (and (< i (matrix-rows matrix)) > ?????????????????????? (< j (matrix-cols matrix))) > ?????? (result any/c))) > > instead of just > > ?(matrix-ref > ? (-> matrix? exact-nonnegative-integer? exact-nonnegative-integer? any/c)) > > The first two do work, but are really, really slow. > > I like having the bounds check in the contract (as opposed to bounds check > in the matrix-ref code, but can't accept the performance hit. Any ideas? > > Doug > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at eecs.northwestern.edu Sat Apr 11 14:47:16 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 14:47:38 2009 Subject: [plt-scheme] Double buffer (scheme/gui) In-Reply-To: <71D652D4-8B45-4750-B2FB-3FFB63DC5789@gmail.com> References: <932b2f1f0904111031v306a72ffqd4c9dbf182da58e9@mail.gmail.com> <71D652D4-8B45-4750-B2FB-3FFB63DC5789@gmail.com> Message-ID: <932b2f1f0904111147s5de38438la1687b4175f0bf90@mail.gmail.com> Oh! I misread the code. You need to create a single bitmap containing the whole thing and then draw it. Don't draw two bitmaps (that's what's causing your flicker). Robby On Sat, Apr 11, 2009 at 12:59 PM, CHAMLY wrote: > Well I already put the 'no-autoclear ?to the canvas, my BITMAP-DC-1 (tunnel) > doesn't flicker only my BITMAP-DC-2(Object) flickers, I will try to put the > 'no-autoclear somewhere else, and see if it works. > > Thank you. > > On Apr 11, 2009, at 7:31 PM, Robby Findler wrote: > >> Probably you want to pass the 'no-autoclear style to the canvas% >> object when you create it (I may have got the precise name wrong, but >> it is listed in the docs for the initialization arguments to canvas%). >> >> But you also probably want to only recreate the bitmaps when their >> content changes, not every time the window is refreshed. In other >> words, all but the last line below should be somewhere else, not in >> the on-paint method. >> >> Robby >> >> On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY wrote: >>> >>> HI! >>> >>> I am programming a game on scheme using #lang scheme/gui, the game is >>> ?made >>> of: >>> 1) an object (copter) that when you click moves up, otherwise it falls >>> down, >>> and does not move horizontaly. >>> 2) a tunnel that moves from right to left, giving the impression that the >>> object is moving forward (moving to the right reaching the end of the >>> tunnel). >>> >>> >>> I have a little problem with my double buffer, >>> I'm using two bitmaps one to draw the copter, and one to draw my tunnel >>> >>> Here is what i have in the paint-callback of my canvas: >>> >>> ? ? ? ? ? ?(send BITMAP-DC-1 clear) ? ? ? ? ? ? ?; i move my tunnel >>> ? ? ? ? ? ?(send TUNNEL draw-tunnel1 ?BITMAP-DC-1 ?y1) >>> ? ? ? ? ? ?(send dc draw-bitmap BITMAP-1 ?(- x-canvas) 0 'solid)) >>> >>> >>> ? ? ? ? ? ?(send BITMAP-DC-2 clear) ? ? ; i move my copter >>> ? ? ? ? ? ?(send BITMAP-DC-2 draw-bitmap copterUp ?0 0 'solid) >>> >>> ? ? ? ? ? ?(send dc draw-bitmap BITMAP-2 ?150 (send COPTER get-y-copter) >>> ?'solid)) >>> >>> The problem is that my copter still flickers, and i don't know why?? >>> (i don't draw my copter in BITMAP-DC-1 because afterwords i also use >>> other >>> bitmaps to draw my tunnel) >>> >>> thanks >>> >>> >>> Marc >>> ? ? ? ? ? _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> > > From marc.chamly at gmail.com Sat Apr 11 15:22:13 2009 From: marc.chamly at gmail.com (CHAMLY) Date: Sat Apr 11 15:22:38 2009 Subject: [plt-scheme] Double buffer (scheme/gui) In-Reply-To: <932b2f1f0904111147s5de38438la1687b4175f0bf90@mail.gmail.com> References: <932b2f1f0904111031v306a72ffqd4c9dbf182da58e9@mail.gmail.com> <71D652D4-8B45-4750-B2FB-3FFB63DC5789@gmail.com> <932b2f1f0904111147s5de38438la1687b4175f0bf90@mail.gmail.com> Message-ID: Yes, But I have 2 bitmaps, because both of my objects have to move independently, the tunnel has to be able to move to the left, without moving the Copter, and the Copter has to move Up and Down without moving the tunnel... Marc On Apr 11, 2009, at 8:47 PM, Robby Findler wrote: > Oh! I misread the code. You need to create a single bitmap containing > the whole thing and then draw it. Don't draw two bitmaps (that's > what's causing your flicker). > > Robby > > On Sat, Apr 11, 2009 at 12:59 PM, CHAMLY > wrote: >> Well I already put the 'no-autoclear to the canvas, my BITMAP-DC-1 >> (tunnel) >> doesn't flicker only my BITMAP-DC-2(Object) flickers, I will try to >> put the >> 'no-autoclear somewhere else, and see if it works. >> >> Thank you. >> >> On Apr 11, 2009, at 7:31 PM, Robby Findler wrote: >> >>> Probably you want to pass the 'no-autoclear style to the canvas% >>> object when you create it (I may have got the precise name wrong, >>> but >>> it is listed in the docs for the initialization arguments to canvas >>> %). >>> >>> But you also probably want to only recreate the bitmaps when their >>> content changes, not every time the window is refreshed. In other >>> words, all but the last line below should be somewhere else, not in >>> the on-paint method. >>> >>> Robby >>> >>> On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY >>> wrote: >>>> >>>> HI! >>>> >>>> I am programming a game on scheme using #lang scheme/gui, the >>>> game is >>>> made >>>> of: >>>> 1) an object (copter) that when you click moves up, otherwise it >>>> falls >>>> down, >>>> and does not move horizontaly. >>>> 2) a tunnel that moves from right to left, giving the impression >>>> that the >>>> object is moving forward (moving to the right reaching the end of >>>> the >>>> tunnel). >>>> >>>> >>>> I have a little problem with my double buffer, >>>> I'm using two bitmaps one to draw the copter, and one to draw my >>>> tunnel >>>> >>>> Here is what i have in the paint-callback of my canvas: >>>> >>>> (send BITMAP-DC-1 clear) ; i move my tunnel >>>> (send TUNNEL draw-tunnel1 BITMAP-DC-1 y1) >>>> (send dc draw-bitmap BITMAP-1 (- x-canvas) 0 'solid)) >>>> >>>> >>>> (send BITMAP-DC-2 clear) ; i move my copter >>>> (send BITMAP-DC-2 draw-bitmap copterUp 0 0 'solid) >>>> >>>> (send dc draw-bitmap BITMAP-2 150 (send COPTER get-y- >>>> copter) >>>> 'solid)) >>>> >>>> The problem is that my copter still flickers, and i don't know >>>> why?? >>>> (i don't draw my copter in BITMAP-DC-1 because afterwords i also >>>> use >>>> other >>>> bitmaps to draw my tunnel) >>>> >>>> thanks >>>> >>>> >>>> Marc >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >> >> From robby at eecs.northwestern.edu Sat Apr 11 15:27:32 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 15:27:54 2009 Subject: [plt-scheme] Double buffer (scheme/gui) In-Reply-To: References: <932b2f1f0904111031v306a72ffqd4c9dbf182da58e9@mail.gmail.com> <71D652D4-8B45-4750-B2FB-3FFB63DC5789@gmail.com> <932b2f1f0904111147s5de38438la1687b4175f0bf90@mail.gmail.com> Message-ID: <932b2f1f0904111227r23b2fc3fnb640764dea80d2c1@mail.gmail.com> Nevertheless, double buffering means that you have to have the entire thing in a single buffer. Otherwise you'll draw the tunnel with no copter and then draw the copter on top, which leads to flicker. I don't know what the rest of your code does, but perhaps you don't really need those two bitmaps at all. But if you do, then you'll need a third bitmap. Robby On Sat, Apr 11, 2009 at 2:22 PM, CHAMLY wrote: > Yes, But I have 2 bitmaps, because both of my objects have to move > independently, the tunnel has to be able to move to the left, without moving > the Copter, and the Copter has to move Up and Down without moving the > tunnel... > > Marc > > > > On Apr 11, 2009, at 8:47 PM, Robby Findler wrote: > >> Oh! I misread the code. You need to create a single bitmap containing >> the whole thing and then draw it. Don't draw two bitmaps (that's >> what's causing your flicker). >> >> Robby >> >> On Sat, Apr 11, 2009 at 12:59 PM, CHAMLY wrote: >>> >>> Well I already put the 'no-autoclear ?to the canvas, my BITMAP-DC-1 >>> (tunnel) >>> doesn't flicker only my BITMAP-DC-2(Object) flickers, I will try to put >>> the >>> 'no-autoclear somewhere else, and see if it works. >>> >>> Thank you. >>> >>> On Apr 11, 2009, at 7:31 PM, Robby Findler wrote: >>> >>>> Probably you want to pass the 'no-autoclear style to the canvas% >>>> object when you create it (I may have got the precise name wrong, but >>>> it is listed in the docs for the initialization arguments to canvas%). >>>> >>>> But you also probably want to only recreate the bitmaps when their >>>> content changes, not every time the window is refreshed. In other >>>> words, all but the last line below should be somewhere else, not in >>>> the on-paint method. >>>> >>>> Robby >>>> >>>> On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY wrote: >>>>> >>>>> HI! >>>>> >>>>> I am programming a game on scheme using #lang scheme/gui, the game is >>>>> ?made >>>>> of: >>>>> 1) an object (copter) that when you click moves up, otherwise it falls >>>>> down, >>>>> and does not move horizontaly. >>>>> 2) a tunnel that moves from right to left, giving the impression that >>>>> the >>>>> object is moving forward (moving to the right reaching the end of the >>>>> tunnel). >>>>> >>>>> >>>>> I have a little problem with my double buffer, >>>>> I'm using two bitmaps one to draw the copter, and one to draw my tunnel >>>>> >>>>> Here is what i have in the paint-callback of my canvas: >>>>> >>>>> ? ? ? ? ? (send BITMAP-DC-1 clear) ? ? ? ? ? ? ?; i move my tunnel >>>>> ? ? ? ? ? (send TUNNEL draw-tunnel1 ?BITMAP-DC-1 ?y1) >>>>> ? ? ? ? ? (send dc draw-bitmap BITMAP-1 ?(- x-canvas) 0 'solid)) >>>>> >>>>> >>>>> ? ? ? ? ? (send BITMAP-DC-2 clear) ? ? ; i move my copter >>>>> ? ? ? ? ? (send BITMAP-DC-2 draw-bitmap copterUp ?0 0 'solid) >>>>> >>>>> ? ? ? ? ? (send dc draw-bitmap BITMAP-2 ?150 (send COPTER get-y-copter) >>>>> ?'solid)) >>>>> >>>>> The problem is that my copter still flickers, and i don't know why?? >>>>> (i don't draw my copter in BITMAP-DC-1 because afterwords i also use >>>>> other >>>>> bitmaps to draw my tunnel) >>>>> >>>>> thanks >>>>> >>>>> >>>>> Marc >>>>> ? ? ? ? ?_________________________________________________ >>>>> ?For list-related administrative tasks: >>>>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>>> >>> >>> > > From m.douglas.williams at gmail.com Sat Apr 11 15:51:48 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Apr 11 15:52:10 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> References: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> Message-ID: Yes, the -> is fine. And, so is doing the same bounds check in my own procedure. I was surprised that the ->d was so much slower. I use contracts regularly and was trying to expand my usage of them. On Sat, Apr 11, 2009 at 12:46 PM, Robby Findler wrote: > ->d is definitely substantially slower than the other because the > wrappers are more complex. Are you finding the performance overhead of > the ordinary -> acceptable? > > Robby > > On Sat, Apr 11, 2009 at 1:17 PM, Doug Williams > wrote: > > I would like to use ->d to impose a precondition for a function. For > > example: > > > > (matrix-ref > > (->d ((matrix matrix?) > > (i (and/c exact-nonnegative-integer? ( > (j (and/c exact-nonnegative-integer? ( matrix))))) > > () > > (result any/c))) > > > > or > > > > (matrix-ref > > (->d ((matrix matrix?) > > (i exact-nonnegative-integer?) > > (j exact-nonnegative-integer?)) > > () > > #:pre-cond (and (< i (matrix-rows matrix)) > > (< j (matrix-cols matrix))) > > (result any/c))) > > > > instead of just > > > > (matrix-ref > > (-> matrix? exact-nonnegative-integer? exact-nonnegative-integer? > any/c)) > > > > The first two do work, but are really, really slow. > > > > I like having the bounds check in the contract (as opposed to bounds > check > > in the matrix-ref code, but can't accept the performance hit. Any ideas? > > > > Doug > > > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/fa5d9ae5/attachment.htm From robby at eecs.northwestern.edu Sat Apr 11 15:55:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 15:56:24 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: References: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> Message-ID: <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> ->d actually evaluates the expressions (and/c exact-nonnegative-integer? ( contract, all of that work is done once, before the contract is even attached to the value. I have experimented with various optimizations to avoid this work, but there is a lot to do to make that happen. Robby On Sat, Apr 11, 2009 at 2:51 PM, Doug Williams wrote: > Yes, the -> is fine. And, so is doing the same bounds check in my own > procedure. I was surprised that the ->d was so much slower. I use contracts > regularly and was trying to expand my usage of them. > > On Sat, Apr 11, 2009 at 12:46 PM, Robby Findler > wrote: >> >> ->d is definitely substantially slower than the other because the >> wrappers are more complex. Are you finding the performance overhead of >> the ordinary -> acceptable? >> >> Robby >> >> On Sat, Apr 11, 2009 at 1:17 PM, Doug Williams >> wrote: >> > I would like to use ->d to impose a precondition for a function.? For >> > example: >> > >> > ?(matrix-ref >> > ? (->d ((matrix matrix?) >> > ??????? (i (and/c exact-nonnegative-integer? (> > matrix)))) >> > ??????? (j (and/c exact-nonnegative-integer? (> > matrix))))) >> > ?????? () >> > ?????? (result any/c))) >> > >> > or >> > >> > ?(matrix-ref >> > ? (->d ((matrix matrix?) >> > ??????? (i exact-nonnegative-integer?) >> > ??????? (j exact-nonnegative-integer?)) >> > ?????? () >> > ?????? #:pre-cond (and (< i (matrix-rows matrix)) >> > ?????????????????????? (< j (matrix-cols matrix))) >> > ?????? (result any/c))) >> > >> > instead of just >> > >> > ?(matrix-ref >> > ? (-> matrix? exact-nonnegative-integer? exact-nonnegative-integer? >> > any/c)) >> > >> > The first two do work, but are really, really slow. >> > >> > I like having the bounds check in the contract (as opposed to bounds >> > check >> > in the matrix-ref code, but can't accept the performance hit. Any ideas? >> > >> > Doug >> > >> > >> > _________________________________________________ >> > ?For list-related administrative tasks: >> > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > >> > > > From m.douglas.williams at gmail.com Sat Apr 11 16:38:07 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Apr 11 16:38:32 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> References: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: matrix-slower.ss Type: application/octet-stream Size: 6478 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/ebe5e46b/matrix-slower-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: matrix-faster.ss Type: application/octet-stream Size: 6479 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/ebe5e46b/matrix-faster-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: life-bitblt-slower.ss Type: application/octet-stream Size: 8470 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/ebe5e46b/life-bitblt-slower-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: life-bitblt-faster.ss Type: application/octet-stream Size: 8470 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/ebe5e46b/life-bitblt-faster-0001.obj From robby at eecs.northwestern.edu Sat Apr 11 16:39:22 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 16:39:44 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: References: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> Message-ID: <932b2f1f0904111339s37332198l5592e4fef39ecf36@mail.gmail.com> Yeah, that's pretty bad. Below is a smaller example showing that there about a 16x slowdown for using ->d as compared to ->, even without doing anything special. And if you change the integer? into (and/c number? integer?) in the ->d contract, the slowdown is 35x. I did spent a fair amount of time trying to make -> go fast, but I just haven't had time to do the same for ->d. #lang scheme/load (module m scheme (provide/contract [f (-> integer? integer? integer?)] [g (->d ([x integer?] [y integer?]) () [r integer?])]) (define (f x y) x) (define (g x y) x)) (module n scheme (require 'm) (define (run f) (time (let loop ([i 10000]) (unless (zero? i) (f 1 2) (f 3 4) (f 5 6) (f 7 8) (f 9 10) (loop (- i 1)))))) (run f) (run g)) (require 'n) On Sat, Apr 11, 2009 at 3:29 PM, Doug Williams wrote: > Here is a graphical example where you can see the difference in speed. > > The life-bitblt-slower.ss requires matrix-slower.ss (with ->d and no bounds > checking in the body of the code) and is really slow. > > The life-bitblt-faster.ss requires matrix-faster.ss (with -> and bounds > checking in the body of the code) and performs okay. > > Other than the contract and the corresponding presence or ansence of bounds > checking (to give the same functionality), the code is identical. [The only > difference between life-bitblt-slower.ss and life-bitblt-faster.ss is the > require statement.] > > The life-bitblt-vector.ss version does the matrix abstraction internally > (using a vector) and doesn't use any external module (or contracts) at all. > It is by far the fastest, but it's kind of an apples and oranges comparison > with the others. I'm not sure how much of the speedup is due to the matrix > abstraction into a module or the contracts. > > They all do better compiled. But it interesting to see the speed difference. > > Note that the code used the science and animated-canvas collections from > PLaneT and will download them the first time any of them are run, which > takes some time. > > Doug > > On Sat, Apr 11, 2009 at 1:55 PM, Robby Findler > wrote: >> >> ->d actually evaluates the expressions (and/c >> exact-nonnegative-integer? (> call the function, and that evaluation involves building up a contract >> combinator (and doing various error checking) before actually checking >> the contract. That's where the extra overhead comes from. In >> comparison with the -> contract, all of that work is done once, before >> the contract is even attached to the value. I have experimented with >> various optimizations to avoid this work, but there is a lot to do to >> make that happen. >> >> Robby >> >> On Sat, Apr 11, 2009 at 2:51 PM, Doug Williams >> wrote: >> > Yes, the -> is fine. And, so is doing the same bounds check in my own >> > procedure. I was surprised that the ->d was so much slower. I use >> > contracts >> > regularly and was trying to expand my usage of them. >> > >> > On Sat, Apr 11, 2009 at 12:46 PM, Robby Findler >> > wrote: >> >> >> >> ->d is definitely substantially slower than the other because the >> >> wrappers are more complex. Are you finding the performance overhead of >> >> the ordinary -> acceptable? >> >> >> >> Robby >> >> >> >> On Sat, Apr 11, 2009 at 1:17 PM, Doug Williams >> >> wrote: >> >> > I would like to use ->d to impose a precondition for a function.? For >> >> > example: >> >> > >> >> > ?(matrix-ref >> >> > ? (->d ((matrix matrix?) >> >> > ??????? (i (and/c exact-nonnegative-integer? (> >> > matrix)))) >> >> > ??????? (j (and/c exact-nonnegative-integer? (> >> > matrix))))) >> >> > ?????? () >> >> > ?????? (result any/c))) >> >> > >> >> > or >> >> > >> >> > ?(matrix-ref >> >> > ? (->d ((matrix matrix?) >> >> > ??????? (i exact-nonnegative-integer?) >> >> > ??????? (j exact-nonnegative-integer?)) >> >> > ?????? () >> >> > ?????? #:pre-cond (and (< i (matrix-rows matrix)) >> >> > ?????????????????????? (< j (matrix-cols matrix))) >> >> > ?????? (result any/c))) >> >> > >> >> > instead of just >> >> > >> >> > ?(matrix-ref >> >> > ? (-> matrix? exact-nonnegative-integer? exact-nonnegative-integer? >> >> > any/c)) >> >> > >> >> > The first two do work, but are really, really slow. >> >> > >> >> > I like having the bounds check in the contract (as opposed to bounds >> >> > check >> >> > in the matrix-ref code, but can't accept the performance hit. Any >> >> > ideas? >> >> > >> >> > Doug >> >> > >> >> > >> >> > _________________________________________________ >> >> > ?For list-related administrative tasks: >> >> > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > >> >> > >> > >> > > > From robby at eecs.northwestern.edu Sat Apr 11 16:41:52 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 16:42:11 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: <932b2f1f0904111339s37332198l5592e4fef39ecf36@mail.gmail.com> References: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> <932b2f1f0904111339s37332198l5592e4fef39ecf36@mail.gmail.com> Message-ID: <932b2f1f0904111341j37c42062n3be845f819e89522@mail.gmail.com> Popping out one level, this kind of use of contracts (roughly: on field accessors) is one of the places where I know that they can have a non-trivial impact on the overall running time of an application. The best suggestion I can make for now is to either use Typed Scheme or to move the contracts onto higher-level abstractions that get called less frequently. Sorry, Robby From m.douglas.williams at gmail.com Sat Apr 11 16:50:16 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Apr 11 16:50:39 2009 Subject: [plt-scheme] Double buffer (scheme/gui) In-Reply-To: <932b2f1f0904111227r23b2fc3fnb640764dea80d2c1@mail.gmail.com> References: <932b2f1f0904111031v306a72ffqd4c9dbf182da58e9@mail.gmail.com> <71D652D4-8B45-4750-B2FB-3FFB63DC5789@gmail.com> <932b2f1f0904111147s5de38438la1687b4175f0bf90@mail.gmail.com> <932b2f1f0904111227r23b2fc3fnb640764dea80d2c1@mail.gmail.com> Message-ID: I have an animated-canvas class on PLaneT that does the double-buffering automatically - I'm sure there are other similar solutions out there too (e.g., I think frtime has some similar classes). Doug On Sat, Apr 11, 2009 at 1:27 PM, Robby Findler wrote: > Nevertheless, double buffering means that you have to have the entire > thing in a single buffer. Otherwise you'll draw the tunnel with no > copter and then draw the copter on top, which leads to flicker. > > I don't know what the rest of your code does, but perhaps you don't > really need those two bitmaps at all. > > But if you do, then you'll need a third bitmap. > > Robby > > On Sat, Apr 11, 2009 at 2:22 PM, CHAMLY wrote: > > Yes, But I have 2 bitmaps, because both of my objects have to move > > independently, the tunnel has to be able to move to the left, without > moving > > the Copter, and the Copter has to move Up and Down without moving the > > tunnel... > > > > Marc > > > > > > > > On Apr 11, 2009, at 8:47 PM, Robby Findler wrote: > > > >> Oh! I misread the code. You need to create a single bitmap containing > >> the whole thing and then draw it. Don't draw two bitmaps (that's > >> what's causing your flicker). > >> > >> Robby > >> > >> On Sat, Apr 11, 2009 at 12:59 PM, CHAMLY wrote: > >>> > >>> Well I already put the 'no-autoclear to the canvas, my BITMAP-DC-1 > >>> (tunnel) > >>> doesn't flicker only my BITMAP-DC-2(Object) flickers, I will try to put > >>> the > >>> 'no-autoclear somewhere else, and see if it works. > >>> > >>> Thank you. > >>> > >>> On Apr 11, 2009, at 7:31 PM, Robby Findler wrote: > >>> > >>>> Probably you want to pass the 'no-autoclear style to the canvas% > >>>> object when you create it (I may have got the precise name wrong, but > >>>> it is listed in the docs for the initialization arguments to canvas%). > >>>> > >>>> But you also probably want to only recreate the bitmaps when their > >>>> content changes, not every time the window is refreshed. In other > >>>> words, all but the last line below should be somewhere else, not in > >>>> the on-paint method. > >>>> > >>>> Robby > >>>> > >>>> On Sat, Apr 11, 2009 at 12:25 PM, CHAMLY > wrote: > >>>>> > >>>>> HI! > >>>>> > >>>>> I am programming a game on scheme using #lang scheme/gui, the game is > >>>>> made > >>>>> of: > >>>>> 1) an object (copter) that when you click moves up, otherwise it > falls > >>>>> down, > >>>>> and does not move horizontaly. > >>>>> 2) a tunnel that moves from right to left, giving the impression that > >>>>> the > >>>>> object is moving forward (moving to the right reaching the end of the > >>>>> tunnel). > >>>>> > >>>>> > >>>>> I have a little problem with my double buffer, > >>>>> I'm using two bitmaps one to draw the copter, and one to draw my > tunnel > >>>>> > >>>>> Here is what i have in the paint-callback of my canvas: > >>>>> > >>>>> (send BITMAP-DC-1 clear) ; i move my tunnel > >>>>> (send TUNNEL draw-tunnel1 BITMAP-DC-1 y1) > >>>>> (send dc draw-bitmap BITMAP-1 (- x-canvas) 0 'solid)) > >>>>> > >>>>> > >>>>> (send BITMAP-DC-2 clear) ; i move my copter > >>>>> (send BITMAP-DC-2 draw-bitmap copterUp 0 0 'solid) > >>>>> > >>>>> (send dc draw-bitmap BITMAP-2 150 (send COPTER > get-y-copter) > >>>>> 'solid)) > >>>>> > >>>>> The problem is that my copter still flickers, and i don't know why?? > >>>>> (i don't draw my copter in BITMAP-DC-1 because afterwords i also use > >>>>> other > >>>>> bitmaps to draw my tunnel) > >>>>> > >>>>> thanks > >>>>> > >>>>> > >>>>> Marc > >>>>> _________________________________________________ > >>>>> 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/20090411/6851181d/attachment.html From m.douglas.williams at gmail.com Sat Apr 11 16:55:08 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Apr 11 16:55:31 2009 Subject: [plt-scheme] Fixnum Conversion In-Reply-To: <18912.41096.737856.705450@winooski.ccs.neu.edu> References: <68F125E9-ACC2-400F-921B-4986A3DBE212@snafu.de> <18912.41096.737856.705450@winooski.ccs.neu.edu> Message-ID: The packed-binary collection on PLaneT can convert between various binary formats and byte strings. It's patterned after a similar capability in Python. On Sat, Apr 11, 2009 at 7:52 AM, Eli Barzilay wrote: > On Apr 11, Erich Rast wrote: > > Hi all, > > > > I'm a bit confused about numbers. A fixnum can hold numbers that fit > > into 31 or 63 bits depending on whether the machine is 32 bit or 64 > > bit, right? > > > > How do I convert a positive integer number in the range from > > 0...4294967295 (inclusive) on any machine to a little-endian encoded 4- > > element bytes string? > > You can use (integer->integer-bytes 4294967295 4 #f #f) -- with #f for > the `signed?' flag, since otherwise it doesn't fit into 4 bytes. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/bab6e210/attachment.htm From matthias at ccs.neu.edu Sat Apr 11 16:58:53 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Apr 11 17:00:13 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: <932b2f1f0904111341j37c42062n3be845f819e89522@mail.gmail.com> References: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> <932b2f1f0904111339s37332198l5592e4fef39ecf36@mail.gmail.com> <932b2f1f0904111341j37c42062n3be845f819e89522@mail.gmail.com> Message-ID: <0F70741C-1AB3-4786-9925-B2D6555D685C@ccs.neu.edu> I second that. Indeed, I consider your kind of programs ideal candidates for just this kind of partial conversion. Still, we're also looking for 'heavy' contract candidates that benefit from parallel contract checking. Yours seems the right kind -- Matthias On Apr 11, 2009, at 4:41 PM, Robby Findler wrote: > Popping out one level, this kind of use of contracts (roughly: on > field accessors) is one of the places where I know that they can have > a non-trivial impact on the overall running time of an application. > The best suggestion I can make for now is to either use Typed Scheme > or to move the contracts onto higher-level abstractions that get > called less frequently. > > Sorry, > Robby > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From m.douglas.williams at gmail.com Sat Apr 11 16:29:09 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Sat Apr 11 18:50:47 2009 Subject: [plt-scheme] ->d Performance In-Reply-To: <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> References: <932b2f1f0904111146t209797d6l1641ed0ab37747e9@mail.gmail.com> <932b2f1f0904111255q56a91455re8a480d26c00e26a@mail.gmail.com> Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: matrix-slower.ss Type: application/octet-stream Size: 6478 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/b3fd65c6/matrix-slower-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: matrix-faster.ss Type: application/octet-stream Size: 6479 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/b3fd65c6/matrix-faster-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: life-bitblt-slower.ss Type: application/octet-stream Size: 8470 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/b3fd65c6/life-bitblt-slower-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: life-bitblt-faster.ss Type: application/octet-stream Size: 8470 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/b3fd65c6/life-bitblt-faster-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: life-bitblt-vector.ss Type: application/octet-stream Size: 8555 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090411/b3fd65c6/life-bitblt-vector-0001.obj From toddobryan at gmail.com Sat Apr 11 20:37:40 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Sat Apr 11 20:37:58 2009 Subject: [plt-scheme] What environment to use for PLT development? Message-ID: <904774730904111737o4c06c9dag14a555986cf5476c@mail.gmail.com> OK, so after Sam fixed the Typed Scheme bugs, I feel obligated to check out the SVN code and start playing. How should I set everything up so that development is pretty easy? Given the DrScheme key-bindings, I'm guessing Emacs is a common choice, but I'm not sure what extra goodies I should use to make building and such fairly easy. Does anyone have a description of what they use to develop PLT and how it's all set up? Todd From robby at eecs.northwestern.edu Sat Apr 11 21:36:10 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 11 21:36:41 2009 Subject: [plt-scheme] What environment to use for PLT development? In-Reply-To: <904774730904111737o4c06c9dag14a555986cf5476c@mail.gmail.com> References: <904774730904111737o4c06c9dag14a555986cf5476c@mail.gmail.com> Message-ID: <932b2f1f0904111836o7e932f14j455a2d9b0e4e10e0@mail.gmail.com> The build process is the usual configure, make, make install. I recommend that you check out the SVN tree and then make a directory inside the src directory called build. From there, just: ../configure ; make ; make install If you have a multi processor machine, use "make -j " where is the number of processors you have. As far as development goes, I use drscheme to develop drscheme, with two separate trees, but I think most people can just use the one drscheme. Robby On Sat, Apr 11, 2009 at 7:37 PM, Todd O'Bryan wrote: > OK, so after Sam fixed the Typed Scheme bugs, I feel obligated to > check out the SVN code and start playing. > > How should I set everything up so that development is pretty easy? > Given the DrScheme key-bindings, I'm guessing Emacs is a common > choice, but I'm not sure what extra goodies I should use to make > building and such fairly easy. > > Does anyone have a description of what they use to develop PLT and how > it's all set up? > > Todd > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jmj at fellowhuman.com Sun Apr 12 03:15:28 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sun Apr 12 03:15:54 2009 Subject: [plt-scheme] dual-editor snip In-Reply-To: <932b2f1f0904110901r296bd840qfe11d1b58f474e7a@mail.gmail.com> References: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> <595b9ab20904110402r1f72c3c8v9c7bd447e63363fe@mail.gmail.com> <5AA3A00F-B262-4D1E-BA99-0E174FA9A7B5@fellowhuman.com> <932b2f1f0904110901r296bd840qfe11d1b58f474e7a@mail.gmail.com> Message-ID: <7953F6B6-136F-4AEA-83BF-0F6F875DE4B3@fellowhuman.com> On Apr 11, 2009, at 9:01 AM, Robby Findler wrote: > I'm sorry I'm just quickly tuning in, but did you try making a > pasteboard with two editor-snip%s that contain the two text%s? You can > show and remove them as you wish (but you will have to do some work to > make sure the editor-snip%s are always the right size). No, I hadn't tried that, and I'm playing with it now. Thanks. It looks like mrlib's vertical-pasteboard% is what I'm after. I think I've found a doc error, though: http://docs.plt-scheme.org/mrlib/aligned-pasteboard-parent___.html > (which it seems my class must implement) states the requirement of implementing set-aligned-min-sizes, but the actual code for aligned- pasteboard-parent<%> has that method name commented out, and requires aligned-min-sizes-invalid instead. Given that my class is a subclass of editor-snip% whose editor is a vertical-pasteboard%, 1) must it indeed implement aligned-pasteboard-parent<%>? 2) if so, what interface method should I implement, and 3) what should that method do? Seems safer to ask rather than making assumptions based on the source or docs -- the only examples I've found to go on are in mrlib/private/ aligned-pasteboard, and the inconsistencies are disconcerting... Thanks again, jmj From adnakh at gmail.com Sun Apr 12 10:34:32 2009 From: adnakh at gmail.com (Alexander Nakhimovsky) Date: Sun Apr 12 10:34:52 2009 Subject: [plt-scheme] language with set-car! and random Message-ID: <6c4c17240904120734n3d0c4713s222bc4444013bf80@mail.gmail.com> I need a language that has both set-[car!,cdr!] and random, and can be used with the GUI. Neither pretty-big nor r5rs has both. Shall I select module? or select pretty-big and add some include instructions at the top? This is a bit urgent, and help would be much appreciated. adn From spdegabrielle at gmail.com Sun Apr 12 14:54:44 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Sun Apr 12 14:55:08 2009 Subject: [plt-scheme] Two new PLT Scheme web server tutorials In-Reply-To: <915e4d7e-2156-421f-a7d5-a9c57f00b67b@s20g2000yqh.googlegroups.com> References: <915e4d7e-2156-421f-a7d5-a9c57f00b67b@s20g2000yqh.googlegroups.com> Message-ID: <595b9ab20904121154h6f16c32dk16cbfacaa9488ce1@mail.gmail.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: xhtml.ss Type: application/octet-stream Size: 5955 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090412/d97dbc15/xhtml.obj From noelwelsh at gmail.com Sun Apr 12 15:56:10 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Sun Apr 12 15:56:32 2009 Subject: [plt-scheme] language with set-car! and random In-Reply-To: <6c4c17240904120734n3d0c4713s222bc4444013bf80@mail.gmail.com> References: <6c4c17240904120734n3d0c4713s222bc4444013bf80@mail.gmail.com> Message-ID: I'm a little bit confused. You can create your own language easily enough. See http://svn.plt-scheme.org/plt/trunk/collects/scheme/main.ss for the definition of the Scheme (#lang scheme) language. But you write > Shall I select module? or select pretty-big and add some include instructions > at the top? If you're happy to include extra modules, I don't understand why you don't just include the modules you need -- rather than needing a new language. I think you're confusing DrScheme languages, and module languages as specified with #lang. So I think the answer to your question is to select Module and include the modules you want. N. From jmj at fellowhuman.com Sun Apr 12 20:04:26 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sun Apr 12 20:04:50 2009 Subject: [plt-scheme] dual-editor snip In-Reply-To: <932b2f1f0904110901r296bd840qfe11d1b58f474e7a@mail.gmail.com> References: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> <595b9ab20904110402r1f72c3c8v9c7bd447e63363fe@mail.gmail.com> <5AA3A00F-B262-4D1E-BA99-0E174FA9A7B5@fellowhuman.com> <932b2f1f0904110901r296bd840qfe11d1b58f474e7a@mail.gmail.com> Message-ID: On Apr 11, 2009, at 9:01 AM, Robby Findler wrote: > I'm sorry I'm just quickly tuning in, but did you try making a > pasteboard with two editor-snip%s that contain the two text%s? OK, vertical-pasteboard% is doing what I want. One more thing: > You can > show and remove them as you wish (but you will have to do some work to > make sure the editor-snip%s are always the right size). Regarding that sizing -- I want to keep the two subordinate snips' widths equal, and need to know: - How can I detect whether a text% has been resized as a result of the user's typing? - Is set-min-width a reliable way to control the width of the two subordinate editor-snip%s? That is, if snip A is wider than snip B (as reported by get-extent), set B's min-width to be the width of A. Or is there a better way? Thanks, jmj From robby at eecs.northwestern.edu Sun Apr 12 20:43:00 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 12 20:43:19 2009 Subject: [plt-scheme] dual-editor snip In-Reply-To: References: <7216F851-3DAF-47B2-A1A8-2D939096613F@fellowhuman.com> <595b9ab20904110402r1f72c3c8v9c7bd447e63363fe@mail.gmail.com> <5AA3A00F-B262-4D1E-BA99-0E174FA9A7B5@fellowhuman.com> <932b2f1f0904110901r296bd840qfe11d1b58f474e7a@mail.gmail.com> Message-ID: <932b2f1f0904121743l11efb777qbde67a860401bb4e@mail.gmail.com> On Sun, Apr 12, 2009 at 7:04 PM, Jordan Johnson wrote: >> You can >> show and remove them as you wish (but you will have to do some work to >> make sure the editor-snip%s are always the right size). > > Regarding that sizing -- I want to keep the two subordinate snips' widths > equal, and need to know: > ? ? ? ?- How can I detect whether a text% has been resized as a result of > the user's typing? > ? ? ? ?- Is set-min-width a reliable way to control the width of the two > subordinate editor-snip%s? ?That is, if snip A is wider than snip B (as > reported by get-extent), set B's min-width to be the width of A. ?Or is > there a better way? I'm sorry -- I'm not better than the documentation for these questions. I've worked thru that all before and there is a way to make everything work, but I've lost the memory of which methods fit with which ones in precisely which way. On the positive side, the vertical-pasteboard% classes are managing some of this for you so if they work, perhaps you can avoid all of the detail I've since forgotten..... Robby From grettke at acm.org Sun Apr 12 20:59:51 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Apr 12 21:00:17 2009 Subject: [plt-scheme] language with set-car! and random In-Reply-To: <6c4c17240904120734n3d0c4713s222bc4444013bf80@mail.gmail.com> References: <6c4c17240904120734n3d0c4713s222bc4444013bf80@mail.gmail.com> Message-ID: <756daca50904121759j293df61fj72cf85bf759d1075@mail.gmail.com> You could set the language to module and use the scheme/gui language and then use mutable pairs: http://download.plt-scheme.org/doc/html/reference/mpairs.html On Sun, Apr 12, 2009 at 9:34 AM, Alexander Nakhimovsky wrote: > I need a language that has both set-[car!,cdr!] and random, and can be > used with the GUI. Neither pretty-big nor r5rs has both. Shall I > select module? or select pretty-big and add some include instructions > at the top? This is a bit urgent, and help would be much appreciated. > > adn > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- http://www.wisdomandwonder.com/ From sbloch at adelphi.edu Sun Apr 12 21:15:27 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Sun Apr 12 21:15:32 2009 Subject: [plt-scheme] stepper interface suggestion for "start-from-here"? In-Reply-To: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> References: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> Message-ID: On Apr 10, 2009, at 8:52 PM, John Clements wrote: > A few weeks ago Jay McCarthy suggested a feature for the stepper > that was so obvious that I had to implement it (also, I have a > sneaking suspicion that others must have suggested it): starting to > step at a specified expression, rather than from the beginning. I presume you mean that the Definitions pane would execute from the beginning, but the Stepper would only go into effect at the specified expression. I had initial some ideas about a UI for this, but then started thinking about my long-standing request to have the Stepper work in the Interactions pane as well as the Definitions pane, and how to do both of these things in a consistent way (from the user's perspective)... and I came up with something much more powerful. How does this sound? 1) Provide a "step" form that opens a Stepper window to evaluate its argument. This form would be invokable from either Definitions or Interactions. If invoked when there is no MrEd window open at all, it would simply evaluate its argument. If invoked from within an expression that's already being Stepped, it would be ignored. 2) Provide a miniature "foot" icon that's an abbreviation for the "step" form, just as an apostrophe is an abbreviation for the "quote" form, or the lambda symbol is an abbreviation for "lambda". 3) Anywhere in the Definitions pane (whether at the top level or inside a function definition), or anywhere in a yet-unevaluated line in the Interactions pane, you can right-click and insert (or remove) a "foot" icon, i.e. a "step" form around the immediately-following expression. This gives you effectively the multiple-breakpoint capability of BlueJ's debugger, plus the ability to invoke a Stepper on any portion (s) of interactively-typed code without removing your hands from the keyboard. Stephen Bloch sbloch@adelphi.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090412/dc67eb09/attachment.htm From reb at cs.bilgi.edu.tr Mon Apr 13 09:36:45 2009 From: reb at cs.bilgi.edu.tr (=?utf-8?Q?R=2E_Emre_Ba=C5=9Far?=) Date: Mon Apr 13 09:37:17 2009 Subject: [plt-scheme] Creating a suspended thread Message-ID: <20090413133645.GC2967@terra.galaxy> Hi, I'm tryring to create a thread which is initially suspended. As far as I know, (thread (lambda () ...)) creates a thread and runs it instantly. Is it possible to create a thread in suspended state to resume later? I know it's possible to create and suspend it afterwards but our application is rather time intensive so I don't want it to have even a little chance to run. I might solve it using some kind of a locking primitive but I think it would be an overkill to do it that way. Any suggestions? -- R. Emre Ba?ar ?stanbul Bilgi University Department of Computer Science -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090413/ea14d898/attachment.pgp From matthias at ccs.neu.edu Mon Apr 13 09:38:08 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 13 09:41:33 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <20090413133645.GC2967@terra.galaxy> References: <20090413133645.GC2967@terra.galaxy> Message-ID: <1D695CC5-8BAD-4777-BDC4-ACE953D9A2B3@ccs.neu.edu> Why create a thread that's suspended? Why not wait until you need it? If your program is so time intensive that starting up the thread until it hits a "suspend" operation, then it is too intensive to even create it at that point. -- Matthias On Apr 13, 2009, at 9:36 AM, R. Emre Ba?ar wrote: > Hi, > > I'm tryring to create a thread which is initially suspended. As > far as > I know, (thread (lambda () ...)) creates a thread and runs it > instantly. > Is it possible to create a thread in suspended state to resume later? > > I know it's possible to create and suspend it afterwards but our > application is rather time intensive so I don't want it to have even a > little chance to run. > > I might solve it using some kind of a locking primitive but I think it > would be an overkill to do it that way. > > Any suggestions? > > -- > R. Emre Ba?ar > ?stanbul Bilgi University > Department of Computer Science > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sbloch at adelphi.edu Mon Apr 13 09:44:53 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Apr 13 09:45:16 2009 Subject: [plt-scheme] stepper interface suggestion for "start-from-here"? In-Reply-To: References: <9CFAF44D-C366-4ACB-959D-A508294D913A@brinckerhoff.org> Message-ID: <09280568-3622-486B-A19F-6B9782A6B6A9@adelphi.edu> Slight modifications to the previous proposal: > 1) Provide a "step" form that opens a Stepper window to evaluate > its argument. This form would be invokable from either Definitions > or Interactions. If invoked when there is no MrEd window open at > all, it would simply evaluate its argument. If invoked from within > an expression that's already being Stepped, it would be ignored. Of course, there's no need for the "step" form to be restricted to one expression; if it were written to take an arbitrary number of expressions and evaluate them in order, the "Stepper" button would be equivalent to wrapping a "step" around the entire Definitions pane and hitting "Run". The miniature "foot" icon would be an abbreviation for the unary form of "step", i.e. it would apply only to the immediately-following expression. Stephen Bloch sbloch@adelphi.edu From mflatt at cs.utah.edu Mon Apr 13 10:24:00 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Apr 13 10:24:23 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <20090413133645.GC2967@terra.galaxy> References: <20090413133645.GC2967@terra.galaxy> Message-ID: <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> At Mon, 13 Apr 2009 16:36:45 +0300, R. Emre Ba?ar wrote: > I'm tryring to create a thread which is initially suspended. As far as > I know, (thread (lambda () ...)) creates a thread and runs it instantly. > Is it possible to create a thread in suspended state to resume later? > > I know it's possible to create and suspend it afterwards but our > application is rather time intensive so I don't want it to have even a > little chance to run. Matthias asks a good question, but... (define (thread/suspended thunk) (let* ([s (make-semaphore)] [t (thread (lambda () (semaphore-wait s) (thunk)))]) (thread-suspend t) (semaphore-post s) t)) In practice, `thread-suspend' will suspend the new thread before it is ever swapped in. In the unlikely event that the creating thread is swapped out before it can suspend the new one, the semaphore prevents the new thread from making any progress. (The semaphore operations are all cheap.) From toddobryan at gmail.com Mon Apr 13 10:25:18 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Apr 13 10:25:37 2009 Subject: [plt-scheme] pasteboard% example Message-ID: <904774730904130725w3e1a7607xfef7f26bdd781b57@mail.gmail.com> Does anyone have a pointer to an example of how a pasteboard% would be used, either in the PLT codebase or elsewhere? Todd From martindemello at gmail.com Mon Apr 13 12:01:00 2009 From: martindemello at gmail.com (Martin DeMello) Date: Mon Apr 13 12:01:26 2009 Subject: [plt-scheme] pasteboard% example In-Reply-To: <904774730904130725w3e1a7607xfef7f26bdd781b57@mail.gmail.com> References: <904774730904130725w3e1a7607xfef7f26bdd781b57@mail.gmail.com> Message-ID: On Mon, Apr 13, 2009 at 7:55 PM, Todd O'Bryan wrote: > Does anyone have a pointer to an example of how a pasteboard% would be > used, either in the PLT codebase or elsewhere? Here's a minimal example of instantiating a pasteboard% and inserting an editor-snip% into it: #lang scheme (require mred framework) (define f (instantiate frame% ("Pasteboard Test" #f 600 400))) (define c (instantiate editor-canvas% (f))) (define p (instantiate pasteboard% ())) (send c set-editor p) (send f show #t) (define t (instantiate text% ())) (define s (instantiate editor-snip% (t))) (send t insert "hello pasteboard world" 0) (send p insert s) martin From ontheheap at gmail.com Mon Apr 13 12:12:50 2009 From: ontheheap at gmail.com (S Brown) Date: Mon Apr 13 12:13:08 2009 Subject: [plt-scheme] HTDP Exercise 9.5.7 Message-ID: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> I'm working my way through HTDP and I have a question regarding Exercise 9.5.7. The exercise asks you to define the function average- price, which takes as it's input a list of prices, and gives as output the average of the prices in the list. I came up with the following solution:
(define (checked-average-price toy-list)
  (cond
    ((empty? toy-list) (error 'checked-average-price "expected a non-
empty list"))
    (else (average-price toy-list))))

(define (average-price toy-list)
  (cond
    ((empty? toy-list) 0)
    (else (/ (sum-list toy-list)
             (num-items toy-list)))))

(define (sum-list a-list)
  (cond
    ((empty? a-list) 0)
    (else (+ (first a-list)
             (sum-list (rest a-list))))))

(define (num-items a-list)
  (cond
    ((empty? a-list) 0)
    (else (+ 1 (num-items (rest a-list))))))
I came to this solution after not being able to figure out how to keep track of the sum of the items and also the number of items at the same time. So my concern/question is, is my solution acceptable, or should I keep trying to figure out how to keep track of both values (sum and number of items) without resulting to helper-functions such as sum- list and num-items? Thanks. From robby at eecs.northwestern.edu Mon Apr 13 12:22:00 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Apr 13 12:22:41 2009 Subject: [plt-scheme] pasteboard% example In-Reply-To: References: <904774730904130725w3e1a7607xfef7f26bdd781b57@mail.gmail.com> Message-ID: <932b2f1f0904130922q36ebc423j46b823f230f7d21b@mail.gmail.com> Also, the module browser and Redex both use a graph library that is built out of pasteboards. Robby On Mon, Apr 13, 2009 at 11:01 AM, Martin DeMello wrote: > On Mon, Apr 13, 2009 at 7:55 PM, Todd O'Bryan wrote: >> Does anyone have a pointer to an example of how a pasteboard% would be >> used, either in the PLT codebase or elsewhere? > > Here's a minimal example of instantiating a pasteboard% and inserting > an editor-snip% into it: > > #lang scheme > > (require mred framework) > > (define f (instantiate frame% ("Pasteboard Test" #f 600 400))) > (define c (instantiate editor-canvas% (f))) > (define p (instantiate pasteboard% ())) > (send c set-editor p) > (send f show #t) > (define t (instantiate text% ())) > (define s (instantiate editor-snip% (t))) > (send t insert "hello pasteboard world" 0) > (send p insert s) > > martin > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From toddobryan at gmail.com Mon Apr 13 12:55:27 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Apr 13 12:55:45 2009 Subject: [plt-scheme] HTDP Exercise 9.5.7 In-Reply-To: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> References: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> Message-ID: <904774730904130955r55e6a1f2s8e0932bf696ef6a9@mail.gmail.com> I just got yelled at for posting complete code to one of the book problems, so I'll yell this time: try to avoid posting complete answers to book exercises--instead post enough info so people know what you're asking and you can send code to individuals rather than the whole list if needed. That said, yes, you're on the right track. I make a big deal of this problem with my classes and say, "I've lied to you. Here's a function that doesn't follow the template. What could I have been thinking?!!!" and then we talk about the fact that using helper functions that follow the template is really just another way of using the template, so my reputation as a trustworthy teacher remains unscathed. Todd On Mon, Apr 13, 2009 at 12:12 PM, S Brown wrote: > I'm working my way through HTDP and I have a question regarding > Exercise 9.5.7. The exercise asks you to define the function average- > price, which takes as it's input a list of prices, and gives as output > the average of the prices in the list. I came up with ?the following > solution: > > I came to this solution after not being able to figure out how to keep > track of the sum of the items and also the number of items at the same > time. So my concern/question is, is my solution acceptable, or should > I keep trying to figure out how to keep track of both values (sum and > number of items) without resulting to helper-functions such as sum- > list and num-items? Thanks. From jos.koot at telefonica.net Mon Apr 13 12:57:59 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Mon Apr 13 12:58:20 2009 Subject: [plt-scheme] HTDP Exercise 9.5.7 References: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> Message-ID: <4D760198496046E7A327F86265B2745C@uw2b2dff239c4d> If you want one pass through the list of prices, you can do so with one single auxiliary function. First consider how many arguments that auxiliary function should have? Later you will learn (at Intermediate student level, section 3) how to write function average as a oneliner, but as for now you dont have all tools yet (and with good reason, mho) Jos ----- Original Message ----- From: "S Brown" To: Sent: Monday, April 13, 2009 6:12 PM Subject: [plt-scheme] HTDP Exercise 9.5.7 > I'm working my way through HTDP and I have a question regarding > Exercise 9.5.7. The exercise asks you to define the function average- > price, which takes as it's input a list of prices, and gives as output > the average of the prices in the list. I came up with the following > solution: > >
> (define (checked-average-price toy-list)
>  (cond
>    ((empty? toy-list) (error 'checked-average-price "expected a non-
> empty list"))
>    (else (average-price toy-list))))
>
> (define (average-price toy-list)
>  (cond
>    ((empty? toy-list) 0)
>    (else (/ (sum-list toy-list)
>             (num-items toy-list)))))
>
> (define (sum-list a-list)
>  (cond
>    ((empty? a-list) 0)
>    (else (+ (first a-list)
>             (sum-list (rest a-list))))))
>
> (define (num-items a-list)
>  (cond
>    ((empty? a-list) 0)
>    (else (+ 1 (num-items (rest a-list))))))
> 
> > I came to this solution after not being able to figure out how to keep > track of the sum of the items and also the number of items at the same > time. So my concern/question is, is my solution acceptable, or should > I keep trying to figure out how to keep track of both values (sum and > number of items) without resulting to helper-functions such as sum- > list and num-items? Thanks. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Mon Apr 13 12:56:49 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 13 13:00:14 2009 Subject: [plt-scheme] HTDP Exercise 9.5.7 In-Reply-To: <904774730904130955r55e6a1f2s8e0932bf696ef6a9@mail.gmail.com> References: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> <904774730904130955r55e6a1f2s8e0932bf696ef6a9@mail.gmail.com> Message-ID: <5C0A7B7D-B4FE-482D-9ED2-6B58857B9757@ccs.neu.edu> Thanks for yelling. I answered in private and it is NOT a violation of design, in the spirit of HtDP, but a good example of -- figure out the tasks involved -- design one function per task. It just happens to be the first exercise that throws students back to this rule introduce earlier in the book and not exercised. -- Matthias On Apr 13, 2009, at 12:55 PM, Todd O'Bryan wrote: > I just got yelled at for posting complete code to one of the book > problems, so I'll yell this time: try to avoid posting complete > answers to book exercises--instead post enough info so people know > what you're asking and you can send code to individuals rather than > the whole list if needed. > > That said, yes, you're on the right track. I make a big deal of this > problem with my classes and say, "I've lied to you. Here's a function > that doesn't follow the template. What could I have been thinking?!!!" > and then we talk about the fact that using helper functions that > follow the template is really just another way of using the template, > so my reputation as a trustworthy teacher remains unscathed. > > Todd > > On Mon, Apr 13, 2009 at 12:12 PM, S Brown wrote: >> I'm working my way through HTDP and I have a question regarding >> Exercise 9.5.7. The exercise asks you to define the function average- >> price, which takes as it's input a list of prices, and gives as >> output >> the average of the prices in the list. I came up with the following >> solution: >> >> I came to this solution after not being able to figure out how to >> keep >> track of the sum of the items and also the number of items at the >> same >> time. So my concern/question is, is my solution acceptable, or should >> I keep trying to figure out how to keep track of both values (sum and >> number of items) without resulting to helper-functions such as sum- >> list and num-items? Thanks. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From reb at cs.bilgi.edu.tr Mon Apr 13 13:16:05 2009 From: reb at cs.bilgi.edu.tr (=?utf-8?Q?R=2E_Emre_Ba=C5=9Far?=) Date: Mon Apr 13 13:17:17 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <1D695CC5-8BAD-4777-BDC4-ACE953D9A2B3@ccs.neu.edu> References: <20090413133645.GC2967@terra.galaxy> <1D695CC5-8BAD-4777-BDC4-ACE953D9A2B3@ccs.neu.edu> Message-ID: <20090413171605.GA2976@terra.galaxy> Sometimes focusing on one solution is just plain evil. I think my mind went away while I'm thinking in terms of Python/Java threads. Thanks a lot. Matthias Felleisen der ki: > > Why create a thread that's suspended? Why not wait until you need it? If > your program is so time intensive that starting up the thread until it > hits a "suspend" operation, then it is too intensive to even create it at > that point. > > -- Matthias > > > > On Apr 13, 2009, at 9:36 AM, R. Emre Ba?ar wrote: > >> Hi, >> >> I'm tryring to create a thread which is initially suspended. As far as >> I know, (thread (lambda () ...)) creates a thread and runs it >> instantly. >> Is it possible to create a thread in suspended state to resume later? >> >> I know it's possible to create and suspend it afterwards but our >> application is rather time intensive so I don't want it to have even a >> little chance to run. >> >> I might solve it using some kind of a locking primitive but I think it >> would be an overkill to do it that way. >> >> Any suggestions? >> >> -- >> R. Emre Ba?ar >> ?stanbul Bilgi University >> Department of Computer Science >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- R. Emre Ba?ar ?stanbul Bilgi University Department of Computer Science -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090413/014d748c/attachment.pgp From jos.koot at telefonica.net Mon Apr 13 13:44:00 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Mon Apr 13 13:44:18 2009 Subject: [plt-scheme] HTDP Exercise 9.5.7 References: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> <904774730904130955r55e6a1f2s8e0932bf696ef6a9@mail.gmail.com> Message-ID: In my unsuspectingness I did not conscientially realize that a complete answer was posted. Therefore, and because I am just a visitor of this list and do not have any authority on this list, I did not yell about it. In my answer I should have erased that the scheme code from the original message. My apollogies. Please note that my answer is just a hint. Jos ----- Original Message ----- From: "Todd O'Bryan" To: "S Brown" ; "PLT-Scheme Mailing List" Sent: Monday, April 13, 2009 6:55 PM Subject: Re: [plt-scheme] HTDP Exercise 9.5.7 I just got yelled at for posting complete code to one of the book problems, so I'll yell this time: try to avoid posting complete answers to book exercises--instead post enough info so people know what you're asking and you can send code to individuals rather than the whole list if needed. ----- Original Message ----- From: "Matthias Felleisen" To: "Todd O'Bryan" Cc: "PLT-Scheme Mailing List" Sent: Monday, April 13, 2009 6:56 PM Subject: Re: [plt-scheme] HTDP Exercise 9.5.7 > > Thanks for yelling. > > I answered in private and it is NOT a violation of design, in the > spirit of HtDP, but a good example of > > -- figure out the tasks involved > -- design one function per task. > > It just happens to be the first exercise that throws students back to > this rule introduce earlier in the book and not exercised. > > -- Matthias From morazanm at gmail.com Mon Apr 13 16:32:11 2009 From: morazanm at gmail.com (Marco Morazan) Date: Mon Apr 13 16:32:31 2009 Subject: [plt-scheme] HTDP Exercise 9.5.7 In-Reply-To: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> References: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> Message-ID: <9b1fff280904131332k725fa60dqd8b62e17609e4099@mail.gmail.com> On Mon, Apr 13, 2009 at 12:12 PM, S Brown wrote: > I'm working my way through HTDP and I have a question regarding > Exercise 9.5.7. The exercise asks you to define the function average- > price, which takes as it's input a list of prices, and gives as output > the average of the prices in the list. I came up with ?the following > solution: > ... > I came to this solution after not being able to figure out how to keep > track of the sum of the items and also the number of items at the same > time. So my concern/question is, is my solution acceptable, or should > I keep trying to figure out how to keep track of both values (sum and > number of items) without resulting to helper-functions such as sum- > list and num-items? Thanks. I am going to give you different feedback. Where does the idea of keeping track of both values come from? At this point in HtDP, there is nothing in the DR to suggest that values should be or can be "kept track of." You write programs based on the shape of your input as done in your solution. Nothing else is required. This may seem to suggest that one ought to have "tunnel vision" when following the steps of the DR and at this point yes you should. :-) Revisit this problem when you cover accumulator-style recursion. It is at that point that the idea of keeping track of values is best introduced. I speculate that your reasoning steps are screaming to keep track of values, because they are "contaminated" by an imperative bias (that hunger is properly satisfied in sections VII and VIII and IMHO they are not fun as judged by the reaction of my students!). A rule of thumb that is useful is to remember that if you need to examine data of arbitrary size to produce an intermediate result then that work should be done by an auxilary function (as in the solution you presented). -- Cheers, Marco From feeley at iro.umontreal.ca Mon Apr 13 16:39:32 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Mon Apr 13 16:40:32 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> Message-ID: <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> On 13-Apr-09, at 10:24 AM, Matthew Flatt wrote: > At Mon, 13 Apr 2009 16:36:45 +0300, R. Emre Ba?ar wrote: >> I'm tryring to create a thread which is initially suspended. As >> far as >> I know, (thread (lambda () ...)) creates a thread and runs it >> instantly. >> Is it possible to create a thread in suspended state to resume later? >> >> I know it's possible to create and suspend it afterwards but our >> application is rather time intensive so I don't want it to have >> even a >> little chance to run. > > Matthias asks a good question, but... > > (define (thread/suspended thunk) > (let* ([s (make-semaphore)] > [t (thread (lambda () > (semaphore-wait s) > (thunk)))]) > (thread-suspend t) > (semaphore-post s) > t)) > > In practice, `thread-suspend' will suspend the new thread before it is > ever swapped in. In the unlikely event that the creating thread is > swapped out before it can suspend the new one, the semaphore prevents > the new thread from making any progress. (The semaphore operations are > all cheap.) Does PLT support SRFI 18? The SRFI 18 API for thread creation distinguishes thread creation (make-thread) and thread activation (thread-start!). The usefulness of this is explained in the SRFI 18 spec under "thread-start!": NOTE: It is useful to separate thread creation and thread activation to avoid the race condition that would occur if the created thread tries to examine a table in which the current thread stores the created thread. See the last example of thread-terminate! which contains mutually recursive threads. and the example from "thread-terminate!" is (define (amb thunk1 thunk2) (let ((result #f) (result-mutex (make-mutex)) (done-mutex (make-mutex))) (letrec ((child1 (make-thread (lambda () (let ((x (thunk1))) (mutex-lock! result-mutex #f #f) (set! result x) (thread-terminate! child2) (mutex-unlock! done-mutex))))) (child2 (make-thread (lambda () (let ((x (thunk2))) (mutex-lock! result-mutex #f #f) (set! result x) (thread-terminate! child1) (mutex-unlock! done-mutex)))))) (mutex-lock! done-mutex #f #f) (thread-start! child1) (thread-start! child2) (mutex-lock! done-mutex #f #f) result))) Delayed activation is essential for creating mutually recursive threads. Marc From matthias at ccs.neu.edu Mon Apr 13 16:43:03 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 13 16:46:23 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> Message-ID: Marc, local comment: I don't understand why you lock the done-mutex twice. On Apr 13, 2009, at 4:39 PM, Marc Feeley wrote: > (define (amb thunk1 thunk2) > (let ((result #f) > (result-mutex (make-mutex)) > (done-mutex (make-mutex))) > (letrec ((child1 > (make-thread > (lambda () > (let ((x (thunk1))) > (mutex-lock! result-mutex #f #f) > (set! result x) > (thread-terminate! child2) > (mutex-unlock! done-mutex))))) > (child2 > (make-thread > (lambda () > (let ((x (thunk2))) > (mutex-lock! result-mutex #f #f) > (set! result x) > (thread-terminate! child1) > (mutex-unlock! done-mutex)))))) > (mutex-lock! done-mutex #f #f) > (thread-start! child1) > (thread-start! child2) > (mutex-lock! done-mutex #f #f) > result))) > > Delayed activation is essential for creating mutually recursive > threads. global comment: I'd program this kind of situation with cml-style sync primitives (available in PLT Scheme) not with mutexes and an imperative style. -- Matthias From benjisimon at gmail.com Mon Apr 13 17:06:06 2009 From: benjisimon at gmail.com (Ben Simon) Date: Mon Apr 13 17:06:35 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: On Tue, Apr 7, 2009 at 4:19 PM, Grant Rettke wrote: > What is your favorite library for parsing XML in PLT 4? > If nothing is available, then what do you use for PLT<4, R5 or R6 Scheme? > Back when I was using SISC [1], I nearly always turned to ssax and sxpath. This especially made sense because SISCweb [2] worked natively with SXML. But recently, I've been using the xml module and scheme/match (see: [3] as an example) and there's something about the solution I like. Whole match-the-shape of the xml expression / destructure on the fly is really cool. I really wish scheme/match was less verbose so that code like [4]: (filter-map (match-lambda [(list-no-order (list 'title _ title) (list 'link (list-no-order (list 'href url) (list 'rel (regexp #rx"^http://.*#cellsfeed$")) _ ...)) (list 'gs:rowCount _ row-count) (list 'gs:colCount _ col-count) _ ...) (make-worksheet title url (s->n row-count) (s->n col-count))] [_ #f]) (url->xexpr spreadsheet-url)) wasn't so ugly. I keep thinking the solution is to put a nice macro around scheme/match that is more xml'ish - but I'll be darned if I can come up with: (a) the macro and (b) what's xml'ish would actually look like :-). -Ben [1] - http://sisc-scheme.org/ [2] - http://siscweb.sourceforge.net [3] - http://benjisimon.blogspot.com/2009/04/another-plt-scheme-google-spreadsheets.html [4] - http://code.ideas2executables.com/scheme-gdata/spreadsheets.ss -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090413/707cf10b/attachment.html From ontheheap at gmail.com Mon Apr 13 17:54:14 2009 From: ontheheap at gmail.com (S Brown) Date: Mon Apr 13 17:54:54 2009 Subject: [plt-scheme] Re: HTDP Exercise 9.5.7 In-Reply-To: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> References: <432b6d7f-18b1-422f-a064-aa857543f5ff@x6g2000vbg.googlegroups.com> Message-ID: I apologize for posting complete code to a book exercise, it won't happen again! That said, I appreciate the feedback from everyone and I'm glad to see that I'm on the right track. On Apr 13, 12:12?pm, S Brown wrote: > I'm working my way through HTDP and I have a question regarding > Exercise 9.5.7. The exercise asks you to define the function average- > price, which takes as it's input a list of prices, and gives as output > the average of the prices in the list. I came up with ?the following > solution: > >
> (define (checked-average-price toy-list)
> ? (cond
> ? ? ((empty? toy-list) (error 'checked-average-price "expected a non-
> empty list"))
> ? ? (else (average-price toy-list))))
>
> (define (average-price toy-list)
> ? (cond
> ? ? ((empty? toy-list) 0)
> ? ? (else (/ (sum-list toy-list)
> ? ? ? ? ? ? ?(num-items toy-list)))))
>
> (define (sum-list a-list)
> ? (cond
> ? ? ((empty? a-list) 0)
> ? ? (else (+ (first a-list)
> ? ? ? ? ? ? ?(sum-list (rest a-list))))))
>
> (define (num-items a-list)
> ? (cond
> ? ? ((empty? a-list) 0)
> ? ? (else (+ 1 (num-items (rest a-list))))))
> 
> > I came to this solution after not being able to figure out how to keep > track of the sum of the items and also the number of items at the same > time. So my concern/question is, is my solution acceptable, or should > I keep trying to figure out how to keep track of both values (sum and > number of items) without resulting to helper-functions such as sum- > list and num-items? Thanks. > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Mon Apr 13 17:59:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Apr 13 17:59:57 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> Message-ID: <20090413215937.3DA6265009C@mail-svr1.cs.utah.edu> At Mon, 13 Apr 2009 16:39:32 -0400, Marc Feeley wrote: > Does PLT support SRFI 18? It seems that we don't. (Any volunteers to implement it?) At Mon, 13 Apr 2009 16:43:03 -0400, Matthias Felleisen wrote: > local comment: I don't understand why you lock the done-mutex twice. You're not thinking low-level enough. :) It's to wait for one of the threads to finish setting `x', after which it unlocks `done-mutex'. > global comment: I'd program this kind of situation with cml-style > sync primitives (available in PLT Scheme) not with mutexes and an > imperative style. Yes, I'd more likely write (define (amb thunk1 thunk2) (let ([ch (make-channel)]) (let ([t1 (thread (lambda () (channel-put ch (thunk1))))] [t2 (thread (lambda () (channel-put ch (thunk2))))]) (begin0 (channel-get ch) (kill-thread t1) (kill-thread t2))))) and wouldn't think of putting the kills in the threads. Putting the kills in the threads makes sense when you're locking a shared variable with a mutex, but it doesn't seem natural with channels. Actually, I'd more likely write (define (amb thunk1 thunk2) (let ([ch (make-channel)] [cust (make-custodian)]) (parameterize ([current-custodian cust]) (thread (lambda () (channel-put ch (thunk1)))) (thread (lambda () (channel-put ch (thunk2))))) (begin0 (channel-get ch) (custodian-shutdown-all cust)))) to clean up more consistently (in case the thunks themselves used this `amb', for example). Interestingly, this implementation moves even further from the mutual references. So, I agree with Matthias which that we tend to use CML in a way that makes state-sharing less common. Also, with most of the ways that we use use threads, I think having to explicitly start each one would be tedious. But the other abstraction is easy to build if you need it. From feeley at iro.umontreal.ca Mon Apr 13 20:44:28 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Mon Apr 13 20:45:27 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> Message-ID: On 13-Apr-09, at 4:43 PM, Matthias Felleisen wrote: > > Marc, > > local comment: I don't understand why you lock the done-mutex twice. > Matthew explained it well. > global comment: I'd program this kind of situation with cml-style > sync primitives (available in PLT Scheme) not with mutexes and an > imperative style. That's also how I would do it in Gambit with mailboxes or vector ports (a FIFO structure), but that is beside my point. You can't remove mutual recursion in all cases. The problem is very similar to the implementation of mutually recursive closures (defined with letrec for example). The closures C1 and C2 have to be created first, but they aren't yet runnable because C1 has to be initialized with a reference to C2 and vice-versa. Note that this separation of thread creation and activation is not novel (indeed Java is a well known instance of a system supporting this). Marc From matthias at ccs.neu.edu Mon Apr 13 21:15:05 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 13 21:16:21 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> Message-ID: <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> On Apr 13, 2009, at 8:44 PM, Marc Feeley wrote: > Note that this separation of thread creation and activation is not > novel (indeed Java is a well known instance of a system supporting > this). I understand that. I just don't think the reasoning is convincing -- Matthias From robby at eecs.northwestern.edu Mon Apr 13 21:18:09 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Mon Apr 13 21:18:28 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> Message-ID: <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> On Mon, Apr 13, 2009 at 8:15 PM, Matthias Felleisen wrote: > > On Apr 13, 2009, at 8:44 PM, Marc Feeley wrote: > >> Note that this separation of thread creation and activation is not novel >> (indeed Java is a well known instance of a system supporting this). > > I understand that. I just don't think the reasoning is convincing It seems easy to implement initially suspended threads (indeed Matthew showed the code a moment ago), no? Robby From feeley at iro.umontreal.ca Mon Apr 13 23:27:38 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Mon Apr 13 23:28:24 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> Message-ID: <52F1352D-0219-42A2-A281-14905B92A22E@iro.umontreal.ca> On 13-Apr-09, at 9:18 PM, Robby Findler wrote: > On Mon, Apr 13, 2009 at 8:15 PM, Matthias Felleisen > wrote: >> >> On Apr 13, 2009, at 8:44 PM, Marc Feeley wrote: >> >>> Note that this separation of thread creation and activation is not >>> novel >>> (indeed Java is a well known instance of a system supporting this). >> >> I understand that. I just don't think the reasoning is convincing > > It seems easy to implement initially suspended threads (indeed Matthew > showed the code a moment ago), no? The problem of conflating thread creation and activation is no different than the problem of conflating function creation and variable definition (which Scheme chose not to conflate). You can simulate anonymous functions with named functions by using a temporary name. But you pay a price in program clarity (elegance?) and in run time cost (unless you have a Sufficiently Smart(tm) compiler). The "thread/suspend" procedure submitted by Matthew runs about 5% slower than the "thread" procedure alone (on MzScheme v4.1 + Intel Mac OS X). So the additional semaphore operations don't seem to add much of an overhead. But that is because thread creation in MzScheme is slow in comparison to the semaphore operations (about 45 microseconds per thread creation + termination). In a system with faster thread creation operations the overhead becomes quite noticeable (Gambit is about 45 times faster, i.e. one microsecond per thread creation + termination). Marc From eli at barzilay.org Tue Apr 14 00:01:57 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Apr 14 00:03:29 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <52F1352D-0219-42A2-A281-14905B92A22E@iro.umontreal.ca> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> <52F1352D-0219-42A2-A281-14905B92A22E@iro.umontreal.ca> Message-ID: <18916.2741.294069.29148@winooski.ccs.neu.edu> On Apr 13, Marc Feeley wrote: > > The problem of conflating thread creation and activation is no > different than the problem of conflating function creation and > variable definition (which Scheme chose not to conflate). You can > simulate anonymous functions with named functions by using a > temporary name. But you pay a price in program clarity (elegance?) > and in run time cost (unless you have a Sufficiently Smart(tm) > compiler). Going down to more primitive forms doesn't always mean gaining clarity (or elegance) -- otherwise machine code would be much better than Scheme, and `call-with-current-continuation' would be much better than `let/cc'. In other words, Scheme *did* choose to conflate a good number of features in its function form... More seriously, if the kind of problems that are solved by separating thread-creation from thread-activation can be solved with channels, then I choose the higher-level operation. If it does turn out that there are some cases where the mzscheme facilities are insufficient, then my guess is that these cases are rare enough that paying the extra cost (if there is any) is perfectly fine with me -- in exactly the same way that I still prefer `lambda' as a better alternative to the low level features it conflates. > The "thread/suspend" procedure submitted by Matthew runs about 5% > slower than the "thread" procedure alone (on MzScheme v4.1 + Intel > Mac OS X). So the additional semaphore operations don't seem to add > much of an overhead. But that is because thread creation in > MzScheme is slow in comparison to the semaphore operations (about 45 > microseconds per thread creation + termination). In a system with > faster thread creation operations the overhead becomes quite > noticeable (Gambit is about 45 times faster, i.e. one microsecond > per thread creation + termination). I'm getting different numbers: I get thread creation and termination at about 10 microseconds -- and that's for both versions; the difference is in the noise. (For these two lines: (time (for ([i (in-range 100000)]) (kill-thread (thread void)))) (time (for ([i (in-range 100000)]) (kill-thread (thread/suspended void)))) I'm getting these medians out of 13 runs of each: first: cpu time: 1057 real time: 1057 gc time: 123 second: cpu time: 1035 real time: 1036 gc time: 148 ) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From feeley at iro.umontreal.ca Tue Apr 14 00:18:56 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Tue Apr 14 00:21:02 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <18916.2741.294069.29148@winooski.ccs.neu.edu> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> <52F1352D-0219-42A2-A281-14905B92A22E@iro.umontreal.ca> <18916.2741.294069.29148@winooski.ccs.neu.edu> Message-ID: <4120BBE9-6218-44FF-8152-15E1EA3FF8B9@iro.umontreal.ca> On 14-Apr-09, at 12:01 AM, Eli Barzilay wrote: >> >> The "thread/suspend" procedure submitted by Matthew runs about 5% >> slower than the "thread" procedure alone (on MzScheme v4.1 + Intel >> Mac OS X). So the additional semaphore operations don't seem to add >> much of an overhead. But that is because thread creation in >> MzScheme is slow in comparison to the semaphore operations (about 45 >> microseconds per thread creation + termination). In a system with >> faster thread creation operations the overhead becomes quite >> noticeable (Gambit is about 45 times faster, i.e. one microsecond >> per thread creation + termination). > > I'm getting different numbers: I get thread creation and termination > at about 10 microseconds -- and that's for both versions; the > difference is in the noise. > > (For these two lines: > > (time (for ([i (in-range 100000)]) (kill-thread (thread void)))) > (time (for ([i (in-range 100000)]) (kill-thread (thread/suspended > void)))) > > I'm getting these medians out of 13 runs of each: > > first: cpu time: 1057 real time: 1057 gc time: 123 > second: cpu time: 1035 real time: 1036 gc time: 148 > > ) Eli, it appears that your machine is twice as fast as mine. Moreover it is "normal termination" that I was measuring in my test, i.e. (time (for ([i (in-range 100000)]) (thread-wait (thread void)))) which is about half as fast as with kill-thread (I guess because kill- thread manages to kill most of the threads before they are even running, thus avoiding the context switch). So MzScheme's thread operations are still roughly 40 times slower than Gambit's. Aside: don't you find it strange that in your test using "thread/ suspend" is *faster* than using "thread" even though "thread/suspend" calls "thread" and does a bunch of other operations? That's probably worth some investigation. Marc From feeley at iro.umontreal.ca Tue Apr 14 00:31:09 2009 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Tue Apr 14 00:32:30 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <18916.2741.294069.29148@winooski.ccs.neu.edu> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> <52F1352D-0219-42A2-A281-14905B92A22E@iro.umontreal.ca> <18916.2741.294069.29148@winooski.ccs.neu.edu> Message-ID: On 14-Apr-09, at 12:01 AM, Eli Barzilay wrote: > On Apr 13, Marc Feeley wrote: >> >> The problem of conflating thread creation and activation is no >> different than the problem of conflating function creation and >> variable definition (which Scheme chose not to conflate). You can >> simulate anonymous functions with named functions by using a >> temporary name. But you pay a price in program clarity (elegance?) >> and in run time cost (unless you have a Sufficiently Smart(tm) >> compiler). > > Going down to more primitive forms doesn't always mean gaining clarity > (or elegance) -- otherwise machine code would be much better than > Scheme, and `call-with-current-continuation' would be much better than > `let/cc'. In other words, Scheme *did* choose to conflate a good > number of features in its function form... > > More seriously, if the kind of problems that are solved by separating > thread-creation from thread-activation can be solved with channels, > then I choose the higher-level operation. If it does turn out that > there are some cases where the mzscheme facilities are insufficient, > then my guess is that these cases are rare enough that paying the > extra cost (if there is any) is perfectly fine with me -- in exactly > the same way that I still prefer `lambda' as a better alternative to > the low level features it conflates. My position is that the lower level of a thread system should provide "make-thread" and "thread-start!". The higher level procedure "thread" can be provided as a convenience to the user and be defined (by the runtime system) simply as: (define (thread thunk) (thread-start! (make-thread thunk))) That way the programmer can easily access the fundamental operations if he so wishes. In other words thread = make-thread + thread-start! It is analogous to saying "procedure definition" = lambda + "variable definition" i.e. (define (f x) (* x x)) = (define f (lambda (x) (* x x))) The "lower level" features (lambda and define) are convenient to have even though a large part of many programs don't need them explicitly if procedures are defined using the special notation for procedure definition. I'll shut up now! Marc From eli at barzilay.org Tue Apr 14 01:15:06 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Apr 14 01:15:47 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: <4120BBE9-6218-44FF-8152-15E1EA3FF8B9@iro.umontreal.ca> References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> <52F1352D-0219-42A2-A281-14905B92A22E@iro.umontreal.ca> <18916.2741.294069.29148@winooski.ccs.neu.edu> <4120BBE9-6218-44FF-8152-15E1EA3FF8B9@iro.umontreal.ca> Message-ID: <18916.7130.581429.96607@winooski.ccs.neu.edu> On Apr 14, Marc Feeley wrote: > > On 14-Apr-09, at 12:01 AM, Eli Barzilay wrote: > > >> > >> The "thread/suspend" procedure submitted by Matthew runs about 5% > >> slower than the "thread" procedure alone (on MzScheme v4.1 + Intel > >> Mac OS X). So the additional semaphore operations don't seem to add > >> much of an overhead. But that is because thread creation in > >> MzScheme is slow in comparison to the semaphore operations (about 45 > >> microseconds per thread creation + termination). In a system with > >> faster thread creation operations the overhead becomes quite > >> noticeable (Gambit is about 45 times faster, i.e. one microsecond > >> per thread creation + termination). > > > > I'm getting different numbers: I get thread creation and termination > > at about 10 microseconds -- and that's for both versions; the > > difference is in the noise. > > > > (For these two lines: > > > > (time (for ([i (in-range 100000)]) (kill-thread (thread void)))) > > (time (for ([i (in-range 100000)]) (kill-thread (thread/suspended > > void)))) > > > > I'm getting these medians out of 13 runs of each: > > > > first: cpu time: 1057 real time: 1057 gc time: 123 > > second: cpu time: 1035 real time: 1036 gc time: 148 > > > > ) > > Eli, it appears that your machine is twice as fast as mine. > Moreover it is "normal termination" If there are different interpretations of "termination", the value in saving such 5% is even smaller... For example, if you interpret termination as running: (time (for ([i (in-range 100000)]) (thread void))) with no killing or waiting, then Matthew's version becomes much faster. > that I was measuring in my test, i.e. > > (time (for ([i (in-range 100000)]) (thread-wait (thread void)))) (With Matthew's version of `thread/suspended' this will just block. And if you're adding `thread-resume' in, then the isolation of the single feature is even worse.) > Aside: don't you find it strange that in your test using "thread/ > suspend" is *faster* than using "thread" even though > "thread/suspend" calls "thread" and does a bunch of other > operations? That's probably worth some investigation. It might be interesting to know why there's a difference, but if we're getting to such minor differences then I don't care. For any practical use of threads that I've encountered, the cost of the real work would make that difference insignificant. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Tue Apr 14 01:15:08 2009 From: eli at barzilay.org (Eli Barzilay) Date: Tue Apr 14 01:15:53 2009 Subject: [plt-scheme] Creating a suspended thread In-Reply-To: References: <20090413133645.GC2967@terra.galaxy> <20090413142402.A3C9965009D@mail-svr1.cs.utah.edu> <7360C79F-3D7B-4EFA-ADDF-52AE5746A73C@iro.umontreal.ca> <6C8E1492-6B73-44F0-9CDA-52845B76C445@ccs.neu.edu> <932b2f1f0904131818v6f81cb0xd754a7e2c17adecf@mail.gmail.com> <52F1352D-0219-42A2-A281-14905B92A22E@iro.umontreal.ca> <18916.2741.294069.29148@winooski.ccs.neu.edu> Message-ID: <18916.7132.997485.225632@winooski.ccs.neu.edu> On Apr 14, Marc Feeley wrote: > > On 14-Apr-09, at 12:01 AM, Eli Barzilay wrote: > > > On Apr 13, Marc Feeley wrote: > >> > >> The problem of conflating thread creation and activation is no > >> different than the problem of conflating function creation and > >> variable definition (which Scheme chose not to conflate). You can > >> simulate anonymous functions with named functions by using a > >> temporary name. But you pay a price in program clarity (elegance?) > >> and in run time cost (unless you have a Sufficiently Smart(tm) > >> compiler). > > > > Going down to more primitive forms doesn't always mean gaining clarity > > (or elegance) -- otherwise machine code would be much better than > > Scheme, and `call-with-current-continuation' would be much better than > > `let/cc'. In other words, Scheme *did* choose to conflate a good > > number of features in its function form... > > > > More seriously, if the kind of problems that are solved by separating > > thread-creation from thread-activation can be solved with channels, > > then I choose the higher-level operation. If it does turn out that > > there are some cases where the mzscheme facilities are insufficient, > > then my guess is that these cases are rare enough that paying the > > extra cost (if there is any) is perfectly fine with me -- in exactly > > the same way that I still prefer `lambda' as a better alternative to > > the low level features it conflates. > > > My position is that the lower level of a thread system should provide > "make-thread" and "thread-start!". The higher level procedure > "thread" can be provided as a convenience to the user and be defined > (by the runtime system) simply as: > > (define (thread thunk) > (thread-start! (make-thread thunk))) > > That way the programmer can easily access the fundamental operations > if he so wishes. In other words > > thread = make-thread + thread-start! But Matthew's code shows that `thread' with a channel (and `thread-resume') can express `make-thread' and `thread-start!' -- so if in both cases I get all operations (and if they perform roughly the same), then I don't care either way. But if going with the above equation means that `thread' is now noticeably slower, then I prefer the other way since it makes the case I care about a priority. (I have never had a need for a `thread/suspended'.) > It is analogous to saying > > "procedure definition" = lambda + "variable definition" And the other side of this analogy is: lambda = goto + gosub which Scheme did choose to conflate. This seems relevant to this case: people who want the lowlevel `goto' feature will surely complain about such an awkward way of getting it, and about possible higher costs. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From noelwelsh at gmail.com Tue Apr 14 06:18:24 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Tue Apr 14 06:18:42 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: On Mon, Apr 13, 2009 at 10:06 PM, Ben Simon wrote: > I keep thinking the solution is to put a nice macro around scheme/match that > is more xml'ish - but I'll be darned if I can come up with: (a) the macro > and (b) what's xml'ish would actually look like :-). Take a look at WebIt. The core part of the package is exactly such a macro. N. From plragde at uwaterloo.ca Tue Apr 14 07:15:44 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Tue Apr 14 07:16:11 2009 Subject: [plt-scheme] Creating a suspended thread Message-ID: <49E47060.5020906@uwaterloo.ca> Marc Feeley wrote: > I'll shut up now! No, please -- I am learning a lot from this conversation. --PR From benjisimon at gmail.com Tue Apr 14 08:27:14 2009 From: benjisimon at gmail.com (Ben Simon) Date: Tue Apr 14 08:28:05 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: On Tue, Apr 14, 2009 at 6:18 AM, Noel Welsh wrote: > On Mon, Apr 13, 2009 at 10:06 PM, Ben Simon wrote: > > I keep thinking the solution is to put a nice macro around scheme/match > that > > is more xml'ish - but I'll be darned if I can come up with: (a) the macro > > and (b) what's xml'ish would actually look like :-). > > Take a look at WebIt. The core part of the package is exactly such a macro. > Excellent - thanks for the tip! -Ben -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090414/ba2740f1/attachment.htm From benderjg2 at aol.com Tue Apr 14 08:48:33 2009 From: benderjg2 at aol.com (Jim Bender) Date: Tue Apr 14 08:55:24 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: You may also wish to take a look at my sxml-match library (which I've now updated in planet for v4.x). If there is sufficient in interest, I could probably create a version that works with xexprs or PLT's xml structs. Jim Sent from my iPhone On Apr 14, 2009, at 7:27 AM, Ben Simon wrote: > > > On Tue, Apr 14, 2009 at 6:18 AM, Noel Welsh > wrote: > On Mon, Apr 13, 2009 at 10:06 PM, Ben Simon > wrote: > > I keep thinking the solution is to put a nice macro around scheme/ > match that > > is more xml'ish - but I'll be darned if I can come up with: (a) > the macro > > and (b) what's xml'ish would actually look like :-). > > Take a look at WebIt. The core part of the package is exactly such a > macro. > > > Excellent - thanks for the tip! > > -Ben > > -- > Have an idea for software? I can make it happen - http://www.ideas2executables.com > My Blog: http://benjisimon.blogspot.com > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090414/905cd253/attachment.html From benjisimon at gmail.com Tue Apr 14 09:00:09 2009 From: benjisimon at gmail.com (Ben Simon) Date: Tue Apr 14 09:00:36 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: On Tue, Apr 14, 2009 at 8:48 AM, Jim Bender wrote: > You may also wish to take a look at my sxml-match library (which I've now > updated in planet for v4.x). > Super - I'll definitely have to do that. > If there is sufficient in interest, I could probably create a version that > works with xexprs or PLT's xml structs. > Oooh, I know that I'd appreciate that. Though, I can't speak for others. On a related note...with both sxml-match and/or WebIt! would anyone mind sharing the preferred way you go from a port with XML data to sxml-match or xml-match? For example, to use the built in xml module I say: (require xml) (define xexpr (xml->xexpr (document-element (read-xml (url->port url))))) (match xexpr ...) I've looked into the WebIt! docs and while probably obvious - it's escaping me this morning :-) Thanks! -Ben > > Jim > > Sent from my iPhone > > On Apr 14, 2009, at 7:27 AM, Ben Simon wrote: > > > > On Tue, Apr 14, 2009 at 6:18 AM, Noel Welsh < > noelwelsh@gmail.com> wrote: > >> On Mon, Apr 13, 2009 at 10:06 PM, Ben Simon < >> benjisimon@gmail.com> wrote: >> > I keep thinking the solution is to put a nice macro around scheme/match >> that >> > is more xml'ish - but I'll be darned if I can come up with: (a) the >> macro >> > and (b) what's xml'ish would actually look like :-). >> >> Take a look at WebIt. The core part of the package is exactly such a >> macro. >> > > > Excellent - thanks for the tip! > > -Ben > > -- > Have an idea for software? I can make it happen - > http://www.ideas2executables.com > My Blog: http://benjisimon.blogspot.com > > _________________________________________________ > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090414/74dd6bb3/attachment.htm From grettke at acm.org Tue Apr 14 10:13:31 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Apr 14 10:13:50 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> Message-ID: <756daca50904140713w688dce23u99f2b1691bde4cc@mail.gmail.com> On Tue, Apr 14, 2009 at 7:48 AM, Jim Bender wrote: > If there is sufficient in interest, I could probably create a version that > works with xexprs or PLT's xml structs. Based on this thread there seems to be a lot of interest (myself included). I wonder how this is related to Neil's XML SRFI (if at all)? From ziboon at gmail.com Tue Apr 14 13:52:21 2009 From: ziboon at gmail.com (Ziboon) Date: Tue Apr 14 13:52:40 2009 Subject: [plt-scheme] 5-6 seconds to run my prog ?? Message-ID: <45bb82cc0904141052l5a9efd67ra7e75ca82260bbda@mail.gmail.com> Hi, I work on a scheme project, (I'm a student) I have a canvas & a double buffer, When, I load a bitmap for my background, why my program, does take 5 or 6 seconds to run????, (my frame appears 5 or 6 seconds later) (my bitmap => 800 * 400 px, and I try png or jpg ) so I put just this : (define img (make-object bitmap% "bg.jpg" 'jpg #f)) in a new window: I run --> same problem but when I use small bitmap (4*4 px ) it's OK no delay. *how to reduce this waiting? * because I use 6 or 7 different backgrounds. so when my frame appears and I swap my background there are no waiting it's really just the initial loading. thanks ------------------------------------- my config (e6750 3.2ghz, 2go ram etc.... i try on windows xp pro, ubuntu) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090414/6259b54e/attachment.htm From pocmatos at gmail.com Tue Apr 14 15:31:11 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 14 15:31:50 2009 Subject: [plt-scheme] Writing unicode characters Message-ID: <11b141710904141231m9a13f03if3e39ac7e352796a@mail.gmail.com> Hi all, Without modifying DrScheme, is there any simple way to input unicode characters? (and if yes, can these characters be used in identifiers?) Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From robby at eecs.northwestern.edu Tue Apr 14 15:37:51 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 14 15:38:12 2009 Subject: [plt-scheme] Writing unicode characters In-Reply-To: <11b141710904141231m9a13f03if3e39ac7e352796a@mail.gmail.com> References: <11b141710904141231m9a13f03if3e39ac7e352796a@mail.gmail.com> Message-ID: <932b2f1f0904141237h55cb9a5bha74a512cc3f02b67@mail.gmail.com> There are platform-specific things that drscheme hooks into. On the mac, you can enable various international modes for your keyboard, eg for Chinese you can type pinyin or you can use the more sophisticated things that real Chinese use when typing. For certain mathematical characters, you can type the latex macro name and then hit alt-\ (on windows) or control-\ (on the mac) and have the character turn into the right thing. You can also use the \u notation to type in the code point of a unicode character. If you do that in the REPL, drscheme will sometimes respond with an actual glyph that you can copy and paste back into the program. Robby On Tue, Apr 14, 2009 at 2:31 PM, Paulo J. Matos wrote: > Hi all, > > Without modifying DrScheme, is there any simple way to input unicode > characters? (and if yes, can these characters be used in identifiers?) > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From pocmatos at gmail.com Tue Apr 14 15:41:40 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 14 15:42:17 2009 Subject: [plt-scheme] Writing unicode characters In-Reply-To: <932b2f1f0904141237h55cb9a5bha74a512cc3f02b67@mail.gmail.com> References: <11b141710904141231m9a13f03if3e39ac7e352796a@mail.gmail.com> <932b2f1f0904141237h55cb9a5bha74a512cc3f02b67@mail.gmail.com> Message-ID: <11b141710904141241j267c73cfneef14e18042bf660@mail.gmail.com> On Tue, Apr 14, 2009 at 7:37 PM, Robby Findler wrote: > There are platform-specific things that drscheme hooks into. On the > mac, you can enable various international modes for your keyboard, eg > for Chinese you can type pinyin or you can use the more sophisticated > things that real Chinese use when typing. > > For certain mathematical characters, you can type the latex macro name > and then hit alt-\ (on windows) or control-\ (on the mac) and have the > character turn into the right thing. > No trick like this on Linux? > You can also use the \u notation to type in the code point of a > unicode character. If you do that in the REPL, drscheme will sometimes > respond with an actual glyph that you can copy and paste back into the > program. > > Robby > > On Tue, Apr 14, 2009 at 2:31 PM, Paulo J. Matos wrote: >> Hi all, >> >> Without modifying DrScheme, is there any simple way to input unicode >> characters? (and if yes, can these characters be used in identifiers?) >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From samth at ccs.neu.edu Tue Apr 14 15:47:25 2009 From: samth at ccs.neu.edu (Sam TH) Date: Tue Apr 14 15:47:43 2009 Subject: [plt-scheme] Writing unicode characters In-Reply-To: <11b141710904141241j267c73cfneef14e18042bf660@mail.gmail.com> References: <11b141710904141231m9a13f03if3e39ac7e352796a@mail.gmail.com> <932b2f1f0904141237h55cb9a5bha74a512cc3f02b67@mail.gmail.com> <11b141710904141241j267c73cfneef14e18042bf660@mail.gmail.com> Message-ID: <63bb19ae0904141247p6b8d53b6t30e35b6114348b79@mail.gmail.com> On Tue, Apr 14, 2009 at 3:41 PM, Paulo J. Matos wrote: > On Tue, Apr 14, 2009 at 7:37 PM, Robby Findler > wrote: >> There are platform-specific things that drscheme hooks into. On the >> mac, you can enable various international modes for your keyboard, eg >> for Chinese you can type pinyin or you can use the more sophisticated >> things that real Chinese use when typing. >> >> For certain mathematical characters, you can type the latex macro name >> and then hit alt-\ (on windows) or control-\ (on the mac) and have the >> character turn into the right thing. >> > > No trick like this on Linux? It depends on the keybindings. For me, it's Alt-\ . -- sam th samth@ccs.neu.edu From robby at eecs.northwestern.edu Tue Apr 14 15:51:00 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 14 15:51:19 2009 Subject: [plt-scheme] Writing unicode characters In-Reply-To: <63bb19ae0904141247p6b8d53b6t30e35b6114348b79@mail.gmail.com> References: <11b141710904141231m9a13f03if3e39ac7e352796a@mail.gmail.com> <932b2f1f0904141237h55cb9a5bha74a512cc3f02b67@mail.gmail.com> <11b141710904141241j267c73cfneef14e18042bf660@mail.gmail.com> <63bb19ae0904141247p6b8d53b6t30e35b6114348b79@mail.gmail.com> Message-ID: <932b2f1f0904141251y6bbf00ccq4c36f612e1fc5553@mail.gmail.com> On Tue, Apr 14, 2009 at 2:47 PM, Sam TH wrote: > On Tue, Apr 14, 2009 at 3:41 PM, Paulo J. Matos wrote: >> On Tue, Apr 14, 2009 at 7:37 PM, Robby Findler >> wrote: >>> There are platform-specific things that drscheme hooks into. On the >>> mac, you can enable various international modes for your keyboard, eg >>> for Chinese you can type pinyin or you can use the more sophisticated >>> things that real Chinese use when typing. >>> >>> For certain mathematical characters, you can type the latex macro name >>> and then hit alt-\ (on windows) or control-\ (on the mac) and have the >>> character turn into the right thing. >>> >> >> No trick like this on Linux? > > It depends on the keybindings. ?For me, it's Alt-\ . Right. In general, one or the other should work. Robby From toddobryan at gmail.com Tue Apr 14 16:39:24 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Tue Apr 14 16:39:42 2009 Subject: [plt-scheme] =?iso-8859-7?q?=EB_doesn=27t_work_in_HtDP_languages?= Message-ID: <904774730904141339i7a9223a7vcb3aac0bb1208529@mail.gmail.com> The subject says it all. We just did lambda today, and the lambda you insert from the menu doesn't work for Intermediate Student with lambda or Advanced Student. You get: ?: name is not defined, not a parameter, and not a primitive name This is with version 4.1.5.4-svn13apr2009 (as well as with the released 4.1.4 and 4.1.5). Such a letdown... :-( Todd From grettke at acm.org Tue Apr 14 22:05:27 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Apr 14 22:05:48 2009 Subject: [plt-scheme] How does one change the background color of search results in DrScheme? Message-ID: <756daca50904141905l6f56d0c6n35c7e51f2211ddf6@mail.gmail.com> How does one change the background color of search results in DrScheme? I don't see a setting anywhere. White-on-black text is difficult to read with a yellow background. From robby at eecs.northwestern.edu Tue Apr 14 22:07:26 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 14 22:07:49 2009 Subject: [plt-scheme] How does one change the background color of search results in DrScheme? In-Reply-To: <756daca50904141905l6f56d0c6n35c7e51f2211ddf6@mail.gmail.com> References: <756daca50904141905l6f56d0c6n35c7e51f2211ddf6@mail.gmail.com> Message-ID: <932b2f1f0904141907n5e8c283cqd9ce0af07933b1b6@mail.gmail.com> What search results are you referring to? I see purple circles for the Edit|Find menu. But are you doing something else? Robby On Tue, Apr 14, 2009 at 9:05 PM, Grant Rettke wrote: > How does one change the background color of search results in DrScheme? > > I don't see a setting anywhere. White-on-black text is difficult to > read with a yellow background. > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From grettke at acm.org Tue Apr 14 22:12:20 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Apr 14 22:12:39 2009 Subject: [plt-scheme] How does one change the background color of search results in DrScheme? In-Reply-To: <932b2f1f0904141907n5e8c283cqd9ce0af07933b1b6@mail.gmail.com> References: <756daca50904141905l6f56d0c6n35c7e51f2211ddf6@mail.gmail.com> <932b2f1f0904141907n5e8c283cqd9ce0af07933b1b6@mail.gmail.com> Message-ID: <756daca50904141912v136ab009pc1abaa3f4f0f307a@mail.gmail.com> On Tue, Apr 14, 2009 at 9:07 PM, Robby Findler wrote: > What search results are you referring to? I see purple circles for the > Edit|Find menu. But are you doing something else? Those are the ones. I have purple circles, and the text background is yellow; rendering the text unreadable. From robby at eecs.northwestern.edu Tue Apr 14 23:18:28 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 14 23:18:46 2009 Subject: [plt-scheme] How does one change the background color of search results in DrScheme? In-Reply-To: <756daca50904141912v136ab009pc1abaa3f4f0f307a@mail.gmail.com> References: <756daca50904141905l6f56d0c6n35c7e51f2211ddf6@mail.gmail.com> <932b2f1f0904141907n5e8c283cqd9ce0af07933b1b6@mail.gmail.com> <756daca50904141912v136ab009pc1abaa3f4f0f307a@mail.gmail.com> Message-ID: <932b2f1f0904142018q57661c29m8b4ca6e05f82fd51@mail.gmail.com> Oh, I see it now. I've checked in something that's better. Robby On Tue, Apr 14, 2009 at 9:12 PM, Grant Rettke wrote: > On Tue, Apr 14, 2009 at 9:07 PM, Robby Findler > wrote: >> What search results are you referring to? I see purple circles for the >> Edit|Find menu. But are you doing something else? > > Those are the ones. I have purple circles, and the text background is > yellow; rendering the text unreadable. > From grettke at acm.org Tue Apr 14 23:36:56 2009 From: grettke at acm.org (Grant Rettke) Date: Tue Apr 14 23:37:15 2009 Subject: [plt-scheme] How does one change the background color of search results in DrScheme? In-Reply-To: <932b2f1f0904142018q57661c29m8b4ca6e05f82fd51@mail.gmail.com> References: <756daca50904141905l6f56d0c6n35c7e51f2211ddf6@mail.gmail.com> <932b2f1f0904141907n5e8c283cqd9ce0af07933b1b6@mail.gmail.com> <756daca50904141912v136ab009pc1abaa3f4f0f307a@mail.gmail.com> <932b2f1f0904142018q57661c29m8b4ca6e05f82fd51@mail.gmail.com> Message-ID: <756daca50904142036t1190141ds7d148915a2c2f8cf@mail.gmail.com> On Tue, Apr 14, 2009 at 10:18 PM, Robby Findler wrote: > Oh, I see it now. I've checked in something that's better. Thank you Robby. From benderjg2 at aol.com Wed Apr 15 01:07:40 2009 From: benderjg2 at aol.com (Jim Bender) Date: Wed Apr 15 01:08:23 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <756daca50904140713w688dce23u99f2b1691bde4cc@mail.gmail.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> <756daca50904140713w688dce23u99f2b1691bde4cc@mail.gmail.com> Message-ID: <46B6D073-8F9F-4CFA-81DF-3158424862AE@aol.com> Ok. Without much work I now have a working version of the pattern matcher that works with xexprs, so I should be able to release a planet package for "xexpr-match" in the near future. Regarding Neil's SRFI effort, I expect I would implement a version my matcher that works with the new representation, either as a new version of one the existing packages, or as a new flavor of sxml-match. Jim Sent from my iPhone On Apr 14, 2009, at 9:13 AM, Grant Rettke wrote: > On Tue, Apr 14, 2009 at 7:48 AM, Jim Bender wrote: >> If there is sufficient in interest, I could probably create a >> version that >> works with xexprs or PLT's xml structs. > > Based on this thread there seems to be a lot of interest (myself > included). I wonder how this is related to Neil's XML SRFI (if at > all)? > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From tsg153 at gmail.com Wed Apr 15 06:58:03 2009 From: tsg153 at gmail.com (Toby Gee) Date: Wed Apr 15 06:58:26 2009 Subject: [plt-scheme] Running the SICP metacircular evaluators Message-ID: <158728f80904150358h5416e3e9q7fb0241d7aaaf4ec@mail.gmail.com> I'm working my way through SICP, using DrScheme. In Chapter 3 I started to have trouble with mutable pairs, but it wasn't such a hassle to rewrite everything with mcons etc. However in Chapter 4 it seems like it would be much easier to just run the code from: http://mitpress.mit.edu/sicp/code/index.html without having to modify it. I'm having trouble doing this! From suggestions around the web, it looks like running the Module language in DrScheme should be the way to go, but I can't make it work. If I try using #lang scheme, it gets stuck at the set-car!. If I use #lang r5rs, it doesn't know "error". And if I use #lang r6rs, I get the mysterious (to me) error: Interactions disabled: r6rs does not support a REPL (no #%top-interaction) Presumably there is a way to make this work; I've seen hints that it's possible to enable set-car! etc by loading particular libraries, but I haven't been able to find out which ones. If anyone can tell me how to get this code to work, or what the best alternative (in terms of minimal rewrites - I find it distracting to have to constantly be checking which things from the book need to be modified), I'd be very grateful. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090415/1e85ee73/attachment.html From eli at barzilay.org Wed Apr 15 07:03:33 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Apr 15 07:03:54 2009 Subject: [plt-scheme] Running the SICP metacircular evaluators In-Reply-To: <158728f80904150358h5416e3e9q7fb0241d7aaaf4ec@mail.gmail.com> References: <158728f80904150358h5416e3e9q7fb0241d7aaaf4ec@mail.gmail.com> Message-ID: <18917.48901.280981.411151@winooski.ccs.neu.edu> On Apr 15, Toby Gee wrote: > [...] From suggestions around the web, it looks like running the > Module language in DrScheme should be the way to go, but I can't > make it work. If I try using #lang scheme, it gets stuck at the > set-car!. If I use #lang r5rs, it doesn't know "error". [...] The R5RS language has a "back door" to import bindings from other modules. You should be able to use #lang r5rs (#%require (only scheme/base error)) to get `error' in. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From detmammut at googlemail.com Wed Apr 15 09:50:16 2009 From: detmammut at googlemail.com (detmammut@googlemail.com) Date: Wed Apr 15 09:50:46 2009 Subject: [plt-scheme] Re: Should PLT Scheme have two R6RS namespaces? In-Reply-To: <0ff51af4-e0c9-4d4b-bf94-f83de0de570c@37g2000yqp.googlegroups.com> References: <756daca50903230704l17110b30oca218416070a634a@mail.gmail.com> <20090323151211.D20746500B7@mail-svr1.cs.utah.edu> <0ff51af4-e0c9-4d4b-bf94-f83de0de570c@37g2000yqp.googlegroups.com> Message-ID: <9c04a480-8898-443d-8ff9-2b45ed6551b9@c9g2000yqm.googlegroups.com> On 23 Mrz., 18:11, "detmam...@googlemail.com" wrote: > I'll have a > week or two a free time starting april so I will port (the testcases > for) srfi-1 (unless someone else is faster :) Well, though I had this free weeks, so did my GF unexpectedly: RL > Scheme ... sry :) As I'm starting a new job I'll have to punt on this topic. Regards, Slom From martindemello at gmail.com Wed Apr 15 11:43:08 2009 From: martindemello at gmail.com (Martin DeMello) Date: Wed Apr 15 11:43:31 2009 Subject: [plt-scheme] Re: Should PLT Scheme have two R6RS namespaces? In-Reply-To: <18887.46589.10007.452872@winooski.ccs.neu.edu> References: <756daca50903230704l17110b30oca218416070a634a@mail.gmail.com> <20090323151211.D20746500B7@mail-svr1.cs.utah.edu> <0ff51af4-e0c9-4d4b-bf94-f83de0de570c@37g2000yqp.googlegroups.com> <18887.46589.10007.452872@winooski.ccs.neu.edu> Message-ID: On Mon, Mar 23, 2009 at 9:47 PM, Eli Barzilay wrote: > On Mar 23, detmammut@googlemail.com wrote: >> I had a discussion with eli on this allready in IRC. The problem is >> not so much that these R6RS replacements are not available*, but >> that someone has to step up to provide test-cases and support. I'll >> have a week or two a free time starting april so I will port (the >> testcases for) srfi-1 (unless someone else is faster :) >> >> * see https://code.launchpad.net/~ikarus-libraries-team/ikarus-libraries/srfi > > What I also said is that dragging a big piece of code like that, > rather than adapting existing code, is very problematic. Isn't one of the points of R6RS that you should be able to do this? martin From keiko at kurims.kyoto-u.ac.jp Wed Apr 15 12:05:39 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Wed Apr 15 12:06:02 2009 Subject: [plt-scheme] bundles of HTML files of Guide & Reference Message-ID: <20090416.010539.125099476.keiko@kurims.kyoto-u.ac.jp> Hello. Are there bundles of HTML files of "Guide:PLT Scheme" and "Reference:PLT Scheme", which I can have locally on my laptop? I do not have access to the Internet at home. Best, Keiko From robby at eecs.northwestern.edu Wed Apr 15 12:22:43 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Apr 15 12:23:23 2009 Subject: [plt-scheme] bundles of HTML files of Guide & Reference In-Reply-To: <20090416.010539.125099476.keiko@kurims.kyoto-u.ac.jp> References: <20090416.010539.125099476.keiko@kurims.kyoto-u.ac.jp> Message-ID: <932b2f1f0904150922k2bf1e666n5e0780179ac1799a@mail.gmail.com> They come in the distribution. Open up drscheme, hit f1 (or run plt-help from the shell) and you'll be reading the locally installed docs. Robby On Wed, Apr 15, 2009 at 11:05 AM, Keiko Nakata wrote: > Hello. > > Are there bundles of HTML files of "Guide:PLT Scheme" and > "Reference:PLT Scheme", which I can have locally on my laptop? > I do not have access to the Internet at home. > > Best, > Keiko > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From grettke at acm.org Wed Apr 15 12:22:58 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Apr 15 12:23:28 2009 Subject: [plt-scheme] bundles of HTML files of Guide & Reference In-Reply-To: <20090416.010539.125099476.keiko@kurims.kyoto-u.ac.jp> References: <20090416.010539.125099476.keiko@kurims.kyoto-u.ac.jp> Message-ID: <756daca50904150922h2ef48851s6a233409a40b2511@mail.gmail.com> On Wed, Apr 15, 2009 at 11:05 AM, Keiko Nakata wrote: > Are there bundles of HTML files of "Guide:PLT Scheme" and > "Reference:PLT Scheme", which I can have locally on my laptop? > I do not have access to the Internet at home. PDF if you like? http://download.plt-scheme.org/doc/pdf/ From grettke at acm.org Wed Apr 15 12:23:58 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Apr 15 12:24:19 2009 Subject: [plt-scheme] bundles of HTML files of Guide & Reference In-Reply-To: <756daca50904150922h2ef48851s6a233409a40b2511@mail.gmail.com> References: <20090416.010539.125099476.keiko@kurims.kyoto-u.ac.jp> <756daca50904150922h2ef48851s6a233409a40b2511@mail.gmail.com> Message-ID: <756daca50904150923i785bb653y86b2b0fba97225d6@mail.gmail.com> On Wed, Apr 15, 2009 at 11:22 AM, Grant Rettke wrote: > On Wed, Apr 15, 2009 at 11:05 AM, Keiko Nakata > wrote: >> Are there bundles of HTML files of "Guide:PLT Scheme" and >> "Reference:PLT Scheme", which I can have locally on my laptop? >> I do not have access to the Internet at home. > > PDF if you like? > > http://download.plt-scheme.org/doc/pdf/ Sorry right answer to wrong question. From nadeem at acm.org Wed Apr 15 12:32:27 2009 From: nadeem at acm.org (Nadeem Abdul Hamid) Date: Wed Apr 15 12:32:51 2009 Subject: [plt-scheme] bundles of HTML files of Guide & Reference In-Reply-To: <756daca50904150922h2ef48851s6a233409a40b2511@mail.gmail.com> References: <20090416.010539.125099476.keiko@kurims.kyoto-u.ac.jp> <756daca50904150922h2ef48851s6a233409a40b2511@mail.gmail.com> Message-ID: <916E0CCA-DBF9-4564-ADD0-1D7E95F5DEB3@acm.org> This (PDF files) is really helpful... I've been looking for it. Is it not linked somewhere from the PLT Scheme site? --- nadeem On Apr 15, 2009, at 12:22 PM, Grant Rettke wrote: > On Wed, Apr 15, 2009 at 11:05 AM, Keiko Nakata > wrote: >> Are there bundles of HTML files of "Guide:PLT Scheme" and >> "Reference:PLT Scheme", which I can have locally on my laptop? >> I do not have access to the Internet at home. > > PDF if you like? > > http://download.plt-scheme.org/doc/pdf/ > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at eecs.northwestern.edu Wed Apr 15 15:37:00 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Apr 15 15:37:22 2009 Subject: [plt-scheme] ACM SIGPLAN Message-ID: <932b2f1f0904151237p7eb674c3gf63deb18df2428b5@mail.gmail.com> For those of you that are members of the ACM's SIGPLAN, do note that our own Matthew Flatt is running in the current elections. You can read his statement here: http://www.acm.org/sigs/elections/SIGPLAN/MFlatt-MemberatLarge.pdf Robby From matthias at ccs.neu.edu Wed Apr 15 15:43:29 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Apr 15 15:47:04 2009 Subject: [plt-scheme] ACM SIGPLAN In-Reply-To: <932b2f1f0904151237p7eb674c3gf63deb18df2428b5@mail.gmail.com> References: <932b2f1f0904151237p7eb674c3gf63deb18df2428b5@mail.gmail.com> Message-ID: The question is whether Matthew wants to be elected. On Apr 15, 2009, at 3:37 PM, Robby Findler wrote: > For those of you that are members of the ACM's SIGPLAN, do note that > our own Matthew Flatt is running in the current elections. You can > read his statement here: > > http://www.acm.org/sigs/elections/SIGPLAN/MFlatt-MemberatLarge.pdf > > Robby > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Wed Apr 15 16:00:45 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Apr 15 16:01:31 2009 Subject: [plt-scheme] ACM SIGPLAN In-Reply-To: References: <932b2f1f0904151237p7eb674c3gf63deb18df2428b5@mail.gmail.com> Message-ID: <20090415200045.9FA846500C8@mail-svr1.cs.utah.edu> I want to be elected iff enough people agree with my stated (in the PDF below) opinion on conferences and journals --- or if enough people want me arguing that side, at least. At Wed, 15 Apr 2009 15:43:29 -0400, Matthias Felleisen wrote: > > The question is whether Matthew wants to be elected. > > > On Apr 15, 2009, at 3:37 PM, Robby Findler wrote: > > > For those of you that are members of the ACM's SIGPLAN, do note that > > our own Matthew Flatt is running in the current elections. You can > > read his statement here: > > > > http://www.acm.org/sigs/elections/SIGPLAN/MFlatt-MemberatLarge.pdf > > > > Robby From robby at eecs.northwestern.edu Wed Apr 15 16:06:11 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Wed Apr 15 16:06:33 2009 Subject: [plt-scheme] ACM SIGPLAN In-Reply-To: <20090415200045.9FA846500C8@mail-svr1.cs.utah.edu> References: <932b2f1f0904151237p7eb674c3gf63deb18df2428b5@mail.gmail.com> <20090415200045.9FA846500C8@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0904151306m75f70254gc8cf9cf414fdbe36@mail.gmail.com> Nice when one's wants are guaranteed to get fulfilled, isn't it? :) Robby On Wed, Apr 15, 2009 at 3:00 PM, Matthew Flatt wrote: > I want to be elected iff enough people agree with my stated (in the PDF > below) opinion on conferences and journals --- or if enough people want > me arguing that side, at least. > > At Wed, 15 Apr 2009 15:43:29 -0400, Matthias Felleisen wrote: >> >> The question is whether Matthew wants to be elected. >> >> >> On Apr 15, 2009, at 3:37 PM, Robby Findler wrote: >> >> > For those of you that are members of the ACM's SIGPLAN, do note that >> > our own Matthew Flatt is running in the current elections. You can >> > read his statement here: >> > >> > http://www.acm.org/sigs/elections/SIGPLAN/MFlatt-MemberatLarge.pdf >> > >> > Robby > > From matthias at ccs.neu.edu Wed Apr 15 16:46:46 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Wed Apr 15 16:50:17 2009 Subject: [plt-scheme] ACM SIGPLAN In-Reply-To: <932b2f1f0904151306m75f70254gc8cf9cf414fdbe36@mail.gmail.com> References: <932b2f1f0904151237p7eb674c3gf63deb18df2428b5@mail.gmail.com> <20090415200045.9FA846500C8@mail-svr1.cs.utah.edu> <932b2f1f0904151306m75f70254gc8cf9cf414fdbe36@mail.gmail.com> Message-ID: <2901C95C-6649-4507-82DB-AA46B63CA810@ccs.neu.edu> Here's the bad news: I think people vote by name, not by value. On Apr 15, 2009, at 4:06 PM, Robby Findler wrote: > Nice when one's wants are guaranteed to get fulfilled, isn't it? :) > > Robby > > On Wed, Apr 15, 2009 at 3:00 PM, Matthew Flatt > wrote: >> I want to be elected iff enough people agree with my stated (in >> the PDF >> below) opinion on conferences and journals --- or if enough people >> want >> me arguing that side, at least. >> >> At Wed, 15 Apr 2009 15:43:29 -0400, Matthias Felleisen wrote: >>> >>> The question is whether Matthew wants to be elected. >>> >>> >>> On Apr 15, 2009, at 3:37 PM, Robby Findler wrote: >>> >>>> For those of you that are members of the ACM's SIGPLAN, do note >>>> that >>>> our own Matthew Flatt is running in the current elections. You can >>>> read his statement here: >>>> >>>> http://www.acm.org/sigs/elections/SIGPLAN/MFlatt-MemberatLarge.pdf >>>> >>>> Robby >> >> From tsg153 at gmail.com Wed Apr 15 17:37:24 2009 From: tsg153 at gmail.com (Toby Gee) Date: Wed Apr 15 17:37:43 2009 Subject: [plt-scheme] Running the SICP metacircular evaluators In-Reply-To: <18917.48901.280981.411151@winooski.ccs.neu.edu> References: <158728f80904150358h5416e3e9q7fb0241d7aaaf4ec@mail.gmail.com> <18917.48901.280981.411151@winooski.ccs.neu.edu> Message-ID: <158728f80904151437g67bfb55en3a5562977c5fc1bf@mail.gmail.com> On Wed, Apr 15, 2009 at 7:03 AM, Eli Barzilay wrote: > The R5RS language has a "back door" to import bindings from other > modules [...] Thanks - this enabled me to get 'error' to work, and I then defined 'true' and 'false' to be #t and #f. However, I've now run into the problem that the metacircular evaluator wants to store the existing version of apply by doing: (define apply-in-underlying-scheme apply) and then defining a new 'apply' below. This gives me the error: "reference to an identifier before its definition: apply". Is there anything I can do about this, or will I have to rewrite everything to call the metacircular evaluator's 'apply' something different? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090415/41518072/attachment.html From yinso.chen at gmail.com Wed Apr 15 20:47:00 2009 From: yinso.chen at gmail.com (YC) Date: Wed Apr 15 20:47:19 2009 Subject: [plt-scheme] parent and child thread's lifetime Message-ID: <779bf2730904151747i7c4a708l49aaf21aecf5c297@mail.gmail.com> Hi - can a child thread outlast a parent thread's lifetime? I have a thread that creates another thread and then pretty much immediately exits. The child thread seem to hang without completing all of its tasks. I verified that the child thread is dead. Is there a potential issue between their respective lifetimes? Or am I looking at the problem from wrong angle? Any thoughts are appreciated, thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090415/c50e4485/attachment.htm From mflatt at cs.utah.edu Wed Apr 15 20:55:31 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Wed Apr 15 20:55:53 2009 Subject: [plt-scheme] parent and child thread's lifetime In-Reply-To: <779bf2730904151747i7c4a708l49aaf21aecf5c297@mail.gmail.com> References: <779bf2730904151747i7c4a708l49aaf21aecf5c297@mail.gmail.com> Message-ID: <20090416005533.9B2DC6500BD@mail-svr1.cs.utah.edu> At Wed, 15 Apr 2009 17:47:00 -0700, YC wrote: > can a child thread outlast a parent thread's lifetime? Yes. There's not really any hierarchy among threads (though there is a hierarchy among custodians for termination or thread groups for scheduling). > I have a thread that creates another thread and then pretty much immediately > exits. The child thread seem to hang without completing all of its tasks. > I verified that the child thread is dead. > > Is there a potential issue between their respective lifetimes? No, it must be something else. The death of the older thread doesn't automatically kill the newer thread. From grettke at acm.org Wed Apr 15 20:56:11 2009 From: grettke at acm.org (Grant Rettke) Date: Wed Apr 15 20:56:30 2009 Subject: [plt-scheme] What can we do to help get the R6RS versions of the SRFIs up and running? Message-ID: <756daca50904151756w4df92198g4baf73aaf90da842@mail.gmail.com> What can volunteers do to help get the R6RS versions of the SRFIs up and running? I would really like to see this happen and I volunteer to help out as much as I can contribute. From yinso.chen at gmail.com Wed Apr 15 21:01:42 2009 From: yinso.chen at gmail.com (YC) Date: Wed Apr 15 21:02:01 2009 Subject: [plt-scheme] parent and child thread's lifetime In-Reply-To: <20090416005533.9B2DC6500BD@mail-svr1.cs.utah.edu> References: <779bf2730904151747i7c4a708l49aaf21aecf5c297@mail.gmail.com> <20090416005533.9B2DC6500BD@mail-svr1.cs.utah.edu> Message-ID: <779bf2730904151801g55fbc54awb407e985970e17dd@mail.gmail.com> On Wed, Apr 15, 2009 at 5:55 PM, Matthew Flatt wrote: > > > I have a thread that creates another thread and then pretty much > immediately > > exits. The child thread seem to hang without completing all of its > tasks. > > I verified that the child thread is dead. > > > > Is there a potential issue between their respective lifetimes? > > No, it must be something else. The death of the older thread doesn't > automatically kill the newer thread. > Thanks - I'll try to think through the issue again. yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090415/e0a63cb2/attachment.html From yinso.chen at gmail.com Thu Apr 16 01:44:58 2009 From: yinso.chen at gmail.com (YC) Date: Thu Apr 16 01:45:18 2009 Subject: [plt-scheme] parent and child thread's lifetime In-Reply-To: <20090416005533.9B2DC6500BD@mail-svr1.cs.utah.edu> References: <779bf2730904151747i7c4a708l49aaf21aecf5c297@mail.gmail.com> <20090416005533.9B2DC6500BD@mail-svr1.cs.utah.edu> Message-ID: <779bf2730904152244h1b7211fctf68104c1c65649b6@mail.gmail.com> On Wed, Apr 15, 2009 at 5:55 PM, Matthew Flatt wrote: > > > I have a thread that creates another thread and then pretty much > immediately > > exits. The child thread seem to hang without completing all of its > tasks. > > I verified that the child thread is dead. > > > > Is there a potential issue between their respective lifetimes? > > No, it must be something else. The death of the older thread doesn't > automatically kill the newer thread. > I tried to trace the child threads to no avail - the thread is either not started or hang in the middle. And they cannot be resumed. I finally solved the problem via introducing an intermediate long running thread to create the child threads. So originally it was: server -> short-living threads for tcp comm -> each creates an asynchronous worker thread Then I change it to: server -> shot-living thread for tcp comm -> pass message to a separate long living thread -> the long living thread creates asynchronous worker thread As far as I can tell, it has something to do with the threads creation order, but I still cannot make out the problem... Any thoughts on what it might be? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090415/b521bef2/attachment.html From DekuDekuplex at Yahoo.com Thu Apr 16 02:18:09 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Apr 16 02:18:45 2009 Subject: [plt-scheme] comprehensive manual for Quack with detailed descriptions of all Quack-related keybindings? Message-ID: Does anybody know where to find a comprehensive user manual for Quack? I am seeking a manual with a comprehensive list of instructions for working with PLT Scheme code in Emacs using Quack, but the best I could find was the following (referenced on the Quack home page at http://www.neilvandyke.org/quack/): Emacs Scheme @ CSE HUJI HOWTO introduction from the Hebrew University of Jerusalem http://www.cs.huji.ac.il/~osigor/emacs/pllab.html However, the above-mentioned site is mainly intended for CSE students at the Hebrew University of Jerusalem. In particular, it does not include a detailed description of all Quack keybindings as listed using the "describe-bindings" (C-h b) command within .scm file and Scheme interpreter buffers in Emacs. Does anybody know where to find a manual that includes such a description? -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From DekuDekuplex at Yahoo.com Thu Apr 16 02:27:33 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Apr 16 02:28:07 2009 Subject: [plt-scheme] Re: comprehensive manual for Quack with detailed descriptions of all Quack-related keybindings? References: Message-ID: <7pjdu4dopa1of4tpuhanbj6coorbfulqd3@4ax.com> On Thu, 16 Apr 2009 15:18:09 +0900, Benjamin L.Russell wrote: >Does anybody know where to find a comprehensive user manual for Quack? > >I am seeking a manual with a comprehensive list of instructions for >working with PLT Scheme code in Emacs using Quack, but the best I >could find was the following (referenced on the Quack home page at >http://www.neilvandyke.org/quack/): > >Emacs Scheme @ CSE HUJI HOWTO introduction from the Hebrew University >of Jerusalem >http://www.cs.huji.ac.il/~osigor/emacs/pllab.html > >However, the above-mentioned site is mainly intended for CSE students >at the Hebrew University of Jerusalem. > >In particular, it does not include a detailed description of all Quack >keybindings as listed using the "describe-bindings" (C-h b) command >within .scm file and Scheme interpreter buffers in Emacs. > >Does anybody know where to find a manual that includes such a >description? > >-- Benjamin L. Russell After some searching, I additionally came across the following references, which included descriptions of some Quack commands: Bill Clementson's Blog: Some MzScheme Interactive Stuff for console/emacs use http://bc.tech.coop/blog/061015.html Bill Clementson's Blog: Setting up Emacs for PLT Scheme http://bc.tech.coop/blog/040117.html Setting up Emacs for use with PLT Scheme on Windows or Mac OS X (somewhat out-of-date) http://bc.tech.coop/scheme/scheme-emacs.htm Any other references would be greatly appreciated. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From noelwelsh at gmail.com Thu Apr 16 09:35:59 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Apr 16 09:36:18 2009 Subject: [plt-scheme] comprehensive manual for Quack with detailed descriptions of all Quack-related keybindings? In-Reply-To: References: Message-ID: On Thu, Apr 16, 2009 at 7:18 AM, Benjamin L.Russell wrote: > Does anybody know where to find a comprehensive user manual for Quack? I don't think there is such a thing. However, there are stacks of comments in the Quack source code, and there is the documentation from within Emacs (C-h f etc.) HTH, N. From neil at neilvandyke.org Thu Apr 16 09:57:00 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Apr 16 09:57:41 2009 Subject: [plt-scheme] comprehensive manual for Quack with detailed descriptions of all Quack-related keybindings? In-Reply-To: References: Message-ID: <49E7392C.204@neilvandyke.org> Noel is correct that there is no manual for Quack. The global and mode menus will indicate many of the commands and options, and the key bindings list (C-h m) from Scheme Mode will indicate some of the other editing commands. You might have to look at the source to figure out how to use some things. For example, the "Toggle Lambda Syntax" option you see on the Scheme Mode menu requires that the point be on the "(define" line or the line with the "(lambda". Quack development is in maintenance mode right now. I have plans to replace Quack completely, but unfortunately that's in my rather large unfunded projects pool, so I can no promises when/if I can get to it. Neil Noel Welsh wrote at 04/16/2009 09:35 AM: > On Thu, Apr 16, 2009 at 7:18 AM, Benjamin L.Russell > wrote: > >> Does anybody know where to find a comprehensive user manual for Quack? >> > > I don't think there is such a thing. However, there are stacks of > comments in the Quack source code, and there is the documentation from > within Emacs (C-h f etc.) > -- http://www.neilvandyke.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090416/60021f15/attachment.html From spdegabrielle at gmail.com Thu Apr 16 10:55:09 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Apr 16 10:55:32 2009 Subject: [plt-scheme] web server error Message-ID: <595b9ab20904160755t3ae707ecg35364656005a6555@mail.gmail.com> Hi, I'm using web-server/servlet-env and I occasionally get the following error; Connection error: tcp-accept: accept from listener failed (An operation was attempted on something that is not a socket.; errno=10038) It normally happens at the begining of my session, but restarting a few times seems to fix it. Any idea what might be causing it? Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From mflatt at cs.utah.edu Thu Apr 16 11:04:17 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Apr 16 11:04:43 2009 Subject: [plt-scheme] web server error In-Reply-To: <595b9ab20904160755t3ae707ecg35364656005a6555@mail.gmail.com> References: <595b9ab20904160755t3ae707ecg35364656005a6555@mail.gmail.com> Message-ID: <20090416150418.35C2A65003B@mail-svr1.cs.utah.edu> At Thu, 16 Apr 2009 15:55:09 +0100, Stephen De Gabrielle wrote: > I'm using web-server/servlet-env and I occasionally get the following error; > > Connection error: tcp-accept: accept from listener failed (An > operation was attempted on something that is not a socket.; > errno=10038) > > It normally happens at the begining of my session, but restarting a > few times seems to fix it. > > Any idea what might be causing it? Is this version 4.1.5? Running on MrEd/DrScheme or MzScheme/plt-web-server? I re-wrote some socket-synchronization code for Windows in 4.1.5, and I got part of it wrong in MrEd --- but no known problems in MzScheme, so far. The known MrEd problem has been fixed in the SVN trunk. From jay.mccarthy at gmail.com Thu Apr 16 11:05:59 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Apr 16 11:06:22 2009 Subject: [plt-scheme] web server error In-Reply-To: <595b9ab20904160755t3ae707ecg35364656005a6555@mail.gmail.com> References: <595b9ab20904160755t3ae707ecg35364656005a6555@mail.gmail.com> Message-ID: What platform are you on? The Web Server defers all TCP management to run-server [1] so if you want to debug further, you can try that directly. 1. http://docs.plt-scheme.org/mzlib/mzlib_thread.html#(def._((lib._mzlib/thread..ss)._run-server)) On Thu, Apr 16, 2009 at 8:55 AM, Stephen De Gabrielle wrote: > Hi, > > I'm using web-server/servlet-env and I occasionally get the following error; > > Connection error: tcp-accept: accept from listener failed (An > operation was attempted on something that is not a socket.; > errno=10038) > > It normally happens at the begining of my session, but restarting a > few times seems to fix it. > > Any idea what might be causing it? > > Cheers, > > Stephen > > -- > Stephen De Gabrielle > s.degabrielle@cs.ucl.ac.uk > Telephone +44 (0)20 7679 0693 (x30693) > Mobile ? ? ? ? ? ? ? ? ?079 851 890 45 > Project: Making Sense of Information (MaSI) > Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html > Home:http://www.degabrielle.name/stephen > > > UCL Interaction Centre > MPEB 8th floor > University College London > Gower Street > London WC1E 6BT > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From erich at snafu.de Thu Apr 16 11:17:43 2009 From: erich at snafu.de (Erich Rast) Date: Thu Apr 16 11:11:30 2009 Subject: [plt-scheme] (Bit Off) External Memory Paging etc. Message-ID: <1239895063.32446.19.camel@darkstar> Hi, I want to implement an external randomized skip list in pure Scheme and think I grasp the concept well enough to give it a try (just for fun). However, I can't find any useful information on how to deal with insertion and deletion on disks and how to prevent excessive skipping back and forth in a file. The books and texts on algorithms I've seen tend to describe structures as if they were in internal memory and leave it quite open how to manage pages, do smart caching, re-use space marked as unused, etc. Does anyone know good tutorials or a good book on *external* data structures and algorithms? To give you some background information, I haven't studied CS and while I'm able read and understand some discrete mathematics, I personally prefer prose + pictures + pseudo code. Best regards, Erich From chust at web.de Thu Apr 16 11:25:17 2009 From: chust at web.de (Thomas Chust) Date: Thu Apr 16 11:25:38 2009 Subject: [plt-scheme] Mysterious bitrot in MrEd Message-ID: <1c1a33bc0904160825k2061c439j27283b0cc385dfc6@mail.gmail.com> Hello, in the last few months I have observed the following very strange behaviour of MrEd versions 4.1.3 through 4.1.5 several times both under MacOS X and Linux both with PowerPC and Intel processors on several different machines: After running a MrEd application (for example DrScheme) and terminating it normally, MrEd sometimes fails to start up correctly ever again (it simply hangs forever when you start it or produces some random segmentation fault). I finally figured out that this happens because the native shared library containing the MrEd backend code actually changes on disk! Of course the problem only occurs if the user running MrEd has write permissions to that library file and it happens only once in a while. However it is needless to say that it spoils my day if it happens :-/ I suspect that the problem is caused by some memory mapping going ballistic and garbage being written into a segment of the library ;-) Unfortunately I haven't been able to trigger the problem deterministically, yet. And I wonder whether I'm going crazy or if anybody else has ever observed this behaviour as well. Please let me know if you had any similar experience or if you know what I'm doing wrong or what may be causing the trouble. cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From czhu at cs.utah.edu Thu Apr 16 13:43:29 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Apr 16 13:44:02 2009 Subject: [plt-scheme] What can we do to help get the R6RS versions of the SRFIs up and running? In-Reply-To: <756daca50904151756w4df92198g4baf73aaf90da842@mail.gmail.com> References: <756daca50904151756w4df92198g4baf73aaf90da842@mail.gmail.com> Message-ID: <49E76E41.1010304@cs.utah.edu> Port SRFIs to r6rs language in PLT (from whatever source you think appropriate), make/run test suites, and then send them to me Chongkai Grant Rettke wrote: > What can volunteers do to help get the R6RS versions of the SRFIs up > and running? > > I would really like to see this happen and I volunteer to help out as > much as I can contribute. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From czhu at cs.utah.edu Thu Apr 16 13:46:43 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Apr 16 13:47:11 2009 Subject: [plt-scheme] What can we do to help get the R6RS versions of the SRFIs up and running? In-Reply-To: <49E76E41.1010304@cs.utah.edu> References: <756daca50904151756w4df92198g4baf73aaf90da842@mail.gmail.com> <49E76E41.1010304@cs.utah.edu> Message-ID: <49E76F03.5030704@cs.utah.edu> Chongkai Zhu wrote: > Port SRFIs to r6rs language in PLT (from whatever source you think > appropriate), make/run test suites, and then send them to me > Possible source of r6rs code: Ikarus, reference implementation of the SRFI, existing PLT (non r6rs) version From pocmatos at gmail.com Thu Apr 16 15:58:54 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Apr 16 15:59:31 2009 Subject: [plt-scheme] [OT] Scheme Jobs Message-ID: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> Hi guys, This might be relatively off-topic but is certainly the target community I would like to approach with this question. I am finishing my PhD by the end of the year and starting to work in Jan, 2010. I am moving to Germany [either Munich or Berlin, up to be decided]. Does anybody know any Scheme-related jobs in any of these areas (or companies to contact?)? Or maybe Lisp related jobs since Scheme might be even harder? Any other suggestions/comments to someone like me without industrial experience that just finished a PhD in formal methods and looking for a job are welcome. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From sk at cs.brown.edu Thu Apr 16 16:27:08 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Apr 16 16:27:47 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> Message-ID: There is a Munich Lisp group, run by our own Marek Kubica. There's a link to it from the schemers.org home page (www.schemers.org). So that would be a good starting point. There should also be good opportunities for functional programmers with a formal methods background in Munich thanks to the influence of the work that has been done at TU-M. Not sure about Berlin. Shriram From jpc-ml at zenburn.net Thu Apr 16 17:35:21 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Apr 16 17:35:41 2009 Subject: [plt-scheme] parent and child thread's lifetime In-Reply-To: <20090416005533.9B2DC6500BD@mail-svr1.cs.utah.edu> References: <779bf2730904151747i7c4a708l49aaf21aecf5c297@mail.gmail.com> <20090416005533.9B2DC6500BD@mail-svr1.cs.utah.edu> Message-ID: <49E7A499.8090202@zenburn.net> On 4/16/09 2:55 AM, Matthew Flatt wrote: > No, it must be something else. The death of the older thread doesn't > automatically kill the newer thread. IIRC it could get garbage collected? -- regards, Jakub Piotr C?apa From toddobryan at gmail.com Thu Apr 16 18:27:26 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Apr 16 18:27:45 2009 Subject: [plt-scheme] =?iso-8859-7?q?Re=3A_=EB_doesn=27t_work_in_HtDP_lan?= =?iso-8859-7?q?guages?= In-Reply-To: <904774730904141339i7a9223a7vcb3aac0bb1208529@mail.gmail.com> References: <904774730904141339i7a9223a7vcb3aac0bb1208529@mail.gmail.com> Message-ID: <904774730904161527k27d449b6hd785653489cba5d1@mail.gmail.com> Is this as easy as adding [intermediate-lambda ?] and [advanced-lambda ?] respectively to the (provide (rename-out blocks of collects/lang/htdp-intermediate.ss and htdp-advanced.ss respectively? It seems to work and doesn't invalidate the spelled out form ("lambda"), but I may be missing something. If that's it, I've attached a patch. Todd 2009/4/14 Todd O'Bryan : > The subject says it all. We just did lambda today, and the lambda you > insert from the menu doesn't work for Intermediate Student with lambda > or Advanced Student. You get: > > ?: name is not defined, not a parameter, and not a primitive name > > This is with version 4.1.5.4-svn13apr2009 (as well as with the > released 4.1.4 and 4.1.5). > > Such a letdown... :-( > > Todd > -------------- next part -------------- A non-text attachment was scrubbed... Name: htdp-lambda-shortcut.patch Type: text/x-diff Size: 1047 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090416/5792a672/htdp-lambda-shortcut.bin From benjisimon at gmail.com Fri Apr 17 00:57:42 2009 From: benjisimon at gmail.com (Ben Simon) Date: Fri Apr 17 00:58:05 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <46B6D073-8F9F-4CFA-81DF-3158424862AE@aol.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> <756daca50904140713w688dce23u99f2b1691bde4cc@mail.gmail.com> <46B6D073-8F9F-4CFA-81DF-3158424862AE@aol.com> Message-ID: On Wed, Apr 15, 2009 at 1:07 AM, Jim Bender wrote: > Ok. Without much work I now have a working version of the pattern matcher > that works with xexprs, so I should be able to release a planet package for > "xexpr-match" in the near future. Oooh, that would fantastic! I've read through the docs of WebIt! pretty extensively now, and am convinced that some sort of xml-match is just what I'm looking for. -Ben -- Have an idea for software? I can make it happen - http://www.ideas2executables.com My Blog: http://benjisimon.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/2a27130e/attachment.htm From DekuDekuplex at Yahoo.com Fri Apr 17 01:53:38 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Fri Apr 17 01:54:22 2009 Subject: [plt-scheme] Re: comprehensive manual for Quack with detailed descriptions of all Quack-related keybindings? References: <49E7392C.204@neilvandyke.org> Message-ID: Thank you for your response. >I have plans to replace Quack completely.... If you don't mind my inquiring, with what do you have plans to replace Quack? -- Benjamin L. Russell On Thu, 16 Apr 2009 09:57:00 -0400, Neil Van Dyke wrote: >Noel is correct that there is no manual for Quack. > >The global and mode menus will indicate many of the commands and >options, and the key bindings list (C-h m) from Scheme Mode will >indicate some of the other editing commands. > >You might have to look at the source to figure out how to use some >things. For example, the "Toggle Lambda Syntax" option you see on the >Scheme Mode menu requires that the point be on the "(define" line or the >line with the "(lambda". > >Quack development is in maintenance mode right now. I have plans to >replace Quack completely, but unfortunately that's in my rather large >unfunded projects pool, so I can no promises when/if I can get to it. > >Neil > >Noel Welsh wrote at 04/16/2009 09:35 AM: >> On Thu, Apr 16, 2009 at 7:18 AM, Benjamin L.Russell >> wrote: >> >>> Does anybody know where to find a comprehensive user manual for Quack? >>> >> >> I don't think there is such a thing. However, there are stacks of >> comments in the Quack source code, and there is the documentation from >> within Emacs (C-h f etc.) >> -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From diggerrrrr at gmail.com Fri Apr 17 02:48:43 2009 From: diggerrrrr at gmail.com (Veer) Date: Fri Apr 17 02:49:03 2009 Subject: [plt-scheme] Web Server : page expires on form submission. Message-ID: Hello, After reading the nice blog tutorial , i tried to write a similar web application, but whenever I submit a form after some delay , browser displays: "Sorry, this page has expired. Please go back." . What should i do to make this go away? Thanks , Veer From noelwelsh at gmail.com Fri Apr 17 02:54:28 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Apr 17 02:54:46 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: Change the continuation manager. What continuation manager are you using? N. On Fri, Apr 17, 2009 at 7:48 AM, Veer wrote: ,,, > ?What should i do to make this go away? From diggerrrrr at gmail.com Fri Apr 17 03:19:21 2009 From: diggerrrrr at gmail.com (Veer) Date: Fri Apr 17 03:19:40 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: > Change the continuation manager. What continuation manager are you using? I really don't know :) , i just followed the blog example from the manual . Only thing that is included is #lang web-server/insta . On Fri, Apr 17, 2009 at 12:24 PM, Noel Welsh wrote: > Change the continuation manager. What continuation manager are you using? > > N. > > On Fri, Apr 17, 2009 at 7:48 AM, Veer wrote: > ,,, >> ?What should i do to make this go away? > From noelwelsh at gmail.com Fri Apr 17 03:32:34 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Apr 17 03:32:54 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: Three options: Switch to serve/servlet, and specify your own theshold-LRU-manager with a higher memory threshold Write your servlets in the "stateless" web language Write your code to use less memory The problem is thus: you're storing continuations in the server's memory. This memory must be reclaimed eventually. The default continuation manager reclaims memory at a slow rate when memory consumption is less than 64MB, and a very fast rate when that threshold is exceeded. If you see page expired after a short (< 4 hours) delay it means your using more than 64MB. You can either set a higher threshold, serialize continuations to {the client|disk} or use less memory. N. On Fri, Apr 17, 2009 at 8:19 AM, Veer wrote: >> Change the continuation manager. What continuation manager are you using? > > I really don't know ?:) , i just followed the blog example from the manual . > Only thing that is included is ?#lang web-server/insta . From diggerrrrr at gmail.com Fri Apr 17 05:37:56 2009 From: diggerrrrr at gmail.com (Veer) Date: Fri Apr 17 05:38:16 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: Thanks! , increasing memory threshold to 128MB seems to work. Veer On Fri, Apr 17, 2009 at 1:02 PM, Noel Welsh wrote: > Three options: > > Switch to serve/servlet, and specify your own theshold-LRU-manager > with a higher memory threshold > > Write your servlets in the "stateless" web language > > Write your code to use less memory > > The problem is thus: you're storing continuations in the server's > memory. This memory must be reclaimed eventually. The default > continuation manager reclaims memory at a slow rate when memory > consumption is less than 64MB, and a very fast rate when that > threshold is exceeded. If you see page expired after a short (< 4 > hours) delay it means your using more than 64MB. You can either set a > higher threshold, serialize continuations to {the client|disk} or use > less memory. > > N. > > On Fri, Apr 17, 2009 at 8:19 AM, Veer wrote: >>> Change the continuation manager. What continuation manager are you using? >> >> I really don't know ?:) , i just followed the blog example from the manual . >> Only thing that is included is ?#lang web-server/insta . > From mflatt at cs.utah.edu Fri Apr 17 07:18:37 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri Apr 17 07:18:59 2009 Subject: [plt-scheme] Re: =?UTF-8?B?zrs=?= doesn't work in HtDP lan guages In-Reply-To: <904774730904161527k27d449b6hd785653489cba5d1@mail.gmail.com> References: <904774730904141339i7a9223a7vcb3aac0bb1208529@mail.gmail.com> <904774730904161527k27d449b6hd785653489cba5d1@mail.gmail.com> Message-ID: <20090417111839.808566500AA@mail-svr1.cs.utah.edu> At Thu, 16 Apr 2009 18:27:26 -0400, "Todd O'Bryan" wrote: > Is this as easy as adding [intermediate-lambda ?] and [advanced-lambda > ?] respectively to the > > (provide (rename-out > > blocks of collects/lang/htdp-intermediate.ss and htdp-advanced.ss respectively? > > It seems to work and doesn't invalidate the spelled out form > ("lambda"), but I may be missing something. If that's it, I've > attached a patch. Patch applied in SVN - thanks! From jadudm at gmail.com Fri Apr 17 07:26:58 2009 From: jadudm at gmail.com (Matt Jadud) Date: Fri Apr 17 07:27:21 2009 Subject: [plt-scheme] Favorite library for parsing XML in PLT 4? 3? In-Reply-To: <46B6D073-8F9F-4CFA-81DF-3158424862AE@aol.com> References: <756daca50904071319s62182c7br9827d0a68d3e0ec9@mail.gmail.com> <756daca50904140713w688dce23u99f2b1691bde4cc@mail.gmail.com> <46B6D073-8F9F-4CFA-81DF-3158424862AE@aol.com> Message-ID: On Wed, Apr 15, 2009 at 1:07 AM, Jim Bender wrote: > Ok. Without much work I now have a working version of the pattern matcher > that works with xexprs, so I should be able to release a planet package for > "xexpr-match" in the near future. In keeping with the original purpose of the thread, I wanted to say that xml-match is my favorite tool in this space. Because it is like the Indiana matcher that I "grew up with," using it feels like "going home." http://www.youtube.com/watch?v=WXUgjU-MeK4 Yes, that's right. I just worked in a Rockapella YouTube reference *on topic*. Clearly, sleep deprivation has not lost me mah touch. Do keep up the excellent work, Jim. Cheers, Matt PS. The bog-standard match does many wonderful things that I use all the time, so no disrespect. I just don't have any songs I can reference about it. From sk at cs.brown.edu Fri Apr 17 07:58:22 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Fri Apr 17 07:59:06 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: This points to a flaw in the tutorial, or perhaps even in the server's defaults.... Jay? On Fri, Apr 17, 2009 at 3:32 AM, Noel Welsh wrote: > Three options: > > Switch to serve/servlet, and specify your own theshold-LRU-manager > with a higher memory threshold > > Write your servlets in the "stateless" web language > > Write your code to use less memory > > The problem is thus: you're storing continuations in the server's > memory. This memory must be reclaimed eventually. The default > continuation manager reclaims memory at a slow rate when memory > consumption is less than 64MB, and a very fast rate when that > threshold is exceeded. If you see page expired after a short (< 4 > hours) delay it means your using more than 64MB. You can either set a > higher threshold, serialize continuations to {the client|disk} or use > less memory. > > N. > > On Fri, Apr 17, 2009 at 8:19 AM, Veer wrote: >>> Change the continuation manager. What continuation manager are you using? >> >> I really don't know ?:) , i just followed the blog example from the manual . >> Only thing that is included is ?#lang web-server/insta . > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jay.mccarthy at gmail.com Fri Apr 17 08:25:49 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Apr 17 08:26:12 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: Can you say how long of a delay you had before these problems showed up? Jay On Fri, Apr 17, 2009 at 3:37 AM, Veer wrote: > Thanks! , increasing memory threshold to 128MB seems to work. > > Veer > > On Fri, Apr 17, 2009 at 1:02 PM, Noel Welsh wrote: >> Three options: >> >> Switch to serve/servlet, and specify your own theshold-LRU-manager >> with a higher memory threshold >> >> Write your servlets in the "stateless" web language >> >> Write your code to use less memory >> >> The problem is thus: you're storing continuations in the server's >> memory. This memory must be reclaimed eventually. The default >> continuation manager reclaims memory at a slow rate when memory >> consumption is less than 64MB, and a very fast rate when that >> threshold is exceeded. If you see page expired after a short (< 4 >> hours) delay it means your using more than 64MB. You can either set a >> higher threshold, serialize continuations to {the client|disk} or use >> less memory. >> >> N. >> >> On Fri, Apr 17, 2009 at 8:19 AM, Veer wrote: >>>> Change the continuation manager. What continuation manager are you using? >>> >>> I really don't know ?:) , i just followed the blog example from the manual . >>> Only thing that is included is ?#lang web-server/insta . >> > _________________________________________________ > ?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 diggerrrrr at gmail.com Fri Apr 17 08:42:12 2009 From: diggerrrrr at gmail.com (Veer) Date: Fri Apr 17 08:42:34 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: I think it was 2 to 3 minutes , before i press submit button. Form contained 293 checkbox control with string. Basically it shows the list of dirs from which i have to select appropriate ones for further processing. Veer. On Fri, Apr 17, 2009 at 5:55 PM, Jay McCarthy wrote: > Can you say how long of a delay you had before these problems showed up? > > Jay > > On Fri, Apr 17, 2009 at 3:37 AM, Veer wrote: >> Thanks! , increasing memory threshold to 128MB seems to work. >> >> Veer >> >> On Fri, Apr 17, 2009 at 1:02 PM, Noel Welsh wrote: >>> Three options: >>> >>> Switch to serve/servlet, and specify your own theshold-LRU-manager >>> with a higher memory threshold >>> >>> Write your servlets in the "stateless" web language >>> >>> Write your code to use less memory >>> >>> The problem is thus: you're storing continuations in the server's >>> memory. This memory must be reclaimed eventually. The default >>> continuation manager reclaims memory at a slow rate when memory >>> consumption is less than 64MB, and a very fast rate when that >>> threshold is exceeded. If you see page expired after a short (< 4 >>> hours) delay it means your using more than 64MB. You can either set a >>> higher threshold, serialize continuations to {the client|disk} or use >>> less memory. >>> >>> N. >>> >>> On Fri, Apr 17, 2009 at 8:19 AM, Veer wrote: >>>>> Change the continuation manager. What continuation manager are you using? >>>> >>>> I really don't know ?:) , i just followed the blog example from the manual . >>>> Only thing that is included is ?#lang web-server/insta . >>> >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > From pocmatos at gmail.com Fri Apr 17 08:50:13 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Apr 17 08:50:50 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> Message-ID: <11b141710904170550w5da856f4l952a80b9427b2d46@mail.gmail.com> On Thu, Apr 16, 2009 at 8:27 PM, Shriram Krishnamurthi wrote: > There is a Munich Lisp group, run by our own Marek Kubica. ?There's a > link to it from the schemers.org home page (www.schemers.org). ?So > that would be a good starting point. ?There should also be good > opportunities for functional programmers with a formal methods > background in Munich thanks to the influence of the work that has been > done at TU-M. > Thank you very much. I will look into it. > Not sure about Berlin. > > Shriram > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From spdegabrielle at gmail.com Fri Apr 17 10:02:01 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Fri Apr 17 10:02:24 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> Message-ID: <595b9ab20904170702n271eece7n42cebe36411ef89b@mail.gmail.com> While there is a thread, I'm in London, coming to the end of my contract - suggestions? Cheers, Stephen On Thu, Apr 16, 2009 at 8:58 PM, Paulo J. Matos wrote: > Hi guys, > > This might be relatively off-topic but is certainly the target > community I would like to approach with this question. > > I am finishing my PhD by the end of the year and starting to work in > Jan, 2010. I am moving to Germany [either Munich or Berlin, up to be > decided]. Does anybody know any Scheme-related jobs in any of these > areas (or companies to contact?)? Or maybe Lisp related jobs since > Scheme might be even harder? > > Any other suggestions/comments to someone like me without industrial > experience that just finished a PhD in formal methods and looking for > a job are welcome. > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From neil at neilvandyke.org Fri Apr 17 10:12:53 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Fri Apr 17 10:13:32 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: <595b9ab20904170702n271eece7n42cebe36411ef89b@mail.gmail.com> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <595b9ab20904170702n271eece7n42cebe36411ef89b@mail.gmail.com> Message-ID: <49E88E65.5090002@neilvandyke.org> For anyone knowing of Boston-based Lisp jobs and consulting gigs, these can be sent to the "boston-lisp-announce" email list. http://www.neilvandyke.org/boston-lisp-announce/ The list is a gold mine of talent in CL, Scheme, and other Lisp dialects. I, and probably others, are available for work. (And also, some of the kids working through HtDP should do startups. All we need is one high-profile Web site to be quoted in the trade press saying that they owe their success to Scheme, and we're all set. :) Neil From noelwelsh at gmail.com Fri Apr 17 10:24:49 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Apr 17 10:25:08 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: <49E88E65.5090002@neilvandyke.org> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <595b9ab20904170702n271eece7n42cebe36411ef89b@mail.gmail.com> <49E88E65.5090002@neilvandyke.org> Message-ID: On Fri, Apr 17, 2009 at 3:12 PM, Neil Van Dyke wrote: > (And also, some of the kids working through HtDP should do startups. ?All we > need is one high-profile Web site to be quoted in the trade press saying > that they owe their success to Scheme, and we're all set. :) You should all do startups. Or consultancy. (Non-technical) customers care about results, not language choice. N. From jay.mccarthy at gmail.com Fri Apr 17 11:20:56 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Apr 17 11:21:53 2009 Subject: [plt-scheme] Web Server : page expires on form submission. In-Reply-To: References: Message-ID: I've updated the defaults in SVN Jay On Fri, Apr 17, 2009 at 6:42 AM, Veer wrote: > I think it was 2 to 3 minutes , before i press submit button. > Form contained 293 checkbox control with string. Basically > it shows the list of dirs from which i have to select appropriate ones > for further processing. > > Veer. > > On Fri, Apr 17, 2009 at 5:55 PM, Jay McCarthy wrote: >> Can you say how long of a delay you had before these problems showed up? >> >> Jay >> >> On Fri, Apr 17, 2009 at 3:37 AM, Veer wrote: >>> Thanks! , increasing memory threshold to 128MB seems to work. >>> >>> Veer >>> >>> On Fri, Apr 17, 2009 at 1:02 PM, Noel Welsh wrote: >>>> Three options: >>>> >>>> Switch to serve/servlet, and specify your own theshold-LRU-manager >>>> with a higher memory threshold >>>> >>>> Write your servlets in the "stateless" web language >>>> >>>> Write your code to use less memory >>>> >>>> The problem is thus: you're storing continuations in the server's >>>> memory. This memory must be reclaimed eventually. The default >>>> continuation manager reclaims memory at a slow rate when memory >>>> consumption is less than 64MB, and a very fast rate when that >>>> threshold is exceeded. If you see page expired after a short (< 4 >>>> hours) delay it means your using more than 64MB. You can either set a >>>> higher threshold, serialize continuations to {the client|disk} or use >>>> less memory. >>>> >>>> N. >>>> >>>> On Fri, Apr 17, 2009 at 8:19 AM, Veer wrote: >>>>>> Change the continuation manager. What continuation manager are you using? >>>>> >>>>> I really don't know ?:) , i just followed the blog example from the manual . >>>>> Only thing that is included is ?#lang web-server/insta . >>>> >>> _________________________________________________ >>> ?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 henk at henk.ca Fri Apr 17 11:40:15 2009 From: henk at henk.ca (Henk Boom) Date: Fri Apr 17 11:40:33 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <595b9ab20904170702n271eece7n42cebe36411ef89b@mail.gmail.com> <49E88E65.5090002@neilvandyke.org> Message-ID: 2009/4/17 Noel Welsh : > On Fri, Apr 17, 2009 at 3:12 PM, Neil Van Dyke wrote: > >> (And also, some of the kids working through HtDP should do startups. ?All we >> need is one high-profile Web site to be quoted in the trade press saying >> that they owe their success to Scheme, and we're all set. :) > > You should all do startups. Or consultancy. ?(Non-technical) customers > care about results, not language choice. I'm doing an undergraduate degree which is split 50/50 between Computer Science and Computation Arts (think art with programming). One of the great parts of doing the art projects is that for the most part they don't care about language either, what you do with it is what counts. (to be fair, we had a choice in language in the compiler writing course I took, so I used Scheme, but it's relatively rare) Henk From pocmatos at gmail.com Fri Apr 17 12:10:08 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Fri Apr 17 12:10:45 2009 Subject: [plt-scheme] Struct guard and auto fields Message-ID: <11b141710904170910i5144b51aya508240ce9699f09@mail.gmail.com> HI all, I have defined a guard for a struct which has an auto field. It makes sense that the guard receives all the fields (including the auto ones) but this doesn't seem to happen. (define-struct foo (bar (foobar #:auto)) #:guard (lambda (bar foobar type-name) (values bar foobar))) make-struct-type: guard procedure does not accept 2 arguments (one more than the number constructor arguments): # There is no reference to this in the docs except for: The arguments to guard are the values provided for the structure?s first n fields, followed by the name of the instantiated structure type (which is name, unless a subtype is instantiated). There is no ref. to possible auto fields not being includes in the arguments to guard. I feel this might be a bug in the code, not the docs because I might be interested to have my guard depend on auto fields. Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From mikeegg1 at me.com Fri Apr 17 12:17:50 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Fri Apr 17 12:18:12 2009 Subject: [plt-scheme] plt-scheme data representation/storage in sqlite3? Message-ID: <20090417161750.GB2750@mail.me.com> Morning, In my playing I'm getting close to storing data in sqlite3. I am working with some exact numbers with very large numerators and denominators. When the data is stored in sqlite3, what is the representation? Is the data stored as a fraction in a text column or as something else? (Yes, I realize I could just try that. I just can't at the moment and am curious for the answer.) Mike From mflatt at cs.utah.edu Fri Apr 17 12:20:13 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri Apr 17 12:20:32 2009 Subject: [plt-scheme] Struct guard and auto fields In-Reply-To: <11b141710904170910i5144b51aya508240ce9699f09@mail.gmail.com> References: <11b141710904170910i5144b51aya508240ce9699f09@mail.gmail.com> Message-ID: <20090417162013.7A6976500B2@mail-svr1.cs.utah.edu> At Fri, 17 Apr 2009 16:10:08 +0000, "Paulo J. Matos" wrote: > I have defined a guard for a struct which has an auto field. It makes > sense that the guard receives all the fields (including the auto ones) > but this doesn't seem to happen. > (define-struct foo > (bar > (foobar #:auto)) > #:guard > (lambda (bar foobar type-name) > (values bar foobar))) > > make-struct-type: guard procedure does not accept 2 arguments (one > more than the number constructor arguments): # > > There is no reference to this in the docs except for: > The arguments to guard are the values provided for the structure?s > first n fields, followed by the name of the instantiated structure > type (which is name, unless a subtype is instantiated). > > There is no ref. to possible auto fields not being includes in the > arguments to guard. I feel this might be a bug in the code, not the > docs because I might be interested to have my guard depend on auto > fields. The docs talk about the "provided" values as being the ones provided to the constructor, so they don't include auto fields. I'll try to clarify that in the docs, though. The auto-field value is computed when the structure type is created. Since the guard procedure is computed at the same time, couldn't it just close over the auto-field value? From jay.mccarthy at gmail.com Fri Apr 17 12:21:45 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Apr 17 12:22:07 2009 Subject: [plt-scheme] plt-scheme data representation/storage in sqlite3? In-Reply-To: <20090417161750.GB2750@mail.me.com> References: <20090417161750.GB2750@mail.me.com> Message-ID: I assume you mean with my sqlite planet package. Here's how I bind parameters: (cond [(integer? param) (sqlite3_bind_int64 handle i param)] [(number? param) (sqlite3_bind_double handle i param)] [(string? param) (sqlite3_bind_text handle i param)] [(bytes? param) (sqlite3_bind_blob handle i param)] [else (sqlite3_bind_null handle i)]) As you see, Scheme's arbitrary precision numbers are transformed into sqlite3's doubles. If you need a different encoding, you'll have to implement it manually. Jay On Fri, Apr 17, 2009 at 10:17 AM, Mike Eggleston wrote: > Morning, > > In my playing I'm getting close to storing data in sqlite3. I am working > with some exact numbers with very large numerators and denominators. When > the data is stored in sqlite3, what is the representation? Is the data > stored as a fraction in a text column or as something else? > > (Yes, I realize I could just try that. I just can't at the moment and > am curious for the answer.) > > Mike > _________________________________________________ > ?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 mikeegg1 at me.com Fri Apr 17 12:25:34 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Fri Apr 17 12:25:57 2009 Subject: [plt-scheme] plt-scheme data representation/storage in sqlite3? In-Reply-To: References: <20090417161750.GB2750@mail.me.com> Message-ID: <20090417162534.GE2750@mail.me.com> On Fri, 17 Apr 2009, Jay McCarthy might have said: > I assume you mean with my sqlite planet package. > > Here's how I bind parameters: > > (cond > [(integer? param) > (sqlite3_bind_int64 handle i param)] > [(number? param) > (sqlite3_bind_double handle i param)] > [(string? param) > (sqlite3_bind_text handle i param)] > [(bytes? param) > (sqlite3_bind_blob handle i param)] > [else > (sqlite3_bind_null handle i)]) > > As you see, Scheme's arbitrary precision numbers are transformed into > sqlite3's doubles. If you need a different encoding, you'll have to > implement it manually. > > Jay > > On Fri, Apr 17, 2009 at 10:17 AM, Mike Eggleston wrote: > > Morning, > > > > In my playing I'm getting close to storing data in sqlite3. I am working > > with some exact numbers with very large numerators and denominators. When > > the data is stored in sqlite3, what is the representation? Is the data > > stored as a fraction in a text column or as something else? > > > > (Yes, I realize I could just try that. I just can't at the moment and > > am curious for the answer.) > > > > Mike > > _________________________________________________ > > ?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 I'm concerned (mildly) about having the numbers converted from exact to inexact. Inexact is what I have now with PERL. I'm interested in the exact numbers and the final results of the programs. So, converting to doubles probably won't happen. I'll look at doing my own put and get to text columns. Thanks for then answer Jay, and yes, I'm using your sqlite package. Mike From tprimke at gmail.com Fri Apr 17 09:18:58 2009 From: tprimke at gmail.com (TPJ) Date: Fri Apr 17 12:44:04 2009 Subject: [plt-scheme] Re: hash-has-key? In-Reply-To: References: Message-ID: On 28 Mar, 01:14, Henk Boom wrote: > Hi, I was looking for a way to test whether or not a hash table has a > mapping for a given key. I was surprised not to find anything in the > docs (...) Interesting. I found hash-has-key? in the PLT Reference (http://docs.plt-scheme.org/reference/hashtables.html), but I cannot use it: Welcome to DrScheme, version 4.1.4 [3m]. Language: Module; memory limit: 128 megabytes. > (define a (make-hash)) > (hash-has-key? a 'key) . . reference to undefined identifier: hash-has-key? What's wrong? (I'm new to Scheme and to PLT Scheme.) From jay.mccarthy at gmail.com Fri Apr 17 12:46:14 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Fri Apr 17 12:46:35 2009 Subject: [plt-scheme] Re: hash-has-key? In-Reply-To: References: Message-ID: The online documentation tracks SVN, and that function was added since 4.1.4. The documentation on your computer is accurate for you. (This is demonstrated in the version number in the upper right hand corner.) Jay On Fri, Apr 17, 2009 at 7:18 AM, TPJ wrote: > On 28 Mar, 01:14, Henk Boom wrote: >> Hi, I was looking for a way to test whether or not a hash table has a >> mapping for a given key. I was surprised not to find anything in the >> docs (...) > > Interesting. I found hash-has-key? in the PLT Reference > (http://docs.plt-scheme.org/reference/hashtables.html), but I cannot > use it: > > Welcome to DrScheme, version 4.1.4 [3m]. > Language: Module; memory limit: 128 megabytes. >> (define a (make-hash)) >> (hash-has-key? a 'key) > . . reference to undefined identifier: hash-has-key? > > What's wrong? (I'm new to Scheme and to 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 carl.eastlund at gmail.com Fri Apr 17 12:47:10 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri Apr 17 12:47:35 2009 Subject: [plt-scheme] Re: hash-has-key? In-Reply-To: References: Message-ID: <990e0c030904170947v1793a466s8a35a6822c9f655e@mail.gmail.com> On Fri, Apr 17, 2009 at 9:18 AM, TPJ wrote: > On 28 Mar, 01:14, Henk Boom wrote: >> Hi, I was looking for a way to test whether or not a hash table has a >> mapping for a given key. I was surprised not to find anything in the >> docs (...) > > Interesting. I found hash-has-key? in the PLT Reference > (http://docs.plt-scheme.org/reference/hashtables.html), but I cannot > use it: > > Welcome to DrScheme, version 4.1.4 [3m]. > Language: Module; memory limit: 128 megabytes. >> (define a (make-hash)) >> (hash-has-key? a 'key) > . . reference to undefined identifier: hash-has-key? > > What's wrong? (I'm new to Scheme and to PLT Scheme.) TPJ, The online documentation refers to the latest development version of PLT Scheme. Note that the upper right hand corner of the page you link to says "Version: 4.1.5.4", whereas the program you ran says "version 4.1.4". If you want documentation corresponding to your version of PLT Scheme, open up the Help Desk from the Help menu of your application. On the other hand, if you want the latest version of PLT Scheme corresponding to the online documentation, download it from: http://pre.plt-scheme.org/installers/ -- Carl Eastlund From carl.eastlund at gmail.com Fri Apr 17 12:50:03 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri Apr 17 12:50:25 2009 Subject: [plt-scheme] Re: hash-has-key? In-Reply-To: <990e0c030904170947v1793a466s8a35a6822c9f655e@mail.gmail.com> References: <990e0c030904170947v1793a466s8a35a6822c9f655e@mail.gmail.com> Message-ID: <990e0c030904170950w5cf7e3eekf5e8da9afb46d9bd@mail.gmail.com> On Fri, Apr 17, 2009 at 12:47 PM, Carl Eastlund wrote: > > TPJ, > > The online documentation refers to the latest development version of > PLT Scheme. ?Note that the upper right hand corner of the page you > link to says "Version: 4.1.5.4", whereas the program you ran says > "version 4.1.4". > > If you want documentation corresponding to your version of PLT Scheme, > open up the Help Desk from the Help menu of your application. ?On the > other hand, if you want the latest version of PLT Scheme corresponding > to the online documentation, download it from: > http://pre.plt-scheme.org/installers/ Let me clarify what I meant by "latest" -- in all cases, I meant pre-release, still-under-development software. My recommendation is that you continue to use a released version (4.1.4, or upgrade to 4.1.5), use the local documentation in the Help Desk rather than the online version, and wait for 4.1.6 to be released before using hash-has-key?. I don't believe it has been released yet, and is thus subject to change at any time. -- Carl Eastlund From grettke at acm.org Fri Apr 17 13:06:39 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Apr 17 13:06:57 2009 Subject: [plt-scheme] Uses for PLT: generating DOS batch files Message-ID: <756daca50904171006h2e48ec61n237151ff940dadee@mail.gmail.com> At virtually all of my clients, Windows is the standard platform for everything; the only exception being Java shops where deployment is often on UNIX (but everything else is still on Windows). As such, DOS batch files are the lingua franca for task automation (I don't mean builds here). Yes I know about the alternatives, but despite them DOS is still the standard. People feel good about "signing off" on batch files; they are simple and verbose. Plain old PLT and DrScheme make it very easy to programatically generate batch files (using standard APIs). I've been doing a lot of it for the past few days. Nothing exciting or attractive about it; but it sure beats handwriting scripts any day. From clements at brinckerhoff.org Fri Apr 17 13:12:42 2009 From: clements at brinckerhoff.org (John Clements) Date: Fri Apr 17 13:13:27 2009 Subject: [plt-scheme] schematics takes 5 minutes to planet install? Message-ID: <5D059DD1-E8FA-4811-B32E-DD77B69F8F7F@brinckerhoff.org> On a reasonably modern Linux machine, installing schematics takes five minutes of user time: clements@vogon:~ $ time planet install schematics schemeunit.plt 3 4 ... real 8m53.741s user 5m34.997s sys 1m53.497s Is this expected? John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/e84cc697/smime.bin From carl.eastlund at gmail.com Fri Apr 17 13:26:47 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Fri Apr 17 13:27:06 2009 Subject: [plt-scheme] schematics takes 5 minutes to planet install? In-Reply-To: <5D059DD1-E8FA-4811-B32E-DD77B69F8F7F@brinckerhoff.org> References: <5D059DD1-E8FA-4811-B32E-DD77B69F8F7F@brinckerhoff.org> Message-ID: <990e0c030904171026m6e6c1dd6l2e5ba2c4a49087e@mail.gmail.com> On Fri, Apr 17, 2009 at 1:12 PM, John Clements wrote: > On a reasonably modern Linux machine, installing schematics takes five > minutes of user time: (Installing SchemeUnit, not Schematics. I doubt you are saving the development team to your hard drive.) > clements@vogon:~ $ time planet install schematics schemeunit.plt 3 4 > > ... > > > real ? ?8m53.741s > user ? ?5m34.997s > sys ? ? 1m53.497s > > > Is this expected? Well, you are downloading the software, compiling it, running the Scribble files, indexing the Scribble files, rendering the Scribble files, and re-building your entire Help Desk index to include links to the Scribble files, as well as re-rendering your main Help Desk and search pages. So, it's unfortunate that it takes so long, but installing Planet packages entails a lot of work these days. -- Carl Eastlund From noelwelsh at gmail.com Fri Apr 17 13:49:39 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Apr 17 13:49:58 2009 Subject: [plt-scheme] schematics takes 5 minutes to planet install? In-Reply-To: <990e0c030904171026m6e6c1dd6l2e5ba2c4a49087e@mail.gmail.com> References: <5D059DD1-E8FA-4811-B32E-DD77B69F8F7F@brinckerhoff.org> <990e0c030904171026m6e6c1dd6l2e5ba2c4a49087e@mail.gmail.com> Message-ID: On Fri, Apr 17, 2009 at 6:26 PM, Carl Eastlund wrote: > > (Installing SchemeUnit, not Schematics. ?I doubt you are saving the > development team to your hard drive.) > Pity. I hear the weather in California is pretty good. Like Carl, I think most of the time is taken up by Scribble. That's the price you pay for the awesome documentation. Note that very recent version of PLT actually include SchemeUnit, but I don't recommend using it unless you're developing the core -- coupling your SchemeUnit installation to your PLT installation is asking for trouble if I ever break the API. N. From matthias at ccs.neu.edu Fri Apr 17 15:46:14 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Apr 17 15:49:50 2009 Subject: [plt-scheme] Uses for PLT: generating DOS batch files In-Reply-To: <756daca50904171006h2e48ec61n237151ff940dadee@mail.gmail.com> References: <756daca50904171006h2e48ec61n237151ff940dadee@mail.gmail.com> Message-ID: <470C90A2-4E9E-412B-B492-4326B145A616@ccs.neu.edu> Nice. As you gather more experience, write it up as a two-page experience report and send it to the Scheme workshop. It is supposed to be the home for all Schemers and all things Scheme, and with a reasonable PC chair, it may even implement this policy. -- Matthias On Apr 17, 2009, at 1:06 PM, Grant Rettke wrote: > At virtually all of my clients, Windows is the standard platform for > everything; the only exception being Java shops where deployment is > often on UNIX (but everything else is still on Windows). > > As such, DOS batch files are the lingua franca for task automation (I > don't mean builds here). Yes I know about the alternatives, but > despite them DOS is still the standard. People feel good about > "signing off" on batch files; they are simple and verbose. > > Plain old PLT and DrScheme make it very easy to programatically > generate batch files (using standard APIs). I've been doing a lot of > it for the past few days. > > Nothing exciting or attractive about it; but it sure beats handwriting > scripts any day. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From clements at brinckerhoff.org Fri Apr 17 15:53:35 2009 From: clements at brinckerhoff.org (John Clements) Date: Fri Apr 17 15:54:10 2009 Subject: [plt-scheme] Uses for PLT: generating DOS batch files In-Reply-To: <470C90A2-4E9E-412B-B492-4326B145A616@ccs.neu.edu> References: <756daca50904171006h2e48ec61n237151ff940dadee@mail.gmail.com> <470C90A2-4E9E-412B-B492-4326B145A616@ccs.neu.edu> Message-ID: <14C6F1BA-38DD-4CB5-BF77-A53275A4B080@brinckerhoff.org> On Apr 17, 2009, at 12:46 PM, Matthias Felleisen wrote: > > Nice. As you gather more experience, write it up as a two-page > experience report and send it to the Scheme workshop. > > It is supposed to be the home for all Schemers and all things > Scheme, and with a reasonable PC chair, it may even implement this > policy. The Scheme Workshop PC looks forward to your submission! The deadline is June 5th. All the best, John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/298cb757/smime-0001.bin From plragde at uwaterloo.ca Fri Apr 17 16:03:00 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Fri Apr 17 16:03:37 2009 Subject: [plt-scheme] schematics takes 5 minutes to planet install? In-Reply-To: <990e0c030904171026m6e6c1dd6l2e5ba2c4a49087e@mail.gmail.com> Message-ID: <49E8E074.3040501@uwaterloo.ca> Carl Eastlund wrote: > Installing SchemeUnit, not Schematics. I doubt you are saving the > development team to your hard drive. Is this what you folks meant when you said you were working on serializable continuations? --PR From noelwelsh at gmail.com Fri Apr 17 16:35:38 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Fri Apr 17 16:36:15 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> Message-ID: On Thu, Apr 16, 2009 at 8:58 PM, Paulo J. Matos wrote: > I am finishing my PhD by the end of the year and starting to work in > Jan, 2010. I am moving to Germany [either Munich or Berlin, up to be > decided]. Does anybody know any Scheme-related jobs in any of these > areas (or companies to contact?)? Or maybe Lisp related jobs since > Scheme might be even harder? > > Any other suggestions/comments to someone like me without industrial > experience that just finished a PhD in formal methods and looking for > a job are welcome. Some thoughts: IMHO there are really two Scheme communities: that derived from the Lisp tradition, and that derived from the functional programming tradition. (FP and Lisp were once the same thing, but really no longer are.) I don't really think they have much in common. PLT is more in the FP tradition. Given this, I suggest widening your search a bit to include Haskell, Scala, and Erlang. Any sane employer looking for those (and there are a number) will respect your Scheme skillz. OTOH, cadence.com has advertised for Lisp programmers in the past. They are based in Munich. N. From clements at brinckerhoff.org Fri Apr 17 16:35:31 2009 From: clements at brinckerhoff.org (John Clements) Date: Fri Apr 17 16:36:23 2009 Subject: [plt-scheme] schematics takes 5 minutes to planet install? In-Reply-To: <49E8E074.3040501@uwaterloo.ca> References: <49E8E074.3040501@uwaterloo.ca> Message-ID: On Apr 17, 2009, at 1:03 PM, Prabhakar Ragde wrote: > Carl Eastlund wrote: > >> Installing SchemeUnit, not Schematics. I doubt you are saving the >> development team to your hard drive. > > Is this what you folks meant when you said you were working on > serializable continuations? --PR Sure... here, let me reinstate that continuation I saved back in 2009 ... There! Is it 2009 for you again? John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/1f3eb38b/smime.bin From neil at neilvandyke.org Fri Apr 17 16:49:16 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Fri Apr 17 16:49:55 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> Message-ID: <49E8EB4C.4060800@neilvandyke.org> BTW, Scala is getting mainstream interest at the moment, due to Twitter ditching teen heartthrob Ruby for Scala, for backend scalability reasons. Noel Welsh wrote at 04/17/2009 04:35 PM: > Given this, I suggest widening your search a bit to > include Haskell, Scala, and Erlang. Any sane employer looking for > those (and there are a number) will respect your Scheme skillz. > -- http://www.neilvandyke.org/ From plragde at uwaterloo.ca Fri Apr 17 17:04:22 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Fri Apr 17 17:04:52 2009 Subject: [plt-scheme] schematics takes 5 minutes to planet install? In-Reply-To: References: <49E8E074.3040501@uwaterloo.ca> Message-ID: <49E8EED6.1070704@uwaterloo.ca> John Clements wrote: > Sure... here, let me reinstate that continuation I saved back in 2009 > ... > There! Is it 2009 for you again? You can't fool me. I mutated my kitchen counter in 2011 when I dropped a cleaver, and the mark is still there. --PR From jao at gnu.org Fri Apr 17 16:48:48 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Fri Apr 17 17:08:33 2009 Subject: [plt-scheme] procedure instrospection Message-ID: <87vdp3j9an.fsf@mithrandir.homeunix.net> hi, i haven't been able to find in the documentation procedures to get information about defined procedures or macros, other than arity. i'd be interested in getting, given a (exported) procedure/macro's name and module: - argument names (as given in its definition's formals) (or, alternatively, the proc source code, from which i can get that). - filename and line number of definition (some time ago i found something similar, but cannot anymore). - callees and callers of the given procedure (given the former i could compute the later, i guess). is there a way of getting any of the metadata above from the MzScheme REPL? thanks! jao -- Come to think of it, there are already a million monkeys on a million typewriters, and Usenet is NOTHING like Shakespeare. - Blair Houghton. From dtnoizerz58 at yandex.ru Fri Apr 17 17:45:57 2009 From: dtnoizerz58 at yandex.ru (DTNOIZR) Date: Fri Apr 17 17:56:36 2009 Subject: [plt-scheme] continuation barrier Message-ID: <428791240004757@webmail89.yandex.ru> how to remove continuation barrier from sandbox? using sandboxing with web - using send/suspend - using continuations ... send/suspend dont work in sandbox reading manual but I'm slow I have read that sandbox have its barrier - do not allow continuation jumps From ryanc at ccs.neu.edu Fri Apr 17 18:35:44 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Fri Apr 17 18:36:09 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <87vdp3j9an.fsf@mithrandir.homeunix.net> References: <87vdp3j9an.fsf@mithrandir.homeunix.net> Message-ID: <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> On Apr 17, 2009, at 4:48 PM, Jose A. Ortega Ruiz wrote: > hi, > > i haven't been able to find in the documentation procedures to get > information about defined procedures or macros, other than arity. > i'd be > interested in getting, given a (exported) procedure/macro's name and > module: > > - argument names (as given in its definition's formals) (or, > alternatively, the proc source code, from which i can get that). > - filename and line number of definition (some time ago i found > something similar, but cannot anymore). > - callees and callers of the given procedure (given the former i could > compute the later, i guess). > > is there a way of getting any of the metadata above from the MzScheme > REPL? For the most part, no. That information isn't attached to procedures. The easiest question is "What file is a name defined in?" ;; definition-source : identifier -> (U symbol path) ;; Returns a symbol or path for the module that contains ;; the definition for a given name. (define (definition-source id) (let ([binding (identifier-binding id)]) (and (list? binding) (resolved-module-path-name (module-path-index-resolve (car binding)))))) For example: (definition-source #'map) => # The map procedure is defined in the file at that path, on my system anyway. (definition-source #'+) => #%kernel The + procedure is defined in the built-in kernel module (it has no Scheme source file). -- Since you can get the module path where a name is defined, you can read the module in from the file and try to search it for the definition. Ryan From chust at web.de Fri Apr 17 19:44:01 2009 From: chust at web.de (Thomas Chust) Date: Fri Apr 17 19:44:24 2009 Subject: [plt-scheme] continuation barrier In-Reply-To: <428791240004757@webmail89.yandex.ru> References: <428791240004757@webmail89.yandex.ru> Message-ID: <1c1a33bc0904171644j7f568e09o2c6f195a4c24ae03@mail.gmail.com> 2009-04-17 DTNOIZR : > [...] > how to remove continuation barrier from sandbox? > using sandboxing with web - using send/suspend - using continuations ... > send/suspend dont work in sandbox > [...] Hello, I don't think it is possible to remove a continuation barrier -- if that was possible it would defy the security aspect of this feature. However, a quick experiment with scheme/sandbox makes me doubt that sandbox evaluators really automatically install continuation barriers around the code they run: (require scheme/sandbox) (define my-eval (parameterize ([sandbox-output (current-output-port)]) (make-evaluator 'scheme/base))) ((my-eval '(begin (define resume #f) (define ((set-resume!/value v) k) (set! resume k) v) (display (call/cc (set-resume!/value 1))) (newline) resume)) 2) This code runs without problems in PLT Scheme 4.1.5, thus it is apparently possible to invoke a continuation created inside the sandbox outside of it. Maybe a more detailed description of your problem would shed some light on the situation... cu, Thomas -- When C++ is your hammer, every problem looks like your thumb. From kevin at hypotheticalabs.com Fri Apr 17 21:14:06 2009 From: kevin at hypotheticalabs.com (Kevin A. Smith) Date: Fri Apr 17 21:19:49 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: <49E8EB4C.4060800@neilvandyke.org> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <49E8EB4C.4060800@neilvandyke.org> Message-ID: FWIW, Erlang is also picking up steam. I'm in the States and I'm seeing a pick up in interest around Erlang. Of course, I might be a bit biased since I do Erlang training and consulting ;-) There's even a Lisp which runs on the Erlang VM. Nothing nearly as good as PLT Scheme but at least it's a Lisp :) --Kevin On Apr 17, 2009, at 4:49 PM, Neil Van Dyke wrote: > BTW, Scala is getting mainstream interest at the moment, due to > Twitter ditching teen heartthrob Ruby for Scala, for backend > scalability reasons. > > Noel Welsh wrote at 04/17/2009 04:35 PM: >> Given this, I suggest widening your search a bit to >> include Haskell, Scala, and Erlang. Any sane employer looking for >> those (and there are a number) will respect your Scheme skillz. >> > > -- > http://www.neilvandyke.org/ > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yinso.chen at gmail.com Fri Apr 17 21:33:12 2009 From: yinso.chen at gmail.com (YC) Date: Fri Apr 17 21:33:31 2009 Subject: [plt-scheme] how to determine where a thread hangs? Message-ID: <779bf2730904171833n4a0d7431y6ad43bde271f189f@mail.gmail.com> Hi - what are some approaches to determine where in code the thread execution (or multiple threads) hangs? The issue is quite intermittent (but definitely there), so I am having a hard time to nail it down, and want to see if there is a way to determine when a procedure do not return (or blocked). Any thoughts are very appreciated. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/da717fb1/attachment.html From mflatt at cs.utah.edu Fri Apr 17 22:03:15 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Fri Apr 17 22:03:40 2009 Subject: [plt-scheme] how to determine where a thread hangs? In-Reply-To: <779bf2730904171833n4a0d7431y6ad43bde271f189f@mail.gmail.com> References: <779bf2730904171833n4a0d7431y6ad43bde271f189f@mail.gmail.com> Message-ID: <20090418020317.AC2966500AF@mail-svr1.cs.utah.edu> At Fri, 17 Apr 2009 18:33:12 -0700, YC wrote: > what are some approaches to determine where in code the thread execution (or > multiple threads) hangs? Here's a function that creates a thread to watch a different thread. Every `delay' seconds, it grabs a stack trace of the thread `t': (define (watch-thread t delay) ;; create a new thread to report snapshots of t: (thread (lambda () (let loop () (sleep delay) (let ([trace (continuation-mark-set->context (continuation-marks t))]) (unless (null? trace) (for-each print-location trace) (newline))) (loop))))) Maybe something like that would help you. Here's a basic print-location function to use with watch-thread: (define (print-location i) (let ([id (car i)] [src (cdr i)]) (cond [src (printf "~a:~a~a\n" (srcloc-source src) (if (srcloc-line src) (format "~a:~a" (srcloc-line src) (srcloc-column src)) (srcloc-position src)) (if id (format ": ~a" id) ""))] [id (printf "~a\n" id)] [else (printf "???\n")]))) For example, the following shows where all the time goes when you load the implementation of the main PLT Scheme reference: (let ([watcher-t (watch-thread (current-thread) 0.1)]) (dynamic-require '(lib "scribblings/reference/reference.scrbl") #f) (kill-thread watcher-t)) This is a noisy way to monitor a thread, though. Instead of dumping each stack trace, you might just save it to check later when the thread seems to be stuck. The gprof-like profiler that Eli mentioned on plt-dev works in a similar way: http://list.cs.brown.edu/pipermail/plt-dev/2009-April/000543.html From m.douglas.williams at gmail.com Fri Apr 17 23:04:30 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Apr 17 23:04:49 2009 Subject: [plt-scheme] Class Contracts Message-ID: Is there a good example of a module that exports a class with an appropriate contract? Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/8ff2fb0c/attachment.htm From matthias at ccs.neu.edu Fri Apr 17 23:06:07 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Fri Apr 17 23:07:32 2009 Subject: [plt-scheme] Class Contracts In-Reply-To: References: Message-ID: <5FDC1416-EC58-4C53-A2E5-A460224BC574@ccs.neu.edu> Sadly classes don't have contracts .. yet. Stevie is working on them. You can slap contracts on objects though is that helps -- Matthias On Apr 17, 2009, at 11:04 PM, Doug Williams wrote: > Is there a good example of a module that exports a class with an > appropriate contract? > > Doug > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From m.douglas.williams at gmail.com Fri Apr 17 23:12:20 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Fri Apr 17 23:12:42 2009 Subject: [plt-scheme] Class Contracts In-Reply-To: <5FDC1416-EC58-4C53-A2E5-A460224BC574@ccs.neu.edu> References: <5FDC1416-EC58-4C53-A2E5-A460224BC574@ccs.neu.edu> Message-ID: That would explain the lack of examples :). I tried object-contract and found that - as you said - it applies to the instances themselves. I'd love to try class contracts out when they're at that point. On Fri, Apr 17, 2009 at 9:06 PM, Matthias Felleisen wrote: > > Sadly classes don't have contracts .. yet. Stevie is working on them. > > You can slap contracts on objects though is that helps -- Matthias > > > > On Apr 17, 2009, at 11:04 PM, Doug Williams wrote: > > Is there a good example of a module that exports a class with an >> appropriate contract? >> >> Doug >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/5218e576/attachment.htm From grettke at acm.org Fri Apr 17 23:44:17 2009 From: grettke at acm.org (Grant Rettke) Date: Fri Apr 17 23:44:35 2009 Subject: [plt-scheme] Class Contracts In-Reply-To: <5FDC1416-EC58-4C53-A2E5-A460224BC574@ccs.neu.edu> References: <5FDC1416-EC58-4C53-A2E5-A460224BC574@ccs.neu.edu> Message-ID: <756daca50904172044q23ae1d92wa0ebe8c6ffe1594c@mail.gmail.com> On Fri, Apr 17, 2009 at 10:06 PM, Matthias Felleisen wrote: > > Sadly classes don't have contracts .. yet. Stevie is working on them. I'm counting the minutes... From yinso.chen at gmail.com Sat Apr 18 01:33:02 2009 From: yinso.chen at gmail.com (YC) Date: Sat Apr 18 01:33:26 2009 Subject: [plt-scheme] how to determine where a thread hangs? In-Reply-To: <20090418020317.AC2966500AF@mail-svr1.cs.utah.edu> References: <779bf2730904171833n4a0d7431y6ad43bde271f189f@mail.gmail.com> <20090418020317.AC2966500AF@mail-svr1.cs.utah.edu> Message-ID: <779bf2730904172233x4ff5a9fcg1c6318021e06ebaf@mail.gmail.com> Thanks Matthew - very cool idea. I'll try to apply it to my code base and see how it works. Thanks, yc On Fri, Apr 17, 2009 at 7:03 PM, Matthew Flatt wrote: > At Fri, 17 Apr 2009 18:33:12 -0700, YC wrote: > > what are some approaches to determine where in code the thread execution > (or > > multiple threads) hangs? > > Here's a function that creates a thread to watch a different thread. > Every `delay' seconds, it grabs a stack trace of the thread `t': > > (define (watch-thread t delay) > ;; create a new thread to report snapshots of t: > (thread (lambda () > (let loop () > (sleep delay) > (let ([trace (continuation-mark-set->context > (continuation-marks t))]) > (unless (null? trace) > (for-each print-location trace) > (newline))) > (loop))))) > > Maybe something like that would help you. > > Here's a basic print-location function to use with watch-thread: > > (define (print-location i) > (let ([id (car i)] > [src (cdr i)]) > (cond > [src (printf "~a:~a~a\n" > (srcloc-source src) > (if (srcloc-line src) > (format "~a:~a" > (srcloc-line src) > (srcloc-column src)) > (srcloc-position src)) > (if id > (format ": ~a" id) > ""))] > [id (printf "~a\n" id)] > [else (printf "???\n")]))) > > For example, the following shows where all the time goes when you load > the implementation of the main PLT Scheme reference: > > (let ([watcher-t (watch-thread (current-thread) 0.1)]) > (dynamic-require '(lib "scribblings/reference/reference.scrbl") #f) > (kill-thread watcher-t)) > > This is a noisy way to monitor a thread, though. Instead of dumping each > stack trace, you might just save it to check later when the thread > seems to be stuck. > > The gprof-like profiler that Eli mentioned on plt-dev works in a > similar way: > > http://list.cs.brown.edu/pipermail/plt-dev/2009-April/000543.html > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090417/ca77dbdc/attachment-0001.html From jao at gnu.org Sat Apr 18 02:14:06 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Sat Apr 18 02:14:28 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> (Ryan Culpepper's message of "Fri, 17 Apr 2009 18:35:44 -0400") References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> Message-ID: <87myaejxox.fsf@mithrandir.homeunix.net> Hi Ryan, Ryan Culpepper writes: [...] > > For the most part, no. That information isn't attached to procedures. > > The easiest question is "What file is a name defined in?" > [...] > Since you can get the module path where a name is defined, you can > read the module in from the file and try to search it for the > definition. i see. that's useful, thanks. i was wondering whether it'd be possible to somehow hook into the module evaluation process to collect metadata while the module is read (or evaluated/expanded), specially for the case of formals names. i'm thinking of something simple, and not necessarily 100% accurate--a hash table maintained separately, say, recording metadata computed during evaluation. or, as you suggest, i could also read the module source as data, and parse it to obtain/cache the information i want (although that sounds a bit brittle and more inaccurate, since it relies on the program's text instead of syntax data)... i'm guessing that plt already provides procedures to help in the task (for instance, ports remembering line and columns): any advice on what would be the best way to accomplish that? i'm not sure if i'm making any sense at all, but in case i am, this could perhaps grow into some sort of introspection extension to plt proper, and i'd be willing to help with real code. just an idea, in case you (the plt team) think that improving introspection is a worthy goal. thanks! jao From dtnoizerz58 at yandex.ru Sat Apr 18 02:15:28 2009 From: dtnoizerz58 at yandex.ru (DTNOIZR) Date: Sat Apr 18 02:15:47 2009 Subject: [plt-scheme] continuation barrier In-Reply-To: <1c1a33bc0904171644j7f568e09o2c6f195a4c24ae03@mail.gmail.com> References: <428791240004757@webmail89.yandex.ru> <1c1a33bc0904171644j7f568e09o2c6f195a4c24ae03@mail.gmail.com> Message-ID: <77021240035328@webmail65.yandex.ru> > This code runs without problems in PLT Scheme 4.1.5 I use 4.1.4. because of 4.1.5. have some errors ... i wanna create web scheme interpreter every user have its own sandbox with its own tweaks (define make-personal-evaluator (lambda (e-mail) ;;functions, allowed for user (e-mail is user) (define allowed (get-allowed-functions-list e-mail)) ;;------------------------------ ;;make personal module for user ;;this module consist of allowed functions ;; '(module m ...) (define m `(module m scheme (require ;(only-in "livecoding/all.ss" ,@allowed) ;;all.ss - all functions that may be allowed ;;now temporary without restrictions, just all.ss "livecoding/all.ss"))) ;;------------------------------ ;;some rules for evaluator ;;now it's simple ;;can I remove continuation barrier here ? (sandbox-security-guard (current-security-guard)) (sandbox-make-code-inspector (let ([cci (current-code-inspector)]) (lambda () cci))) ;;??????? ???????????? evaluator (make-module-evaluator m))) then, using send/suspend inside and outside sandboxes use sandboxing to create some parts of web-application wanna create web-engine that can be developed by livecoding in its engine 18.04.09, 03:44, "Thomas Chust" : > 2009-04-17 DTNOIZR : > > [...] > > how to remove continuation barrier from sandbox? > > using sandboxing with web - using send/suspend - using continuations ... > > send/suspend dont work in sandbox > > [...] > Hello, > I don't think it is possible to remove a continuation barrier -- if > that was possible it would defy the security aspect of this feature. > However, a quick experiment with scheme/sandbox makes me doubt that > sandbox evaluators really automatically install continuation barriers > around the code they run: > (require > scheme/sandbox) > (define my-eval > (parameterize ([sandbox-output (current-output-port)]) > (make-evaluator 'scheme/base))) > ((my-eval '(begin > (define resume > #f) > (define ((set-resume!/value v) k) > (set! resume k) v) > (display (call/cc (set-resume!/value 1))) > (newline) > resume)) > 2) > This code runs without problems in PLT Scheme 4.1.5, thus it is > apparently possible to invoke a continuation created inside the > sandbox outside of it. > Maybe a more detailed description of your problem would shed some > light on the situation... > cu, > Thomas > -- > When C++ is your hammer, every problem looks like your thumb. From eli at barzilay.org Sat Apr 18 02:54:26 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Apr 18 02:55:09 2009 Subject: [plt-scheme] continuation barrier In-Reply-To: <77021240035328@webmail65.yandex.ru> References: <428791240004757@webmail89.yandex.ru> <1c1a33bc0904171644j7f568e09o2c6f195a4c24ae03@mail.gmail.com> <77021240035328@webmail65.yandex.ru> Message-ID: <18921.31010.137564.566951@winooski.ccs.neu.edu> On Apr 18, DTNOIZR wrote: > > This code runs without problems in PLT Scheme 4.1.5 > I use 4.1.4. because of 4.1.5. have some errors ... > > i wanna create web scheme interpreter > every user have its own sandbox with its own tweaks So you wouldn't want the sandboxed code to be able to interfere with your own server -- which is why its environment is isolated. Below is a sample quick web-server based evaluator that I once wrote -- if you try it, you'll see that capturing continuations and calling them is fine as long as it's user code that calls its own continuations. If you want sandboxed code to be part of the web server, then you should probably write some wrapper that will call a function inside the sandbox with the query, and display the result it returned. This way the continuations that are captured inside the sandbox are kept private, and no continuation barriers get in your way. ------------------------------------------------------------------------------- #lang scheme (require scheme/sandbox web-server/http/bindings web-server/servlet-env) (define e (parameterize ([sandbox-output 'string] [sandbox-error-output current-output-port]) (make-module-evaluator '(module foo scheme/base)))) (define (show-values . vs) `(span () ,@(apply append (map (lambda (v) (list "-> " (format "~s" v) "\n")) (filter (lambda (x) (not (void? x))) vs))))) (define (show-input str) `(span ([style "font-weight: bolder;"]) ">" nbsp ,str "\n")) (define (show-output str) `(span ([style "font-style: italic;"]) ,str ,(if (regexp-match? #rx"[^\n]$" str) "\n" ""))) (define (show-exception e) `(span ([style "font-style: italic; font-weight: bolder;"]) (span ([style "color: #a22; text-decoration: underline;"]) "error") ": " ,(if (exn? e) (exn-message e) (format "~s" e)))) (define (serve req) (let* ([inp (extract-bindings 'expr (request-bindings req))] [inp (and (pair? inp) (car inp))] [res (if inp (with-handlers ([void show-exception]) (call-with-values (lambda () (e inp)) show-values)) (banner))] [out (if inp (show-output (get-output e)) "")] [inp (if inp (show-input inp) "")]) `(html (body ([style "font-family: Arial Black, arial, sans-serif;"]) (pre ,inp ,out ,res) (form ([action "eval.ss"] [method "post"]) (tt ([style "font-weight: bolder;"]) ">" nbsp) (input ([type "text"] [name "expr"] [border "0"])) (input ([type "submit"]))))))) (serve/servlet serve #:port 8080 #:listen-ip #f #:command-line? #t #:servlet-path "/" #:servlet-regexp #rx"") ------------------------------------------------------------------------------- -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Sat Apr 18 02:54:28 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Apr 18 02:55:15 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <87myaejxox.fsf@mithrandir.homeunix.net> References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> Message-ID: <18921.31012.311391.949582@winooski.ccs.neu.edu> On Apr 18, Jose A. Ortega Ruiz wrote: > > i see. that's useful, thanks. i was wondering whether it'd be > possible to somehow hook into the module evaluation process to > collect metadata while the module is read (or evaluated/expanded), Some of the information that you originally mentioned is only collectible while (or after) the code is running, for example, the callers and callees. See the code in Matthew's recent post or in the new `profile' collection on how to get such data. (But this is will not be accurate at all...) > specially for the case of formals names. i'm thinking of something > simple, and not necessarily 100% accurate--a hash table maintained > separately, say, recording metadata computed during evaluation. The real way to do that is if there was a way at the core to make procedures somehow remember their arguments. It's not difficult to add a `lambda' form that does that, but it won't help with existing code. > or, as you suggest, i could also read the module source as data, and > parse it to obtain/cache the information i want (although that > sounds a bit brittle and more inaccurate, since it relies on the > program's text instead of syntax data)... i'm guessing that plt > already provides procedures to help in the task (for instance, ports > remembering line and columns): any advice on what would be the best > way to accomplish that? You can get pretty accurate with that -- for example, reading the module as syntax (using `read-syntax') and expanding it will catch any macros that expanded into function definitions. But it will still be a problem to get the argument names of a definition like (define foo (let (...) (lambda (x y z) ...))) and it won't help at all with: (define blah (compose foo bar)) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jao at gnu.org Sat Apr 18 03:33:27 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Sat Apr 18 03:40:33 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <18921.31012.311391.949582@winooski.ccs.neu.edu> (Eli Barzilay's message of "Sat, 18 Apr 2009 02:54:28 -0400") References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> <18921.31012.311391.949582@winooski.ccs.neu.edu> Message-ID: <87iql2ju0o.fsf@mithrandir.homeunix.net> Eli Barzilay writes: > On Apr 18, Jose A. Ortega Ruiz wrote: >> >> i see. that's useful, thanks. i was wondering whether it'd be >> possible to somehow hook into the module evaluation process to >> collect metadata while the module is read (or evaluated/expanded), > > Some of the information that you originally mentioned is only > collectible while (or after) the code is running, for example, the > callers and callees. See the code in Matthew's recent post or in the > new `profile' collection on how to get such data. (But this is will > not be accurate at all...) yes, i understand that callers/callees is hairy, and for that reason it's low priority in my list. i'll take a look at Matthew's profile, though. thanks for the pointer. > > >> specially for the case of formals names. i'm thinking of something >> simple, and not necessarily 100% accurate--a hash table maintained >> separately, say, recording metadata computed during evaluation. > > The real way to do that is if there was a way at the core to make > procedures somehow remember their arguments. It's not difficult to > add a `lambda' form that does that, but it won't help with existing > code. given that it doesn't seem difficult to accomplish, any chance that it could be added to a future relase? for instance, it'd be very nice to have a 'status bar' in DrScheme showing this information (i'll be showing it in an emacs mode i'm working on). >> or, as you suggest, i could also read the module source as data, and >> parse it to obtain/cache the information i want (although that >> sounds a bit brittle and more inaccurate, since it relies on the >> program's text instead of syntax data)... i'm guessing that plt >> already provides procedures to help in the task (for instance, ports >> remembering line and columns): any advice on what would be the best >> way to accomplish that? > > You can get pretty accurate with that -- for example, reading the > module as syntax (using `read-syntax') and expanding it will catch any > macros that expanded into function definitions. excellent. i'll try my hand at that. > But it will still be a problem to get the argument names of a > definition like > > (define foo (let (...) (lambda (x y z) ...))) > > and it won't help at all with: > > (define blah (compose foo bar)) right. but my guess is that those case are not that common, and for them i can fall back to displaying an argument list derived from arity information (is that still available for them?) with dummy arg names. thanks! jao From eli at barzilay.org Sat Apr 18 03:39:45 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Apr 18 03:40:39 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <87iql2ju0o.fsf@mithrandir.homeunix.net> References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> <18921.31012.311391.949582@winooski.ccs.neu.edu> <87iql2ju0o.fsf@mithrandir.homeunix.net> Message-ID: <18921.33729.745456.393820@winooski.ccs.neu.edu> On Apr 18, Jose A. Ortega Ruiz wrote: > Eli Barzilay writes: > > > On Apr 18, Jose A. Ortega Ruiz wrote: > >> specially for the case of formals names. i'm thinking of > >> something simple, and not necessarily 100% accurate--a hash table > >> maintained separately, say, recording metadata computed during > >> evaluation. > > > > The real way to do that is if there was a way at the core to make > > procedures somehow remember their arguments. It's not difficult > > to add a `lambda' form that does that, but it won't help with > > existing code. > > given that it doesn't seem difficult to accomplish, any chance that > it could be added to a future relase? for instance, it'd be very > nice to have a 'status bar' in DrScheme showing this information > (i'll be showing it in an emacs mode i'm working on). I'm not sure... It would need to be some "proper" solution for it to be useful enough to be added. For example, such an emacs facility would be very helpful (and in drscheme too, of course), but it should also deal with macros. And macros should not be dismissed into "hard cases that are left with no solution for now" -- they are much more common than you'd think... For example, contracted functions are actually macros. > right. but my guess is that those case are not that common, and for > them i can fall back to displaying an argument list derived from > arity information (is that still available for them?) with dummy arg > names. Yes, the arity list is still available. In fact the mechanism that keeps track of the arity is the best place to add a facility like you want, but it's not hackable since it's in the core... But it does point at yet another problem -- what are the argument names you'd expect for this: (define foo (case-lambda [(x) "stuff"] [(a b) "other stuff"])) ? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jao at gnu.org Sat Apr 18 03:59:41 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Sat Apr 18 04:00:07 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <18921.33729.745456.393820@winooski.ccs.neu.edu> (Eli Barzilay's message of "Sat, 18 Apr 2009 03:39:45 -0400") References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> <18921.31012.311391.949582@winooski.ccs.neu.edu> <87iql2ju0o.fsf@mithrandir.homeunix.net> <18921.33729.745456.393820@winooski.ccs.neu.edu> Message-ID: <87eivqjssy.fsf@mithrandir.homeunix.net> Eli Barzilay writes: >> given that it doesn't seem difficult to accomplish, any chance that >> it could be added to a future relase? for instance, it'd be very >> nice to have a 'status bar' in DrScheme showing this information >> (i'll be showing it in an emacs mode i'm working on). > > I'm not sure... It would need to be some "proper" solution for it to > be useful enough to be added. For example, such an emacs facility > would be very helpful (and in drscheme too, of course), but it should > also deal with macros. And macros should not be dismissed into "hard > cases that are left with no solution for now" -- they are much more > common than you'd think... For example, contracted functions are > actually macros. > i totally agree with you that macros should be supported too. i'll do my best with manually parsing the results of reading the module as syntax to provide partial support for them. i'm sure there are lots of difficulties and corner cases i cannot even imagine now, but i'll try to deal with them as i encounter them. i'm guessing that some things will be more easily dealt with before macro expansion: for instance, displaying information about contracted functions (seems that the relevant info is already in the source forms before expansion). imho, these difficulties are yet another reason to implement this functionality natively in the core :) >> right. but my guess is that those case are not that common, and for >> them i can fall back to displaying an argument list derived from >> arity information (is that still available for them?) with dummy arg >> names. > > Yes, the arity list is still available. In fact the mechanism that > keeps track of the arity is the best place to add a facility like you > want, but it's not hackable since it's in the core... (providing ways to hook into that mechanism from outside, so that i can implement the facility i want, would perhaps be an option in case you don't think implementing it in the core is going to happen.) > But it does point at yet another problem -- what are the argument > names you'd expect for this: > > (define foo > (case-lambda [(x) "stuff"] > [(a b) "other stuff"])) > > ? (foo x #:optional y) (foo x [y]) or something similar (i'm using the first form in my emacs thing for other schemes). thanks! jao From eli at barzilay.org Sat Apr 18 04:19:45 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Apr 18 04:20:20 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <87eivqjssy.fsf@mithrandir.homeunix.net> References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> <18921.31012.311391.949582@winooski.ccs.neu.edu> <87iql2ju0o.fsf@mithrandir.homeunix.net> <18921.33729.745456.393820@winooski.ccs.neu.edu> <87eivqjssy.fsf@mithrandir.homeunix.net> Message-ID: <18921.36129.458545.449985@winooski.ccs.neu.edu> On Apr 18, Jose A. Ortega Ruiz wrote: > Eli Barzilay writes: > > > But it does point at yet another problem -- what are the argument > > names you'd expect for this: > > > > (define foo > > (case-lambda [(x) "stuff"] > > [(a b) "other stuff"])) > > > > ? > > (foo x #:optional y) > (foo x [y]) > > or something similar (i'm using the first form in my emacs thing for > other schemes). But the name for the "optional" in the above is `b'... I've put "optional" in quotes since it doesn't have to be an optional argument, it can be anything, and can have behavior that is not related to the other cases in the `case-lambda' form (that's why I used different strings in the above). The resulting arities can also be arbitrary, for example: (case-lambda [(x) 1] [(a b c) 2] [(i j k l m) 3]) has an arity list of (1 3 5), which cannot be described with such an `#:optional'. Here's another random example from the texpict collection: (define inset/clip (case-lambda [(p l t r b) ...] [(p h v) (inset/clip p h v h v)] [(p a) (inset/clip p a a a a)])) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jao at gnu.org Sat Apr 18 04:48:37 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Sat Apr 18 04:48:59 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <18921.36129.458545.449985@winooski.ccs.neu.edu> (Eli Barzilay's message of "Sat, 18 Apr 2009 04:19:45 -0400") References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> <18921.31012.311391.949582@winooski.ccs.neu.edu> <87iql2ju0o.fsf@mithrandir.homeunix.net> <18921.33729.745456.393820@winooski.ccs.neu.edu> <87eivqjssy.fsf@mithrandir.homeunix.net> <18921.36129.458545.449985@winooski.ccs.neu.edu> Message-ID: <87ab6ejqje.fsf@mithrandir.homeunix.net> Eli Barzilay writes: [...] > > But the name for the "optional" in the above is `b'... I've put > "optional" in quotes since it doesn't have to be an optional argument, > it can be anything, and can have behavior that is not related to the > other cases in the `case-lambda' form (that's why I used different > strings in the above). The resulting arities can also be arbitrary, > for example: > > (case-lambda [(x) 1] > [(a b c) 2] > [(i j k l m) 3]) > > has an arity list of (1 3 5), which cannot be described with such an > `#:optional'. OK, i see your point now. what about something like: (foo [x] [a b c] [i j k l m]) or (foo [(x) (a b c) (i j k l m)]) ? > Here's another random example from the texpict collection: > > (define inset/clip > (case-lambda > [(p l t r b) ...] > [(p h v) (inset/clip p h v h v)] > [(p a) (inset/clip p a a a a)])) one could even try to be smart and share common prefixes: (insert/clip p [l t r b] [h v] [a]) does that make sense? From geoff at knauth.org Sat Apr 18 06:54:55 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Sat Apr 18 06:55:15 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <49E8EB4C.4060800@neilvandyke.org> Message-ID: On Apr 17, 2009, at 21:14, Kevin A. Smith wrote: > FWIW, Erlang is also picking up steam. I'm in the States and I'm > seeing a pick up in interest around Erlang. Of course, I might be a > bit biased since I do Erlang training and consulting ;-) Also, Amazon uses Erlang. From pocmatos at gmail.com Sat Apr 18 08:00:14 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Apr 18 08:00:57 2009 Subject: [plt-scheme] Struct guard and auto fields In-Reply-To: <20090417162013.7A6976500B2@mail-svr1.cs.utah.edu> References: <11b141710904170910i5144b51aya508240ce9699f09@mail.gmail.com> <20090417162013.7A6976500B2@mail-svr1.cs.utah.edu> Message-ID: <11b141710904180500x54dc3cdel3d8ce5e458921d74@mail.gmail.com> On Fri, Apr 17, 2009 at 4:20 PM, Matthew Flatt wrote: > At Fri, 17 Apr 2009 16:10:08 +0000, "Paulo J. Matos" wrote: >> I have defined a guard for a struct which has an auto field. It makes >> sense that the guard receives all the fields (including the auto ones) >> but this doesn't seem to happen. >> (define-struct foo >> ? (bar >> ? ?(foobar #:auto)) >> ? #:guard >> ? (lambda (bar foobar type-name) >> ? ? (values bar foobar))) >> >> make-struct-type: guard procedure does not accept 2 arguments (one >> more than the number constructor arguments): # >> >> There is no reference to this in the docs except for: >> The arguments to guard are the values provided for the structure?s >> first n fields, followed by the name of the instantiated structure >> type (which is name, unless a subtype is instantiated). >> >> There is no ref. to possible auto fields not being includes in the >> arguments to guard. I feel this might be a bug in the code, not the >> docs because I might be interested to have my guard depend on auto >> fields. > > The docs talk about the "provided" values as being the ones provided to > the constructor, so they don't include auto fields. I'll try to clarify > that in the docs, though. > You are right. My idea at the time was that the auto field would become an optional argument of the constructor... but it seems I was wrong. What I need is a wrapper around the constructor then to make a field optional. > The auto-field value is computed when the structure type is created. > Since the guard procedure is computed at the same time, couldn't it > just close over the auto-field value? > Now I understand the decision of not including the auto-value in the guard. :) Thanks! > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Sat Apr 18 08:01:36 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Sat Apr 18 08:02:42 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <49E8EB4C.4060800@neilvandyke.org> Message-ID: <11b141710904180501o4b6705d4ncdce44773e01deed@mail.gmail.com> On Sat, Apr 18, 2009 at 10:54 AM, Geoffrey S. Knauth wrote: > On Apr 17, 2009, at 21:14, Kevin A. Smith wrote: >> >> FWIW, Erlang is also picking up steam. I'm in the States and I'm seeing a >> pick up in interest around Erlang. Of course, I might be a bit biased since >> I do Erlang training and consulting ;-) > > Also, Amazon uses Erlang. > Interesting! I always wondered how amazon as a company works (from the software, stock, shipping perspective). Any interesting articles or books around about it? > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From dtnoizerz58 at yandex.ru Sat Apr 18 09:00:53 2009 From: dtnoizerz58 at yandex.ru (DTNOIZR) Date: Sat Apr 18 09:01:20 2009 Subject: [plt-scheme] continuation barrier In-Reply-To: <18921.31010.137564.566951@winooski.ccs.neu.edu> References: <428791240004757@webmail89.yandex.ru> <1c1a33bc0904171644j7f568e09o2c6f195a4c24ae03@mail.gmail.com> <77021240035328@webmail65.yandex.ru> <18921.31010.137564.566951@winooski.ccs.neu.edu> Message-ID: <620671240059653@webmail53.yandex.ru> your code do not use "send/suspend" my code is like your, but "send/suspend" don't work > If you want sandboxed code to be part of the web server, then you > should probably write some wrapper that will call a function inside > the sandbox with the query, and display the result it returned. I have written sandbox evaluator, which run web functions (parts of my web-application) But I need "send/suspend" in web functions, and "send/suspend" include continuations in it and if "send/suspend" appear in such function, raise error: "call-with-composable-continuation: continuation includes no prompt with the given tag: #" 18.04.09, 10:54, "Eli Barzilay" : > On Apr 18, DTNOIZR wrote: > > > This code runs without problems in PLT Scheme 4.1.5 > > I use 4.1.4. because of 4.1.5. have some errors ... > > > > i wanna create web scheme interpreter > > every user have its own sandbox with its own tweaks > So you wouldn't want the sandboxed code to be able to interfere with > your own server -- which is why its environment is isolated. Below is > a sample quick web-server based evaluator that I once wrote -- if you > try it, you'll see that capturing continuations and calling them is > fine as long as it's user code that calls its own continuations. > If you want sandboxed code to be part of the web server, then you > should probably write some wrapper that will call a function inside > the sandbox with the query, and display the result it returned. This > way the continuations that are captured inside the sandbox are kept > private, and no continuation barriers get in your way. From eli at barzilay.org Sat Apr 18 10:01:39 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Apr 18 10:02:01 2009 Subject: [plt-scheme] continuation barrier In-Reply-To: <620671240059653@webmail53.yandex.ru> References: <428791240004757@webmail89.yandex.ru> <1c1a33bc0904171644j7f568e09o2c6f195a4c24ae03@mail.gmail.com> <77021240035328@webmail65.yandex.ru> <18921.31010.137564.566951@winooski.ccs.neu.edu> <620671240059653@webmail53.yandex.ru> Message-ID: <18921.56643.293638.155831@winooski.ccs.neu.edu> On Apr 18, DTNOIZR wrote: > > > If you want sandboxed code to be part of the web server, then you > > should probably write some wrapper that will call a function > > inside the sandbox with the query, and display the result it > > returned. > > your code do not use "send/suspend" > my code is like your, but "send/suspend" don't work Right -- this is why I wrote the above: the sandbox is working in its own world, so you will need to wrap around it some code that will translate your own query to a call inside the sandbox, then show the results that the sandbox returns. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From dtnoizerz58 at yandex.ru Sat Apr 18 10:25:53 2009 From: dtnoizerz58 at yandex.ru (DTNOIZR) Date: Sat Apr 18 10:26:23 2009 Subject: Fwd: [plt-scheme] continuation barrier Message-ID: <108871240064753@webmail27.yandex.ru> -------- ???????????? ????????? -------- 18.04.09, 18:25, "DTNOIZR" : Do you mean I have to create my own version of send/suspend? can you advice me some short way to do it? 18.04.09, 18:01, "Eli Barzilay" : > On Apr 18, DTNOIZR wrote: > > > > > If you want sandboxed code to be part of the web server, then you > > > should probably write some wrapper that will call a function > > > inside the sandbox with the query, and display the result it > > > returned. > > > > your code do not use "send/suspend" > > my code is like your, but "send/suspend" don't work > Right -- this is why I wrote the above: the sandbox is working in its > own world, so you will need to wrap around it some code that will > translate your own query to a call inside the sandbox, then show the > results that the sandbox returns. > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! -------- ?????????? ????????????? ????????? -------- From jay.mccarthy at gmail.com Sat Apr 18 10:29:48 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sat Apr 18 10:30:10 2009 Subject: [plt-scheme] continuation barrier In-Reply-To: <108871240064753@webmail27.yandex.ru> References: <108871240064753@webmail27.yandex.ru> Message-ID: I don't think that's the right way to go. I think what Eli is suggesting is to run your entire servlet inside of the sandbox, so that there is no need to jump across the sandbox's barrier. Jay 2009/4/18 DTNOIZR : > > > -------- ???????????? ????????? -------- > 18.04.09, 18:25, "DTNOIZR" : > > Do you mean I have to create my own version of send/suspend? > can you advice me some short way to do it? > > > 18.04.09, 18:01, "Eli Barzilay" : > >> On Apr 18, DTNOIZR wrote: >> > >> > > If you want sandboxed code to be part of the web server, then you >> > > should probably write some wrapper that will call a function >> > > inside the sandbox with the query, and display the result it >> > > returned. >> > >> > your code do not use "send/suspend" >> > my code is like your, but "send/suspend" don't work >> Right -- this is why I wrote the above: the sandbox is working in its >> own world, so you will need to wrap around it some code that will >> translate your own query to a call inside the sandbox, then show the >> results that the sandbox returns. >> -- >> ? ? ? ? ? ((lambda (x) (x x)) (lambda (x) (x x))) ? ? ? ? ?Eli Barzilay: >> ? ? ? ? ? ? ? ? ? http://www.barzilay.org/ ? ? ? ? ? ? ? ? Maze is Life! > -------- ?????????? ????????????? ????????? -------- > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From kevin at hypotheticalabs.com Sat Apr 18 10:37:12 2009 From: kevin at hypotheticalabs.com (Kevin A. Smith) Date: Sat Apr 18 10:37:35 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: <11b141710904180501o4b6705d4ncdce44773e01deed@mail.gmail.com> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <49E8EB4C.4060800@neilvandyke.org> <11b141710904180501o4b6705d4ncdce44773e01deed@mail.gmail.com> Message-ID: Amazon's highest visibility use of Erlang is SimpleDB, their hosted key-value store. They published a whitepaper describing the design: http://s3.amazonaws.com/AllThingsDistributed/sosp/amazon-dynamo-sosp2007.pdf There's also an open-source implementation of Dynamo here: http://github.com/cliffmoon/dynomite/tree/master ...and now I return the list to it's regular Scheme-related programming. --Kevin On Apr 18, 2009, at 8:01 AM, Paulo J. Matos wrote: > On Sat, Apr 18, 2009 at 10:54 AM, Geoffrey S. Knauth > wrote: >> On Apr 17, 2009, at 21:14, Kevin A. Smith wrote: >>> >>> FWIW, Erlang is also picking up steam. I'm in the States and I'm >>> seeing a >>> pick up in interest around Erlang. Of course, I might be a bit >>> biased since >>> I do Erlang training and consulting ;-) >> >> Also, Amazon uses Erlang. >> > > Interesting! I always wondered how amazon as a company works (from the > software, stock, shipping perspective). Any interesting articles or > books around about it? > >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm From dtnoizerz58 at yandex.ru Sat Apr 18 10:55:47 2009 From: dtnoizerz58 at yandex.ru (DTNOIZR) Date: Sat Apr 18 11:02:02 2009 Subject: [plt-scheme] continuation barrier In-Reply-To: References: <108871240064753@webmail27.yandex.ru> Message-ID: <14281240066547@webmail5.yandex.ru> I decided to make "community programming environment" with multiple accounts: every user have individual list of functions, that allowed for him and have personal sandbox evaluator personal sandbox will restrict - which functions user can call (no difference, for programming or for use them as site parts) "run entire servlet inside of the sandbox" - I dont like this idea this mean that every account will have it's own servlet, and work without some restrictions I think this is not what I need ... (define make-personal-evaluator (lambda (e-mail) (define allowed (get-allowed-functions-list e-mail)) (define m `(module m scheme (require (only-in "livecoding/all.ss" ,@allowed)))) (sandbox-security-guard (current-security-guard)) (sandbox-make-code-inspector (let ([cci (current-code-inspector)]) (lambda () cci))) (make-module-evaluator m))) e-mail is account ... > I don't think that's the right way to go. I think what Eli is > suggesting is to run your entire servlet inside of the sandbox, so > that there is no need to jump across the sandbox's barrier. From stephen at degabrielle.name Sat Apr 18 12:01:37 2009 From: stephen at degabrielle.name (Stephen De Gabrielle) Date: Sat Apr 18 12:02:05 2009 Subject: [plt-scheme] [OT] Scheme Jobs In-Reply-To: References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <49E8EB4C.4060800@neilvandyke.org> Message-ID: <595b9ab20904180901v2598f60fmd1897a8cfdc3f0d6@mail.gmail.com> Wasn't there a scheme on the Erlang VM? On 4/18/09, Kevin A. Smith wrote: > FWIW, Erlang is also picking up steam. I'm in the States and I'm > seeing a pick up in interest around Erlang. Of course, I might be a > bit biased since I do Erlang training and consulting ;-) > > There's even a Lisp which runs on the Erlang VM. Nothing nearly as > good as PLT Scheme but at least it's a Lisp :) > > --Kevin > On Apr 17, 2009, at 4:49 PM, Neil Van Dyke wrote: > >> BTW, Scala is getting mainstream interest at the moment, due to >> Twitter ditching teen heartthrob Ruby for Scala, for backend >> scalability reasons. >> >> Noel Welsh wrote at 04/17/2009 04:35 PM: >>> Given this, I suggest widening your search a bit to >>> include Haskell, Scala, and Erlang. Any sane employer looking for >>> those (and there are a number) will respect your Scheme skillz. >>> >> >> -- >> http://www.neilvandyke.org/ >> _________________________________________________ >> 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 > -- Sent from my mobile device Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT From eli at barzilay.org Sat Apr 18 14:17:24 2009 From: eli at barzilay.org (Eli Barzilay) Date: Sat Apr 18 14:18:02 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <87ab6ejqje.fsf@mithrandir.homeunix.net> References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> <18921.31012.311391.949582@winooski.ccs.neu.edu> <87iql2ju0o.fsf@mithrandir.homeunix.net> <18921.33729.745456.393820@winooski.ccs.neu.edu> <87eivqjssy.fsf@mithrandir.homeunix.net> <18921.36129.458545.449985@winooski.ccs.neu.edu> <87ab6ejqje.fsf@mithrandir.homeunix.net> Message-ID: <18922.6452.890324.962560@winooski.ccs.neu.edu> On Apr 18, Jose A. Ortega Ruiz wrote: > Eli Barzilay writes: > > > But the name for the "optional" in the above is `b'... I've put > > "optional" in quotes since it doesn't have to be an optional > > argument, it can be anything, and can have behavior that is not > > related to the other cases in the `case-lambda' form (that's why I > > used different strings in the above). The resulting arities can > > also be arbitrary, for example: > > > > (case-lambda [(x) 1] > > [(a b c) 2] > > [(i j k l m) 3]) > > > > has an arity list of (1 3 5), which cannot be described with such > > an `#:optional'. > > OK, i see your point now. what about something like: > > (foo [x] [a b c] [i j k l m]) > > or > > (foo [(x) (a b c) (i j k l m)]) > > ? > > > Here's another random example from the texpict collection: > > > > (define inset/clip > > (case-lambda > > [(p l t r b) ...] > > [(p h v) (inset/clip p h v h v)] > > [(p a) (inset/clip p a a a a)])) > > one could even try to be smart and share common prefixes: > > (insert/clip p [l t r b] [h v] [a]) > > does that make sense? [Yes -- but that's a presentation issue. My point was that there are all of these additional considerations to make.] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From keydana at gmx.de Sat Apr 18 16:18:53 2009 From: keydana at gmx.de (keydana@gmx.de) Date: Sat Apr 18 16:19:15 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way Message-ID: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> Hi, today on one of the extremely rare occasions where I can use scheme at work, I had to get at the frequencies for a list of ids extracted from a logfile. E.g., I had a list like '(1234 1234 5678 1234) and wanted to, on the one hand, remove the duplicates and, on the other hand, store how many instances there were of each id. For example, if represented as an alist, the result might have looked like this: '((1234 3) (5678 1)) However, I could not imagine a "purely functional" way to do this, and so I used a box to update the frequencies, like so: (define count (lambda (lst) (let count-accum ((lst lst) (frequencies '())) (if (null? lst) frequencies (let ((first (car lst))) (cond ((assoc first frequencies) (let ((count-box (cdr (assoc first frequencies)))) (begin (set-box! count-box (+ 1 (unbox count-box))) (count-accum (cdr lst) frequencies)))) (else (count-accum (cdr lst) (cons (cons first (box 1)) frequencies))))))))) (I also considered a hashtable, which would have been equally "impure" and less practical, because the next processing step again required a list). I suppose there must be "more functional" (if I may say so) and more elegant ways to perform this task. I'd be glad to learn and thankful for any suggestions :-) Ciao Sigrid -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090418/a0049874/attachment.htm From robby at eecs.northwestern.edu Sat Apr 18 16:27:01 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 18 16:27:24 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> Message-ID: <932b2f1f0904181327k203c1dej88ea5742aac778fe@mail.gmail.com> If the list is very long, an equal-key hash table is definitely the way to go (unless you expect there to be very few duplicates). If it is very long (with lots of duplicates) and you really want to do something purely functional, there are some clever purely function balanced binary tree algorithms out there (I'd start with Chris Okasaki's book to learn more about them). If the list is very long and there are not many duplicates, then I'm not sure of the best algorithm, but I'd probably start with the hash-table and experiment from there. If the list is short, then using an assocation table as the accumulator is probably just fine and is purely functional. You'd do something similar to what you have below, except instead of mutating the box, you can remove the old association from the list and replace with a new one that has the updated value. Probably easiest to use 'filter' to remove the old association. hth, Robby On Sat, Apr 18, 2009 at 3:18 PM, keydana@gmx.de wrote: > Hi, > today on one of the extremely rare occasions where I can use scheme at work, > I had to get at the frequencies for a list of ids extracted from a logfile. > E.g., I had a list like > '(1234 1234 5678 1234) > and wanted to, on the one hand, remove the duplicates and, on the other > hand, store how many instances there were of each id. > For example, if represented as an alist, the result might have looked like > this: > '((1234 3) (5678 1)) > However, I could not imagine a "purely functional" way to do this, and so I > used a box to update the frequencies, like so: > (define count > ?(lambda (lst) > ?? (let count-accum ((lst lst) (frequencies '())) > ?? ? (if (null? lst) > ?? ? ? ? frequencies > ?? ? ? ? (let ((first (car lst))) > ?? ? ? ? ? (cond ((assoc first frequencies) > ?? ? ? ? ? ? ? ? ?(let ((count-box (cdr (assoc first frequencies)))) > ?? ? ? ? ? ? ? ? ? ?(begin (set-box! count-box (+ 1 (unbox count-box))) > ?? ? ? ? ? ? ? ? ? ? ? ? ? (count-accum (cdr lst) frequencies)))) > ?? ? ? ? ? ? ? ? (else (count-accum (cdr lst) (cons (cons first (box 1)) > frequencies))))))))) > > (I also considered a hashtable, which would have been equally "impure" and > less practical, because the next processing step again required a list). > I suppose there must be "more functional" (if I may say so) and more elegant > ways to perform this task. I'd be glad to learn and thankful for any > suggestions :-) > Ciao > Sigrid > > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From matthias at ccs.neu.edu Sat Apr 18 16:34:09 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Apr 18 16:35:45 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> Message-ID: Frequencies come in ranges and my guess is that you have the full range of them. If so, I would have no hesitations giving up pure FP and use a vector in the proper range. I doubt very much any FP technique comes close in efficiency. -- Matthias On Apr 18, 2009, at 4:18 PM, keydana@gmx.de wrote: > Hi, > > today on one of the extremely rare occasions where I can use scheme > at work, I had to get at the frequencies for a list of ids > extracted from a logfile. E.g., I had a list like > > '(1234 1234 5678 1234) > > and wanted to, on the one hand, remove the duplicates and, on the > other hand, store how many instances there were of each id. > For example, if represented as an alist, the result might have > looked like this: > > '((1234 3) (5678 1)) > > However, I could not imagine a "purely functional" way to do this, > and so I used a box to update the frequencies, like so: > > (define count > (lambda (lst) > (let count-accum ((lst lst) (frequencies '())) > (if (null? lst) > frequencies > (let ((first (car lst))) > (cond ((assoc first frequencies) > (let ((count-box (cdr (assoc first frequencies)))) > (begin (set-box! count-box (+ 1 (unbox count- > box))) > (count-accum (cdr lst) frequencies)))) > (else (count-accum (cdr lst) (cons (cons first > (box 1)) frequencies))))))))) > > > (I also considered a hashtable, which would have been equally > "impure" and less practical, because the next processing step again > required a list). > > I suppose there must be "more functional" (if I may say so) and > more elegant ways to perform this task. I'd be glad to learn and > thankful for any suggestions :-) > > Ciao > 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/20090418/9fa34888/attachment-0001.htm From robby at eecs.northwestern.edu Sat Apr 18 16:37:12 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 18 16:37:34 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> Message-ID: <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> Oh, yes -- sorry that's the best if you know that the data is dense in a particular range of values (and that range isn't huge). Robby On Sat, Apr 18, 2009 at 3:34 PM, Matthias Felleisen wrote: > > Frequencies come in ranges and my guess is that you have the full range of > them. > If so, I would have no hesitations giving up pure FP and use a vector in the > proper range. I doubt very much any FP technique comes close in efficiency. > -- Matthias > > > On Apr 18, 2009, at 4:18 PM, keydana@gmx.de wrote: > > Hi, > today on one of the extremely rare occasions where I can use scheme at work, > I had to get at the frequencies for a list of ids extracted from a logfile. > E.g., I had a list like > '(1234 1234 5678 1234) > and wanted to, on the one hand, remove the duplicates and, on the other > hand, store how many instances there were of each id. > For example, if represented as an alist, the result might have looked like > this: > '((1234 3) (5678 1)) > However, I could not imagine a "purely functional" way to do this, and so I > used a box to update the frequencies, like so: > (define count > ?(lambda (lst) > ?? (let count-accum ((lst lst) (frequencies '())) > ?? ? (if (null? lst) > ?? ? ? ? frequencies > ?? ? ? ? (let ((first (car lst))) > ?? ? ? ? ? (cond ((assoc first frequencies) > ?? ? ? ? ? ? ? ? ?(let ((count-box (cdr (assoc first frequencies)))) > ?? ? ? ? ? ? ? ? ? ?(begin (set-box! count-box (+ 1 (unbox count-box))) > ?? ? ? ? ? ? ? ? ? ? ? ? ? (count-accum (cdr lst) frequencies)))) > ?? ? ? ? ? ? ? ? (else (count-accum (cdr lst) (cons (cons first (box 1)) > frequencies))))))))) > > (I also considered a hashtable, which would have been equally "impure" and > less practical, because the next processing step again required a list). > I suppose there must be "more functional" (if I may say so) and more elegant > ways to perform this task. I'd be glad to learn and thankful for any > suggestions :-) > Ciao > Sigrid > > _________________________________________________ > ? 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 plragde at uwaterloo.ca Sat Apr 18 16:57:20 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Sat Apr 18 16:57:46 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <932b2f1f0904181327k203c1dej88ea5742aac778fe@mail.gmail.com> Message-ID: <49EA3EB0.5030304@uwaterloo.ca> Robby wrote: > If the list is very long, an equal-key hash table is definitely the > way to go (unless you expect there to be very few duplicates). If it > is very long (with lots of duplicates) and you really want to do > something purely functional, there are some clever purely function > balanced binary tree algorithms out there (I'd start with Chris > Okasaki's book to learn more about them). If the IDs can be totally ordered, sorting by ID puts the duplicates together, after which a single pass produces the frequency counts in O(n log n) time for a purely-functional solution (which is what you'll get with a messier data structure anyway). But the hash table (followed by a hash-map to convert to a list for the next step) will be faster, I suspect. --PR From keydana at gmx.de Sat Apr 18 17:03:28 2009 From: keydana at gmx.de (keydana@gmx.de) Date: Sat Apr 18 17:03:52 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> Message-ID: <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> Hi Robby, hi Matthias, thanks for your ultra-quick responses! In fact in my special case, the data turned out to be not in a Gaussian or equally-distributed form at all - there were very few rather high outliers, but most frequencies were just equal to one (some suspicion in this direction was even the reason for the task). So a vector representing the frequencies would have had lots of empty fields. For the other suggestions, I will write the association-list variant for practise (and perhaps also for performance comparison, though this is not a problem in my specific task), and have a look at the binary tree algorithms for interest. Regarding the hash table solution, how does it really compare to the box version - is it better performance, better style...? I must admit I would have "automatically" used a hash table had I not discovered the box datatype by reading PLAI (before that, I didn't know something like this existed in PLT. So this is the occasion to ask - is this a feature meant to be used in "production code" or rather in a learning context only? Thanks a lot Sigrid Am 18.04.2009 um 22:37 schrieb Robby Findler: > Oh, yes -- sorry that's the best if you know that the data is dense in > a particular range of values (and that range isn't huge). > > Robby > > On Sat, Apr 18, 2009 at 3:34 PM, Matthias Felleisen > wrote: >> >> Frequencies come in ranges and my guess is that you have the full >> range of >> them. >> If so, I would have no hesitations giving up pure FP and use a >> vector in the >> proper range. I doubt very much any FP technique comes close in >> efficiency. >> -- Matthias >> >> >> On Apr 18, 2009, at 4:18 PM, keydana@gmx.de wrote: >> >> Hi, >> today on one of the extremely rare occasions where I can use scheme >> at work, >> I had to get at the frequencies for a list of ids extracted from a >> logfile. >> E.g., I had a list like >> '(1234 1234 5678 1234) >> and wanted to, on the one hand, remove the duplicates and, on the >> other >> hand, store how many instances there were of each id. >> For example, if represented as an alist, the result might have >> looked like >> this: >> '((1234 3) (5678 1)) >> However, I could not imagine a "purely functional" way to do this, >> and so I >> used a box to update the frequencies, like so: >> (define count >> (lambda (lst) >> (let count-accum ((lst lst) (frequencies '())) >> (if (null? lst) >> frequencies >> (let ((first (car lst))) >> (cond ((assoc first frequencies) >> (let ((count-box (cdr (assoc first frequencies)))) >> (begin (set-box! count-box (+ 1 (unbox count- >> box))) >> (count-accum (cdr lst) frequencies)))) >> (else (count-accum (cdr lst) (cons (cons first >> (box 1)) >> frequencies))))))))) >> >> (I also considered a hashtable, which would have been equally >> "impure" and >> less practical, because the next processing step again required a >> list). >> I suppose there must be "more functional" (if I may say so) and >> more elegant >> ways to perform this task. I'd be glad to learn and thankful for any >> suggestions :-) >> Ciao >> Sigrid >> >> _________________________________________________ >> 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 Sat Apr 18 17:05:49 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 18 17:06:13 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> Message-ID: <932b2f1f0904181405u171bfbbes51a9e60024333789@mail.gmail.com> Boxes are fine for jobs where the work. It is just a single mutable cell (altho I don't use them much -- set! or having multiple mutable fields in a struct often seems more useful). FWIW, PR's suggestion is much better than the association list revision I suggested if you want to avoid mutation. Robby On Sat, Apr 18, 2009 at 4:03 PM, keydana@gmx.de wrote: > Hi Robby, hi Matthias, > > thanks for your ultra-quick responses! In fact in my special case, the data > turned out to be not in a Gaussian or ?equally-distributed form at all - > there were very few rather high outliers, but most frequencies were just > equal to one (some suspicion in this direction was even the reason for the > task). So a vector representing the frequencies would have had lots of empty > fields. > > For the other suggestions, I will write the association-list variant for > practise (and perhaps also for performance comparison, though this is not a > problem in my specific task), ?and have a look at the binary tree algorithms > for interest. > Regarding the hash table solution, how does it really compare to the box > version - is it better performance, better style...? > I must admit I would have "automatically" used a hash table had I not > discovered the box datatype by reading PLAI (before that, I didn't know > something like this existed in PLT. So this is the occasion to ask - is this > a feature meant to be used in "production code" or rather in a learning > context only? > > Thanks a lot > Sigrid > > > > > > Am 18.04.2009 um 22:37 schrieb Robby Findler: > >> Oh, yes -- sorry that's the best if you know that the data is dense in >> a particular range of values (and that range isn't huge). >> >> Robby >> >> On Sat, Apr 18, 2009 at 3:34 PM, Matthias Felleisen >> wrote: >>> >>> Frequencies come in ranges and my guess is that you have the full range >>> of >>> them. >>> If so, I would have no hesitations giving up pure FP and use a vector in >>> the >>> proper range. I doubt very much any FP technique comes close in >>> efficiency. >>> -- Matthias >>> >>> >>> On Apr 18, 2009, at 4:18 PM, keydana@gmx.de wrote: >>> >>> Hi, >>> today on one of the extremely rare occasions where I can use scheme at >>> work, >>> I had to get at the frequencies for a list of ids extracted from a >>> logfile. >>> E.g., I had a list like >>> '(1234 1234 5678 1234) >>> and wanted to, on the one hand, remove the duplicates and, on the other >>> hand, store how many instances there were of each id. >>> For example, if represented as an alist, the result might have looked >>> like >>> this: >>> '((1234 3) (5678 1)) >>> However, I could not imagine a "purely functional" way to do this, and so >>> I >>> used a box to update the frequencies, like so: >>> (define count >>> ?(lambda (lst) >>> ? (let count-accum ((lst lst) (frequencies '())) >>> ? ? (if (null? lst) >>> ? ? ? ? frequencies >>> ? ? ? ? (let ((first (car lst))) >>> ? ? ? ? ? (cond ((assoc first frequencies) >>> ? ? ? ? ? ? ? ? ?(let ((count-box (cdr (assoc first frequencies)))) >>> ? ? ? ? ? ? ? ? ? ?(begin (set-box! count-box (+ 1 (unbox count-box))) >>> ? ? ? ? ? ? ? ? ? ? ? ? ? (count-accum (cdr lst) frequencies)))) >>> ? ? ? ? ? ? ? ? (else (count-accum (cdr lst) (cons (cons first (box 1)) >>> frequencies))))))))) >>> >>> (I also considered a hashtable, which would have been equally "impure" >>> and >>> less practical, because the next processing step again required a list). >>> I suppose there must be "more functional" (if I may say so) and more >>> elegant >>> ways to perform this task. I'd be glad to learn and thankful for any >>> suggestions :-) >>> Ciao >>> Sigrid >>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> _________________________________________________ >>> ?For list-related administrative tasks: >>> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> > > From sk at cs.brown.edu Sat Apr 18 17:23:34 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sat Apr 18 17:24:13 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: References: <49749EB3.4040105@gmail.com> <756daca50901191311h454a9312i1da91369edb79302@mail.gmail.com> Message-ID: Following-up to a long-standing request... Here's a servlet I sometimes use. It lets me play iTunes at my desk but control it remotely from my phone using the phone's Web server as the interface. (Use case: start up the music, then carry a baby around w/ one hand and change what's playing using the phone browser with the other....) I've kept the UI very simple to make the code easy to understand. Tested/used w/ PLT v4.1.1. Exercises for extending the code: - The use of state here means the volume in the servlet may be inconsistent with that on iTunes; rather than remember it, always ask iTunes for the latest value and increment/decrement that. - Add support for playlists, which you can obtain with (define libsrc (com-get-property iTunes "LibrarySource")) (define playlists (com-get-property libsrc "Playlists")) - Reduce footprint by using Filipe Cabecinhas's cgao/coclass (com-get-active-object-from-coclass). - This version expects you to set up iTunes on your desktop. (In particular, Play/Pause/Stop don't mean quite what they ought to mean; I had some difficulty reconstructing a precise spec.) Enable more of it from the Web interface. - Add basic security, like a passcode on startup (printed at terminal, must be entered by Web client). This way, even if your neighbor hacks into your house network, steals all your money, changes your locks, and performs illicit activities using your identity, at least they can't change what's currently playing on your speakers. - Support more of iTunes! (There are some bugs w/ the current MysterX that inhibit it from supporting all of it, or we could have a much better interface to iTunes than iTunes itself.) Shriram ---------------------------------------------------------------------- #lang scheme/base (require web-server/servlet) (provide (all-defined-out)) (define interface-version 'v1) (define timeout +inf.0) (require mysterx) (require (lib "class.ss")) (define iTunes (cci/coclass "iTunes Class")) (define current-volume (com-get-property iTunes "SoundVolume")) (define (play) (com-invoke iTunes "Play")) (define (stop) (com-invoke iTunes "Stop")) (define (next-track) (com-invoke iTunes "NextTrack")) (define (previous-track) (com-invoke iTunes "PreviousTrack")) (define (incr-volume) (set! current-volume (min 100 (+ current-volume 5))) (com-set-property! iTunes "SoundVolume" current-volume)) (define (decr-volume) (set! current-volume (max 0 (- current-volume 5))) (com-set-property! iTunes "SoundVolume" current-volume)) (define (display-loop) (send/suspend/dispatch (lambda (embed/url) (define (make-button title callback) `(a ([href ,(embed/url (lambda (req) (callback) (display-loop)))]) ,title)) `(html (head (title "iTunes Player")) (body (p ,(make-button "Play" play) nbsp nbsp ,(make-button "Stop" stop)) (p ,(make-button "<-" previous-track) nbsp nbsp ,(make-button "->" next-track)) (p ,(make-button "-" decr-volume) nbsp nbsp ,(number->string current-volume) nbsp nbsp ,(make-button "+" incr-volume))))))) (define (start initial-request) (display-loop)) ---------------------------------------------------------------------- From jos.koot at telefonica.net Sat Apr 18 17:38:46 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Apr 18 17:39:08 2009 Subject: [plt-scheme] coroutine versus stream Message-ID: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> It seems to me that in many cases the same problem can be solved (for an eager evaluater) both by coroutines and by streams. Both solutions very well show the structure of the principal algorithm as might have been written with a lazy evaluator in mind. Which approach would be preferred in terms of efficiency (time and memory). May be you would like to address other aspects as well. One reason that makes me tend to choose streams, is that the latter seem better suited to automatic code generation from purely lazy code. Thanks, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090418/31dd2347/attachment-0001.html From matthias at ccs.neu.edu Sat Apr 18 17:43:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Apr 18 17:45:00 2009 Subject: [plt-scheme] coroutine versus stream In-Reply-To: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> Message-ID: It is indeed a well-known fact that streams and coroutines are two sides of the same coin. Talcott's 1986 dissertation is the earliest theoretical treatment that I know. -- Matthias On Apr 18, 2009, at 5:38 PM, Jos Koot wrote: > It seems to me that in many cases the same problem can be solved > (for an eager evaluater) both by coroutines and by streams. Both > solutions very well show the structure of the principal algorithm > as might have been written with a lazy evaluator in mind. Which > approach would be preferred in terms of efficiency (time and > memory). May be you would like to address other aspects as well. > One reason that makes me tend to choose streams, is that the latter > seem better suited to automatic code generation from purely lazy code. > Thanks, Jos > _________________________________________________ > 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/20090418/cefe9d24/attachment.htm From jos.koot at telefonica.net Sat Apr 18 17:54:39 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Apr 18 17:58:53 2009 Subject: [plt-scheme] coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> Message-ID: Thanks, Matthias, I did a quick search for Talcott 1986, but got so many hits relevevant info is hidden like a leaf on a sound tree. Can you be more specific? Thanks Jos ----- Original Message ----- From: Matthias Felleisen To: Jos Koot Cc: plt-scheme@list.cs.brown.edu Sent: Saturday, April 18, 2009 11:43 PM Subject: Re: [plt-scheme] coroutine versus stream It is indeed a well-known fact that streams and coroutines are two sides of the same coin. Talcott's 1986 dissertation is the earliest theoretical treatment that I know. -- Matthias On Apr 18, 2009, at 5:38 PM, Jos Koot wrote: It seems to me that in many cases the same problem can be solved (for an eager evaluater) both by coroutines and by streams. Both solutions very well show the structure of the principal algorithm as might have been written with a lazy evaluator in mind. Which approach would be preferred in terms of efficiency (time and memory). May be you would like to address other aspects as well. One reason that makes me tend to choose streams, is that the latter seem better suited to automatic code generation from purely lazy code. Thanks, Jos _________________________________________________ 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/20090418/a94f8e6e/attachment.html From benderjg2 at aol.com Sat Apr 18 18:23:49 2009 From: benderjg2 at aol.com (Jim Bender) Date: Sat Apr 18 18:24:55 2009 Subject: [plt-scheme] coroutine versus stream In-Reply-To: References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> Message-ID: <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> I believe the reference is to Carolyn Talcott's dissertation "The essence of Rum: A theory of intensional and extensional aspects of Lisp-type computation". Stanford, 1986. Unfortunately this is not available online, as far as I know. Jim Sent from my iPhone On Apr 18, 2009, at 4:54 PM, "Jos Koot" wrote: > Thanks, Matthias, > I did a quick search for Talcott 1986, but got so many hits > relevevant info is hidden like a leaf on a sound tree. > Can you be more specific? Thanks > Jos > ----- Original Message ----- > From: Matthias Felleisen > To: Jos Koot > Cc: plt-scheme@list.cs.brown.edu > Sent: Saturday, April 18, 2009 11:43 PM > Subject: Re: [plt-scheme] coroutine versus stream > > > It is indeed a well-known fact that streams and coroutines are two > sides of the same coin. Talcott's 1986 dissertation is the earliest > theoretical treatment that I know. -- Matthias > > > > On Apr 18, 2009, at 5:38 PM, Jos Koot wrote: > >> It seems to me that in many cases the same problem can be solved >> (for an eager evaluater) both by coroutines and by streams. Both >> solutions very well show the structure of the principal >> algorithm as might have been written with a lazy evaluator in mind. >> Which approach would be preferred in terms of efficiency (time and >> memory). May be you would like to address other aspects as well. >> One reason that makes me tend to choose streams, is that the latter >> seem better suited to automatic code generation from purely lazy >> code. >> Thanks, Jos >> _________________________________________________ >> 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/20090418/02d9c6bd/attachment.htm From jos.koot at telefonica.net Sat Apr 18 18:54:04 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sat Apr 18 18:58:02 2009 Subject: [plt-scheme] coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> Message-ID: <7C6E6697CCF04F069470B3B4F27E4AED@uw2b2dff239c4d> Thanks for the info, I got a lot more relevant hits this time, although most of them refer to rather old articles. 1986 is a long way back, but that does not mean the articles are outdated, of course. I saw some articles introducing the concept of first class continuations. No longer new, of course, but may be interesting from a historical point of view. Thanks, Jos ----- Original Message ----- From: Jim Bender To: Jos Koot Cc: Matthias Felleisen ; plt-scheme@list.cs.brown.edu Sent: Sunday, April 19, 2009 12:23 AM Subject: Re: [plt-scheme] coroutine versus stream I believe the reference is to Carolyn Talcott's dissertation "The essence of Rum: A theory of intensional and extensional aspects of Lisp-type computation". Stanford, 1986. Unfortunately this is not available online, as far as I know. Jim Sent from my iPhone On Apr 18, 2009, at 4:54 PM, "Jos Koot" wrote: Thanks, Matthias, I did a quick search for Talcott 1986, but got so many hits relevevant info is hidden like a leaf on a sound tree. Can you be more specific? Thanks Jos ----- Original Message ----- From: Matthias Felleisen To: Jos Koot Cc: plt-scheme@list.cs.brown.edu Sent: Saturday, April 18, 2009 11:43 PM Subject: Re: [plt-scheme] coroutine versus stream It is indeed a well-known fact that streams and coroutines are two sides of the same coin. Talcott's 1986 dissertation is the earliest theoretical treatment that I know. -- Matthias On Apr 18, 2009, at 5:38 PM, Jos Koot wrote: It seems to me that in many cases the same problem can be solved (for an eager evaluater) both by coroutines and by streams. Both solutions very well show the structure of the principal algorithm as might have been written with a lazy evaluator in mind. Which approach would be preferred in terms of efficiency (time and memory). May be you would like to address other aspects as well. One reason that makes me tend to choose streams, is that the latter seem better suited to automatic code generation from purely lazy code. Thanks, Jos _________________________________________________ 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/20090419/37b22d20/attachment-0001.html From robby at eecs.northwestern.edu Sat Apr 18 20:26:14 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sat Apr 18 20:26:36 2009 Subject: [plt-scheme] coroutine versus stream In-Reply-To: <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> Message-ID: <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> It looks like you can buy a copy here: http://proquest.umi.com/pqdlink?did=752257391&Fmt=7&clientId =79356&RQT=309&VName=PQD and if you are at a university you can probably get it via interlibrary loan. Robby On Sat, Apr 18, 2009 at 5:23 PM, Jim Bender wrote: > I believe the reference is to Carolyn Talcott's dissertation "The essence of > Rum: A theory of intensional and extensional aspects of Lisp-type > computation". Stanford, 1986. Unfortunately this is not available online, as > far as I know. > Jim > > Sent from my iPhone > On Apr 18, 2009, at 4:54 PM, "Jos Koot" wrote: > > Thanks, Matthias, > I did a quick search for Talcott 1986, but got so many hits relevevant info > is hidden like a leaf on a sound tree. > Can you be more specific? Thanks > Jos > > ----- Original Message ----- > From: Matthias Felleisen > To: Jos Koot > Cc: plt-scheme@list.cs.brown.edu > Sent: Saturday, April 18, 2009 11:43 PM > Subject: Re: [plt-scheme] coroutine versus stream > > It is indeed a well-known fact that streams and coroutines are two sides of > the same coin. Talcott's 1986 dissertation is the earliest theoretical > treatment that I know. -- Matthias > > > On Apr 18, 2009, at 5:38 PM, Jos Koot wrote: > > It seems to me that in many cases the same problem can be solved (for an > eager evaluater) both by coroutines and by streams. Both solutions very well > show the structure of the principal algorithm as might have been written > with a lazy evaluator in mind. Which approach would be preferred in terms of > efficiency (time and memory). May be you would like to address other aspects > as well. One reason that makes me tend to choose streams, is that the latter > seem better suited to automatic code generation from purely lazy code. > Thanks, Jos > _________________________________________________ > ? 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 matthias at ccs.neu.edu Sat Apr 18 22:57:59 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sat Apr 18 22:59:28 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> Message-ID: Sigrid, just to get a first idea, I coded up the four most natural solutions to this problem with a simple stress test and timed them: -- vector -- sort and count (PR's suggestion) -- association list -- binary search tree The third one is so slow that I gave up on it. The vector is the base line, sort-and-count is twice as slow, and BST is twice as slow as that. What I didn't time is writing out a sorted file at the end from the 'association map' because I figured that I can do this in linear time in all cases though I realize now that in the FP case, I get to traverse the actual elements in the file in linear time while in the Imperative case, I get to traverse ALL. Still, a vector traversal should be fast enough. I will leave it to you to time the rest. Report to the list what you find -- Matthias P.S. You can get even better FP solutions, though I doubt you get close to the vector solution unless you have really strange distributions of the frequencies. #lang scheme (require mzlib/etc) (define HIGH 22000) (define LOW 80) ;; Frequency is in [LOW ... HIGH) (define SIZE 1000000) ;; String Nat -> Void ;; generate file f with n frequencies between 80 and 22000 (define (gen f n) (define (freq) (+ LOW (random (- HIGH LOW)))) (with-output-to-file f (lambda () (for ((i (in-range n))) (printf "~s " (freq)))) #:exists 'truncate)) (gen "tmp1" SIZE) ;; read file f and count how many times each frequency occurs in a vector ;; String -> [Vectorof Nat] ;; imperative vector update (define (cnt-vec f) (define a (make-vector (- HIGH LOW))) (define (up freq) (define i (- freq LOW)) (vector-set! a i (+ (vector-ref a i) 1))) (with-input-from-file f (rec loop (lambda () (define nxt (read)) (unless (eof-object? nxt) (up nxt) (loop))))) a) ;; String -> [Listof [List Nat Nat]] ;; sort, then create association list (define (cnt-alst f) (define l:in (with-input-from-file f (rec L (lambda () (define nxt (read)) (if (eof-object? nxt) '() (cons nxt (L))))))) (define l:st (sort l:in <)) (let L ([l (cdr l:st)][p (car l:st)][c 1]) (if (null? l) '() (let ([a (car l)]) (if (= a p) (L (cdr l) p (+ c 1)) (cons (list p c) (L (cdr l) (car l) 1))))))) ;; String (-> Association) (Association Nat -> Association) -> Association ;; create association list on the fly (define (cnt-fp f nu up) (with-input-from-file f (lambda () (let L ([a (nu)]) (define nxt (read)) (if (eof-object? nxt) a (L (up a nxt))))))) (define (cnt-AL f) (cnt-fp f (lambda () '()) (lambda (al freq) (let L ((al al)) (if (null? al) (list (list freq 1)) (let* ([a (car al)] [key (car a)]) (if (= key freq) (cons (list key (+ (cadr a) 1)) (cdr al)) (cons a (L (cdr al)))))))))) (define (cnt-BST f) (define-struct node (lft info count rgt)) ;; A BST is one of: ;; -- '() ;; -- (make-node BST Frequency Nat BST) (cnt-fp f (lambda () '()) (lambda (a freq) (let L ([bst a]) (if (null? bst) (make-node '() freq 1 '()) (let* ([a (node-info bst)] [lft (node-lft bst)] [rgt (node-rgt bst)] [cnt (node-count bst)]) (cond [(< freq a) (make-node (L lft) a cnt rgt)] [(= freq a) (make-node lft a (+ cnt 1) rgt)] [else (make-node lft a cnt (L rgt))]))))))) ;; ------------------------------------------------------------------------ ----- (define (test f) (collect-garbage) (let ([r (time (f "tmp1"))]) (void))) (test cnt-vec) (test cnt-alst) ;; (test cnt-AL) ;;; takes too long for my taste (test cnt-BST) From gadva1g at gmail.com Sat Apr 18 22:22:35 2009 From: gadva1g at gmail.com (gadva) Date: Sat Apr 18 23:51:58 2009 Subject: [plt-scheme] Newbie question about PLT web application Message-ID: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> Hello everyone, I've started working on the basic blog application described on the PLT Scheme Website, but I can't seem to figure out how to put the server online. Does the following simply launch an application on the localhost, but not put it online? #lang web-server/insta (define (start request) '(html (head (title "My Blog")) (body (h1 "Under construction")))) >From what I understand there are some other steps to putting the server online but I can't seem to get it to work. I don't have access to port 80 so I am trying to launch it on port 8000 or 8080. Are these ports blocked from remote users connecting to the server? If there are other steps to putting the basic page above online could someone provide some code I can add to it so that it works? Would adding the following be a step in the right direction? #lang scheme (require web-server/servlet) (provide/contract (start (request? . -> . response/c))) .. (require web-server/servlet-env) (serve/servlet start #:launch-browser? #f #:quit? #f #:listen-ip #f #:port 8000 #:extra-files-paths (list (build-path your-path-here "htdocs")) #:servlet-path "/servlets/APPLICATION.ss") Thank you in advance! From jay.mccarthy at gmail.com Sat Apr 18 23:58:32 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Sat Apr 18 23:58:54 2009 Subject: [plt-scheme] Newbie question about PLT web application In-Reply-To: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> References: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> Message-ID: Hi gadva, I don't understand what you mean be "put the server online". This message might explain something useful to you. PLT Web apps are not like Perl CGI Web apps that can be served off a server like Apache that you're likely to find on a hosting company, like FatCow. PLT Web apps run inside a custom PLT Web server. If you want to run a live application, like mail.google.com, then you have to run the PLT server on the host (modulo proxying, etc). [Caveat, you could build a CGI proxy fairly easily, but FatCow (eg) doesn't have PLT installed, so it's a no go.] So, the only way that the server runs is how it runs when you use web-sever/insta, serve/servlet, or plt-web-server. Once the server is running on whatever port, it's up to you to direct live traffic there somehow. Jay On Sat, Apr 18, 2009 at 8:22 PM, gadva wrote: > Hello everyone, > > I've started working on the basic blog application described on the > PLT Scheme Website, but I can't seem to figure out how to put the > server online. > > Does the following simply launch an application on the localhost, but > not put it online? > #lang web-server/insta > ?(define (start request) > ? '(html > ? ? (head (title "My Blog")) > ? ? (body (h1 "Under construction")))) > > >From what I understand there are some other steps to putting the > server online but I can't seem to get it to work. I don't have access > to port 80 so I am trying to launch it on port 8000 or 8080. Are these > ports blocked from remote users connecting to the server? > If there are other steps to putting the basic page above online could > someone provide some code I can add to it so that it works? > > Would adding the following be a step in the right direction? > > #lang scheme > > ?(require web-server/servlet) > ?(provide/contract (start (request? . -> . response/c))) > > .. > > ?(require web-server/servlet-env) > ?(serve/servlet start > ? ? ? ? ? ? ? ? #:launch-browser? #f > ? ? ? ? ? ? ? ? #:quit? #f > ? ? ? ? ? ? ? ? #:listen-ip #f > ? ? ? ? ? ? ? ? #:port 8000 > ? ? ? ? ? ? ? ? #:extra-files-paths > ? ? ? ? ? ? ? ? (list (build-path your-path-here "htdocs")) > ? ? ? ? ? ? ? ? #:servlet-path > ? ? ? ? ? ? ? ? "/servlets/APPLICATION.ss") > > Thank you in advance! > _________________________________________________ > ?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 jos.koot at telefonica.net Sun Apr 19 05:25:14 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Apr 19 05:25:40 2009 Subject: [plt-scheme] coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> Message-ID: <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> Thanks, I have no account on that site, but I posted a question whether or not they do serve private persons too. As I am retired I have no access via an official institute. Thanks, again, Jos ----- Original Message ----- From: "Robby Findler" To: "Jim Bender" Cc: "Jos Koot" ; ; "Matthias Felleisen" Sent: Sunday, April 19, 2009 2:26 AM Subject: Re: [plt-scheme] coroutine versus stream It looks like you can buy a copy here: http://proquest.umi.com/pqdlink?did=752257391&Fmt=7&clientId =79356&RQT=309&VName=PQD and if you are at a university you can probably get it via interlibrary loan. Robby On Sat, Apr 18, 2009 at 5:23 PM, Jim Bender wrote: > I believe the reference is to Carolyn Talcott's dissertation "The essence of > Rum: A theory of intensional and extensional aspects of Lisp-type > computation". Stanford, 1986. Unfortunately this is not available online, as > far as I know. > Jim > > Sent from my iPhone > On Apr 18, 2009, at 4:54 PM, "Jos Koot" wrote: > > Thanks, Matthias, > I did a quick search for Talcott 1986, but got so many hits relevevant info > is hidden like a leaf on a sound tree. > Can you be more specific? Thanks > Jos > > ----- Original Message ----- > From: Matthias Felleisen > To: Jos Koot > Cc: plt-scheme@list.cs.brown.edu > Sent: Saturday, April 18, 2009 11:43 PM > Subject: Re: [plt-scheme] coroutine versus stream > > It is indeed a well-known fact that streams and coroutines are two sides of > the same coin. Talcott's 1986 dissertation is the earliest theoretical > treatment that I know. -- Matthias > > > On Apr 18, 2009, at 5:38 PM, Jos Koot wrote: > > It seems to me that in many cases the same problem can be solved (for an > eager evaluater) both by coroutines and by streams. Both solutions very well > show the structure of the principal algorithm as might have been written > with a lazy evaluator in mind. Which approach would be preferred in terms of > efficiency (time and memory). May be you would like to address other aspects > as well. One reason that makes me tend to choose streams, is that the latter > seem better suited to automatic code generation from purely lazy code. > Thanks, Jos > _________________________________________________ > 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 matthias at ccs.neu.edu Sun Apr 19 10:20:18 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 19 10:22:06 2009 Subject: [plt-scheme] coroutine versus stream In-Reply-To: <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> Message-ID: <92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> Sorry Jos but it's not worth buying this kind of document (I wouldn't recommend buying my dissertation either). Go to the closest university library (cs) and ask whether they can't get a copy for you. It may take some time but it's your best bet. Also, Carolyn's treatment is formal, i.e., she develops a framework for proving equivalences. (She likes baroque notation, btw.) If you're interested in the ideas only, she has pointers to even earlier suggestions on how coroutines and streams relate -- Matthias On Apr 19, 2009, at 5:25 AM, Jos Koot wrote: > Thanks, > I have no account on that site, but I posted a question whether or > not they do serve private persons too. > As I am retired I have no access via an official institute. > Thanks, again, Jos > > ----- Original Message ----- From: "Robby Findler" > > To: "Jim Bender" > Cc: "Jos Koot" ; scheme@list.cs.brown.edu>; "Matthias Felleisen" > Sent: Sunday, April 19, 2009 2:26 AM > Subject: Re: [plt-scheme] coroutine versus stream > > > It looks like you can buy a copy here: > > http://proquest.umi.com/pqdlink?did=752257391&Fmt=7&clientId > =79356&RQT=309&VName=PQD > > and if you are at a university you can probably get it via > interlibrary loan. > > Robby > > On Sat, Apr 18, 2009 at 5:23 PM, Jim Bender wrote: >> I believe the reference is to Carolyn Talcott's dissertation "The >> essence of >> Rum: A theory of intensional and extensional aspects of Lisp-type >> computation". Stanford, 1986. Unfortunately this is not available >> online, as >> far as I know. >> Jim >> >> Sent from my iPhone >> On Apr 18, 2009, at 4:54 PM, "Jos Koot" >> wrote: >> >> Thanks, Matthias, >> I did a quick search for Talcott 1986, but got so many hits >> relevevant info >> is hidden like a leaf on a sound tree. >> Can you be more specific? Thanks >> Jos >> >> ----- Original Message ----- >> From: Matthias Felleisen >> To: Jos Koot >> Cc: plt-scheme@list.cs.brown.edu >> Sent: Saturday, April 18, 2009 11:43 PM >> Subject: Re: [plt-scheme] coroutine versus stream >> >> It is indeed a well-known fact that streams and coroutines are two >> sides of >> the same coin. Talcott's 1986 dissertation is the earliest >> theoretical >> treatment that I know. -- Matthias >> >> >> On Apr 18, 2009, at 5:38 PM, Jos Koot wrote: >> >> It seems to me that in many cases the same problem can be solved >> (for an >> eager evaluater) both by coroutines and by streams. Both solutions >> very well >> show the structure of the principal algorithm as might have been >> written >> with a lazy evaluator in mind. Which approach would be preferred >> in terms of >> efficiency (time and memory). May be you would like to address >> other aspects >> as well. One reason that makes me tend to choose streams, is that >> the latter >> seem better suited to automatic code generation from purely lazy >> code. >> Thanks, Jos >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > From jos.koot at telefonica.net Sun Apr 19 11:05:20 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Apr 19 11:07:30 2009 Subject: [plt-scheme] coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> <92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> Message-ID: Thanks for warning me, Tomorrow I'll be in Barcelona (Spain) and have a look at the university library there, although I am not sure they have a strong department for informatics/mathematics. Next week I'll be in the neighbourhood of Amsterdam and may have a look in the library of the CWI (Centrum for Mathematica and Informatica) Lot's of friendly people there wo can point me to the right documents. May be I can find time to visit some libraries of the the University of Amsterdam (where I did my studies in mathematics and physics and have worked as a researcher) Also a good opportunity to meet some former colleagues. The matter interests me. Mathematical proof of equivalences would be interesting, although I always have trouble getting acquanted with unfamiliar notations. I also have this problem of not understanding a theorem and even not being able to use a theorem until I think "why did I not discover this myself?" (off topic I'm afraid) Any people on this list living near Barcelona ??? (for me near = +- within 300 km) I live in Matar? (in the northern part of the mediterranean coast of Spain) Jos ----- Original Message ----- From: "Matthias Felleisen" To: "Jos Koot" Cc: "Robby Findler" ; "Jim Bender" ; Sent: Sunday, April 19, 2009 4:20 PM Subject: Re: [plt-scheme] coroutine versus stream > > > Sorry Jos but it's not worth buying this kind of document (I wouldn't recommend buying my dissertation either). Go to the closest > university library (cs) and ask whether they can't get a copy for you. It may take some time but it's your best bet. Also, > Carolyn's treatment is formal, i.e., she develops a framework for proving equivalences. (She likes baroque notation, btw.) If > you're interested in the ideas only, she has pointers to even earlier suggestions on how coroutines and streams relate -- > Matthias > > > > > > On Apr 19, 2009, at 5:25 AM, Jos Koot wrote: > >> Thanks, >> I have no account on that site, but I posted a question whether or not they do serve private persons too. >> As I am retired I have no access via an official institute. >> Thanks, again, Jos >> >> ----- Original Message ----- From: "Robby Findler" >> To: "Jim Bender" >> Cc: "Jos Koot" ; ; "Matthias Felleisen" >> Sent: Sunday, April 19, 2009 2:26 AM >> Subject: Re: [plt-scheme] coroutine versus stream >> >> >> It looks like you can buy a copy here: >> >> http://proquest.umi.com/pqdlink?did=752257391&Fmt=7&clientId >> =79356&RQT=309&VName=PQD >> snip From mflatt at cs.utah.edu Sun Apr 19 11:56:28 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Sun Apr 19 11:56:50 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> Message-ID: <20090419155630.368466500AD@mail-svr1.cs.utah.edu> At Sat, 18 Apr 2009 22:57:59 -0400, Matthias Felleisen wrote: > > Sigrid, just to get a first idea, I coded up the four most natural > solutions to this problem with a simple stress test and timed them: > > -- vector > -- sort and count (PR's suggestion) > -- association list > -- binary search tree Here's one more, using a functional "hash table": (define (cnt-ht f) (cnt-fp f (lambda () #hash()) (lambda (ht freq) (hash-update ht freq add1 0)))) The performance is close to the binary-tree performance, probably because that's how functional hash tables are implemented internally (but as red-black trees, so they're always balanced). From benderjg2 at aol.com Sun Apr 19 12:28:27 2009 From: benderjg2 at aol.com (benderjg2@aol.com) Date: Sun Apr 19 12:29:19 2009 Subject: [plt-scheme] coroutine versus stream In-Reply-To: References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d><7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com><932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com><03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d><92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> Message-ID: <8CB8F2300E30151-DF0-2F85@MBLK-M08.sysops.aol.com> Jos, You may wish to have a look at Talcott's "Programming and Proving with Function and Control Abstractions", a set of lecture notes?on "Rum" from 1986: http://blackforest.stanford.edu/clt/publications.html?name=talcott-89wix Whether it's worthwhile or not, Proquest/UMI is where I got a copy of Talcott's dissertation, several years ago. The 'right' entry point into their site for individuals to order dissertations is: http://disexpress.umi.com/ But I do see that prices are substantially higher for shipment to Europe. Jim -----Original Message----- From: Jos Koot To: Matthias Felleisen Cc: plt-scheme@list.cs.brown.edu; Robby Findler ; Jim Bender Sent: Sun, 19 Apr 2009 10:05 am Subject: Re: [plt-scheme] coroutine versus stream Thanks for warning me,? Tomorrow I'll be in Barcelona (Spain) and have a look at the university library there, although I am not sure they have a strong department for informatics/mathematics.? Next week I'll be in the neighbourhood of Amsterdam and may have a look in the library of the CWI (Centrum for Mathematica and Informatica) Lot's of friendly people there wo can point me to the right documents. May be I can find time to visit some libraries of the the University of Amsterdam (where I did my studies in mathematics and physics and have worked as a researcher) Also a good opportunity to meet some former colleagues.? ? The matter interests me. Mathematical proof of equivalences would be interesting, al though I always have trouble getting acquanted with unfamiliar notations. I also have this problem of not understanding a theorem and even not being able to use a theorem until I think "why did I not discover this myself?" (off topic I'm afraid)? ? Any people on this list living near Barcelona ??? (for me near = +- within 300 km)? I live in Matar? (in the northern part of the mediterranean coast of Spain)? Jos? ? ----- Original Message ----- From: "Matthias Felleisen" ? To: "Jos Koot" ? Cc: "Robby Findler" ; "Jim Bender" ; ? Sent: Sunday, April 19, 2009 4:20 PM? Subject: Re: [plt-scheme] coroutine versus stream? ? >? >? > Sorry Jos but it's not worth buying this kind of document (I wouldn't recommend buying my dissertation either). Go to the closest > university library (cs) and ask whether they can't get a copy for you. It may take some time but it's your best bet. Also, > Carolyn's treatment is formal, i.e., she develops a framework for proving equivalences. (She likes baroque notation, btw.) If > you're interested in the ideas only, she has pointers to even earlier suggestions on how coroutines and streams relate -- > Matthias? >? >? >? >? >? > On Apr 19, 2009, at 5:25 AM, Jos Koot wrote:? >? >> Thanks,? >> I have no account on that site, but I posted a question whether or not they do serve pri vate persons too.? >> As I am retired I have no access via an official institute.? >> Thanks, again, Jos? >>? >> ----- Original Message ----- From: "Robby Findler" ? >> To: "Jim Bender" ? >> Cc: "Jos Koot" ; ; "Matthias Felleisen" ? >> Sent: Sunday, April 19, 2009 2:26 AM? >> Subject: Re: [plt-scheme] coroutine versus stream? >>? >>? >> It looks like you can buy a copy here:? >>? >> http://proquest.umi.com/pqdlink?did=752257391&Fmt=7&clientId? >> =79356&RQT=309&VName=PQD? >>? snip ? _________________________________________________? ?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/20090419/d7a5850b/attachment.htm From jos.koot at telefonica.net Sun Apr 19 12:52:11 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Apr 19 12:52:36 2009 Subject: [plt-scheme] coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d><7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com><932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com><03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d><92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> <8CB8F2300E30151-DF0-2F85@MBLK-M08.sysops.aol.com> Message-ID: Thanks very much. Following your pointer, I downloaded Talcott's dissertation for free. Jos Internet is a maze, apparently for both suppliers and clients. ----- Original Message ----- From: benderjg2@aol.com To: jos.koot@telefonica.net ; plt-scheme@list.cs.brown.edu Sent: Sunday, April 19, 2009 6:28 PM Subject: Re: [plt-scheme] coroutine versus stream Jos, You may wish to have a look at Talcott's "Programming and Proving with Function and Control Abstractions", a set of lecture notes on "Rum" from 1986: http://blackforest.stanford.edu/clt/publications.html?name=talcott-89wix Whether it's worthwhile or not, Proquest/UMI is where I got a copy of Talcott's dissertation, several years ago. The 'right' entry point into their site for individuals to order dissertations is: http://disexpress.umi.com/ But I do see that prices are substantially higher for shipment to Europe. Jim -----Original Message----- From: Jos Koot To: Matthias Felleisen Cc: plt-scheme@list.cs.brown.edu; Robby Findler ; Jim Bender Sent: Sun, 19 Apr 2009 10:05 am Subject: Re: [plt-scheme] coroutine versus stream Thanks for warning me, Tomorrow I'll be in Barcelona (Spain) and have a look at the university library there, although I am not sure they have a strong department for informatics/mathematics. Next week I'll be in the neighbourhood of Amsterdam and may have a look in the library of the CWI (Centrum for Mathematica and Informatica) Lot's of friendly people there wo can poi nt me to the right documents. May be I can find time to visit some libraries of the the University of Amsterdam (where I did my studies in mathematics and physics and have worked as a researcher) Also a good opportunity to meet some former colleagues. The matter interests me. Mathematical proof of equivalences would be interesting, although I always have trouble getting acquanted with unfamiliar notations. I also have this problem of not understanding a theorem and even not being able to use a theorem until I think "why did I not discover this myself?" (off topic I'm afraid) Any people on this list living near Barcelona ??? (for me near = +- within 300 km) I live in Matar? (in the northern part of the mediterranean coast of Spain) Jos ----- Original Message ----- From: "Matthias Felleisen" To: "Jos Koot" Cc: "Robby Findler" ; "Jim Bender" ; Sent: Sunday, April 19, 2009 4:20 PM Subject: Re: [plt-scheme] coroutine versus stream > > > Sorry Jos but it's not worth buy ing this kind of document (I wouldn't recommend buying my dissertation either). Go to the closest > university library (cs) and ask whether they can't get a copy for you. It may take some time but it's your best bet. Also, > Carolyn's treatment is formal, i.e., she develops a framework for proving equivalences. (She likes baroque notation, btw.) If > you're interested in the ideas only, she has pointers to even earlier suggestions on how coroutines and streams relate -- > Matthias > > > > > > On Apr 19, 2009, at 5:25 AM, Jos Koot wrote: > >> Thanks, >> I have no account on that site, but I posted a question whether or not they do serve private persons too. >> As I am retired I have no access via an official institute. >> Thanks, again, Jos >> >> ----- Original Message ----- From: "Robby Findler" >> To: "Jim Bender" >> Cc: "Jos Koot" ; ; "Matthias Felleisen" >> Sent: Sunday, April 19, 2009 2:26 AM &g t;> Subject: Re: [plt-scheme] coroutine versus stream >> >> >> It looks like you can buy a copy here: >> >> http://proquest.umi.com/pqdlink?did=752257391&Fmt=7&clientId >> =79356&RQT=309&VName=PQD >> snip _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme ------------------------------------------------------------------------------ Why pay full price? Check out this month's deals on the new AOL Shopping. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090419/f98bcf5b/attachment.html From matthias at ccs.neu.edu Sun Apr 19 13:59:36 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 19 14:01:08 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <20090419155630.368466500AD@mail-svr1.cs.utah.edu> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> Message-ID: <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> I forgot about functional hash: vector: cpu time: 3580 real time: 3626 gc time: 0 alist: cpu time: 7784 real time: 8068 gc time: 1380 bst: cpu time: 15791 real time: 16052 gc time: 368 hash: cpu time: 7439 real time: 7646 gc time: 456 Not bad. -- Matthias On Apr 19, 2009, at 11:56 AM, Matthew Flatt wrote: > At Sat, 18 Apr 2009 22:57:59 -0400, Matthias Felleisen wrote: >> >> Sigrid, just to get a first idea, I coded up the four most natural >> solutions to this problem with a simple stress test and timed them: >> >> -- vector >> -- sort and count (PR's suggestion) >> -- association list >> -- binary search tree > > Here's one more, using a functional "hash table": > > (define (cnt-ht f) > (cnt-fp f > (lambda () #hash()) > (lambda (ht freq) > (hash-update ht freq add1 0)))) > > The performance is close to the binary-tree performance, probably > because that's how functional hash tables are implemented internally > (but as red-black trees, so they're always balanced). > From carl.eastlund at gmail.com Sun Apr 19 14:13:20 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sun Apr 19 14:13:39 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> Message-ID: <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> Hashes might be an even bigger win on datasets constructed to be sparse, because the vector would allocate many unused slots that hash tables would not. And it might be interesting to throw imperative hashes into the mix. --Carl On Sun, Apr 19, 2009 at 1:59 PM, Matthias Felleisen wrote: > > I forgot about functional hash: > > ?vector: cpu time: 3580 real time: 3626 gc time: 0 > ?alist: ?cpu time: 7784 real time: 8068 gc time: 1380 > ?bst: ? ?cpu time: 15791 real time: 16052 gc time: 368 > ?hash: ? cpu time: 7439 real time: 7646 gc time: 456 > > Not bad. -- Matthias From etanter at dcc.uchile.cl Sun Apr 19 14:52:14 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Sun Apr 19 14:53:19 2009 Subject: [plt-scheme] procedure instrospection In-Reply-To: <18922.6452.890324.962560@winooski.ccs.neu.edu> References: <87vdp3j9an.fsf@mithrandir.homeunix.net> <1F7F7A9A-BCC1-4343-BDAC-8BA0ECCD33AF@ccs.neu.edu> <87myaejxox.fsf@mithrandir.homeunix.net> <18921.31012.311391.949582@winooski.ccs.neu.edu> <87iql2ju0o.fsf@mithrandir.homeunix.net> <18921.33729.745456.393820@winooski.ccs.neu.edu> <87eivqjssy.fsf@mithrandir.homeunix.net> <18921.36129.458545.449985@winooski.ccs.neu.edu> <87ab6ejqje.fsf@mithrandir.homeunix.net> <18922.6452.890324.962560@winooski.ccs.neu.edu> Message-ID: FWIW, I'd be a very interested client of well-designed introspection facilities for PLT Scheme. For language experimentations that would be very valuable, at least from my perspective. Macros already give a nice bit of extensibility, but I've hit the lack of introspection on lambdas a couple of times already. Maybe if the PLT team does not want to directly support it in the core, adding necessary hooks (in the Open Implementation line of thought) would be feasible? This would avoid everyone that needs some facilities to implement completely ad-hoc solutions. -- ?ric On Apr 18, 2009, at 14:17 , Eli Barzilay wrote: > On Apr 18, Jose A. Ortega Ruiz wrote: >> Eli Barzilay writes: >> >>> But the name for the "optional" in the above is `b'... I've put >>> "optional" in quotes since it doesn't have to be an optional >>> argument, it can be anything, and can have behavior that is not >>> related to the other cases in the `case-lambda' form (that's why I >>> used different strings in the above). The resulting arities can >>> also be arbitrary, for example: >>> >>> (case-lambda [(x) 1] >>> [(a b c) 2] >>> [(i j k l m) 3]) >>> >>> has an arity list of (1 3 5), which cannot be described with such >>> an `#:optional'. >> >> OK, i see your point now. what about something like: >> >> (foo [x] [a b c] [i j k l m]) >> >> or >> >> (foo [(x) (a b c) (i j k l m)]) >> >> ? >> >>> Here's another random example from the texpict collection: >>> >>> (define inset/clip >>> (case-lambda >>> [(p l t r b) ...] >>> [(p h v) (inset/clip p h v h v)] >>> [(p a) (inset/clip p a a a a)])) >> >> one could even try to be smart and share common prefixes: >> >> (insert/clip p [l t r b] [h v] [a]) >> >> does that make sense? > > [Yes -- but that's a presentation issue. My point was that there are > all of these additional considerations to make.] > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli > Barzilay: > http://www.barzilay.org/ Maze is > Life! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jao at gnu.org Sun Apr 19 14:28:14 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Sun Apr 19 15:08:35 2009 Subject: [plt-scheme] Re: coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> <92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> Message-ID: <871vrojy69.fsf@mithrandir.homeunix.net> "Jos Koot" writes: [...] > Any people on this list living near Barcelona ??? (for me near = +- > within 300 km) I live in Matar? (in the northern part of the > mediterranean coast of Spain) i live in barcelona... maybe it's time to have a BSUG :) cheers, jao From pedro.e.pinto at gmail.com Sun Apr 19 16:01:24 2009 From: pedro.e.pinto at gmail.com (pp) Date: Sun Apr 19 16:02:01 2009 Subject: [plt-scheme] Re: [OT] Scheme Jobs In-Reply-To: <11b141710904180501o4b6705d4ncdce44773e01deed@mail.gmail.com> References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <49E8EB4C.4060800@neilvandyke.org> <11b141710904180501o4b6705d4ncdce44773e01deed@mail.gmail.com> Message-ID: > Interesting! I always wondered how amazon as a company works (from the > software, stock, shipping perspective). Any interesting articles or > books around about it? http://queue.acm.org/detail.cfm?id=1142065 -pp From sk at cs.brown.edu Sun Apr 19 16:05:48 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Sun Apr 19 16:06:29 2009 Subject: [plt-scheme] Re: [OT] Scheme Jobs In-Reply-To: References: <11b141710904161258i4deef1a7x407f8b5df1c58fb@mail.gmail.com> <49E8EB4C.4060800@neilvandyke.org> <11b141710904180501o4b6705d4ncdce44773e01deed@mail.gmail.com> Message-ID: There are also technical articles in systems conferences about Amazon's association store, etc. [Sorry, I'm not able to look up reference right now.] Similarly for Google (google for "big table").] On Sun, Apr 19, 2009 at 4:01 PM, pp wrote: >> Interesting! I always wondered how amazon as a company works (from the >> software, stock, shipping perspective). Any interesting articles or >> books around about it? > > http://queue.acm.org/detail.cfm?id=1142065 > > -pp > > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jos.koot at telefonica.net Sun Apr 19 17:04:32 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Apr 19 17:04:57 2009 Subject: [plt-scheme] Re: coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d><7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com><932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com><03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d><92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> <871vrojy69.fsf@mithrandir.homeunix.net> Message-ID: <1F586A01BBF44279B8A45373755BC74A@uw2b2dff239c4d> Hi Jose I don't know what a SBUG is (not in wikipedia), but it would be nice to meet people in person with the same interests, if that's what you mean. No se que es un SBUG, pero me gusteria encontrar a gente personalmente con el mismo interes que yo tengo. Disculpeme, no hablo (o escribo) mucho Catala. Jos ----- Original Message ----- From: "Jose A. Ortega Ruiz" To: Sent: Sunday, April 19, 2009 8:28 PM Subject: [plt-scheme] Re: coroutine versus stream > "Jos Koot" writes: > > > [...] > >> Any people on this list living near Barcelona ??? (for me near = +- >> within 300 km) I live in Matar? (in the northern part of the >> mediterranean coast of Spain) > > i live in barcelona... maybe it's time to have a BSUG :) > > cheers, > jao > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From fkoksal at cs.bilgi.edu.tr Sun Apr 19 17:09:08 2009 From: fkoksal at cs.bilgi.edu.tr (=?UTF-8?B?Ik0uIEZhdGloIEvDtmtzYWwi?=) Date: Sun Apr 19 17:09:58 2009 Subject: [plt-scheme] getting slider's values Message-ID: <49EB92F4.9080303@cs.bilgi.edu.tr> Hi all, Is there any way to get the start and the end values of the slider when the user changes the slider's value? (i.e. the values when the user clicks and drags the slider from one point to another) M. Fatih K?ksal ?stanbul Bilgi University Computer Science Department -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090420/8d610aa4/signature.pgp From carl.eastlund at gmail.com Sun Apr 19 17:19:00 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Sun Apr 19 17:19:18 2009 Subject: [plt-scheme] Re: coroutine versus stream In-Reply-To: <1F586A01BBF44279B8A45373755BC74A@uw2b2dff239c4d> References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> <92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> <871vrojy69.fsf@mithrandir.homeunix.net> <1F586A01BBF44279B8A45373755BC74A@uw2b2dff239c4d> Message-ID: <990e0c030904191419qd90e290ka9f75288eee0be78@mail.gmail.com> Based on similar acronyms, I would guess he meant Barcelona Scheme User's Group. --Carl On Sun, Apr 19, 2009 at 5:04 PM, Jos Koot wrote: > Hi Jose > I don't know what a SBUG is (not in wikipedia), but it would be nice to meet > people in person with the same interests, if that's what you mean. > No se que es un SBUG, pero me gusteria encontrar a gente personalmente con > el mismo interes que yo tengo. > Disculpeme, no hablo (o escribo) mucho Catala. > Jos > > > > ----- Original Message ----- From: "Jose A. Ortega Ruiz" > To: > Sent: Sunday, April 19, 2009 8:28 PM > Subject: [plt-scheme] Re: coroutine versus stream > > >> "Jos Koot" writes: >> >> >> [...] >> >>> Any people on this list living near Barcelona ??? (for me near = +- >>> within 300 km) I live in Matar? (in the northern part of the >>> mediterranean coast of Spain) >> >> i live in barcelona... maybe it's time to have a BSUG :) >> >> cheers, >> jao From jos.koot at telefonica.net Sun Apr 19 17:25:36 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Apr 19 17:25:57 2009 Subject: [plt-scheme] Re: coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> <92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> <871vrojy69.fsf@mithrandir.homeunix.net> <1F586A01BBF44279B8A45373755BC74A@uw2b2dff239c4d> <990e0c030904191419qd90e290ka9f75288eee0be78@mail.gmail.com> Message-ID: That sounds plausible. I am not very familiar with acronyms :) Thanks, Jos ----- Original Message ----- From: "Carl Eastlund" To: "Jos Koot" Cc: "Jose A. Ortega Ruiz" ; Sent: Sunday, April 19, 2009 11:19 PM Subject: Re: [plt-scheme] Re: coroutine versus stream Based on similar acronyms, I would guess he meant Barcelona Scheme User's Group. --Carl On Sun, Apr 19, 2009 at 5:04 PM, Jos Koot wrote: > Hi Jose > I don't know what a SBUG is (not in wikipedia), but it would be nice to meet > people in person with the same interests, if that's what you mean. > No se que es un SBUG, pero me gusteria encontrar a gente personalmente con > el mismo interes que yo tengo. > Disculpeme, no hablo (o escribo) mucho Catala. > Jos > > > > ----- Original Message ----- From: "Jose A. Ortega Ruiz" > To: > Sent: Sunday, April 19, 2009 8:28 PM > Subject: [plt-scheme] Re: coroutine versus stream > > >> "Jos Koot" writes: >> >> >> [...] >> >>> Any people on this list living near Barcelona ??? (for me near = +- >>> within 300 km) I live in Matar? (in the northern part of the >>> mediterranean coast of Spain) >> >> i live in barcelona... maybe it's time to have a BSUG :) >> >> cheers, >> jao From jmj at fellowhuman.com Sun Apr 19 17:27:11 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sun Apr 19 17:27:21 2009 Subject: [plt-scheme] initalization problem w/comment-box:snip% subclass Message-ID: Hi all, I'm puzzled by the following: (new comment-box:snip% [with-border? #f]) generates this error: instantiate: unused initialization arguments: (with-border? #f) for instantiated class: -snip% comment-box:snip% is a subclass of editor-snip%, no? What's going on? Thanks, jmj From jao at gnu.org Sun Apr 19 17:32:11 2009 From: jao at gnu.org (Jose A. Ortega Ruiz) Date: Sun Apr 19 17:32:33 2009 Subject: [plt-scheme] Re: coroutine versus stream In-Reply-To: <1F586A01BBF44279B8A45373755BC74A@uw2b2dff239c4d> (Jos Koot's message of "Sun, 19 Apr 2009 23:04:32 +0200") References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d> <7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com> <932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com> <03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d> <92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu> <871vrojy69.fsf@mithrandir.homeunix.net> <1F586A01BBF44279B8A45373755BC74A@uw2b2dff239c4d> Message-ID: <87bpqsib38.fsf@mithrandir.homeunix.net> "Jos Koot" writes: > Hi Jose > I don't know what a SBUG is (not in wikipedia), but it would be nice > to meet people in person with the same interests, if that's what you > mean. Barcelona Scheme User's Group :) And yes, that's what i mean; probably i could enroll a couple of friends for some sort of schemy meetings. I guess we can sort out the details off-list. Cheers, jao From robby at eecs.northwestern.edu Sun Apr 19 17:33:08 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 17:33:30 2009 Subject: [plt-scheme] initalization problem w/comment-box:snip% subclass In-Reply-To: References: Message-ID: <932b2f1f0904191433j1fe0eb88u36eff656b9b5409f@mail.gmail.com> One of the super classes already supplies the with-border? flag as #f (editor-snip:decorated-mixin, to be precise). Did you need it to do something different? Robby On Sun, Apr 19, 2009 at 4:27 PM, Jordan Johnson wrote: > Hi all, > > I'm puzzled by the following: > > ? ? ? ?(new comment-box:snip% [with-border? #f]) > generates this error: > ? ? ? ?instantiate: unused initialization arguments: (with-border? #f) for > instantiated class: -snip% > > comment-box:snip% is a subclass of editor-snip%, no? ?What's going on? > > Thanks, > jmj > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jmj at fellowhuman.com Sun Apr 19 17:45:43 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sun Apr 19 17:46:13 2009 Subject: [plt-scheme] initalization problem w/comment-box:snip% subclass In-Reply-To: <932b2f1f0904191433j1fe0eb88u36eff656b9b5409f@mail.gmail.com> References: <932b2f1f0904191433j1fe0eb88u36eff656b9b5409f@mail.gmail.com> Message-ID: <70379425-3994-43EF-930E-93DE10DB4221@fellowhuman.com> On Apr 19, 2009, at 2:33 PM, Robby Findler wrote: > One of the super classes already supplies the with-border? flag as #f > (editor-snip:decorated-mixin, to be precise). > > Did you need it to do something different? Well, yes...not draw a border. :) Does editor-snip:decorated-mixin draw its own border? jmj > Robby > > On Sun, Apr 19, 2009 at 4:27 PM, Jordan Johnson > wrote: >> Hi all, >> >> I'm puzzled by the following: >> >> (new comment-box:snip% [with-border? #f]) >> generates this error: >> instantiate: unused initialization arguments: (with-border? >> #f) for >> instantiated class: -snip% >> >> comment-box:snip% is a subclass of editor-snip%, no? What's going >> on? >> >> Thanks, >> jmj >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> From jos.koot at telefonica.net Sun Apr 19 17:50:38 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Sun Apr 19 17:50:57 2009 Subject: [plt-scheme] Re: coroutine versus stream References: <6FC8DD44893743CEB4D9BC2BDC23D7BF@uw2b2dff239c4d><7674FADA-B3B0-4733-A551-43B63410DFCD@aol.com><932b2f1f0904181726o6acc951aw1336eab4cfd8e4c0@mail.gmail.com><03BBC8E7D9C74FBEBCDAE46BF5A25307@uw2b2dff239c4d><92B91D35-9908-4829-A5C1-0690E4065317@ccs.neu.edu><871vrojy69.fsf@mithrandir.homeunix.net><1F586A01BBF44279B8A45373755BC74A@uw2b2dff239c4d> <87bpqsib38.fsf@mithrandir.homeunix.net> Message-ID: Responded to off list. Jos ----- Original Message ----- From: "Jose A. Ortega Ruiz" To: "Jos Koot" Cc: Sent: Sunday, April 19, 2009 11:32 PM Subject: Re: [plt-scheme] Re: coroutine versus stream > "Jos Koot" writes: > >> Hi Jose >> I don't know what a SBUG is (not in wikipedia), but it would be nice >> to meet people in person with the same interests, if that's what you >> mean. > > Barcelona Scheme User's Group :) And yes, that's what i mean; probably i > could enroll a couple of friends for some sort of schemy meetings. I > guess we can sort out the details off-list. > > Cheers, > jao > From matthias at ccs.neu.edu Sun Apr 19 18:01:08 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 19 18:02:39 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> Message-ID: So I ran the thing for four different sample sizes: 1000 @ vector: cpu time: 14 real time: 14 gc time: 0 1000 @ a list: cpu time: 14 real time: 14 gc time: 0 1000 @ bst : cpu time: 21 real time: 21 gc time: 0 1000 @ hash : cpu time: 14 real time: 15 gc time: 0 10000 @ vector: cpu time: 82 real time: 86 gc time: 0 10000 @ a list: cpu time: 81 real time: 82 gc time: 0 10000 @ bst : cpu time: 181 real time: 184 gc time: 0 10000 @ hash : cpu time: 93 real time: 94 gc time: 0 100000 @ vector: cpu time: 440 real time: 448 gc time: 0 100000 @ a list: cpu time: 543 real time: 553 gc time: 0 100000 @ bst : cpu time: 1645 real time: 1671 gc time: 23 100000 @ hash : cpu time: 815 real time: 836 gc time: 38 1000000 @ vector: cpu time: 3603 real time: 3669 gc time: 0 1000000 @ a list: cpu time: 8015 real time: 8346 gc time: 1539 1000000 @ bst : cpu time: 15353 real time: 15605 gc time: 349 1000000 @ hash : cpu time: 7632 real time: 7807 gc time: 455 As soon as you have 100,000 frequencies in an approximate range of 20,000 steps, the functional solutions don't look that good compared to vectors. With 1,000,000 it's unquestionable. I bet you can repeat this experiment in C and get similar results. In a sparse world, the results are indifferent. I will leave it to Sigrid to play with imperative hashes and balanced trees and who knows what. The code is attached. It should be easy to play with other parameters of the experiment -- Matthias #lang scheme (require mzlib/etc) (define HIGH 22000) (define LOW 80) ;; Frequency is in [LOW ... HIGH) (define SIZE 1000000) ;; sample size for file (define F "~s: ~s\n") ;; output format for result lines ;; Nat -> Void (define (experiment SIZE) ;; ------------------------------------------------------------------------ ----- ;; creating the sample ;; String Nat -> Void ;; generate file f with n frequencies between 80 and 22000 (define (gen f n) (define (freq) (+ LOW (random (- HIGH LOW)))) (with-output-to-file f (lambda () (for ((i (in-range n))) (printf "~s " (freq)))) #:exists 'truncate)) (define create_output (gen "tmp1" SIZE)) (define (test str f t) (collect-garbage) (printf "~a @ ~a " SIZE str) (time (f "tmp1" t)) (void)) (test "vector:" cnt-vec "tmp-vec") (test "a list:" cnt-alst "tmp-alst") (test "bst :" cnt-BST "tmp-bst") (test "hash :" cnt-ht "tmp-hash")) ;; ------------------------------------------------------------------------ ----- ;; functions for gathering statistics ;; read file f and count how many times each frequency occurs in a vector ;; write result to file g in ascending order of frequencies ;; String String -> Void ;; imperative vector update via [Vectorof Nat] (define (cnt-vec f g) (define a (make-vector (- HIGH LOW))) (define (up freq) (define i (- freq LOW)) (vector-set! a i (+ (vector-ref a i) 1))) (with-input-from-file f (rec loop (lambda () (define nxt (read)) (unless (eof-object? nxt) (up nxt) (loop))))) ;; --- (with-output-to-file g (lambda () (for ((i (in-range (- HIGH LOW)))) (define v (vector-ref a i)) (unless (= v 0) (printf F (+ 80 i) v)))) #:exists 'truncate)) ;; String -> Void ;; sort, then create association list via [Listof [List Nat Nat]] (define (cnt-alst f g) (define l:in (with-input-from-file f (rec L (lambda () (define nxt (read)) (if (eof-object? nxt) '() (cons nxt (L))))))) (define l:st (sort l:in <)) (define res (let L ([l (cdr l:st)][p (car l:st)][c 1]) (if (null? l) '() (let ([a (car l)]) (if (= a p) (L (cdr l) p (+ c 1)) (cons (list p c) (L (cdr l) (car l) 1))))))) (out-al g res)) ;; String String (-> Assoc) (Assoc Nat -> Assoc) (Assoc -> Void) -> Void ;; create association list on the fly (define (cnt-fp f g nu up out) (out (with-input-from-file f (lambda () (let L ([a (nu)]) (define nxt (read)) (if (eof-object? nxt) a (L (up a nxt)))))))) (define (cnt-AL f g) (cnt-fp f g (lambda () '()) (lambda (al freq) (let L ((al al)) (if (null? al) (list (list freq 1)) (let* ([a (car al)] [key (car a)]) (if (= key freq) (cons (list key (+ (cadr a) 1)) (cdr al)) (cons a (L (cdr al)))))))) (lambda (al) (out-al g al)))) (define (cnt-BST f g) (define-struct node (lft info count rgt)) ;; A BST is one of: ;; -- '() ;; -- (make-node BST Frequency Nat BST) (cnt-fp f g (lambda () '()) (lambda (a freq) (let L ([bst a]) (if (null? bst) (make-node '() freq 1 '()) (let* ([a (node-info bst)] [lft (node-lft bst)] [rgt (node-rgt bst)] [cnt (node-count bst)]) (cond [(< freq a) (make-node (L lft) a cnt rgt)] [(= freq a) (make-node lft a (+ cnt 1) rgt)] [else (make-node lft a cnt (L rgt))]))))) (lambda (a) (out g (lambda () (let L ((bst a)) (unless (null? bst) (let* ([a (node-info bst)] [lft (node-lft bst)] [rgt (node-rgt bst)] [cnt (node-count bst)]) (if (and (null? lft) (null? rgt)) (printf F a cnt) (begin (L lft) (printf F a cnt) (L rgt))))))))))) (define (cnt-ht f g) (cnt-fp f g (lambda () #hash()) (lambda (ht freq) (hash-update ht freq add1 0)) (lambda (H) (out g (lambda () (hash-for-each H (lambda (k v) (printf "~s: ~s\n" k v)))))))) ;; ------------------------------------------------------------------------ ----- ;; auxiliaries ;; String (-> Void) -> Void ;; create file f from th (define (out f th) (with-output-to-file f th #:exists 'truncate)) ;; String [Listof (List X Y)] -> Void (define (out-al g res) (out g (lambda () (for-each (lambda (i) (printf F (car i) (cadr i))) res)))) ;; ------------------------------------------------------------------------ ----- (let L ((i 1000)) (unless (> i SIZE) (experiment i) (L (* 10 i)))) From robby at eecs.northwestern.edu Sun Apr 19 18:12:54 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 18:13:13 2009 Subject: [plt-scheme] initalization problem w/comment-box:snip% subclass In-Reply-To: <70379425-3994-43EF-930E-93DE10DB4221@fellowhuman.com> References: <932b2f1f0904191433j1fe0eb88u36eff656b9b5409f@mail.gmail.com> <70379425-3994-43EF-930E-93DE10DB4221@fellowhuman.com> Message-ID: <932b2f1f0904191512q75176cf6vfe944d658038d1fb@mail.gmail.com> On Sun, Apr 19, 2009 at 4:45 PM, Jordan Johnson wrote: > > On Apr 19, 2009, at 2:33 PM, Robby Findler wrote: >> >> One of the super classes already supplies the with-border? flag as #f >> (editor-snip:decorated-mixin, to be precise). >> >> Did you need it to do something different? > > Well, yes...not draw a border. :) What do you consider the border? The semi-colon too? I'm guessing that you also want the border to not take up space, is that right? (that's not what the with-border? flag does, due to the way editor-snip% is set up). Robby From robby at eecs.northwestern.edu Sun Apr 19 18:21:26 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 18:21:46 2009 Subject: [plt-scheme] initalization problem w/comment-box:snip% subclass In-Reply-To: <932b2f1f0904191512q75176cf6vfe944d658038d1fb@mail.gmail.com> References: <932b2f1f0904191433j1fe0eb88u36eff656b9b5409f@mail.gmail.com> <70379425-3994-43EF-930E-93DE10DB4221@fellowhuman.com> <932b2f1f0904191512q75176cf6vfe944d658038d1fb@mail.gmail.com> Message-ID: <932b2f1f0904191521v17571e25l8f272b5cffa0b4c8@mail.gmail.com> Well, I went ahead an mimic'd the old functionality. That is, the with-border? flag now works in SVN, but all it does is avoid drawing the 1 pixel border, nothing else. Robby On Sun, Apr 19, 2009 at 5:12 PM, Robby Findler wrote: > On Sun, Apr 19, 2009 at 4:45 PM, Jordan Johnson wrote: >> >> On Apr 19, 2009, at 2:33 PM, Robby Findler wrote: >>> >>> One of the super classes already supplies the with-border? flag as #f >>> (editor-snip:decorated-mixin, to be precise). >>> >>> Did you need it to do something different? >> >> Well, yes...not draw a border. :) > > What do you consider the border? The semi-colon too? I'm guessing that > you also want the border to not take up space, is that right? (that's > not what the with-border? flag does, due to the way editor-snip% is > set up). > > Robby > From jmj at fellowhuman.com Sun Apr 19 18:40:56 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sun Apr 19 18:41:09 2009 Subject: [plt-scheme] initalization problem w/comment-box:snip% subclass In-Reply-To: <932b2f1f0904191512q75176cf6vfe944d658038d1fb@mail.gmail.com> References: <932b2f1f0904191433j1fe0eb88u36eff656b9b5409f@mail.gmail.com> <70379425-3994-43EF-930E-93DE10DB4221@fellowhuman.com> <932b2f1f0904191512q75176cf6vfe944d658038d1fb@mail.gmail.com> Message-ID: On Apr 19, 2009, at 3:12 PM, Robby Findler wrote: > On Sun, Apr 19, 2009 at 4:45 PM, Jordan Johnson > wrote: >> >> On Apr 19, 2009, at 2:33 PM, Robby Findler wrote: >>> Did you need it to do something different? >> >> Well, yes...not draw a border. :) > > What do you consider the border? The semi-colon too? The border line, only. > I'm guessing that > you also want the border to not take up space, is that right? (that's > not what the with-border? flag does, due to the way editor-snip% is > set up). The space doesn't matter much for my purposes -- it's just that in the situation I'm working with, one of these boxes will always be immediately inside another, and I don't need two borders. I believe I can absorb any extra space by changing my numbers for the outer box's insets (though I haven't played with that). I just saw your other note; thanks. jmj From laplacian42 at gmail.com Sun Apr 19 18:46:50 2009 From: laplacian42 at gmail.com (i j) Date: Sun Apr 19 18:52:13 2009 Subject: [plt-scheme] PLT vs. the world Message-ID: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> Hi, I'm brand new to Scheme. Can you please tell me what the PLT story is? My impression so far is that PLT consists of a group of motivated individuals who want to use Scheme as a productive general purpose language, and so a number of features have been added to facilitate that. It seems to me that a large portion of the Scheme community thinks that's great, and another large portion is apalled at the rash and gratuitous extensions to the basic Scheme language. :) When the subject came up on Reddit, one commenter suggested that PLTers are very strong marketers of their approach. Others suggested that R6RS was basically a product of PLT. Are the changes/additions that PLT makes fluid and subject to improvement later on? Or are they cast in stone, locked into backward-compatibility requirements? Does PLT support the SRFI's (which I'm just learning about) or does PLT go off in its own direction? Also, is there a PLT-specific faq or community-edited wiki anywhere where I might find these questions answered? I see that PLT has substantial docs, but did not find a link to a FAQ or wiki. Thanks for any info! From robby at eecs.northwestern.edu Sun Apr 19 19:02:26 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 19:03:15 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> Message-ID: <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> On Sun, Apr 19, 2009 at 5:46 PM, i j wrote: > Others suggested that R6RS was basically a product of PLT. Just because of the appalling untruth to this one, I thought I'd better just point out what should be obvious to anyone that looks into it even a little bit: there is only one R6RS editor who is a PLT insider (Matthew Flatt), and even he was after a Scheme standard for all Schemes that want progress. The other editors, I presume, would be justifiably annoyed at such claims, since they are not PLT insiders at all. I generally think of this mailing list as a friendly place, and I hope the remainder of this thread bears that out, but please do try to do a little bit of fact checking to make sure you do not repeat nonsense (flame bait, even). Best regards, Robby From robby at eecs.northwestern.edu Sun Apr 19 19:09:24 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 19:09:46 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> Message-ID: <932b2f1f0904191609o123ca14fm9be80f7e1da6e480@mail.gmail.com> On Sun, Apr 19, 2009 at 5:46 PM, i j wrote: > I'm brand new to Scheme. Welcome! > Can you please tell me what the PLT story is? Just sit right back and you'll hear a tale, A tale of a fateful trip That started from this tropic port, Aboard this tiny Ship. .... > My impression so far is that PLT consists of a group of motivated > individuals who want to use Scheme as a productive general purpose > language, and so a number of features have been added to facilitate > that. That's about it. We also tend to be academics. > Are the changes/additions that PLT makes fluid and subject to > improvement later on? Or are they cast in stone, locked into > backward-compatibility requirements? They are fluid, but we try to be somewhat careful with backwards compatibility. In major releases, there are often major changes and we provide porting guides (and sometimes backwards compatible macros are possible to help with that). We've been thru 4 of those in the last 14 or so years. > Does PLT support the SRFI's (which I'm just learning about) or does > PLT go off in its own direction? It supports many. This is not an exclusive or. :) > Also, is there a PLT-specific faq or community-edited wiki anywhere > where I might find these questions answered? I see that PLT has > substantial docs, but did not find a link to a FAQ or wiki. I think that the Scheme cookbook (http://schemecookbook.org/) is the closest thing. There are also user-contributed libraries on PLaneT (http://planet.plt-scheme.org/), which plays some of the role those would play. See also http://www.plt-scheme.org/community.html . hth, Robby From laplacian42 at gmail.com Sun Apr 19 19:14:10 2009 From: laplacian42 at gmail.com (i j) Date: Sun Apr 19 19:14:28 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> Message-ID: <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> On Sun, Apr 19, 2009 at 7:02 PM, Robby Findler wrote: > On Sun, Apr 19, 2009 at 5:46 PM, i j wrote: >> Others suggested that R6RS was basically a product of PLT. > > Just because of the appalling untruth to this one, [snip] > > I generally think of this mailing list as a friendly place, and I hope > the remainder of this thread bears that out, but please do try to do a > little bit of fact checking to make sure you do not repeat nonsense > (flame bait, even). Thanks for the reply, Robby. Certainly not trying to post nonsense or be rude. I do however think it was interesting that this particular commenter's comment (on the site mentioned) was probably taken as truth by many (as it was upvoted pretty well). Perhaps if there were a PLT faq or wiki, these sorts of "apalling untruths" :) could be clarified and easily linked to. From grettke at acm.org Sun Apr 19 19:15:59 2009 From: grettke at acm.org (Grant Rettke) Date: Sun Apr 19 19:16:21 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> Message-ID: <756daca50904191615i3a30a9fdrada947d98215cc80@mail.gmail.com> Hi, On Sun, Apr 19, 2009 at 5:46 PM, i j wrote: > I'm brand new to Scheme. Welcome! > Can you please tell me what the PLT story is? PLT Scheme has great documentation, libraries, community, people, and implementation (with many great languages). > My impression so far is that PLT consists of a group of motivated > individuals Virtually all academics. > who want to use Scheme as a productive general purpose > language, and so a number of features have been added to facilitate > that. Yes, and, for teaching and research. > It seems to me that a large portion of the Scheme community thinks > that's great, and another large portion is apalled at the rash and > gratuitous extensions to the basic Scheme language. :) Do you like chocolate or vanilla? Every community seems to need bogeyman and that of Scheme is no exception. > When the subject came up on Reddit, one commenter suggested that PLTers are > very strong marketers of their approach. We are all marketers of our preferred approach :). > Others suggested that R6RS was basically a product of PLT. R6RS is a product of the committee. See: http://www.r6rs.org/ > Does PLT support the SRFI's (which I'm just learning about) or does > PLT go off in its own direction? Support support support. > Also, is there a PLT-specific faq or community-edited wiki anywhere > where I might find these questions answered? I see that PLT has > substantial docs, but did not find a link to a FAQ or wiki. This list is the best place. Best wishes, Grant From robby at eecs.northwestern.edu Sun Apr 19 19:16:00 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 19:16:43 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> Message-ID: <932b2f1f0904191616m8379495ib9adc51c997b1e91@mail.gmail.com> On Sun, Apr 19, 2009 at 6:14 PM, i j wrote: > On Sun, Apr 19, 2009 at 7:02 PM, Robby Findler > wrote: >> On Sun, Apr 19, 2009 at 5:46 PM, i j wrote: >>> Others suggested that R6RS was basically a product of PLT. >> >> Just because of the appalling untruth to this one, [snip] >> >> I generally think of this mailing list as a friendly place, and I hope >> the remainder of this thread bears that out, but please do try to do a >> little bit of fact checking to make sure you do not repeat nonsense >> (flame bait, even). > > Thanks for the reply, Robby. Certainly not trying to post nonsense or > be rude. I do however think it was interesting that this particular > commenter's comment (on the site mentioned) was probably taken as > truth by many (as it was upvoted pretty well). > > Perhaps if there were a PLT faq or wiki, these sorts of "apalling > untruths" :) could be clarified and easily linked to. Do you mind pointing me to that comment, so I can at least point out the editor situation, or perhaps read this in more detail? Thanks, Robby From robert.winslow at gmail.com Sun Apr 19 19:19:55 2009 From: robert.winslow at gmail.com (rw) Date: Sun Apr 19 19:20:13 2009 Subject: [plt-scheme] Who is working on improving PLT performance? Message-ID: The title says it: Who is doing the work, if anyone? What are you trying to do? Are you looking for help? Robert From robby at eecs.northwestern.edu Sun Apr 19 19:24:05 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 19:24:23 2009 Subject: [plt-scheme] Who is working on improving PLT performance? In-Reply-To: References: Message-ID: <932b2f1f0904191624uffacaefxa44f16dc99b3ed9a@mail.gmail.com> On Sun, Apr 19, 2009 at 6:19 PM, rw wrote: > The title says it: > Who is doing the work, if anyone? > What are you trying to do? In addition to (relatively minor) various continuous improvements that various people do, Matthew Flatt is generally the one doing that kind of thing. He's made lots of improvements to the runtime over the years; the two major improvements were a new garbage collector (based on Adam Wick's dissertation) and a JIT compiler. > Are you looking for help? I'm pretty sure the answer to that one is yes. :) Robby From laplacian42 at gmail.com Sun Apr 19 19:37:14 2009 From: laplacian42 at gmail.com (i j) Date: Sun Apr 19 19:37:36 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <932b2f1f0904191616m8379495ib9adc51c997b1e91@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> <932b2f1f0904191616m8379495ib9adc51c997b1e91@mail.gmail.com> Message-ID: <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> On Sun, Apr 19, 2009 at 7:16 PM, Robby Findler wrote: > On Sun, Apr 19, 2009 at 6:14 PM, i j wrote: >> On Sun, Apr 19, 2009 at 7:02 PM, Robby Findler >> wrote: >>> On Sun, Apr 19, 2009 at 5:46 PM, i j wrote: >>>> Others suggested that R6RS was basically a product of PLT. >>> >>> Just because of the appalling untruth to this one, [snip] >>> >>> I generally think of this mailing list as a friendly place, and I hope >>> the remainder of this thread bears that out, but please do try to do a >>> little bit of fact checking to make sure you do not repeat nonsense >>> (flame bait, even). >> >> Thanks for the reply, Robby. Certainly not trying to post nonsense or >> be rude. I do however think it was interesting that this particular >> commenter's comment (on the site mentioned) was probably taken as >> truth by many (as it was upvoted pretty well). >> >> Perhaps if there were a PLT faq or wiki, these sorts of "apalling >> untruths" :) could be clarified and easily linked to. > > Do you mind pointing me to that comment, so I can at least point out > the editor situation, or perhaps read this in more detail? > > Thanks, > Robby > Heh, after some searching (both my memory, and reddit), finally found it: http://www.reddit.com/r/programming/comments/73r55/scheme_language_steering_committee_election/ (It was the "PLT takes over" comment that I was remembering. And the one after it for that matter.) From jmj at fellowhuman.com Sun Apr 19 19:40:18 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Sun Apr 19 19:40:29 2009 Subject: [plt-scheme] focus question Message-ID: <4CC5E7C2-A309-43F5-A219-BA2B96D77768@fellowhuman.com> Hi all, I have an editor-snip% subclass with two component editor-snip%s (top- snip and bottom-snip). I've written a subclass of aligned-pasteboard % to align these two parts vertically, and so far, that works. I'm now trying to get this behavior: 1) Initially, the top-snip is hidden. 2) When the pasteboard gets focus (which, to me, means the user clicks on it to enter text, same as DrS's comment boxes), the top- snip appears and gets focus. (At this point, the user can also click the bottom-snip and type into it.) 3) When the pasteboard loses focus, the top-snip is again hidden. The questions: - Can I accomplish this with an on-focus handler in the pasteboard? - Is additional machinery needed, and if so, where? Here is relevant code from an attempt at the aligned-pasteboard% subclass: (inherit get-focus-snip set-caret-owner) (define/override (on-focus focus?) (if focus? (begin (send the-top-part show #t) ;; the-top-part, above, is a vertical-alignment% I'm using ;; just for the ability to show/hide, as a wrapper around the snip. (unless (get-focus-snip) (set-caret-owner the-top-snip))) (send top-part show #f))) I've tested this in the REPL and in an independent window, and it seems to successfully accomplish (1) and (2), but not (3). My hunch is that it's because some of the events I want are being handled only by the component snips, but after reading the docs I'm still not clear on how to work around that (if indeed that's the case). Thanks again, jmj From goetter at mazama.net Sun Apr 19 19:53:56 2009 From: goetter at mazama.net (Ben Goetter) Date: Sun Apr 19 19:54:15 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> <932b2f1f0904191616m8379495ib9adc51c997b1e91@mail.gmail.com> <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> Message-ID: <49EBB994.20903@mazama.net> i j wrote: >>> I do however think it was interesting that this particular >>> commenter's comment (on the site mentioned) was probably taken as >>> truth by many (as it was upvoted pretty well). >>> >>> > (It was the "PLT takes over" comment that I was remembering. And the > one after it for that matter.) I wouldn't exactly call two up-votes a Zerg-rush of approval. From robby at eecs.northwestern.edu Sun Apr 19 20:19:18 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Sun Apr 19 20:19:41 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> <932b2f1f0904191616m8379495ib9adc51c997b1e91@mail.gmail.com> <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> Message-ID: <932b2f1f0904191719m2aed2de7t41be4079fedd4a86@mail.gmail.com> On Sun, Apr 19, 2009 at 6:37 PM, i j wrote: > Heh, after some searching (both my memory, and reddit), finally found it: > > http://www.reddit.com/r/programming/comments/73r55/scheme_language_steering_committee_election/ > > (It was the "PLT takes over" comment that I was remembering. And the > one after it for that matter.) Thanks. Amusing reading, definitely. Robby From neil at neilvandyke.org Sun Apr 19 20:51:08 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Sun Apr 19 20:51:48 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> <932b2f1f0904191616m8379495ib9adc51c997b1e91@mail.gmail.com> <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> Message-ID: <49EBC6FC.1020107@neilvandyke.org> Don't worry about it. I'm not a PLT insider, though I have settled on PLT as my default Scheme implementation, after using over a dozen of the others. I think you'll find, when talking to knowledgeable people, that the PLT work is widely respected. There is the occasional academic-type who objects to this-or-that particular property of PLT, or who wishes that their own favorite Scheme implementation were as popular as PLT. Academics are like that, and that's a good thing for diversity in the research ecology. However, I've never heard anyone who actually knew what they were talking about make comments like the ones to which you point. I can only guess where these two comments at the bottom of Reddit are coming from, but I think they're without merit. When choosing a Scheme implementation, I suggest concerning oneself with substantive issues, not with rumors that Matthias plots New World Order in secret drumming circles at the Bohemian Grove. Neil -- http://www.neilvandyke.org/ From plragde at uwaterloo.ca Sun Apr 19 21:47:21 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Sun Apr 19 21:47:55 2009 Subject: [plt-scheme] PLT vs. the world Message-ID: <49EBD429.9020804@uwaterloo.ca> laplacian42 wrote: > I do however think it was interesting that this particular > commenter's comment (on the site mentioned) was probably taken as > truth by many (as it was upvoted pretty well). Received wisdom is not necessarily wise, and what people say in the heat of the moment may not hold up to scrutiny. Just because twenty anonymous strangers upvote a comment does not mean it is true. There is a great deal of good documentation associated with PLT Scheme, and the differences between R6RS and PLT Scheme v4 should be apparent once you spend a while with it. Take a look and decide for yourself. What you see will, I think, intrigue you enough to at least install it and try it out. And that does not preclude you from using other implementations with their own merits. http://docs.plt-scheme.org/ --PR From martindemello at gmail.com Sun Apr 19 21:54:06 2009 From: martindemello at gmail.com (Martin DeMello) Date: Sun Apr 19 21:54:24 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> Message-ID: On Mon, Apr 20, 2009 at 3:31 AM, Matthias Felleisen wrote: > > As soon as you have 100,000 frequencies in an approximate range of 20,000 > steps, the functional solutions don't look that good compared to vectors. > With 1,000,000 it's unquestionable. I bet you can repeat this experiment in > C and get similar results. In a sparse world, the results are indifferent. Something I've been wondering about - is sticking to purely functional data structures really idiomatic scheme? Specifically in PLT, do they buy you any advantage over the imperative, mutable versions? martin From martindemello at gmail.com Sun Apr 19 21:57:36 2009 From: martindemello at gmail.com (Martin DeMello) Date: Sun Apr 19 21:57:58 2009 Subject: [plt-scheme] Re: Should PLT Scheme have two R6RS namespaces? In-Reply-To: References: <756daca50903230704l17110b30oca218416070a634a@mail.gmail.com> <20090323151211.D20746500B7@mail-svr1.cs.utah.edu> <0ff51af4-e0c9-4d4b-bf94-f83de0de570c@37g2000yqp.googlegroups.com> <18887.46589.10007.452872@winooski.ccs.neu.edu> Message-ID: On Wed, Apr 15, 2009 at 9:13 PM, Martin DeMello wrote: > On Mon, Mar 23, 2009 at 9:47 PM, Eli Barzilay wrote: >> On Mar 23, detmammut@googlemail.com wrote: >>> I had a discussion with eli on this allready in IRC. The problem is >>> not so much that these R6RS replacements are not available*, but >>> that someone has to step up to provide test-cases and support. I'll >>> have a week or two a free time starting april so I will port (the >>> testcases for) srfi-1 (unless someone else is faster :) >>> >>> * see https://code.launchpad.net/~ikarus-libraries-team/ikarus-libraries/srfi >> >> What I also said is that dragging a big piece of code like that, >> rather than adapting existing code, is very problematic. > > Isn't one of the points of R6RS that you should be able to do this? Anyone? I'm curious about this, because back when R6RS was being debated, one of the points that got raised was that it would allow libraries to be portable across scheme implementations. Was that abandoned as one of the goals (did I misunderstand it in the first place?) or did R6RS just not deliver on the promise? martin From matthias at ccs.neu.edu Sun Apr 19 22:40:40 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 19 22:42:09 2009 Subject: [plt-scheme] PLT vs. the world In-Reply-To: <49EBC6FC.1020107@neilvandyke.org> References: <1301d5d20904191546u68237255y7bf017e2c2be5d4f@mail.gmail.com> <932b2f1f0904191602i445c42a5n3f57afbec9267ea5@mail.gmail.com> <1301d5d20904191614k5f07d2e8nfb3e7d14262adb5d@mail.gmail.com> <932b2f1f0904191616m8379495ib9adc51c997b1e91@mail.gmail.com> <1301d5d20904191637j19717fbfl58c09e2eb4f12e26@mail.gmail.com> <49EBC6FC.1020107@neilvandyke.org> Message-ID: <05B84835-4842-4529-AB14-DA442E5BE41A@ccs.neu.edu> On Apr 19, 2009, at 8:51 PM, Neil Van Dyke wrote: > Matthias plots New World Order in secret drumming circles at the > Bohemian Grove. Fortunately Robby had already looked up that thing, which I had never heard of. (As a member with standing, I have to deny its existence I was told.) -- Matthias From matthias at ccs.neu.edu Sun Apr 19 22:42:31 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Sun Apr 19 22:44:03 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> Message-ID: On Apr 19, 2009, at 9:54 PM, Martin DeMello wrote: > On Mon, Apr 20, 2009 at 3:31 AM, Matthias Felleisen > wrote: >> >> As soon as you have 100,000 frequencies in an approximate range of >> 20,000 >> steps, the functional solutions don't look that good compared to >> vectors. >> With 1,000,000 it's unquestionable. I bet you can repeat this >> experiment in >> C and get similar results. In a sparse world, the results are >> indifferent. > > Something I've been wondering about - is sticking to purely functional > data structures really idiomatic scheme? Specifically in PLT, do they > buy you any advantage over the imperative, mutable versions? No, we aren't purists. We are pragmatic. When an issue calls for mutation, we have no problem using it. When we can do without, we're better off. The key is to know when there's a call. -- Matthias From noelwelsh at gmail.com Mon Apr 20 01:58:42 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Apr 20 01:59:01 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> Message-ID: On Mon, Apr 20, 2009 at 3:42 AM, Matthias Felleisen wrote: > No, we aren't purists. We are pragmatic. When an issue calls for mutation, > we have no problem using it. When we can do without, we're better off. The > key is to know when there's a call. For this problem imperative = functional. The problem is basically a fold over a list. If the seed/accumulator of the fold never leaks outside the fold (i.e. it cannot be observed until the fold is complete) you can mutate it all you want and still have a functional implementation. This is related to the list monad, but I'm not entirely precise on the details so I won't attempt an explanation. N. From mflatt at cs.utah.edu Mon Apr 20 08:43:45 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Mon Apr 20 08:44:07 2009 Subject: [plt-scheme] Who is working on improving PLT performance? In-Reply-To: References: Message-ID: <20090420124347.1BDF96500A9@mail-svr1.cs.utah.edu> At Sun, 19 Apr 2009 16:19:55 -0700 (PDT), rw wrote: > Who is doing the work, if anyone? > What are you trying to do? > Are you looking for help? I see two directions for general performance improvements: * Unsafe operations: add operations like `unsafe-fx+', `unsafe-fl+', `unsafe-vector-ref', `unsafe-apply-struct-accessor', etc. where some run-time checks can be usefully skipped if unsafe mode (i.e. unsafe from the JIT's perspective) is enabled. This one is relatively straightforward, and I'd welcome help. * Cross-module inlining. The challenge here is fitting into the existing bytecode model. I don't yet know how to make it work, and it's probably too hard for someone not already deep into the runtime system. Of course, we'd also welcome general improvements to the GC or JIT, but I think we're approaching a local maximum in our current architecture. Here's a related idea that would be easier to work on: a tool that takes a starting module and combines all imported code into a single module, stripping away all macro definitions and other compile-time code. This would be suitable for producing stand-alone applications that don't need to expand any code at run time (since macros have been stripped away completely). Depending on how it's implemented, you might get cross-module inlining for free. We created a one-off tool for the programs that we provided during the 2005 ICFP programming contest. That tool worked by `expand'ing all the source modules, and then shuffling S-expressions into a single `module' form. A general version of that tool might be the right thing. Or, since we now have tools to decompile a ".zo" file, it might work better to decompile files instead of starting over with `expand'. It may even make sense to generate new bytecode directly, instead of decompiling and going back through `compile'. [Follow-ups should probably go to the plt-dev list.] From noelwelsh at gmail.com Mon Apr 20 09:41:32 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Mon Apr 20 09:41:51 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> Message-ID: I'd like to retract this statement. I think this is too confusing and possibly controversial to be useful in the context of this discussion. N. On Mon, Apr 20, 2009 at 6:58 AM, Noel Welsh wrote: > For this problem imperative = functional. The problem is basically a > fold over a list. If the seed/accumulator of the fold never leaks > outside the fold (i.e. it cannot be observed until the fold is > complete) you can mutate it all you want and still have a functional > implementation. This is related to the list monad, but I'm not > entirely precise on the details so I won't attempt an explanation. From toddobryan at gmail.com Mon Apr 20 11:23:35 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Mon Apr 20 11:23:55 2009 Subject: [plt-scheme] In Typed Scheme, type for sub1 doesn't include (Integer -> Integer) Message-ID: <904774730904200823i1d20013av27625ffff95f975@mail.gmail.com> Any reason why? The following doesn't work: (: ! (Integer -> Integer)) (define (! n) (cond [(zero? n) 1] [else (* n (! (sub1 n)))])) but change (sub1 n) to (- n 1) and it works fine. Also, is there any way to define subtypes? For example, could I define a "natural-number" type that's limited to non-negative integers? Thanks, Todd P.S. Typed Scheme is fun to play with. :-) From matthias at ccs.neu.edu Mon Apr 20 12:18:00 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 20 12:19:34 2009 Subject: [plt-scheme] In Typed Scheme, type for sub1 doesn't include (Integer -> Integer) In-Reply-To: <904774730904200823i1d20013av27625ffff95f975@mail.gmail.com> References: <904774730904200823i1d20013av27625ffff95f975@mail.gmail.com> Message-ID: <3D421807-623C-4E76-BC69-1FC73A85E977@ccs.neu.edu> There will be soon, e.g., n in Nat such that even? is true, too. Sam has been working on this and it should come out soon -- Matthias On Apr 20, 2009, at 11:23 AM, Todd O'Bryan wrote: > Any reason why? > > The following doesn't work: > > (: ! (Integer -> Integer)) > (define (! n) > (cond > [(zero? n) 1] > [else (* n > (! (sub1 n)))])) > > but change (sub1 n) to (- n 1) and it works fine. > > Also, is there any way to define subtypes? For example, could I define > a "natural-number" type that's limited to non-negative integers? > > Thanks, > Todd > > P.S. Typed Scheme is fun to play with. :-) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dvanhorn at ccs.neu.edu Mon Apr 20 13:13:10 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Mon Apr 20 13:14:14 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <20090419155630.368466500AD@mail-svr1.cs.utah.edu> <8EE16AC1-0356-4007-9B31-B16B7A2A8BC7@ccs.neu.edu> <990e0c030904191113h7d88f0f4m516dcea11da4eee@mail.gmail.com> Message-ID: <49ECAD26.8000908@ccs.neu.edu> Matthias Felleisen wrote: > As soon as you have 100,000 frequencies in an approximate range of > 20,000 steps, the functional solutions don't look that good compared to > vectors. With 1,000,000 it's unquestionable. I bet you can repeat this > experiment in C and get similar results. In a sparse world, the results > are indifferent. > > I will leave it to Sigrid to play with imperative hashes and balanced > trees and who knows what. > > The code is attached. It should be easy to play with other parameters of > the experiment Here's one more using functional random-access lists: (require (prefix-in ra: (planet dvanhorn/ralist:1:7))) (define (cnt-ra f g) (cnt-fp f g (lambda () (ra:make-list (- HIGH LOW) 0)) (lambda (ls freq) (ra:list-update ls (- freq LOW) add1)) (lambda (ls) (out g (lambda () (for ((v (ra:in-list ls)) (i (in-range (- HIGH LOW)))) (unless (= v 0) (printf F (+ 80 i) v)))))))) [Add (test "ralist:" cnt-ra "tmp-ra") to `experement'.] For large sizes, the performance is worse than hash tables but better than BSTs. David 1000 @ vector: cpu time: 18 real time: 29 gc time: 0 1000 @ a list: cpu time: 16 real time: 19 gc time: 0 1000 @ bst : cpu time: 25 real time: 27 gc time: 0 1000 @ hash : cpu time: 13 real time: 13 gc time: 0 1000 @ ralist: cpu time: 30 real time: 31 gc time: 0 10000 @ vector: cpu time: 94 real time: 102 gc time: 0 10000 @ a list: cpu time: 93 real time: 96 gc time: 0 10000 @ bst : cpu time: 196 real time: 200 gc time: 0 10000 @ hash : cpu time: 108 real time: 111 gc time: 0 10000 @ ralist: cpu time: 147 real time: 151 gc time: 0 100000 @ vector: cpu time: 540 real time: 560 gc time: 0 100000 @ a list: cpu time: 740 real time: 763 gc time: 0 100000 @ bst : cpu time: 1967 real time: 2014 gc time: 51 100000 @ hash : cpu time: 1036 real time: 1160 gc time: 96 100000 @ ralist: cpu time: 1217 real time: 1255 gc time: 48 1000000 @ vector: cpu time: 4373 real time: 4475 gc time: 0 1000000 @ a list: cpu time: 9155 real time: 9357 gc time: 1768 1000000 @ bst : cpu time: 19721 real time: 20158 gc time: 967 1000000 @ hash : cpu time: 9978 real time: 10271 gc time: 1269 1000000 @ ralist: cpu time: 11272 real time: 11537 gc time: 635 From grettke at acm.org Mon Apr 20 15:22:46 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Apr 20 15:23:05 2009 Subject: [plt-scheme] Is it helpful to flag set!s to variables outside of a define form? Message-ID: <756daca50904201222s673ec086oe4628045864ff246@mail.gmail.com> It is sort of ironic, in the Java world, that most Java developers seem to look down on the idea of "side-effect" free programming, ala pure functional programming in Scheme for example. It is ironic for two reasons: 1. Classes are a very convenient way to manage side effects and state. 2. Java tooling is tailored to help programmers manage the terrible things that can happen due to confusion/misunderstanding about state because it can be hard to manage in big multi-developer projects. Here is an example, in the IDE that I use at work I have the following syntax coloring configuration set up: 1. Everything is white by default. 2. String are yellow. Comments are green. // here is the relevant part 3. Method local variables are light blue. 4. Method arguments are pink. 5. Class variables are *bold* 6. Static variables are italic. 7. Reassignments of parameters and local variables are highlighted with an enclosing box. This arrangement makes it very easy for programmers doing maintenance coding, or new development, or code reviews, to pick up on bad "code smells". In fact without it, it would be nearly impossible to *quickly* get a sense for "what is happening". Would it be interesting, in DrScheme, to have check-syntax flag set!s that occur on variables defined outside of the 'define' form? I suppose when functions are small, it is obvious. Perhaps this problem doesn't occur in the Scheme world. From gabor.lists at mndl.hu Mon Apr 20 15:37:08 2009 From: gabor.lists at mndl.hu (gabor papp) Date: Mon Apr 20 15:44:19 2009 Subject: [plt-scheme] osx embedded app and mzlib Message-ID: <49ECCEE4.2040507@mndl.hu> i'm trying to make an osx application of a program called fluxus that embeds plt scheme. i included the PLT_MrEd framework in the application, as well as some plt modules that seem to be required: compiler, config, defaults, frtime, lang, mzlib, mzscheme, scheme, setup, srfi, stxclass, syntax, xml. when i run the application it exists with the following error message: Applications/Fluxus.app/Contents/Resources/collects/mzlib/unit.ss:1460:38: syntax: no pattern variables before ellipses in template at: ... in: ((import i.s ...) (export e.s ...) dep . body) i'm using plt 4.1.5, it seemed to be working fine with 4.1.4. any help would be appreciated. thanks, gabor From keydana at gmx.de Mon Apr 20 16:10:01 2009 From: keydana at gmx.de (keydana@gmx.de) Date: Mon Apr 20 16:10:30 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> Message-ID: <9F774C34-5F3F-48DD-818C-50CFE6B0B007@gmx.de> Hi Matthias, hi all, please excuse the delay of my answer - it's an answer to this discussion's state from yesterday morning only - I did the coding yesterday, but didn't finish and couldn't do anything during working hours today ( and also I'm not so fast at writing scheme code - and, to be honest, understanding algorithms) - yet) ... In fact the "cnt-AL" (functional update of alist) implementation was what I would have liked to write in the beginning but could not really imagine how to do, let alone the pretty "cnt-alst" implementation. Regarding everything that has been posted to this thread in the meantime, and also the general level of the posts, I don't think my "experiments" will be of much interest to you - but really I don't want to be impolite (just asking for information and not doing anything myself ...), so I'll just write what I tried yesterday regarding the following task: > > What I didn't time is writing out a sorted file at the end from the > 'association map' because I figured that I can do this in linear > time in all cases though I realize now that in the FP case, I get to > traverse the actual elements in the file in linear time while in the > Imperative case, I get to traverse ALL. Still, a vector traversal > should be fast enough. > > I will leave it to you to time the rest. Report to the list what you > find -- Matthias First, in order to be able to compare the impact of the counting and sorting steps, I removed from the functions the input-getting part (also in my original task, I was operating on lists already at that point). [This way, they also got easier as I could replace the before- unknown-to-me recur by a simple named let :-). In fact I also assumed that factoring out the IO operation would make the differences between the algorithms even bigger, but it does not really look like this when I take my result for define SIZE 1000000: Original operation on file: cnt-vec: cpu time: 3058 real time: 3107 gc time: 0 cnt-alst: cpu time: 6408 real time: 6626 gc time: 1477 cnt-BST: cpu time: 7927 real time: 7943 gc time: 64 Operation on list: cnt-vec: cpu time: 601 real time: 602 gc time: 0 cnt-alst: cpu time: 1206 real time: 1233 gc time: 134 cnt-BST: cpu time: 6419 real time: 6438 gc time: 76 Regarding the sorting, I did not understand the sentence "in the FP case, I get to traverse the actual elements in the file in linear time while in the Imperative case, I get to traverse ALL." - to me "all" would mean the same as linear, i.e. O(n)? In fact for the sorting, I had just naively assumed I would use PLT's sort for the list, and though I did not look up its implementation I would assume it should be O (n log n) e.g. like a mergesort. So I'd simply written (define sort-alist (lambda (lst) (sort lst (lambda (x y) (> (cadr x) (cadr y)))))) For the vector, I don't know if this is stupid but I could not think of anything better than transforming the vector into an alist first, and then do the same sorting, like (define sort-cnt-vec-from-list (lambda (lst) (sort-alist (vector->alist (cnt-vec-from-list lst))))) (define vector->alist (lambda (vec) (do ((i 0 (+ i 1)) (res '() (if (= (vector-ref vec i) 0) res (cons (list (+ i LOW) (vector-ref vec i)) res)))) ((= i (vector-length vec)) (reverse res)) (void)))) So with this procedure, the sorting of the vector would also be in O (n log n), and so the whole sorting step should not make any difference. In fact my results confirmed this: sort-cnt-vec-from-list: cpu time: 657 real time: 658 gc time: 0 sort-cnt-alst-from-list: cpu time: 1091 real time: 1093 gc time: 0 So these were my naive results so far - seemed better to just write this than to not reply to this thread at all any more :-) For the algorithms posted in the meantime, I will certainly take a look at them but I also need time for this ... thanks to all of you anyway for the helpful hints and explanations :-) Ciao Sigrid From sbloch at adelphi.edu Mon Apr 20 16:27:16 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Mon Apr 20 16:28:02 2009 Subject: [BULK] [plt-scheme] Is it helpful to flag set!s to variables outside of a define form? In-Reply-To: <756daca50904201222s673ec086oe4628045864ff246@mail.gmail.com> References: <756daca50904201222s673ec086oe4628045864ff246@mail.gmail.com> Message-ID: <1394BD2E-801F-497B-B995-434DAF440286@adelphi.edu> On Apr 20, 2009, at 3:22 PM, Grant Rettke wrote: > It is sort of ironic, in the Java world, that most Java developers > seem to look down on the idea of "side-effect" free programming, ala > pure functional programming in Scheme for example. It is ironic for > two reasons:... There's a whole section in the Sun Swing tutorials on why immutable objects are good for you and how to convert a mutable class into an immutable one. Stephen Bloch sbloch@adelphi.edu From grettke at acm.org Mon Apr 20 16:30:27 2009 From: grettke at acm.org (Grant Rettke) Date: Mon Apr 20 16:30:48 2009 Subject: [BULK] [plt-scheme] Is it helpful to flag set!s to variables outside of a define form? In-Reply-To: <1394BD2E-801F-497B-B995-434DAF440286@adelphi.edu> References: <756daca50904201222s673ec086oe4628045864ff246@mail.gmail.com> <1394BD2E-801F-497B-B995-434DAF440286@adelphi.edu> Message-ID: <756daca50904201330q2f2385ebtabc07677bb1a7e8a@mail.gmail.com> On Mon, Apr 20, 2009 at 3:27 PM, Stephen Bloch wrote: > There's a whole section in the Sun Swing tutorials on why immutable objects > are good for you and how to convert a mutable class into an immutable one. Thanks, though people working with Swing are bound to hate any material associated with it :). From matthias at ccs.neu.edu Mon Apr 20 20:30:46 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Mon Apr 20 20:32:17 2009 Subject: [plt-scheme] help on how to write a frequency-counting function in a more functional way In-Reply-To: <9F774C34-5F3F-48DD-818C-50CFE6B0B007@gmx.de> References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <9F774C34-5F3F-48DD-818C-50CFE6B0B007@gmx.de> Message-ID: Consider writing a file generator (or list generator) that produces sample inputs close to your real use case. That may reveal something none of us has thought of -- Matthias On Apr 20, 2009, at 4:10 PM, keydana@gmx.de wrote: > Hi Matthias, hi all, > > please excuse the delay of my answer - it's an answer to this > discussion's state from yesterday morning only - I did the coding > yesterday, but didn't finish and couldn't do anything during > working hours today ( and also I'm not so fast at writing scheme > code - and, to be honest, understanding algorithms) - yet) ... > In fact the "cnt-AL" (functional update of alist) implementation > was what I would have liked to write in the beginning but could not > really imagine how to do, let alone the pretty "cnt-alst" > implementation. > > Regarding everything that has been posted to this thread in the > meantime, and also the general level of the posts, I don't think my > "experiments" will be of much interest to you - but really I don't > want to be impolite (just asking for information and not doing > anything myself ...), so I'll just write what I tried yesterday > regarding the following task: > > >> >> What I didn't time is writing out a sorted file at the end from >> the 'association map' because I figured that I can do this in >> linear time in all cases though I realize now that in the FP case, >> I get to traverse the actual elements in the file in linear time >> while in the Imperative case, I get to traverse ALL. Still, a >> vector traversal should be fast enough. >> >> I will leave it to you to time the rest. Report to the list what >> you find -- Matthias > > First, in order to be able to compare the impact of the counting > and sorting steps, I removed from the functions the input-getting > part (also in my original task, I was operating on lists already at > that point). [This way, they also got easier as I could replace the > before-unknown-to-me recur by a simple named let :-). In fact I > also assumed that factoring out the IO operation would make the > differences between the algorithms even bigger, but it does not > really look like this when I take my result for define SIZE 1000000: > > > Original operation on file: > cnt-vec: cpu time: 3058 real time: 3107 gc time: 0 > cnt-alst: cpu time: 6408 real time: 6626 gc time: 1477 > cnt-BST: cpu time: 7927 real time: 7943 gc time: 64 > > Operation on list: > cnt-vec: cpu time: 601 real time: 602 gc time: 0 > cnt-alst: cpu time: 1206 real time: 1233 gc time: 134 > cnt-BST: cpu time: 6419 real time: 6438 gc time: 76 > > > Regarding the sorting, I did not understand the sentence "in the FP > case, I get to traverse the actual elements in the file in linear > time while in the Imperative case, I get to traverse ALL." - to me > "all" would mean the same as linear, i.e. O(n)? > In fact for the sorting, I had just naively assumed I would use > PLT's sort for the list, and though I did not look up its > implementation I would assume it should be O (n log n) e.g. like a > mergesort. > So I'd simply written > > (define sort-alist > (lambda (lst) > (sort lst (lambda (x y) (> (cadr x) (cadr y)))))) > > For the vector, I don't know if this is stupid but I could not > think of anything better than transforming the vector into an alist > first, and then do the same sorting, like > > (define sort-cnt-vec-from-list > (lambda (lst) > (sort-alist (vector->alist (cnt-vec-from-list lst))))) > > (define vector->alist > (lambda (vec) > (do ((i 0 (+ i 1)) (res '() (if (= (vector-ref vec i) 0) res > (cons (list (+ i LOW) (vector-ref vec i)) res)))) > ((= i (vector-length vec)) (reverse res)) > (void)))) > > So with this procedure, the sorting of the vector would also be in > O (n log n), and so the whole sorting step should not make any > difference. > > In fact my results confirmed this: > > sort-cnt-vec-from-list: cpu time: 657 real time: 658 gc time: 0 > sort-cnt-alst-from-list: cpu time: 1091 real time: 1093 gc time: 0 > > > So these were my naive results so far - seemed better to just write > this than to not reply to this thread at all any more :-) > For the algorithms posted in the meantime, I will certainly take a > look at them but I also need time for this ... thanks to all of you > anyway for the helpful hints and explanations :-) > > Ciao > Sigrid > > > > From gadva1g at gmail.com Sun Apr 19 01:20:36 2009 From: gadva1g at gmail.com (gadva) Date: Mon Apr 20 23:52:39 2009 Subject: [plt-scheme] Re: Newbie question about PLT web application In-Reply-To: References: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> Message-ID: <74a1b482-8e82-4804-a41a-a02a2f50f0d8@r37g2000yqn.googlegroups.com> Thanks for the quick reply, Sorry If I was unclear with the question, I just haven't had that much experience with setting up a web server before, and with networking in general so I'm not sure about the right terminology yet. I guess my question was how to setup the application to serve requests to users connecting to my server by typing http://serverIP:8000/myapplication.ss. Because right now when I test it on a browser from within the server it runs ok, but when I attempt to connect from a different computer it does not work. So by using the code described above (and in the PLT Blog Application example from the website) (basically using web-sever/ insta, serve/servlet) I am running the application on a selected port, so when a user connects to my IP adress with the correct port etc shouldn't the web server accept a request and respond with the HTML page that I define? (I am using my own Linux box with a static IP to run the scheme server on) Thanks again for your reply, gadva From clements at brinckerhoff.org Tue Apr 21 00:02:18 2009 From: clements at brinckerhoff.org (John Clements) Date: Tue Apr 21 00:04:13 2009 Subject: [plt-scheme] Re: Newbie question about PLT web application In-Reply-To: <74a1b482-8e82-4804-a41a-a02a2f50f0d8@r37g2000yqn.googlegroups.com> References: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> <74a1b482-8e82-4804-a41a-a02a2f50f0d8@r37g2000yqn.googlegroups.com> Message-ID: On Apr 18, 2009, at 10:20 PM, gadva wrote: > Thanks for the quick reply, > > Sorry If I was unclear with the question, I just haven't had that much > experience with setting up a web server before, and with networking in > general so I'm not sure about the right terminology yet. > > I guess my question was how to setup the application to serve requests > to users connecting to my server by typing http://serverIP:8000/myapplication.ss > . > > Because right now when I test it on a browser from within the server > it runs ok, but when I attempt to connect from a different computer it > does not work. So by using the code described above (and in the PLT > Blog Application example from the website) (basically using web-sever/ > insta, serve/servlet) I am running the application on a selected port, > so when a user connects to my IP adress with the correct port etc > shouldn't the web server accept a request and respond with the HTML > page that I define? Speaking very generally, yes. My guess is that the external requests are not reaching your web server, either because of a software firewall or because of an external network firewall. One easy test is to try to contact the your PLT web server on the given port using a simple telnet client from another machine, e.g.: my-other-machine% telnet serverIP 8000 If it goes through... well, I'd be surprised. My guess is that it will fail, but it can fail in two very different ways: most firewalls refuse to answer entirely, in order to increase the cost of port scanning. So if you get an immediate "server is not answering" message, then there's probably no firewall in place. If you just get a stalled telnet, then there's probably a firewall in place. FWIW, there are about 150 things that could be going wrong here; my confidence that I'm steering you in the right direction is only slightly higher than 50%. All the best, John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090420/422450e9/smime.bin From yinso.chen at gmail.com Tue Apr 21 04:58:20 2009 From: yinso.chen at gmail.com (YC) Date: Tue Apr 21 04:58:41 2009 Subject: [plt-scheme] dynamic-wind & kill-thread Message-ID: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> Hi - what happens when a thread is killed in the middle of executing a dynamic-wind block? Does the post-thunk get executed still? I am tracing my hanging thread problembased on Matthew's recommendatioin, and the trace lead me to a dynamic-wind block that first wait on a semaphore and release it in post-thunk. If the thread can be killed without executing post-thunk then the next thread would wait indefinitely (which appears to be what I am experiencing). If I am on the right track - how can one write kill-safe semaphore code? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/d752b144/attachment.htm From robby at eecs.northwestern.edu Tue Apr 21 06:42:30 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 21 06:42:48 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> Message-ID: <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> On Tue, Apr 21, 2009 at 3:58 AM, YC wrote: > Hi - > > what happens when a thread is killed in the middle of executing a > dynamic-wind block?? Does the post-thunk get executed still? No, it doesn't. > I am tracing my hanging thread problem based on Matthew's recommendatioin, > and the trace lead me to a dynamic-wind block that first wait on a semaphore > and release it in post-thunk.? If the thread can be killed without executing > post-thunk then the next thread would wait indefinitely (which appears to be > what I am experiencing). > > If I am on the right track - how can one write kill-safe semaphore code? In general, one might have to rewrite the program to make it kill-safe. That is, there is no way to just take code that synchronizes in some arbitrary way and make it kill-safe. Perhaps if you can say more about what the actual syncronization protocol is, we can help you make it kill-safe. Robby From jay.mccarthy at gmail.com Tue Apr 21 07:33:33 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Apr 21 07:33:55 2009 Subject: [plt-scheme] Re: Newbie question about PLT web application In-Reply-To: References: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> <74a1b482-8e82-4804-a41a-a02a2f50f0d8@r37g2000yqn.googlegroups.com> Message-ID: Another thing to do is to switch to serve/servlet and add #:listen-ip #f to the arguments. Jay On Mon, Apr 20, 2009 at 10:02 PM, John Clements wrote: > > On Apr 18, 2009, at 10:20 PM, gadva wrote: > >> Thanks for the quick reply, >> >> Sorry If I was unclear with the question, I just haven't had that much >> experience with setting up a web server before, and with networking in >> general so I'm not sure about the right terminology yet. >> >> I guess my question was how to setup the application to serve requests >> to users connecting to my server by typing >> http://serverIP:8000/myapplication.ss. >> >> Because right now when I test it on a browser from within the server >> it runs ok, but when I attempt to connect from a different computer it >> does not work. So by using the code described above (and in the PLT >> Blog Application example from the website) (basically using web-sever/ >> insta, serve/servlet) I am running the application on a selected port, >> so when a user connects to my IP adress with the correct port etc >> shouldn't the web server accept a request and respond with the HTML >> page that I define? > > Speaking very generally, yes. > > My guess is that the external requests are not reaching your web server, > either because of a software firewall or because of an external network > firewall. > > One easy test is to try to contact the your PLT web server on the given port > using a simple telnet client from another machine, e.g.: > > my-other-machine% telnet serverIP 8000 > > If it goes through... well, I'd be surprised. ?My guess is that it will > fail, but it can fail in two very different ways: most firewalls refuse to > answer entirely, in order to increase the cost of port scanning. ?So if you > get an immediate "server is not answering" message, then there's probably no > firewall in place. ?If you just get a stalled telnet, then there's probably > a firewall in place. > > FWIW, there are about 150 things that could be going wrong here; my > confidence that I'm steering you in the right direction is only slightly > higher than 50%. > > All the best, > > John Clements > > > > _________________________________________________ > ?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 diggerrrrr at gmail.com Tue Apr 21 09:15:46 2009 From: diggerrrrr at gmail.com (Veer) Date: Tue Apr 21 09:16:05 2009 Subject: [plt-scheme] snooze installation : libsqlite3.so not found Message-ID: When running the db.ss file from quick start section of snooze , i get this error: ffi-lib: couldn't open "libsqlite3.so" (libsqlite3.so: cannot open shared object file: No such file or directory) I am on Ubuntu and using DrScheme ver 4.1.5 . >From the package manager i can see libsqlite3-0 shared library is already installed. Do i have to make some link ? Please guide. Thanks. From diggerrrrr at gmail.com Tue Apr 21 09:26:46 2009 From: diggerrrrr at gmail.com (Veer) Date: Tue Apr 21 09:27:08 2009 Subject: [plt-scheme] Re: snooze installation : libsqlite3.so not found In-Reply-To: References: Message-ID: All right , creating a symbolic link worked. Sorry for spam! On Tue, Apr 21, 2009 at 6:45 PM, Veer wrote: > When running the db.ss file from quick start section of snooze , i get > this error: > > ffi-lib: couldn't open "libsqlite3.so" (libsqlite3.so: cannot open > shared object file: No such file or directory) > > I am on Ubuntu and using DrScheme ver 4.1.5 . > > From the package manager i can see libsqlite3-0 shared library is > already installed. > Do i have to make some link ? ?Please guide. > > Thanks. > From diggerrrrr at gmail.com Tue Apr 21 10:42:25 2009 From: diggerrrrr at gmail.com (Veer) Date: Tue Apr 21 10:42:48 2009 Subject: [plt-scheme] Re: snooze installation : libsqlite3.so not found In-Reply-To: References: Message-ID: Example given here : http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/6/planet-docs/snooze/quick.html when run takes around 1 minute to produce the result. Is there some special configuration required to speed up the execution? On Tue, Apr 21, 2009 at 6:56 PM, Veer wrote: > All right , creating a symbolic link worked. > Sorry for spam! > > > > > On Tue, Apr 21, 2009 at 6:45 PM, Veer wrote: >> When running the db.ss file from quick start section of snooze , i get >> this error: >> >> ffi-lib: couldn't open "libsqlite3.so" (libsqlite3.so: cannot open >> shared object file: No such file or directory) >> >> I am on Ubuntu and using DrScheme ver 4.1.5 . >> >> From the package manager i can see libsqlite3-0 shared library is >> already installed. >> Do i have to make some link ? ?Please guide. >> >> Thanks. >> > From d.j.gurnell at gmail.com Tue Apr 21 11:39:13 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Tue Apr 21 11:39:54 2009 Subject: [plt-scheme] Re: snooze installation : libsqlite3.so not found In-Reply-To: References: Message-ID: <53EB4801-2B91-4933-B7BB-9BE27F657795@gmail.com> > Example given here : > > http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/6/planet-docs/snooze/quick.html > > when run takes around 1 minute to produce the result. > > Is there some special configuration required to speed up the > execution? There shouldn't be. My first guess is it could be some issue to do with compilation or PLaneT downloads on your system. Here's a quick test. Put something like (printf "go!~n") right after the (require ...) statements in your test module and run the code: - If it takes a minute for "Go" to appear, the problem is likely to be something other than DB related. - If "Go" appears immediately and the other messages take a minute to appear, it's probably a DB related problem. At any rate, the first message to be delayed will give you a clue as to what's going wrong. If it's definitely DB related, post your code from the quick start in case there's something I haven't thought of. It could be a bug in Snooze or it could be related to your SQLite installation. -- Dave From diggerrrrr at gmail.com Tue Apr 21 12:14:37 2009 From: diggerrrrr at gmail.com (Veer) Date: Tue Apr 21 12:14:59 2009 Subject: [plt-scheme] Re: snooze installation : libsqlite3.so not found In-Reply-To: <53EB4801-2B91-4933-B7BB-9BE27F657795@gmail.com> References: <53EB4801-2B91-4933-B7BB-9BE27F657795@gmail.com> Message-ID: I think you are right its not DB related. #lang scheme (printf "before") (require "db.ss") (printf "after") Both "before" and "after" takes long time. Any idea why? Same in db.ss . I will try build plt scheme from source and try again . Thanks for replying Veer On Tue, Apr 21, 2009 at 9:09 PM, Dave Gurnell wrote: >> Example given here : >> >> >> http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/6/planet-docs/snooze/quick.html >> >> when run takes around 1 minute to produce the result. >> >> Is there some special configuration required to speed up the execution? > > There shouldn't be. My first guess is it could be some issue to do with > compilation or PLaneT downloads on your system. > Here's a quick test. Put something like (printf "go!~n") right after the > (require ...) statements in your test module and run the code: > > ?- If it takes a minute for "Go" to appear, the problem is likely to be > something other than DB related. > ?- If "Go" appears immediately and the other messages take a minute to > appear, it's probably a DB related problem. > > At any rate, the first message to be delayed will give you a clue as to > what's going wrong. > > If it's definitely DB related, post your code from the quick start in case > there's something I haven't thought of. It could be > a bug in Snooze or it could be related to your SQLite installation. > > -- Dave > _________________________________________________ > ?For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at eecs.northwestern.edu Tue Apr 21 12:16:19 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 21 12:16:42 2009 Subject: [plt-scheme] Re: snooze installation : libsqlite3.so not found In-Reply-To: References: <53EB4801-2B91-4933-B7BB-9BE27F657795@gmail.com> Message-ID: <932b2f1f0904210916m1870e9a5p7a6af97caa1cbb80@mail.gmail.com> The requires always happen before anything else in the body of a module. Robby On Tue, Apr 21, 2009 at 11:14 AM, Veer wrote: > I think you are right its not DB related. > > #lang scheme > (printf "before") > (require "db.ss") > (printf "after") > > Both ?"before" and "after" takes long time. ?Any idea why? > Same in db.ss . > I will try build plt scheme from source and try again . > > Thanks for replying > Veer > > > > On Tue, Apr 21, 2009 at 9:09 PM, Dave Gurnell wrote: >>> Example given here : >>> >>> >>> http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/6/planet-docs/snooze/quick.html >>> >>> when run takes around 1 minute to produce the result. >>> >>> Is there some special configuration required to speed up the execution? >> >> There shouldn't be. My first guess is it could be some issue to do with >> compilation or PLaneT downloads on your system. >> Here's a quick test. Put something like (printf "go!~n") right after the >> (require ...) statements in your test module and run the code: >> >> ?- If it takes a minute for "Go" to appear, the problem is likely to be >> something other than DB related. >> ?- If "Go" appears immediately and the other messages take a minute to >> appear, it's probably a DB related problem. >> >> At any rate, the first message to be delayed will give you a clue as to >> what's going wrong. >> >> If it's definitely DB related, post your code from the quick start in case >> there's something I haven't thought of. It could be >> a bug in Snooze or it could be related to your SQLite installation. >> >> -- Dave >> _________________________________________________ >> ?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 marc.chamly at gmail.com Tue Apr 21 13:23:24 2009 From: marc.chamly at gmail.com (CHAMLY) Date: Tue Apr 21 13:32:05 2009 Subject: [plt-scheme] Gif in canvas Message-ID: <73B1C9CB-0A8C-4A96-9AB9-044B2580096D@gmail.com> Hi All, I need to put an animated Gif in a Canvas, If i use this command: (send (send canvas get-dc) draw-bitamp bitmap 0 0 'solid) With a non-animated GIF it works, And when the Gif is animated... Well it doesn't :P , If anyone knows how to put an animated Gif in a canvas.. Well I'm listening. Thank You. Marc From yinso.chen at gmail.com Tue Apr 21 13:42:49 2009 From: yinso.chen at gmail.com (YC) Date: Tue Apr 21 13:43:08 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> Message-ID: <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> On Tue, Apr 21, 2009 at 3:42 AM, Robby Findler wrote: > > what happens when a thread is killed in the middle of executing a > > dynamic-wind block? Does the post-thunk get executed still? > > No, it doesn't. > Thanks for the verification. In general, one might have to rewrite the program to make it > kill-safe. That is, there is no way to just take code that > synchronizes in some arbitrary way and make it kill-safe. Perhaps if > you can say more about what the actual syncronization protocol is, we > can help you make it kill-safe. I try to verify the possibility first to ensure my bug report is not bogus :) The blocked code exists in planet package schematics spgsql.plt, in private/p3.ss & private/connection.ss. Inside - it uses a semaphore to lock the critical region. The function protocol3:new-exchange waits for the semaphore, and protocol3:end-exchange releases the semaphore. protocol3:end-exchange appears to be only called by base%:end-exchange in private/connection.ss, which appears to be only called in primitive-query-mixin:with-final-end-exchange, which generates a dynamic-wind block that calls the end-exchange in post-thunk. My threads eventually block on protocol3:new-exchange, which appears to be waiting for a semaphore that's never released (and if dynamic-wind is not kill-safe that it can explain the behavior). This behavior is intermittent and hard to reproduce, but definitely there (as once it happens my app does nothing). Without Matthew's stack tracing approach I could not find out where it was blocking and how. Below is the code snippet from the two files. ;; private/p3.ss ;; protocol3:new-exchange : protocol3 -> stream (define (protocol3:new-exchange protocol) (semaphore-wait (protocol3-ownerlock protocol)) ...) ;; protocol3:end-exchange : protocol3 -> void (define (protocol3:end-exchange protocol) (semaphore-post (protocol3-ownerlock protocol))) ;; private/connection.ss ;; base% (define base% (class* object% (base<%>) ... ;; new-exchange : -> stream (define/public-final (new-exchange) (unless protocol (raise-user-error 'connection<%> "not connected")) (protocol3:new-exchange protocol)) ;; end-exchange : -> void (define/public-final (end-exchange) (unless protocol (raise-user-error 'connection<%> "not connected")) (protocol3:end-exchange protocol)) ...)) (define primitive-query-mixin (mixin (base<%>) (primitive-query<%>) ... (define-syntax with-final-end-exchange (syntax-rules () [(with-final-end-exchange . b) (dynamic-wind void (lambda () . b) (lambda () (end-exchange)))])) ...)) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/e920b553/attachment.htm From diggerrrrr at gmail.com Tue Apr 21 14:20:00 2009 From: diggerrrrr at gmail.com (Veer) Date: Tue Apr 21 14:20:22 2009 Subject: [plt-scheme] Re: snooze installation : libsqlite3.so not found In-Reply-To: References: Message-ID: Program seems to run normally now. Removing .plt-scheme dir and running setup-plt(as adviced Danny) and running the program again seems to do the trick. Now when i again run the setup-plt i get these error and warnings not in any order: WARNING: collected information for key multiple times: (exporting-libraries #f); values: ((planet untyped/snooze:2/postgresql8/postgresql8)) ((planet untyped/snooze:2/sqlite3/sqlite3)) setup-plt: WARNING: undefined tag in /untyped/unlib.plt/3/15/scribblings/unlib.scrbl: setup-plt: error: during making for /ryanc/macros.plt/1/2/interfaces setup-plt: default-load-handler: cannot open input file: "/home/myhome/.plt-scheme/planet/300/4.1.5/cache/ryanc/macros.plt/1/2/class.ss" (No such file or directory; errno=2) Is this normal? Thank you all for the help. On Tue, Apr 21, 2009 at 8:12 PM, Veer wrote: > Example given here : > > http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/6/planet-docs/snooze/quick.html > > when run takes around 1 minute to produce the result. > > Is there some special configuration required to speed up the execution? > > > > > > > On Tue, Apr 21, 2009 at 6:56 PM, Veer wrote: >> All right , creating a symbolic link worked. >> Sorry for spam! >> >> >> >> >> On Tue, Apr 21, 2009 at 6:45 PM, Veer wrote: >>> When running the db.ss file from quick start section of snooze , i get >>> this error: >>> >>> ffi-lib: couldn't open "libsqlite3.so" (libsqlite3.so: cannot open >>> shared object file: No such file or directory) >>> >>> I am on Ubuntu and using DrScheme ver 4.1.5 . >>> >>> From the package manager i can see libsqlite3-0 shared library is >>> already installed. >>> Do i have to make some link ? ?Please guide. >>> >>> Thanks. >>> >> > From robby at eecs.northwestern.edu Tue Apr 21 15:09:14 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 21 15:09:34 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> Message-ID: <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> Well, it is the case that if you're using non-kill-safe- code (as it sounds like spqsql is), then you cannot kill those threads. You might be able to build a kill-safe wrapper for that code, however. That is, put all of the code that queries the database into a single thread and then communicate with that thread in a kill-safe manner (much like the way the manager thread manages the queue in our kill safe paper). Robby On Tue, Apr 21, 2009 at 12:42 PM, YC wrote: > > On Tue, Apr 21, 2009 at 3:42 AM, Robby Findler > wrote: >> >> > what happens when a thread is killed in the middle of executing a >> > dynamic-wind block?? Does the post-thunk get executed still? >> >> No, it doesn't. > > Thanks for the verification. > >> In general, one might have to rewrite the program to make it >> kill-safe. That is, there is no way to just take code that >> synchronizes in some arbitrary way and make it kill-safe. Perhaps if >> you can say more about what the actual syncronization protocol is, we >> can help you make it kill-safe. > > I try to verify the possibility first to ensure my bug report is not bogus > :) > > The blocked code exists in planet package schematics spgsql.plt, in > private/p3.ss & private/connection.ss.? Inside - it uses a semaphore to lock > the critical region.? The function protocol3:new-exchange waits for the > semaphore, and protocol3:end-exchange releases the semaphore. > > protocol3:end-exchange appears to be only called by base%:end-exchange in > private/connection.ss, which appears to be only called in > primitive-query-mixin:with-final-end-exchange, which generates a > dynamic-wind block that calls the end-exchange in post-thunk. > > My threads eventually block on protocol3:new-exchange, which appears to be > waiting for a semaphore that's never released (and if dynamic-wind is not > kill-safe that it can explain the behavior). > > This behavior is intermittent and hard to reproduce, but definitely there > (as once it happens my app does nothing).? Without Matthew's stack tracing > approach I could not find out where it was blocking and how. > > Below is the code snippet from the two files. > > ;; private/p3.ss > ;; protocol3:new-exchange : protocol3 -> stream > (define (protocol3:new-exchange protocol) > ? (semaphore-wait (protocol3-ownerlock protocol)) > ? ...) > ;; protocol3:end-exchange : protocol3 -> void > (define (protocol3:end-exchange protocol) > ? (semaphore-post (protocol3-ownerlock protocol))) > > ;; private/connection.ss > ;; base% > (define base% > ? (class* object% (base<%>) > ??? ... > ??? ;; new-exchange : -> stream > ??? (define/public-final (new-exchange) > ????? (unless protocol > ??????? (raise-user-error 'connection<%> "not connected")) > ????? (protocol3:new-exchange protocol)) > > ??? ;; end-exchange : -> void > ??? (define/public-final (end-exchange) > ????? (unless protocol > ??????? (raise-user-error 'connection<%> "not connected")) > ????? (protocol3:end-exchange protocol)) > ??? ...)) > (define primitive-query-mixin > ? (mixin (base<%>) (primitive-query<%>) > ??? ... > ??? (define-syntax with-final-end-exchange > ????? (syntax-rules () > ??????? [(with-final-end-exchange . b) > ???????? (dynamic-wind > ???????????? void > ???????????? (lambda () . b) > ???????????? (lambda () (end-exchange)))])) > ???? ...)) > > From yinso.chen at gmail.com Tue Apr 21 15:44:25 2009 From: yinso.chen at gmail.com (YC) Date: Tue Apr 21 15:44:44 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> Message-ID: <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> Oops - did not cc plt-scheme. ---------- Forwarded message ---------- From: YC Date: Tue, Apr 21, 2009 at 12:42 PM Subject: Re: [plt-scheme] dynamic-wind & kill-thread To: Robby Findler On Tue, Apr 21, 2009 at 12:09 PM, Robby Findler wrote: > Well, it is the case that if you're using non-kill-safe- code (as it > sounds like spqsql is), then you cannot kill those threads. > The threads are initiated and managed from web-server. I don't know how it handles interrupted connections (I generally reproduce the bug via refreshing browser quickly), but these threads appears outside my apps control. You might be able to build a kill-safe wrapper for that code, however. > That is, put all of the code that queries the database into a single > thread and then communicate with that thread in a kill-safe manner > (much like the way the manager thread manages the queue in our kill > safe paper). Yeah that's my current plan as a stop gap. Eventually I think the kill-safe code should belong in spgsql package itself. Is Trac still the right place to file bugs? I have bugs filed 5 months ago not being touched. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/f9956a4e/attachment.htm From robby at eecs.northwestern.edu Tue Apr 21 15:45:40 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Tue Apr 21 15:46:00 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> Message-ID: <932b2f1f0904211245s2927c810p9d5d0a2f90acf2f4@mail.gmail.com> Yes, trac is the right place. You might try pinging the developers to see if they realize that the bugs are there. Robby On Tue, Apr 21, 2009 at 2:44 PM, YC wrote: > Oops - did not cc plt-scheme. > > ---------- Forwarded message ---------- > From: YC > Date: Tue, Apr 21, 2009 at 12:42 PM > Subject: Re: [plt-scheme] dynamic-wind & kill-thread > To: Robby Findler > > > > On Tue, Apr 21, 2009 at 12:09 PM, Robby Findler > wrote: >> >> Well, it is the case that if you're using non-kill-safe- code (as it >> sounds like spqsql is), then you cannot kill those threads. > > The threads are initiated and managed from web-server.? I don't know how it > handles interrupted connections (I generally reproduce the bug via > refreshing browser quickly), but these threads appears outside my apps > control. > >> You might be able to build a kill-safe wrapper for that code, however. >> That is, put all of the code that queries the database into a single >> thread and then communicate with that thread in a kill-safe manner >> (much like the way the manager thread manages the queue in our kill >> safe paper). > > Yeah that's my current plan as a stop gap.? Eventually I think the kill-safe > code should belong in spgsql package itself. > > Is Trac still the right place to file bugs?? I have bugs filed 5 months ago > not being touched. > > Thanks, > yc > > > From yinso.chen at gmail.com Tue Apr 21 15:49:09 2009 From: yinso.chen at gmail.com (YC) Date: Tue Apr 21 15:49:32 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <932b2f1f0904211245s2927c810p9d5d0a2f90acf2f4@mail.gmail.com> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> <932b2f1f0904211245s2927c810p9d5d0a2f90acf2f4@mail.gmail.com> Message-ID: <779bf2730904211249h8ed7468gf0ddac3020eacbe7@mail.gmail.com> sounds good - thanks. On Tue, Apr 21, 2009 at 12:45 PM, Robby Findler wrote: > Yes, trac is the right place. You might try pinging the developers to > see if they realize that the bugs are there. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/f3aae3c2/attachment.html From pocmatos at gmail.com Tue Apr 21 18:30:40 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 21 18:31:16 2009 Subject: [plt-scheme] Macro changing behaviour Message-ID: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> Hi all, I have a simple issue: (define-syntax-rule (test proc . args) (apply proc args)) (test (lambda () (+ 1 1))) doesn't work. Generates: #%app: missing procedure expression; probably originally (), which is an illegal empty application in: (#%app) But this works: (apply (lambda () (+ 1 1)) '()) So, somewhere this goes wrong. Can someone explain me what's the issue? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From matthias at ccs.neu.edu Tue Apr 21 18:37:30 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Tue Apr 21 18:39:37 2009 Subject: [plt-scheme] Macro changing behaviour In-Reply-To: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> References: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> Message-ID: <4DE97971-B14D-417F-99DC-EE7F98854DBE@ccs.neu.edu> This will work: #lang scheme (define-syntax-rule (test proc . args) (apply proc 'args)) (test (lambda () (+ 1 1))) So does this: (define-syntax-rule (test proc args ...) (apply proc (list args ...))) (test (lambda () (+ 1 1))) which I consider a bit more elegant. -- Matthias P.S. Oh and do use the macro stepper. It works. On Apr 21, 2009, at 6:30 PM, Paulo J. Matos wrote: > Hi all, > > I have a simple issue: > (define-syntax-rule (test proc . args) > (apply proc args)) > (test (lambda () (+ 1 1))) > > doesn't work. Generates: > #%app: missing procedure expression; probably originally (), which is > an illegal empty application in: (#%app) > > But this works: > (apply (lambda () (+ 1 1)) '()) > > So, somewhere this goes wrong. Can someone explain me what's the > issue? > > Cheers, > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From carl.eastlund at gmail.com Tue Apr 21 18:38:37 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Tue Apr 21 18:39:42 2009 Subject: [plt-scheme] Macro changing behaviour In-Reply-To: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> References: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> Message-ID: <990e0c030904211538o7cad6d4eqb99a493e084cc318@mail.gmail.com> On Tue, Apr 21, 2009 at 6:30 PM, Paulo J. Matos wrote: > Hi all, > > I have a simple issue: > (define-syntax-rule (test proc . args) > ?(apply proc args)) > (test (lambda () (+ 1 1))) > > doesn't work. Generates: > ?#%app: missing procedure expression; probably originally (), which is > an illegal empty application in: (#%app) > > But this works: > (apply (lambda () (+ 1 1)) '()) > > So, somewhere this goes wrong. Can someone explain me what's the issue? Where did the apostrophe come from? You added a quote around the () in your apply expression that isn't present in your macro. That's why they get different results. I suggest you replace (apply proc args) with (apply proc (list . args)) in your macro and replace '() with (list) in your comparison expression; then they should reflect the same thing. -- Carl Eastlund From pocmatos at gmail.com Tue Apr 21 18:38:31 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 21 18:39:48 2009 Subject: [plt-scheme] Re: Macro changing behaviour In-Reply-To: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> References: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> Message-ID: <11b141710904211538i19cfb1f3m4298555ba3301e4b@mail.gmail.com> On Tue, Apr 21, 2009 at 10:30 PM, Paulo J. Matos wrote: > Hi all, > > I have a simple issue: > (define-syntax-rule (test proc . args) > ?(apply proc args)) > (test (lambda () (+ 1 1))) > > doesn't work. Generates: > ?#%app: missing procedure expression; probably originally (), which is > an illegal empty application in: (#%app) > > But this works: > (apply (lambda () (+ 1 1)) '()) > > So, somewhere this goes wrong. Can someone explain me what's the issue? > Whoops, my bad, can't use rest args there, need to use syntax-rules. :) > Cheers, > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From ryanc at ccs.neu.edu Tue Apr 21 18:44:59 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Tue Apr 21 18:45:24 2009 Subject: [plt-scheme] Macro changing behaviour In-Reply-To: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> References: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> Message-ID: <4A9A19C2-72A8-4277-BDFD-A85ECC0A15F1@ccs.neu.edu> On Apr 21, 2009, at 6:30 PM, Paulo J. Matos wrote: > Hi all, > > I have a simple issue: > (define-syntax-rule (test proc . args) > (apply proc args)) > (test (lambda () (+ 1 1))) > > doesn't work. Generates: > #%app: missing procedure expression; probably originally (), which is > an illegal empty application in: (#%app) > > But this works: > (apply (lambda () (+ 1 1)) '()) > > So, somewhere this goes wrong. Can someone explain me what's the > issue? Your example expands into this expression (see using the macro stepper): (apply (lambda () (+ 1 1)) ()) The second argument, (), is illegal in PLT Scheme v4. The error says '# %app' because it is interpreted as an empty application, which is not allowed. -- Let's back up and look at the skeleton of your macro again: (define-syntax-rule (test proc . args) (apply proc ???)) What is 'args'? Well, it's probably supposed to be a (syntax) list of expressions. What do you need for the final argument of 'apply'? It must be an expression resulting in a list. (Not the same as a list of expressions!) How do you form an expression resulting in a list from a list of expressions? Use the list procedure. Here's the macro, rewritten: (define-syntax-rule (test proc . args) (apply proc (list . args)) or, more idiomatically: (define-syntax-rule (test proc arg ...) (apply proc (list arg ...)) Ryan From pocmatos at gmail.com Tue Apr 21 18:48:26 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 21 18:49:02 2009 Subject: [plt-scheme] Macro changing behaviour In-Reply-To: <4DE97971-B14D-417F-99DC-EE7F98854DBE@ccs.neu.edu> References: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> <4DE97971-B14D-417F-99DC-EE7F98854DBE@ccs.neu.edu> Message-ID: <11b141710904211548r342abeccy84685f2729080c1f@mail.gmail.com> On Tue, Apr 21, 2009 at 10:37 PM, Matthias Felleisen wrote: > > This will work: > > #lang scheme > > (define-syntax-rule (test proc . args) > ?(apply proc 'args)) > > (test (lambda () (+ 1 1))) > > So does this: > > (define-syntax-rule (test proc args ...) > ?(apply proc (list args ...))) > > (test (lambda () (+ 1 1))) > > which I consider a bit more elegant. -- Matthias > > P.S. Oh and do use the macro stepper. It works. > > Thanks for the tip, forgot about the macro stepper! :) > > On Apr 21, 2009, at 6:30 PM, Paulo J. Matos wrote: > >> Hi all, >> >> I have a simple issue: >> (define-syntax-rule (test proc . args) >> ?(apply proc args)) >> (test (lambda () (+ 1 1))) >> >> doesn't work. Generates: >> ?#%app: missing procedure expression; probably originally (), which is >> an illegal empty application in: (#%app) >> >> But this works: >> (apply (lambda () (+ 1 1)) '()) >> >> So, somewhere this goes wrong. Can someone explain me what's the issue? >> >> Cheers, >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> ?For list-related administrative tasks: >> ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From ryanc at ccs.neu.edu Tue Apr 21 18:50:29 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Tue Apr 21 18:50:59 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> Message-ID: <44D3DD14-E4D8-4B18-995C-092A10E7719E@ccs.neu.edu> spgsql connections are definitely not kill-safe. Does the web server, in fact, kill servlet threads under some circumstances (like reload)? I don't have time right now to write a kill-safe proxy, but I would be happy to accept one and add it to the package. Ryan On Apr 21, 2009, at 3:44 PM, YC wrote: > Oops - did not cc plt-scheme. > > ---------- Forwarded message ---------- > From: YC > Date: Tue, Apr 21, 2009 at 12:42 PM > Subject: Re: [plt-scheme] dynamic-wind & kill-thread > To: Robby Findler > > > > On Tue, Apr 21, 2009 at 12:09 PM, Robby Findler > wrote: > Well, it is the case that if you're using non-kill-safe- code (as it > sounds like spqsql is), then you cannot kill those threads. > > The threads are initiated and managed from web-server. I don't know > how it handles interrupted connections (I generally reproduce the > bug via refreshing browser quickly), but these threads appears > outside my apps control. > > You might be able to build a kill-safe wrapper for that code, however. > That is, put all of the code that queries the database into a single > thread and then communicate with that thread in a kill-safe manner > (much like the way the manager thread manages the queue in our kill > safe paper). > > Yeah that's my current plan as a stop gap. Eventually I think the > kill-safe code should belong in spgsql package itself. > > Is Trac still the right place to file bugs? I have bugs filed 5 > months ago not being touched. > > Thanks, > yc > > > _________________________________________________ > 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/20090421/91a1afae/attachment.htm From pocmatos at gmail.com Tue Apr 21 18:50:44 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Tue Apr 21 18:51:25 2009 Subject: [plt-scheme] Macro changing behaviour In-Reply-To: <4A9A19C2-72A8-4277-BDFD-A85ECC0A15F1@ccs.neu.edu> References: <11b141710904211530h3ed63a7elfb00808efe8dabed@mail.gmail.com> <4A9A19C2-72A8-4277-BDFD-A85ECC0A15F1@ccs.neu.edu> Message-ID: <11b141710904211550j4fb169cbs1f79e3e33edb7f72@mail.gmail.com> On Tue, Apr 21, 2009 at 10:44 PM, Ryan Culpepper wrote: > On Apr 21, 2009, at 6:30 PM, Paulo J. Matos wrote: > >> Hi all, >> >> I have a simple issue: >> (define-syntax-rule (test proc . args) >> ?(apply proc args)) >> (test (lambda () (+ 1 1))) >> >> doesn't work. Generates: >> #%app: missing procedure expression; probably originally (), which is >> an illegal empty application in: (#%app) >> >> But this works: >> (apply (lambda () (+ 1 1)) '()) >> >> So, somewhere this goes wrong. Can someone explain me what's the issue? > > Your example expands into this expression (see using the macro stepper): > > (apply (lambda () (+ 1 1)) ()) > > The second argument, (), is illegal in PLT Scheme v4. The error says '#%app' > because it is interpreted as an empty application, which is not allowed. > > -- > > Let's back up and look at the skeleton of your macro again: > > (define-syntax-rule (test proc . args) > ?(apply proc ???)) > > What is 'args'? > Well, it's probably supposed to be a (syntax) list of expressions. > > What do you need for the final argument of 'apply'? > It must be an expression resulting in a list. (Not the same as a list of > expressions!) > > How do you form an expression resulting in a list from a list of > expressions? > Use the list procedure. > > Here's the macro, rewritten: > > (define-syntax-rule (test proc . args) > ?(apply proc (list . args)) > > or, more idiomatically: > > (define-syntax-rule (test proc arg ...) > ?(apply proc (list arg ...)) > Thanks, got the mistake! :) > Ryan > > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From jay.mccarthy at gmail.com Tue Apr 21 19:12:44 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Apr 21 19:13:05 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <44D3DD14-E4D8-4B18-995C-092A10E7719E@ccs.neu.edu> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> <44D3DD14-E4D8-4B18-995C-092A10E7719E@ccs.neu.edu> Message-ID: It only kills threads when the connection times out. Jay On Tue, Apr 21, 2009 at 4:50 PM, Ryan Culpepper wrote: > spgsql connections are definitely not kill-safe. Does the web server, in > fact, kill servlet threads under some circumstances (like reload)? > I don't have time right now to write a kill-safe proxy, but I would be happy > to accept one and add it to the package. > Ryan > > On Apr 21, 2009, at 3:44 PM, YC wrote: > > Oops - did not cc plt-scheme. > > ---------- Forwarded message ---------- > From: YC > Date: Tue, Apr 21, 2009 at 12:42 PM > Subject: Re: [plt-scheme] dynamic-wind & kill-thread > To: Robby Findler > > > > On Tue, Apr 21, 2009 at 12:09 PM, Robby Findler > wrote: >> >> Well, it is the case that if you're using non-kill-safe- code (as it >> sounds like spqsql is), then you cannot kill those threads. > > The threads are initiated and managed from web-server.? I don't know how it > handles interrupted connections (I generally reproduce the bug via > refreshing browser quickly), but these threads appears outside my apps > control. > >> You might be able to build a kill-safe wrapper for that code, however. >> That is, put all of the code that queries the database into a single >> thread and then communicate with that thread in a kill-safe manner >> (much like the way the manager thread manages the queue in our kill >> safe paper). > > Yeah that's my current plan as a stop gap.? Eventually I think the kill-safe > code should belong in spgsql package itself. > > Is Trac still the right place to file bugs?? I have bugs filed 5 months ago > not being touched. > > Thanks, > 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 > > -- 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 Tue Apr 21 20:19:15 2009 From: yinso.chen at gmail.com (YC) Date: Tue Apr 21 20:19:42 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: <44D3DD14-E4D8-4B18-995C-092A10E7719E@ccs.neu.edu> References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> <44D3DD14-E4D8-4B18-995C-092A10E7719E@ccs.neu.edu> Message-ID: <779bf2730904211719j198adeabl53d94897c5279447@mail.gmail.com> On Tue, Apr 21, 2009 at 3:50 PM, Ryan Culpepper wrote: > spgsql connections are definitely not kill-safe. Does the web server, in > fact, kill servlet threads under some circumstances (like reload)? > I don't have time right now to write a kill-safe proxy, but I would be > happy to accept one and add it to the package. > I don't know how to add an extension to your classes that'll nicely fit into your connection classes and mixins. I am happy to help with a functional oriented proxy if you are okay with it. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/a3eefefc/attachment-0001.htm From jay.mccarthy at gmail.com Tue Apr 21 20:27:57 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Tue Apr 21 20:28:20 2009 Subject: [plt-scheme] Re: Newbie question about PLT web application In-Reply-To: <9c6e8c3c0904211727s7b517d3cv451a3ced3c3accc9@mail.gmail.com> References: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> <74a1b482-8e82-4804-a41a-a02a2f50f0d8@r37g2000yqn.googlegroups.com> <9c6e8c3c0904211727s7b517d3cv451a3ced3c3accc9@mail.gmail.com> Message-ID: You don't really need the second line. Jay On Tue, Apr 21, 2009 at 6:27 PM, gad vatsi wrote: > I tried what John mentioned, and got a connection failed error after about > 10-15 seconds. > I also included serve/servlet and add #:listen-ip > #f at the bottom of my application. The documentation also says to change > the top of my application from > > ??#lang?web-server/insta > > to > > ?(require web-server/servlet) > ?(provide/contract (start (request? . -> . response/c))) > > but I'm not sure what the second line is doing, if that is a correct syntax > or not or if I should change/add something to that line, and it is causing > an error saying something like (undefined module in responce/c. ) > > I'm providing the code that I'm using in case anyone has the time to take a > look and see if there is something I'm doing wrong. > > Thanks, > > On Tue, Apr 21, 2009 at 7:33 AM, Jay McCarthy > wrote: >> >> Another thing to do is to switch to serve/servlet and add #:listen-ip >> #f to the arguments. >> >> Jay >> >> On Mon, Apr 20, 2009 at 10:02 PM, John Clements >> wrote: >> > >> > On Apr 18, 2009, at 10:20 PM, gadva wrote: >> > >> >> Thanks for the quick reply, >> >> >> >> Sorry If I was unclear with the question, I just haven't had that much >> >> experience with setting up a web server before, and with networking in >> >> general so I'm not sure about the right terminology yet. >> >> >> >> I guess my question was how to setup the application to serve requests >> >> to users connecting to my server by typing >> >> http://serverIP:8000/myapplication.ss. >> >> >> >> Because right now when I test it on a browser from within the server >> >> it runs ok, but when I attempt to connect from a different computer it >> >> does not work. So by using the code described above (and in the PLT >> >> Blog Application example from the website) (basically using web-sever/ >> >> insta, serve/servlet) I am running the application on a selected port, >> >> so when a user connects to my IP adress with the correct port etc >> >> shouldn't the web server accept a request and respond with the HTML >> >> page that I define? >> > >> > Speaking very generally, yes. >> > >> > My guess is that the external requests are not reaching your web server, >> > either because of a software firewall or because of an external network >> > firewall. >> > >> > One easy test is to try to contact the your PLT web server on the given >> > port >> > using a simple telnet client from another machine, e.g.: >> > >> > my-other-machine% telnet serverIP 8000 >> > >> > If it goes through... well, I'd be surprised. ?My guess is that it will >> > fail, but it can fail in two very different ways: most firewalls refuse >> > to >> > answer entirely, in order to increase the cost of port scanning. ?So if >> > you >> > get an immediate "server is not answering" message, then there's >> > probably no >> > firewall in place. ?If you just get a stalled telnet, then there's >> > probably >> > a firewall in place. >> > >> > FWIW, there are about 150 things that could be going wrong here; my >> > confidence that I'm steering you in the right direction is only slightly >> > higher than 50%. >> > >> > All the best, >> > >> > John Clements >> > >> > >> > >> > _________________________________________________ >> > ?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 yinso.chen at gmail.com Tue Apr 21 20:30:11 2009 From: yinso.chen at gmail.com (YC) Date: Tue Apr 21 20:30:33 2009 Subject: [plt-scheme] dynamic-wind & kill-thread In-Reply-To: References: <779bf2730904210158k61a610c2yb0451709c794ba3b@mail.gmail.com> <932b2f1f0904210342v2867deabm547dd2e4ea33bde6@mail.gmail.com> <779bf2730904211042n2241435ehc1a7accdf8ac3e04@mail.gmail.com> <932b2f1f0904211209h5adc940ak580ec59ef6ecfa17@mail.gmail.com> <779bf2730904211242ia712d20u86cd43cb276cf221@mail.gmail.com> <779bf2730904211244m765a7923h8faf38b044e7f161@mail.gmail.com> <44D3DD14-E4D8-4B18-995C-092A10E7719E@ccs.neu.edu> Message-ID: <779bf2730904211730o603b4f78s8ba562e9b82f0a52@mail.gmail.com> On Tue, Apr 21, 2009 at 4:12 PM, Jay McCarthy wrote: > It only kills threads when the connection times out. > > Jay > I don't know whether my threads were timing out, as the issue is intermittent and has no consistent repro steps. Most of the time the issue is reproduced when I try to reload and connect randomly as quick as possible. I am able to verify that the code blocks on waiting for a semaphore that should be released in the post-thunk of dynamic-wind, so somehow the post-thunk is never executed and hence causes the next thread to block. This problem most likely will go away if I do not share connections between threads, of course. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/182009ce/attachment.html From d.j.gurnell at gmail.com Wed Apr 22 01:21:50 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Wed Apr 22 01:30:09 2009 Subject: [plt-scheme] Re: snooze installation : libsqlite3.so not found In-Reply-To: References: Message-ID: <7A7AAA60-F6F8-4B28-AB4C-FEFE0AD68372@gmail.com> Those are documentation compilation warnings I haven't been able to get rid of. Some of them aren from Snooze, and some are from one of its dependent libraries (Ryan's "macros.plt". They won't affect the actual running of your applications. -- Dave > Program seems to run normally now. > > Removing .plt-scheme dir and running setup-plt(as adviced Danny) and > running the program again seems to do the trick. > > Now when i again run the setup-plt i get these error and warnings not > in any order: > > WARNING: collected information for key multiple times: > (exporting-libraries #f); values: ((planet > untyped/snooze:2/postgresql8/postgresql8)) ((planet > untyped/snooze:2/sqlite3/sqlite3)) > > setup-plt: WARNING: undefined tag in > /untyped/unlib.plt/3/15/scribblings/unlib.scrbl: > > setup-plt: error: during making for /ryanc/macros.plt/1/2/ > interfaces > setup-plt: default-load-handler: cannot open input file: > "/home/myhome/.plt-scheme/planet/300/4.1.5/cache/ryanc/macros.plt/ > 1/2/class.ss" > (No such file or directory; errno=2) > > Is this normal? > > Thank you all for the help. > > > On Tue, Apr 21, 2009 at 8:12 PM, Veer wrote: >> Example given here : >> >> http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/6/planet-docs/snooze/quick.html >> >> when run takes around 1 minute to produce the result. >> >> Is there some special configuration required to speed up the >> execution? >> >> >> >> >> >> >> On Tue, Apr 21, 2009 at 6:56 PM, Veer wrote: >>> All right , creating a symbolic link worked. >>> Sorry for spam! >>> >>> >>> >>> >>> On Tue, Apr 21, 2009 at 6:45 PM, Veer wrote: >>>> When running the db.ss file from quick start section of snooze , >>>> i get >>>> this error: >>>> >>>> ffi-lib: couldn't open "libsqlite3.so" (libsqlite3.so: cannot open >>>> shared object file: No such file or directory) >>>> >>>> I am on Ubuntu and using DrScheme ver 4.1.5 . >>>> >>>> From the package manager i can see libsqlite3-0 shared library is >>>> already installed. >>>> Do i have to make some link ? Please guide. >>>> >>>> Thanks. >>>> >>> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From srikumarks at gmail.com Wed Apr 22 05:33:29 2009 From: srikumarks at gmail.com (Kumar) Date: Wed Apr 22 05:33:50 2009 Subject: [plt-scheme] video editing and Scheme .. Message-ID: Hi all, This is only partially related to PLT, but is hopefully of interest to a few even if it isn't. My company makes an automatic video editing product called "muvee Reveal" in which different visual styles (the sum of effects, transitions and editing logic) are scripted in a dialect of Scheme. We've now released an sdk for creating these styles as public beta to gather feedback from media-savvy Scheme hackers (like us :P). Until now, we've been the only ones to create these styles ... pretty much. If that sounds interesting to you as a Schemer (I do hope it does), please do give it a whirl and drop us some wisdom. The sdk is up on googlecode at http://muvee-style-authoring.googlecode.com PLT credits - Though we don't embed the mzscheme runtime (for various historical, legal and technical reasons), we recommend and use DrScheme as an editor. The documentation, which is chock full of code, is formatted using the scribble tool. Cheers, -Kumar Principal Engineer, muvee Technologies Pte. Ltd. From gadva1g at gmail.com Tue Apr 21 20:27:05 2009 From: gadva1g at gmail.com (gad vatsi) Date: Wed Apr 22 05:43:23 2009 Subject: [plt-scheme] Re: Newbie question about PLT web application In-Reply-To: References: <7ca9a0df-0501-426e-8b2d-6c8a9b43bd6b@z9g2000yqi.googlegroups.com> <74a1b482-8e82-4804-a41a-a02a2f50f0d8@r37g2000yqn.googlegroups.com> Message-ID: <9c6e8c3c0904211727s7b517d3cv451a3ced3c3accc9@mail.gmail.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: app-run.ss Type: application/octet-stream Size: 6019 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/4e7718f1/app-run-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: model.ss Type: application/octet-stream Size: 2218 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090421/4e7718f1/model-0001.obj From d.j.gurnell at gmail.com Wed Apr 22 06:05:58 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Wed Apr 22 06:06:35 2009 Subject: [plt-scheme] web-server: connection timeout with open file handles Message-ID: Hi all, I'm having a couple of issues with timeouts in the web server. This is kind of related to the "dynamic-wind & kill-thread" thread. I'm using a servlet and make-response/incremental to serve files from the file system to web users. I've attached simplified test code below (tested on PLT 4.1.4.1). Three problems: - large file downloads can take a long time, and can be killed by the web server's connection timeout (default 60 seconds); - when the connection times out, the servlet thread is killed and leaves the file handle open permanently ("lsof -p "). - over time, the web server accrues open file handles until it hits the OS-imposed limit ("ulimit -n") and stops working properly (connecting to Postgres in my case). I remember back in the day we had the same problem with files served using dispatch-files.ss. The solution there was to insert a call to adjust-connection-timeout! to increase the connection timeout for large files. Here it's not so simple because make-response/incremental can do more than just serve static files. I'd like to be able to call adjust-connection-timeout! from servlet code, but I don't think that feature is available from inside a servlet (no access to the connection object). Cheers, -- Dave ===== test-server.ss ===== #lang scheme/base (require scheme/runtime-path web-server/servlet-env web-server/http) ; Plain text file of >60 bytes in length: (define-runtime-path test-file "test-file.txt") ; Serve the text file at an artificiually slow rage (1 byte/sec): (define (make-test-response) (make-response/incremental 200 "Okay" (current-seconds) #"text/plain" null (lambda (write) ; This is 4096 in my actual production code: (define BUFFER-SIZE 1) (define buffer (make-bytes BUFFER-SIZE)) (call-with-input-file test-file (lambda (input) (let loop ([counter 0]) (sleep 1) (printf "... ~as~n" counter) ; Send some data to the browser: (let ([num-read (read-bytes! buffer input)]) (cond [(eof-object? num-read) (void)] [(= num-read BUFFER-SIZE) (write buffer) (loop (add1 counter))] [else (write (subbytes buffer 0 num-read)) (loop (add1 counter))])))))))) ; Main server loop: (serve/servlet (lambda (request) (printf "Serving file.~n") (begin0 (make-test-response) (printf "Finished serving file.~n")))) ===== end test-server.ss ===== ===== test-file.txt ===== 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 ===== end test-file.txt ===== -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090422/e4c6588f/attachment.htm From srikumarks at gmail.com Wed Apr 22 05:55:01 2009 From: srikumarks at gmail.com (Kumar) Date: Wed Apr 22 06:07:35 2009 Subject: [plt-scheme] Re: help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <9F774C34-5F3F-48DD-818C-50CFE6B0B007@gmx.de> Message-ID: Just to tickle you guys, here is an elegant expression of PR's approach - sort ids.txt | uniq -c ... the really pragmatic solution ;-P From eli at barzilay.org Wed Apr 22 06:24:24 2009 From: eli at barzilay.org (Eli Barzilay) Date: Wed Apr 22 06:24:46 2009 Subject: [plt-scheme] Re: help on how to write a frequency-counting function in a more functional way In-Reply-To: References: <8CAFC43D-610B-4853-92C5-530DD3CF17D6@gmx.de> <932b2f1f0904181337x7ca27618oc5101f19a57e73b@mail.gmail.com> <76BC9A0B-28E3-4E5D-B51D-9D42A72C96A2@gmx.de> <9F774C34-5F3F-48DD-818C-50CFE6B0B007@gmx.de>