From mark.engelberg at gmail.com Sat Nov 1 00:21:41 2008 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Thu Mar 26 02:32:08 2009 Subject: [plt-scheme] Inserting an image programmatically Message-ID: I'd like to write a function that displays in the interactions window (or pops it up in a separate window) a file-based image. My first try was this: (require scheme/gui) (make-object bitmap% "C:\\temp\\soccerball.gif") but this just prints # in the interactions window. How do I get this to display, just like an image inserted using the Insert Image menu item? Thanks, Mark From esmith at acanac.net Sat Nov 1 00:25:02 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:32:11 2009 Subject: [plt-scheme] Manipulating Scheme vectors with FFI In-Reply-To: <18695.32990.362645.389911@arabic.ccs.neu.edu> References: <48bf23a9-18b6-467c-98e8-d52fb578f0b8@y79g2000hsa.googlegroups.com> <18695.32990.362645.389911@arabic.ccs.neu.edu> Message-ID: <490BDA1E.1010806@acanac.net> Eli Barzilay wrote: > On Oct 28, Benjamin Seppke wrote: > >> So my question is: How can I manipulate Scheme vectors inside a c- >> function and see the results of that in Scheme..? >> > > Generally speaking, you don't want to manipulate *Scheme* vectors -- > they hold data that your C library will not know how to handle. The > right solution is to translate a Scheme vector to a C vector and > back. Here's a few examples: > > Further to your comments on vectors in function parameter interfaces, I have a question: /* vector as typedef How to declare corresponding c-type in scheeme? */ typedef int test_type[2]; /* vector inside structure. How to declare the same in Scheeme? */ struct { int __val[ 2 ]; } ; /* vector embedded in struct */ TIA From czhu at cs.utah.edu Sat Nov 1 01:49:40 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:32:11 2009 Subject: [plt-scheme] Inserting an image programmatically In-Reply-To: References: Message-ID: <490BEDF4.9010209@cs.utah.edu> (make-object image-snip% ...) Chongkai Mark Engelberg wrote: > I'd like to write a function that displays in the interactions window > (or pops it up in a separate window) a file-based image. > > My first try was this: > (require scheme/gui) > (make-object bitmap% "C:\\temp\\soccerball.gif") > > but this just prints # in the interactions window. > > How do I get this to display, just like an image inserted using the > Insert Image menu item? > > Thanks, > > Mark > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jensaxel at soegaard.net Sat Nov 1 05:29:30 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:32:11 2009 Subject: [plt-scheme] Inserting an image programmatically In-Reply-To: References: Message-ID: <490C217A.7030709@soegaard.net> Mark Engelberg skrev: > I'd like to write a function that displays in the interactions window > (or pops it up in a separate window) a file-based image. > > http://schemecookbook.org/Cookbook/GUIRecipeImagesInTheInteractionWindow http://schemecookbook.org/view/Cookbook/HowToMakeASnip -- Jens Axel S?gaard From jos.koot at telefonica.net Sat Nov 1 10:15:50 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:32:11 2009 Subject: [plt-scheme] scary cool logo References: <490B5F29.4080209@gmail.com><932b2f1f0810311253r45656ad1r398200e41eb6224c@mail.gmail.com> <904774730810311737q5e875b8dl721c7713449de4cf@mail.gmail.com> Message-ID: To whom belongs the face that's flashing in the garbage-collector indicator? Nevertheless Happy Birthday to ??? Jos ----- Original Message ----- From: "Todd O'Bryan" To: "Robby Findler" Cc: "Scheme PLT" Sent: Saturday, November 01, 2008 1:37 AM Subject: Re: [plt-scheme] scary cool logo > Keep an eye out for photographs of actual people. It usually indicates > a birthday. > > Most of my students took the lambda-o-lantern in stride, but one was > convinced that someone had replaced DrScheme with another program. :-) > > On Fri, Oct 31, 2008 at 3:53 PM, Robby Findler > wrote: >> Mike MacHenry. Its a photograph, believe it or not! >> >> Robby >> >> On Fri, Oct 31, 2008 at 2:40 PM, David Vanderson >> wrote: >>> Thank you to whoever put the pumpkin/flame logo into Dr. Scheme's splash >>> for >>> Halloween! It was a great surprise! >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at cs.uchicago.edu Sat Nov 1 10:36:16 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:11 2009 Subject: [plt-scheme] scary cool logo In-Reply-To: References: <490B5F29.4080209@gmail.com> <932b2f1f0810311253r45656ad1r398200e41eb6224c@mail.gmail.com> <904774730810311737q5e875b8dl721c7713449de4cf@mail.gmail.com> Message-ID: <932b2f1f0811010736u77943411p473fef7942aa3b5a@mail.gmail.com> Click on it and see! :) On Sat, Nov 1, 2008 at 9:15 AM, Jos Koot wrote: > To whom belongs the face that's flashing in the garbage-collector indicator? > Nevertheless Happy Birthday to ??? > Jos > > ----- Original Message ----- From: "Todd O'Bryan" > To: "Robby Findler" > Cc: "Scheme PLT" > Sent: Saturday, November 01, 2008 1:37 AM > Subject: Re: [plt-scheme] scary cool logo > > >> Keep an eye out for photographs of actual people. It usually indicates >> a birthday. >> >> Most of my students took the lambda-o-lantern in stride, but one was >> convinced that someone had replaced DrScheme with another program. :-) >> >> On Fri, Oct 31, 2008 at 3:53 PM, Robby Findler >> wrote: >>> >>> Mike MacHenry. Its a photograph, believe it or not! >>> >>> Robby >>> >>> On Fri, Oct 31, 2008 at 2:40 PM, David Vanderson >>> wrote: >>>> >>>> Thank you to whoever put the pumpkin/flame logo into Dr. Scheme's splash >>>> for >>>> Halloween! It was a great surprise! >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > From jos.koot at telefonica.net Sat Nov 1 10:53:22 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:32:11 2009 Subject: [plt-scheme] scary cool logo References: <490B5F29.4080209@gmail.com> <932b2f1f0810311253r45656ad1r398200e41eb6224c@mail.gmail.com> <904774730810311737q5e875b8dl721c7713449de4cf@mail.gmail.com> <932b2f1f0811010736u77943411p473fef7942aa3b5a@mail.gmail.com> Message-ID: Happy birthday Matthew! Jos ----- Original Message ----- From: "Robby Findler" To: "Jos Koot" Cc: "Todd O'Bryan" ; "Scheme PLT" Sent: Saturday, November 01, 2008 3:36 PM Subject: Re: [plt-scheme] scary cool logo > Click on it and see! :) > snip From marek at xivilization.net Sat Nov 1 13:04:37 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:32:12 2009 Subject: [plt-scheme] The adventures of a Pythonista in Schemeland Message-ID: <20081101180437.2e674ef7@halmanfloyd.lan.local> Hi, I don't know if it has been mentioned before, but Michele Simionato posts his adventures in Schemeland in his blog, (sorry, they do not seem to be interlinked). I think it is quite nice that someone took the time to explain how Pythoneers can approach Scheme. I definitely need to read his articles about macros in more detail. regards, Marek From chust at web.de Sat Nov 1 13:17:06 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:32:12 2009 Subject: [plt-scheme] Possible mistake in the documentation of call/ec Message-ID: <490C8F12.5050203@web.de> Hello, the documentation of PLT Scheme 4.1.2, section 9.4, states that the procedure call-with-escape-continuation and its alias call/ec take one or two arguments. However, an experiment at the REPL shows that call/ec accepts only one argument. As far as I understand, it would also be rather pointless to specify a delimiting prompt tag for an escape continuation. Therefore I think the procedure behaves correctly and this is probably a small mistake in the documentation. cu, Thomas From vyzo at media.mit.edu Sat Nov 1 18:18:38 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:32:12 2009 Subject: [plt-scheme] planet browsing broken? Message-ID: The planet browsing functionality appears to be broken for some packages e.g: http://planet.plt-scheme.org/display.ss?package=socket.plt&owner=vyzo no code appearing: http://planet.plt-scheme.org/package-source/vyzo/socket.plt/3/0/ [just 3 files] no docs: http://planet.plt-scheme.org/package-source/vyzo/socket.plt/3/0/ [404s] -- vyzo From goetter at mazama.net Sun Nov 2 04:50:47 2008 From: goetter at mazama.net (Ben Goetter) Date: Thu Mar 26 02:32:12 2009 Subject: [plt-scheme] SGL app flashes when it changes canvases Message-ID: <490D77F7.8030601@mazama.net> Environment: 4.1.2 [3m], Windows XP (and Vista), various GPUs When the following application changes canvases (on any mouse button-down or -up), its window flashes white or partly-white briefly, despite my best efforts via change-children. How can I prevent it from flashing so? (The obvious solution is never to change canvases. This is a greatly distilled version of a larger application that keeps very different UI logic in its two canvases. I would prefer to maintain that structure if I can.) Thanks for your time, Ben ---this is flashbug.ss--- #lang scheme/gui (require sgl) (define my-frame% (class* frame% () (define/augment (on-close) (when a-canvas (send a-canvas cleanup)) (when b-canvas (send b-canvas cleanup)) (inner (void) on-close)) (define/public (change-state) (queue-callback (lambda () (if (or (not current-canvas) (not (eq? current-canvas a-canvas))) (setup-a-canvas) (setup-b-canvas))) #f)) (super-instantiate ("sgl flashing bug") ) )) (define my-canvas% (class* canvas% () (inherit with-gl-context swap-gl-buffers get-top-level-window refresh) (define/override (on-paint) (with-gl-context (lambda () (gl-matrix-mode 'modelview) (gl-push-matrix) (gl-load-identity) (gl-matrix-mode 'projection) (gl-push-matrix) (gl-load-identity) (gl-ortho 0 1 0 1 -1 1) (gl-depth-mask #f) (gl-shade-model 'smooth) (gl-polygon-mode 'front 'fill) (gl-begin 'quads) (gl-color (/ 199.0 255.0) (/ 199.0 255.0) (/ 219.0 255.0)) (gl-vertex 0 0 0) (gl-vertex 1 0 0) (gl-color (/ 48.0 255.0) (/ 48.0 255.0) (/ 48.0 255.0)) (gl-vertex 1 1 0) (gl-vertex 0 1 0) (gl-end) (gl-depth-mask #t) (gl-pop-matrix) (gl-matrix-mode 'modelview) (gl-pop-matrix) (swap-gl-buffers) )) ) (define/override (on-size w h) (with-gl-context (lambda () (gl-viewport 0 0 w h)))) (define/public (cleanup) (queue-callback (lambda () (send this shake-heap)) #f) ) (define/public (shake-heap) (with-gl-context collect-garbage)) (define/override (on-event e) (when (send e button-changed?) (send (get-top-level-window) change-state))) (super-instantiate () (style '(gl no-autoclear)) (min-width 600) (min-height 600)) )) (define a-canvas #f) (define b-canvas #f) (define current-canvas #f) (define f (instantiate my-frame% () )) (define (setup-a-canvas) (send f begin-container-sequence) (unless a-canvas (set! a-canvas (instantiate my-canvas% (f) ))) (send f change-children (lambda (k) (list a-canvas))) (set! current-canvas a-canvas) (send f end-container-sequence) ;; (when b-canvas ;; (send b-canvas cleanup) ;; (set! b-canvas #f)) ) (define (setup-b-canvas) (send f begin-container-sequence) (unless b-canvas (set! b-canvas (instantiate my-canvas% (f) ))) (send f change-children (lambda (k) (list b-canvas))) (set! current-canvas b-canvas) (send f end-container-sequence) ;; (when a-canvas ;; (send a-canvas cleanup) ;; (set! a-canvas #f)) ) (setup-a-canvas) (send f show #t) ---end of flashbug.ss--- From mflatt at cs.utah.edu Sun Nov 2 07:27:47 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:12 2009 Subject: [plt-scheme] SGL app flashes when it changes canvases In-Reply-To: <490D77F7.8030601@mazama.net> References: <490D77F7.8030601@mazama.net> Message-ID: <20081102122749.00D61650064@mail-svr1.cs.utah.edu> At Sun, 02 Nov 2008 01:50:47 -0800, Ben Goetter wrote: > Environment: 4.1.2 [3m], Windows XP (and Vista), various GPUs > > When the following application changes canvases (on any mouse > button-down or -up), its window flashes white or partly-white briefly, > despite my best efforts via change-children. How can I prevent it from > flashing so? Although we might be able to improve `begin-container-sequence' so that it suppresses more low-level window updates, I think it will be difficult. > (The obvious solution is never to change canvases. This is a greatly > distilled version of a larger application that keeps very different UI > logic in its two canvases. I would prefer to maintain that structure if > I can.) The `surrogate' form of `scheme/surrogate' can help you delegate canvas methods to a surrogate object. Most of the work is simply listing the methods that you need to be delegated, and then deriving new classes from the generated surrogate class instead of from `canvas%'. Then you can switch surrogates instead of switching canvases. Matthew From mflatt at cs.utah.edu Sun Nov 2 07:29:57 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:12 2009 Subject: [plt-scheme] Possible mistake in the documentation of call/ec In-Reply-To: <490C8F12.5050203@web.de> References: <490C8F12.5050203@web.de> Message-ID: <20081102122959.5CC86650085@mail-svr1.cs.utah.edu> At Sat, 01 Nov 2008 18:17:06 +0100, Thomas Chust wrote: > the documentation of PLT Scheme 4.1.2, section 9.4, states that the > procedure call-with-escape-continuation and its alias call/ec take one > or two arguments. > > However, an experiment at the REPL shows that call/ec accepts only one > argument. As far as I understand, it would also be rather pointless to > specify a delimiting prompt tag for an escape continuation. > > Therefore I think the procedure behaves correctly and this is probably a > small mistake in the documentation. Right - fixed in SVN. Thanks, Matthew From jpc-ml at zenburn.net Sun Nov 2 07:38:09 2008 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:32:13 2009 Subject: [plt-scheme] shortcut for comment out with a box? In-Reply-To: <932b2f1f0810311128y137cc992s7d7e6bb7b8330e6e@mail.gmail.com> References: <9b1fff280810291212k1aaa25f6o901417c4c0f25b62@mail.gmail.com> <20081031.171151.201780285.maxigas@anargeek.net> <932b2f1f0810311128y137cc992s7d7e6bb7b8330e6e@mail.gmail.com> Message-ID: <490D9F31.4060405@zenburn.net> Robby Findler wrote: > Emacs/quack doesn't have comment-out-with-a-box at all.... > > In DrScheme there isn't a direct keyboard shortcut, except when you > use Windows (and work your way thru the menus with the alt key) or > when you enable something at the OS level on the mac that also lets > you work thru the menus with keystrokes. On a Mac you should be able to add a keyboard shortcut for any menu item using the Keyboard & Mouse pane in system preferences. This adds the shortcut (it is displayed in the menu after restarting DrScheme) and blinks the menu when I press Cmd-; but it still inserts #\; to the buffer. -- regards, Jakub Piotr C?apa From jpc-ml at zenburn.net Sun Nov 2 07:49:03 2008 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:32:13 2009 Subject: [plt-scheme] Manipulating Scheme vectors with FFI In-Reply-To: <490BDA1E.1010806@acanac.net> References: <48bf23a9-18b6-467c-98e8-d52fb578f0b8@y79g2000hsa.googlegroups.com> <18695.32990.362645.389911@arabic.ccs.neu.edu> <490BDA1E.1010806@acanac.net> Message-ID: <490DA1BF.7020105@zenburn.net> Ernie Smith wrote: > /* vector inside structure. How to declare the same in Scheeme? */ > struct { int __val[ 2 ]; } ; /* vector embedded in struct */ This is impossible because of libffi limitations. You can workaround by defining a custom type which is a struct with N fields and custom access methods. See [1] for an example: (define _path-type (make-ctype (make-cstruct-type (build-list (/ usb-max-path-len 8) (lambda (i) _uint64))) #f (lambda (ptr) (let ([v (make-bytes usb-max-path-len)] [length #f]) (let loop ([i 0]) (let ([value (ptr-ref ptr _uint8 'abs i)]) (if (or (= i usb-max-path-len) (= value 0)) (set! length i) (begin (bytes-set! v i value) (loop (add1 i)))))) (subbytes v 0 length))))) [1] http://list.cs.brown.edu/pipermail/plt-scheme/2007-March/016671.html -- regards, Jakub Piotr C?apa From jvjulien at free.fr Sat Nov 1 07:42:45 2008 From: jvjulien at free.fr (jeeve) Date: Thu Mar 26 02:32:13 2009 Subject: [plt-scheme] Re: world.ss - combination of keys In-Reply-To: References: Message-ID: <6358ed46-2ab0-41c8-a027-796d0097c748@r36g2000prf.googlegroups.com> thanks for your response ! the universe model seems very interesting. I'm going to try use it. but, if two players want to use the same keyboard of one computer for a ping-pong game for example. they want to play with keys configuration : player 1 : #\a key to go up #\q key to go down player 2 : 'up to go up 'down to go down the problem is if player 1 goes to up or down, player 2 doesn't move until player 1 stops. if you have an idea to resolve this little problem. I am french beginer in scheme. On Oct 31, 3:35?pm, Matthias Felleisen wrote: > Voil?, but you may also want to look at the experimental universe.ss ? > teachpack and its documentation: > > ? ?http://www.ccs.neu.edu/home/matthias/107-f08/Universe/universe2.ss > ? ?http://www.ccs.neu.edu/home/matthias/107-f08/Universe/universe/ > index.html > > This will allow you to have two computers for two players (and soon N ? > for N). > > Also, the use of state/assignment is superfluous. The world/universe ? > is entirely functional. If you insist on using state, try use (void) ? > as the first and only world -- Matthias > > (define-struct jeu-mobile (gauche droit turn)) > ;; JeuMobile is (make-jeu-mobile Posn Posn GD) > ;; GD is one of: 'gauche ou 'droit > > (define (changer-direction j key) > ? ?(let* ((jmg (jeu-mobile-gauche j)) > ? ? ? ? ? (jmd (jeu-mobile-droit j)) > ? ? ? ? ? (y1 (posn-y jmg)) > ? ? ? ? ? (y2 (posn-y jmd))) > ? ? ?(begin > ? ? ? ?(cond > ? ? ? ? ?((key=? key #\a) (set-jeu-mobile-turn! j 'gauche)) > ? ? ? ? ?((key=? key #\q) (set-jeu-mobile-turn! j 'droit)) > ? ? ? ? ?((key=? key 'up) > ? ? ? ? ? (if (symbol=? (jeu-mobile-turn j) 'droit) > ? ? ? ? ? ? ? (set-posn-y! jmd (- y2 10)) > ? ? ? ? ? ? ? (set-posn-y! jmg (- y1 10)))) > ? ? ? ? ?((key=? key 'down) > ? ? ? ? ? (if (symbol=? (jeu-mobile-turn j) 'droit) > ? ? ? ? ? ? ? (set-posn-y! jmd (+ y2 10)) > ? ? ? ? ? ? ? (set-posn-y! jmg (+ y1 10))))) > ? ? ? ?j))) > > (check-expect > ? (let ([j (make-jeu-mobile (make-posn 10 20) (make-posn 30 40) ? > 'gauche)]) > ? ? (begin > ? ? ? (changer-direction j #\a) > ? ? ? (changer-direction j 'up))) > ? (make-jeu-mobile (make-posn 10 10) (make-posn 30 40) 'gauche)) > > (check-expect > ? (let ([j (make-jeu-mobile (make-posn 10 20) (make-posn 30 40) ? > 'droite)]) > ? ? (begin > ? ? ? (changer-direction j #\a) > ? ? ? (changer-direction j 'down))) > ? (make-jeu-mobile (make-posn 10 30) (make-posn 30 40) 'gauche)) > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From grettke at acm.org Sun Nov 2 14:11:03 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:13 2009 Subject: [plt-scheme] Papers on criticism of Scheme? Message-ID: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> Hi, This paper: http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf was referenced recently. It was interesting to see criticisms of Scheme from someone who knew Scheme. I think Wadler knew it well. Are there more like this out there? Best wishes, Grant From matthias at ccs.neu.edu Sun Nov 2 14:28:23 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:13 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> Message-ID: <0ABA6434-3E8D-4F57-ACA7-00A876DCD416@ccs.neu.edu> On Nov 2, 2008, at 2:11 PM, Grant Rettke wrote: > http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf > > was referenced recently. It was interesting to see criticisms of > Scheme from someone who knew Scheme. I think Wadler knew it well. Phil knows Scheme the way I know Fortran iv. But he has a good point about the use of primitive Scheme subsets in education. > > Are there more like this out there? > > Best wishes, > > Grant > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From geoff at knauth.org Sun Nov 2 14:50:17 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:32:13 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <0ABA6434-3E8D-4F57-ACA7-00A876DCD416@ccs.neu.edu> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0ABA6434-3E8D-4F57-ACA7-00A876DCD416@ccs.neu.edu> Message-ID: <940CD8E9-8AC7-4918-990A-D7E300463F5C@knauth.org> My attraction to Scheme, especially DrScheme, has been that with a little intellectual effort you can make just about anything out of it with relatively little fuss. It's programming language Play-Doh that lends itself to solid engineering too. From grettke at acm.org Sun Nov 2 14:51:52 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:13 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <0ABA6434-3E8D-4F57-ACA7-00A876DCD416@ccs.neu.edu> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0ABA6434-3E8D-4F57-ACA7-00A876DCD416@ccs.neu.edu> Message-ID: <756daca50811021151i64ec1600ie0546698db66ed10@mail.gmail.com> It was interesting to see the landscape back then. It reads like was disappointing with Scheme, enamored by Miranda, and the whole experience fed into Haskell. Yes, I am reading to deeply into it :) From jos.koot at telefonica.net Sun Nov 2 17:40:25 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:32:14 2009 Subject: [plt-scheme] Papers on criticism of Scheme? References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> Message-ID: <8B6A450BF7644D8889A731906BAA0EC3@uw2b2dff239c4d> Philip Wadler certainly knows what he is talking about. I do not fully agrree with his argument about the example explaining the evaluation of (list (list 1 2) nil), though. Notice that text in this font is implicitly quoted. I would write: $(list (list 1 2) nil) = (x y), where x = $(list 1 2) and y = $nil $(list 1 2) = (1 2) $nil = ( ) Hence $(list (list 1 2) nil) = ((1 2) ( )) where $x is the value of x. It is a matter of an appropriate distinction between quotation, mention and value. Other examples: $'x == $(quote x) = x $list is a procedure, not a sexpr. list is a symbol, but where a non quoted part of a program probably an identifier referring to a variable. $123 is 123. With check syntax of DrScheme, the distiction between program and data can clearly be displayed. In Scheme I like the clear distinction between sexprs and their values. The fact that some sexprs are self evaluating should not confuse the student, I think. Jos ----- Original Message ----- From: "Grant Rettke" To: "PLT Scheme Mailing List" Sent: Sunday, November 02, 2008 8:11 PM Subject: [plt-scheme] Papers on criticism of Scheme? > Hi, > > This paper: > > http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf > > was referenced recently. It was interesting to see criticisms of > Scheme from someone who knew Scheme. I think Wadler knew it well. > > Are there more like this out there? > > Best wishes, > > Grant > _________________________________________________ > 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/20081102/8734c631/attachment.html From workmin at ccs.neu.edu Sun Nov 2 18:40:53 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:32:14 2009 Subject: [plt-scheme] identifier binding to undefined identifier Message-ID: <490E3A85.8030003@ccs.neu.edu> The docs say identifier-binding returns #f is the binding is a top-level binding but what if there is no binding at all? ;; (define y 2) (define-syntax (bar stx) (syntax-case stx () ((_ id) (begin (printf "binding at ~a\n" (identifier-binding #'id)) #'id)))) (define-syntax foo (syntax-rules () ((_) (let ((x 1)) (bar y))))) (foo) This program prints "binding at #f" when (define y 2) is uncommented or not. What is the rationale for this? It seems more logical to return 'top-level if the identifier is bound at the top-level. From esmith at acanac.net Sun Nov 2 19:30:58 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:32:14 2009 Subject: [plt-scheme] Manipulating Scheme vectors with FFI In-Reply-To: <490DA1BF.7020105@zenburn.net> References: <48bf23a9-18b6-467c-98e8-d52fb578f0b8@y79g2000hsa.googlegroups.com> <18695.32990.362645.389911@arabic.ccs.neu.edu> <490BDA1E.1010806@acanac.net> <490DA1BF.7020105@zenburn.net> Message-ID: <490E4642.2090007@acanac.net> Jakub Piotr C?apa wrote: > Ernie Smith wrote: >> /* vector inside structure. How to declare the same in Scheeme? */ >> struct { int __val[ 2 ]; } ; /* vector embedded in struct */ > > This is impossible because of libffi limitations. You can workaround > by defining a custom type which is a struct with N fields and custom > access methods. See [1] for an example: > (define _path-type > (make-ctype (make-cstruct-type (build-list (/ usb-max-path-len 8) > (lambda (i) _uint64))) > #f > (lambda (ptr) > (let ([v (make-bytes usb-max-path-len)] > [length #f]) > (let loop ([i 0]) > (let ([value (ptr-ref ptr _uint8 'abs i)]) > (if (or (= i usb-max-path-len) (= value 0)) > (set! length i) > (begin > (bytes-set! v i value) > (loop (add1 i)))))) > (subbytes v 0 length))))) > Thanks for the help Jakub. It is very disappointing to learn that vectors within structs are ill supported by define-struct and the like. C structs really have little to do with scheme, but names like 'define-cstruct' etc does lead one to assume a capacity for coping with a valid, commonplace declaration of a C structure. I feel like I've been thrown back to the early days of C compilers when some implementors just threw all the member names in a global name space and forced you to rename all your fields prefixing them by the struct name, then other compiler writers wrapped you on the knuckles for exceeding name size limits. I thought I'd never have to go back to that time. Least of all from within scheme. Sigh. I'm going to hope that a kind hearted schemer out there will take pity on me and show me a nice general way around this. Do all the budding foreign function importers out there really need to be burdened with writing code fragments like the above. From alexshinn at gmail.com Sun Nov 2 21:16:28 2008 From: alexshinn at gmail.com (Alex Shinn) Date: Thu Mar 26 02:32:14 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> (Grant Rettke's message of "Sun\, 2 Nov 2008 13\:11\:03 -0600") References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> Message-ID: "Grant Rettke" writes: > This paper: > > http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf > > was referenced recently. It was interesting to see criticisms of > Scheme from someone who knew Scheme. I think Wadler knew it well. It's pretty clear that at the time he wrote that paper he barely knew Scheme at all. On page 13 he actually admits to having typed into a REPL ((+ 3 4) = (+ 5 2)) the sort of mistake you wouldn't expect anyone who had spent more than a few days working with Scheme to make, yet in the same paragraph he claims to be "an experienced Lisp programmer." His main points are made as an attack on Scheme itself, when in fact with macros Scheme can have all of the features he discusses (he seems to be completely unaware of the existence of macros). Taken as an approach to teaching (i.e. should you teach vanilla Scheme or Scheme with some libraries) he has some valid points. Personally I think pattern-matching is vastly underused in Scheme programming. -- Alex From sbloch at adelphi.edu Sun Nov 2 21:32:22 2008 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:32:15 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> Message-ID: <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> On Nov 2, 2008, at 9:16 PM, Alex Shinn referred to >> http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf and wrote: > Taken as an approach to teaching (i.e. should you teach > vanilla Scheme or Scheme with some libraries) he has some > valid points. Personally I think pattern-matching is vastly > underused in Scheme programming. I have a bunch of students right now trying to write (define (scale-posn num (make-posn x y)) (make-posn (* num x) (* num y))) which actually does make sense, but isn't legal Scheme. Any likelihood of a Haskell language module coming for DrScheme? Or a Scheme dialect with pattern-matching in function headers? Stephen Bloch sbloch@adelphi.edu From grettke at acm.org Sun Nov 2 21:41:31 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:15 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> Message-ID: <756daca50811021841i30c3d634w2daaebff3ee1c6b1@mail.gmail.com> On Sun, Nov 2, 2008 at 8:16 PM, Alex Shinn wrote: > "Grant Rettke" writes: > I think Wadler knew it well. > > It's pretty clear that at the time he wrote that paper he > barely knew Scheme at all. Ok. I *assumed* he knew it well. On page 2 he talks about using SICP and Scheme for two years, but now I look at it and see that he didn't teach it, Joe Stoy taught it. Ack. I had assumed the crazy things he said in the paper were just gross exaggerations made solely for the sake of drama. Eg: * Students can't tell the difference between cons and list * Students can't tell the difference between (list 'x) '(x) and (x) * Students screw up if they get lazy > On page 13 he actually admits to having typed into a REPL > > ((+ 3 4) = (+ 5 2)) > > the sort of mistake you wouldn't expect anyone who had spent > more than a few days working with Scheme to make, yet in the > same paragraph he claims to be "an experienced Lisp > programmer." Yes that is... strangle. From sk at cs.brown.edu Sun Nov 2 22:01:12 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:15 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <756daca50811021841i30c3d634w2daaebff3ee1c6b1@mail.gmail.com> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <756daca50811021841i30c3d634w2daaebff3ee1c6b1@mail.gmail.com> Message-ID: I learned Scheme from SICP and a very traditional REPL. After a brief initial hump, I found the programming style natural and the language enjoyable, but the one thing I could not quite get the hang of was quote. Years later I realized the problem was not with quote per se, it was with the way the REPL presented it. * Students can't tell the difference between (list 'x) '(x) and (x) As the saying goes, I resemble that remark. Exercises meant to clarify the REPL only confused me, because the REPL printing is NOT the right way to think of *intermediate* results (and I naively thought that the REPL was merely the thing that showed the final step of computation, not a special device in itself). That is, I was thinking with a value semantics but the environment did not offer me value printing. In short, let's not shoot the messenger here. Irrespective of whether Phil knew Scheme intimately or not, some of the issues he raises are worth contemplating. (But I do agree w/ Alex; I can't imagine writing an infix expression after *programming* in Scheme for any duration -- but it's conceivable that someone who has only *taught* Scheme could make that mistake....) Shriram From alexshinn at gmail.com Mon Nov 3 01:59:04 2008 From: alexshinn at gmail.com (Alex Shinn) Date: Thu Mar 26 02:32:15 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> (Stephen Bloch's message of "Sun\, 2 Nov 2008 21\:32\:22 -0500") References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> Message-ID: Stephen Bloch writes: > I have a bunch of students right now trying to write > > (define (scale-posn num (make-posn x y)) > (make-posn (* num x) (* num y))) > > which actually does make sense, but isn't legal Scheme. Any > likelihood of a Haskell language module coming for DrScheme? Or a > Scheme dialect with pattern-matching in function headers? The most common match syntax in use is based on an old library by Andrew Wright. There's a portable hygienic version with many extensions available at http://synthcode.com/scheme/match.scm The MATCH-LAMBDA* syntax it provides is close to what you want, but could be made a little more convenient with something like: (define-syntax define* (syntax-rules () ((def (name params ...) body ...) (define name (match-lambda* ((params ...) body ...)))) ((def name value) (define name value)))) Then you can do (define* (scale-posn num ($ posn x y)) (make-posn (* num x) (* num y))) This is using the (non-portable, but widely supported) $ record syntax. PLT's new default match uses a different syntax closer to what you want, and is extensible. It would be easy to provide a DEFINE-RECORD-TYPE constructor which automatically provided the MAKE-FOO match pattern for a record FOO. The example would then become (define* (scale-posn num (make-posn x y)) (make-posn (* num x) (* num y))) exactly as you wrote. -- Alex From sergey.khorev at gmail.com Mon Nov 3 03:14:07 2008 From: sergey.khorev at gmail.com (Sergey Khorev) Date: Thu Mar 26 02:32:15 2009 Subject: [plt-scheme] Code for catching exceptions in embedding applications In-Reply-To: <20081006001954.2D0A965008C@mail-svr1.cs.utah.edu> References: <48E78592.1060400@gmail.com> <20081006001954.2D0A965008C@mail-svr1.cs.utah.edu> Message-ID: <134cebf50811030014k3a3514s5f26fcc6b2b8ed9d@mail.gmail.com> >> Code below (basically it has been extracted from PLT documentation) >> crashes with >> #f::0: compile: bad syntax; function application is not allowed, because >> no #%app syntax transformer is bound in: (lambda (thunk) (with-handlers >> ((void (lambda(exn) (cons #f exn)))) (cons #t (thunk)))) >> >> Seg fault (internal error) at 4 >> >> Do I need to `require' some module for this to work? > > Yes. The initial namespace is empty; it doesn't even have syntax for > `lambda' or for function application. So, you need to require something > like `scheme/base'. Ok, I created base.c with mzc --c-mods base.c ++lib scheme/base but unable to require it into new namespace (getting scheme/base: standard-module-name-resolver: collection not found: "scheme" in any of: () in: scheme/base), please see code below. Do I need to populate MzScheme collection path? What is the point in use of base.c then? #define MZ_PRECISE_GC 1 #include #include "base.c" static Scheme_Env *environment = NULL; static int scheme_main(void *data) { char *e = "(lambda (thunk) " "(with-handlers ([void (lambda (exn) (cons #f exn))]) " "(cons #t (thunk))))"; Scheme_Env *env = NULL; Scheme_Object *exn_catching_apply = NULL; Scheme_Object *sym = NULL; MZ_GC_DECL_REG(3); MZ_GC_VAR_IN_REG(0, env); MZ_GC_VAR_IN_REG(1, exn_catching_apply); MZ_GC_VAR_IN_REG(2, sym); MZ_GC_REG(); MZ_REGISTER_STATIC(environment); environment = scheme_basic_env(); declare_modules(environment); sym = scheme_intern_symbol("scheme/base"); //scheme_namespace_require(sym); env = (Scheme_Env *)scheme_make_namespace(0, NULL); declare_modules(env); scheme_set_param(scheme_current_config(), MZCONFIG_ENV, env); scheme_namespace_require(sym); exn_catching_apply = scheme_eval_string(e, env); MZ_GC_UNREG(); return 1; } int main() { return scheme_main_stack_setup(1, scheme_main, NULL); } From matthias at ccs.neu.edu Mon Nov 3 07:17:12 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:16 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> Message-ID: <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> On Nov 3, 2008, at 1:59 AM, Alex Shinn wrote: > The most common match syntax in use is based on an old > library by Andrew Wright. There's a portable hygienic > version with many extensions available at > > http://synthcode.com/scheme/match.scm This is even older than you can possibly imagine. It's based on a library that Bruce maintained from 87 or so. And that is based/inspired on a macro that I wrote in Oct 1984, because I was switching from Prolog to Scheme, and back then, I thought I couldn't live w/o pattern matching anymore. -- Matthias From robby at cs.uchicago.edu Mon Nov 3 07:22:22 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:16 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> Message-ID: <932b2f1f0811030422p454ed2b2oe0f61afe439e81ca@mail.gmail.com> Also note that an newer version of that (maintained by SamTH) is built into #lang scheme. Robby On Mon, Nov 3, 2008 at 6:17 AM, Matthias Felleisen wrote: > > On Nov 3, 2008, at 1:59 AM, Alex Shinn wrote: > >> The most common match syntax in use is based on an old >> library by Andrew Wright. There's a portable hygienic >> version with many extensions available at >> >> http://synthcode.com/scheme/match.scm > > > This is even older than you can possibly imagine. > It's based on a library that Bruce maintained from 87 or so. > And that is based/inspired on a macro that I wrote in Oct 1984, > because I was switching from Prolog to Scheme, and back then, > I thought I couldn't live w/o pattern matching anymore. > > -- Matthias > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From alexshinn at gmail.com Mon Nov 3 07:38:11 2008 From: alexshinn at gmail.com (Alex Shinn) Date: Thu Mar 26 02:32:16 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> (Matthias Felleisen's message of "Mon\, 3 Nov 2008 07\:17\:12 -0500") References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> Message-ID: Matthias Felleisen writes: > On Nov 3, 2008, at 1:59 AM, Alex Shinn wrote: > >> The most common match syntax in use is based on an old >> library by Andrew Wright. There's a portable hygienic >> version with many extensions available at >> >> http://synthcode.com/scheme/match.scm > > This is even older than you can possibly imagine. > It's based on a library that Bruce maintained from 87 or so. > And that is based/inspired on a macro that I wrote in Oct 1984, > because I was switching from Prolog to Scheme, and back then, > I thought I couldn't live w/o pattern matching anymore. Thanks! It can be so hard to track down programming language history sometimes :) There wouldn't be any trace left of these early systems, would there? I know OPS5 (which was even earlier, written in the 70S) was originally written in Lisp and had a not dissimilar pattern matching facility. -- Alex From matthias at ccs.neu.edu Mon Nov 3 08:08:16 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:16 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> Message-ID: <1A13FD31-8E00-4DE9-9101-4E22470A2044@ccs.neu.edu> On Nov 3, 2008, at 7:38 AM, Alex Shinn wrote: > Matthias Felleisen writes: > >> On Nov 3, 2008, at 1:59 AM, Alex Shinn wrote: >> >>> The most common match syntax in use is based on an old >>> library by Andrew Wright. There's a portable hygienic >>> version with many extensions available at >>> >>> http://synthcode.com/scheme/match.scm >> >> This is even older than you can possibly imagine. >> It's based on a library that Bruce maintained from 87 or so. >> And that is based/inspired on a macro that I wrote in Oct 1984, >> because I was switching from Prolog to Scheme, and back then, >> I thought I couldn't live w/o pattern matching anymore. > > Thanks! It can be so hard to track down programming > language history sometimes :) Nah, just a tidbit. > > There wouldn't be any trace left of these early systems, > would there? I know OPS5 (which was even earlier, written > in the 70S) was originally written in Lisp and had a not > dissimilar pattern matching facility. I used OPS5 that same year, but it left no pattern matching expression on me whatsoever. The patterns were quite simplistic just enough to get the rule engine firing. But that doesn't mean it didn't exist. BTW, I suspect that Prolog is significantly older than OPS5. -- Matthias From mflatt at cs.utah.edu Mon Nov 3 09:39:33 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:16 2009 Subject: [plt-scheme] Code for catching exceptions in embedding applications In-Reply-To: <134cebf50811030014k3a3514s5f26fcc6b2b8ed9d@mail.gmail.com> References: <48E78592.1060400@gmail.com> <20081006001954.2D0A965008C@mail-svr1.cs.utah.edu> <134cebf50811030014k3a3514s5f26fcc6b2b8ed9d@mail.gmail.com> Message-ID: <20081103143934.AF8416500B1@mail-svr1.cs.utah.edu> At Mon, 3 Nov 2008 11:14:07 +0300, "Sergey Khorev" wrote: > > environment = scheme_basic_env(); > declare_modules(environment); At this point, `environment' is set up ok. > env = (Scheme_Env *)scheme_make_namespace(0, NULL); > declare_modules(env); But then you create another namespace... Solution 1: If you don't actually need a second namespace, just set `env' to `environment'. The other solutions below assume that you do need a second namespace. Solution 2 (incomplete): It turns out that declare_modules() doesn't use its `env' argument. Instead, it declares modules in the current environment, which is `environment'. I'll adjust the docs to clarify this. Even if you reverse the order of the declare and parameter assignment, like this: env = (Scheme_Env *)scheme_make_namespace(0, NULL); scheme_set_param(scheme_current_config(), MZCONFIG_ENV, env); declare_modules(env); then it doesn't work, because the empty namespace doesn't have some built-in modules that are needed for the `scheme/base' declarations. You could attach the built-in declarations from `environment' to `env', but it's best just to attach `scheme/base' itself, as in Solution 3. Solution 3 (works with latest in SVN): To create a separate `env', it's best to call `make-base-namespace' from `scheme/base' instead of scheme_make_namespace(). That operation attaches the declared modules from the original namespace, instead of redeclaring them. The C code looks like this: a[0] = scheme_intern_symbol("scheme/base"); a[1] = scheme_intern_symbol("make-base-namespace"); p = scheme_dynamic_require(2, a); env = scheme_apply(p, 0, NULL); However, this didn't work previously, because the namespace-attaching operation didn't transfer module-name mappings. That is, in the new namespace, the module resolver didn't track that `scheme/base' was pre-declared. In SVN, I've adjusted the module renamer created by `mzc --c-mods' to correctly track attaches, so that this approach works. The code below works with the latest in SVN. ---------------------------------------- #define MZ_PRECISE_GC 1 #include #include "base.c" static Scheme_Env *environment = NULL; static int scheme_main(void *data) { char *e = "(lambda (thunk) " "(with-handlers ([void (lambda (exn) (cons #f exn))]) " "(cons #t (thunk))))"; Scheme_Env *env = NULL; Scheme_Object *exn_catching_apply = NULL; Scheme_Object *p = NULL, *a[2] = { NULL, NULL }; MZ_GC_DECL_REG(6); MZ_GC_VAR_IN_REG(0, env); MZ_GC_VAR_IN_REG(1, exn_catching_apply); MZ_GC_VAR_IN_REG(2, p); MZ_GC_ARRAY_VAR_IN_REG(3, a, 2); MZ_GC_REG(); MZ_REGISTER_STATIC(environment); environment = scheme_basic_env(); declare_modules(environment); a[0] = scheme_intern_symbol("scheme/base"); a[1] = scheme_intern_symbol("make-base-namespace"); p = scheme_dynamic_require(2, a); env = scheme_apply(p, 0, NULL); scheme_set_param(scheme_current_config(), MZCONFIG_ENV, (Scheme_Object *)env); scheme_namespace_require(a[0]); exn_catching_apply = scheme_eval_string(e, env); MZ_GC_UNREG(); a[1] = scheme_intern_symbol("read-eval-print-loop"); p = scheme_dynamic_require(2, a); p = scheme_dynamic_require(2, a); env = scheme_apply(p, 0, NULL); return 1; } int main() { return scheme_main_stack_setup(1, scheme_main, NULL); } From plragde at uwaterloo.ca Mon Nov 3 10:29:55 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:32:16 2009 Subject: [plt-scheme] Papers on criticism of Scheme? Message-ID: <490F18F3.4070006@uwaterloo.ca> Grant wrote: > I had assumed the crazy things he said in the paper were just gross > exaggerations made solely for the sake of drama. Eg: > > * Students can't tell the difference between cons and list > * Students can't tell the difference between (list 'x) '(x) and (x) > * Students screw up if they get lazy I have seen students do all of these things, so while they are not universal, they are definitely tendencies against which we should guard. I concur with the sentiment that Wadler made some good points in this early paper (particularly with respect to the way that Scheme was taught at the time) while being off base on others. At FDPE in September, I heard him refer to Scheme in a positive way (something about "as clean and simple as Scheme") so I think that, while we may disagree on some of the details, we are all pulling in more or less the same direction. Stephen wrote: > I have a bunch of students right now trying to write > > (define (scale-posn num (make-posn x y)) > (make-posn (* num x) (* num y))) > > which actually does make sense, but isn't legal Scheme. Any > likelihood of a Haskell language module coming for DrScheme? Or a > Scheme dialect with pattern-matching in function headers? Tomorrow I take my first-term advanced students into the Module language, and one of the first things we will do -- before printing, reading, and mutation -- is look at `match' (not match-lambda). I think it facilitates much data structures work. At some point, I tried to get it to work with the teaching languages, and failed. I don't think it should be introduced very early, but it would be nice when working with trees, for example, or lists with depth greater than one or two. A ComradeHaskell language level would be great, but certainly nontrivial (more so than the ML interface developed at Brown) and probably everyone currently on the PLT team has higher priorities. I also think (and here Wadler would clearly disagree) that Haskell should not be used anywhere in a first course, so perhaps there is less need for it. I did ask, at FDPE, if anyone in the Haskell community was thinking about an analogue to DrScheme, and Wadler mentioned Helium (in progress at Utrecht), but I have not looked seriously into it. --PR From sk at cs.brown.edu Mon Nov 3 10:35:43 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:16 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <490F18F3.4070006@uwaterloo.ca> References: <490F18F3.4070006@uwaterloo.ca> Message-ID: I have used Helium in my course. It's a nice start, and like DrScheme, also an incubator for some research. But it still has a long way to go. Programming environments don't, in general, seem to be in the DNA of the functional community. Shriram From mflatt at cs.utah.edu Mon Nov 3 10:51:13 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:17 2009 Subject: [plt-scheme] identifier binding to undefined identifier In-Reply-To: <490E3A85.8030003@ccs.neu.edu> References: <490E3A85.8030003@ccs.neu.edu> Message-ID: <20081103155113.DB7C66500AA@mail-svr1.cs.utah.edu> At Sun, 02 Nov 2008 16:40:53 -0700, Jon Rafkind wrote: > The docs say identifier-binding returns #f is the binding is a top-level > binding but what if there is no binding at all? That's the same as having a top-level variable binding. The docs need some work on this point. > What is the rationale for this? It seems more logical to return > 'top-level if the identifier is bound at the top-level. Conflating "unbound" and "bound at the top level" makes REPLs work. That is, outside of a module, there's is really no such thing as "unbound", so in a REPL you can write > (define (f) (g)) > (define (g) (f)) and then `(g)' is an infinite loop. As of first interaction, the body of the function `f' has a meaning because `g' is "bound", even though `g' is not yet "defined". Within a module, there's no such thing as "bound at the top level", so identifiers with no other binding within a module are described as "unbound". Matthew From jos.koot at telefonica.net Mon Nov 3 11:05:13 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:32:17 2009 Subject: Fw: [plt-scheme] identifier binding to undefined identifier Message-ID: It appears that I did not cc my email on this topic to the PLT list. Sorry. I am sure my answer is just the same as yours. Jos ----- Original Message ----- From: "Jos Koot" To: "Jon Rafkind" Sent: Monday, November 03, 2008 11:20 AM Subject: Re: [plt-scheme] identifier binding to undefined identifier >I answer because I did not see a reply from a more expert member of the >list. In case my answer is not fully acurate, I will certainly be >corrected. > > You won't have this problem within modules. It is a top level problem. In > a REPL for instance, the macro, i.e. syntax-transformer running at > expansion time, cannot know whether or not the identifier will be defined > later. At the top level every identifier that has no other binding is, > during expansion, supposed to be bound at top level. Without this, it > would not be possible to define a procedure in a REPL in terms of > procedures yet to be defined. > > REPL: > > (define (foo x) (bar (bar x))) > ;During expansion identifier `bar' must be supposed to be bound later at > top level. > > (define (bar x) (+ x 1)) > ;And now `'bar' is bound indeed. > > (foo 3) ; --> 5 > > In a module forward references are no problem, because a module is > expanded as a whole and can therefore see forward references. > > Jos > > ----- Original Message ----- > From: "Jon Rafkind" > To: "PLT-list" > Sent: Monday, November 03, 2008 12:40 AM > Subject: [plt-scheme] identifier binding to undefined identifier > > >> The docs say identifier-binding returns #f is the binding is a top-level >> binding but what if there is no binding at all? >> >> ;; (define y 2) >> >> (define-syntax (bar stx) >> (syntax-case stx () >> ((_ id) >> (begin >> (printf "binding at ~a\n" (identifier-binding #'id)) >> #'id)))) >> >> (define-syntax foo >> (syntax-rules () >> ((_) (let ((x 1)) >> (bar y))))) >> >> (foo) >> >> This program prints "binding at #f" when (define y 2) is uncommented or >> not. What is the rationale for this? It seems more logical to return >> 'top-level if the identifier is bound at the top-level. >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > From sbloch at adelphi.edu Mon Nov 3 11:12:28 2008 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:32:17 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: References: <490F18F3.4070006@uwaterloo.ca> Message-ID: On Nov 3, 2008, at 10:35 AM, Shriram Krishnamurthi wrote: > I have used Helium in my course. It's a nice start, and like > DrScheme, also an incubator for some research. But it still has a > long way to go. Programming environments don't, in general, seem to > be in the DNA of the functional community. I used Helium a little (in conjunction with Shriram's book) in a 4th- semester "Principles of Programming Languages" course last year, and I might use it again next semester. It worked for the tiny examples we tried :-) Does anybody have any experience with Oz? Stephen Bloch sbloch@adelphi.edu From esmith at acanac.net Mon Nov 3 11:49:56 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:32:17 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <1A13FD31-8E00-4DE9-9101-4E22470A2044@ccs.neu.edu> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> <1A13FD31-8E00-4DE9-9101-4E22470A2044@ccs.neu.edu> Message-ID: <490F2BB4.8000704@acanac.net> Matthias Felleisen wrote: >> in the 70S) was originally written in Lisp and had a not >> dissimilar pattern matching facility. Since the subject has turned to history.. I went a little further back. "One can cure oneself of the not un- formation by memorizing this sentence: A not unblack dog was chasing a not unsmall rabbit across a not ungreen field." George Orwell -1946 From william.wood3 at comcast.net Mon Nov 3 11:37:00 2008 From: william.wood3 at comcast.net (Bill) Date: Thu Mar 26 02:32:17 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <1A13FD31-8E00-4DE9-9101-4E22470A2044@ccs.neu.edu> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> <1A13FD31-8E00-4DE9-9101-4E22470A2044@ccs.neu.edu> Message-ID: <1225730220.22156.18.camel@localhost> On Mon, 2008-11-03 at 08:08 -0500, Matthias Felleisen wrote: . . . > BTW, I suspect that Prolog is significantly older than OPS5. Not so much. The "Marseille Interpreter" seems to date to the early 70's (Battani and Medoni 1973. citation: Campbell, Implementations of Prolog, 1984) and Kowalski bases "Logic for Problem Solving" on lectures given in 1974 (citation: Kowalski, Logic for Problem Solving, 1979). Kowalski worked on theorem-prover strategies and implementation techniques from 1969. The seed seems to have been Cordell Green's insight that a Horn clause could be viewed as a procedure call in the late 60's ("Application of theorem proving to problem solving", IJCAI-1, 1969 and "Theorem-proving by resolution as a basis for question-answering systems", MI4, 1969. citations: Nilsson, Principles of Artificial Intelligence, 1980). -- Bill Wood From ebellani at gmail.com Mon Nov 3 12:50:43 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:18 2009 Subject: [plt-scheme] Sweet-expressions on PLT Message-ID: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> Hey there guys. I'm new to LISP/scheme (I'm from the ruby world), trying a lot of stuff to make sense of this new environment. One particular thing I've found that would really smooth the line of effort is sweet-expressions (http://www.dwheeler.com/readable/). The author was gentle enough even to provide a why do it here http://www.dwheeler.com/readable/retort-lisp-can-be-readable.html . So quoting a conversation I had with the author: Eduardo Bellani: >> Would you know if your sweet-expressions would work on PLT Scheme >> (I'm reaching for some way to develop a web app with sweet expressions >> here, just to show case it to a study group, perhaps get some >> people interested)? > >I don't know if it'd work on PLT Scheme, but if it doesn't, it should be extremely >trivial to make it work. > >The Scheme implementation of sweet-expressions is intentionally >written to be _very_ portable; I actively strived to avoid anything that >wasn't explicitly promised by the Scheme (R5) spec. >The one exception is modules, which R5 didn't have at all, so you may >need to edit the (few) lines to cause it to be combined into a module. >Nearly all Schemes have _some_ module system, but they're all slightly >different :-(. > >The code I wrote (modulo reuse) uses a relatively small dialect of Scheme. >I want it to be easily translatable to Common Lisp and ACL2, so I intentionally >avoided some Scheme capabilities. I'm looking for a hand on porting this to PLT, since I'm trying here is to learn lisp using that, and to port it I would need to learn lisp, and so on :P Would anyone care to lend a hand? Hugs -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081103/ad0983d4/attachment.htm From robby at cs.uchicago.edu Mon Nov 3 12:58:39 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:18 2009 Subject: [plt-scheme] planet browsing broken? In-Reply-To: References: Message-ID: <932b2f1f0811030958y5e626996s84826b0f354a7b54@mail.gmail.com> Thanks. Should be fixed now. There was a bug in the code that rendered source code into html with colors -- two bugs really: 1) #; was (effectively) treated as a single-line comment, presumably because the code was written before there were #; comments. 2) an unclosed string caused a non-tail-recursive infinite loop. Robby On Sat, Nov 1, 2008 at 5:18 PM, Dimitris Vyzovitis wrote: > The planet browsing functionality appears to be broken for some packages > e.g: http://planet.plt-scheme.org/display.ss?package=socket.plt&owner=vyzo > no code appearing: > http://planet.plt-scheme.org/package-source/vyzo/socket.plt/3/0/ > [just 3 files] > no docs: > http://planet.plt-scheme.org/package-source/vyzo/socket.plt/3/0/ > [404s] > > -- vyzo > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From kbohdan at mail.ru Mon Nov 3 13:13:56 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:32:19 2009 Subject: [plt-scheme] Which Programming Languages Book to read? Message-ID: Hi, Can anyone experienced compare following books ?: 1. Programming Languages: Application and Interpretation (by Shriram Krishnamurthi) 2. ESSENTIALS OF PROGRAMMING LANGUAGES (by Daniel P. Friedman, Mitchell Wand). 3. Design Concepts in Programming Languages (by FRANKLYN TURBAK AND DAVID GIFFORD WITH MARK A. SHELDON) Thanks. -- Bohdan From grettke at acm.org Mon Nov 3 13:51:52 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:19 2009 Subject: [plt-scheme] Which Programming Languages Book to read? In-Reply-To: References: Message-ID: <756daca50811031051t7306c5c7x81e2aa040c484a0b@mail.gmail.com> On Mon, Nov 3, 2008 at 12:13 PM, wrote: > 1. Programming Languages: Application and Interpretation > (by Shriram Krishnamurthi) > > 2. ESSENTIALS OF PROGRAMMING LANGUAGES (by Daniel P. Friedman, > Mitchell Wand). See "How do you compare this book to Friedman, Wand and Haynes's Essentials of Programming Languages (EoPL)?": http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/FAQ/ From jadudm at gmail.com Mon Nov 3 13:45:04 2008 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:32:19 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> Message-ID: Hi Eduardo, On Mon, Nov 3, 2008 at 12:50 PM, Eduardo Bellani wrote: > provide a why do it here > http://www.dwheeler.com/readable/retort-lisp-can-be-readable.html . This is largely a rehashing of all kinds of garbage. I especially like this: "Guy Steele? The guy who developed both Common Lisp and Scheme, but has now moved on from Lisp to lead the development of Java? Java, a decidedly non s-expression-based language? Oh, yeah, that guy." As if Steele's work at Sun on Java (in an infix syntax) was simply because S-expressions are intractable. Next, they'll be saying that Matthias Felleisen works with Scheme because he could never master the state monad in Haskell! I would honestly encourage you to simply attempt to use the language as-is. Perhaps dive into HtDP (http://www.htdp.org), or (if you're keen) take a look at projects like LeftParen: http://blog.leftparen.com/ which will drop you into developing web applications in a rather Rails-like environment. Either way, I wouldn't let yourself get caught up in syntax malarky. C is different than Java is different than Ruby is different than Scheme is different than Erlang is different than Damian Conway's Latin syntax for Perl is different... My point is, instead of learning enough Scheme to end up programming in a syntax that is decidedly not that of Scheme, why not just learn the language and get rolling? But, up to you. If you have questions about your porting effort (that is, if you don't get explicit offers for help), by all means do ask questions. It isn't my intent to discourage you... but instead to encourage you to embrace the language as-is. Cheers, Matt From grettke at acm.org Mon Nov 3 14:02:17 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:19 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0D9831D6-804B-486D-B8E5-2FDC608AF53B@adelphi.edu> <8FA1F19E-10F9-4BBF-B65E-A269D674772F@ccs.neu.edu> Message-ID: <756daca50811031102tadb88c2gc99285af8de58b33@mail.gmail.com> On Mon, Nov 3, 2008 at 6:17 AM, Matthias Felleisen wrote: > > On Nov 3, 2008, at 1:59 AM, Alex Shinn wrote: > >> The most common match syntax in use is based on an old >> library by Andrew Wright. There's a portable hygienic >> version with many extensions available at >> >> http://synthcode.com/scheme/match.scm > > > This is even older than you can possibly imagine. > It's based on a library that Bruce maintained from 87 or so. Bruce Duba? From ebellani at gmail.com Mon Nov 3 14:13:10 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:20 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> Message-ID: <184222e50811031113r2a797d08i20d6ef9807137cd7@mail.gmail.com> Hey there Matt, Man, I do think the David has some valid points, but frankly my opinion is that of a foreigner to the lisp world, so even I don't trust my opinion too much on this subject. The PLT translation effort is precisely aimed at building stuff with leftparen, which was the only framework that worked a hello world with the amount of effort that I found acceptable. Oh, and thanks for the HtDP, I'm currently looking SICP lectures to dive into scheme itself http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ so I don't think I'll have the time, but it went to the top of my reading list (pun intended :P). I'm pretty comfortable with rails and merb for my production needs, but I'm also looking for the better ways to do things and to expand my knowledge base, plus I'm also trying to make a point for other people I know and some students at the college I graduated in about (I do some volunteer teaching there) about lisp/scheme, and sweet-expressions sounded like the way to begin to approach the subject with people who are not familiar with s-expressions syntax (which I found somewhat alien, and I do think others would feel the same) so to get their feet wet. Anyway, I'll get on with the porting thing, and try to post specific questions when they arise. Hugs everyone. On Mon, Nov 3, 2008 at 4:45 PM, Matt Jadud wrote: > Hi Eduardo, > > On Mon, Nov 3, 2008 at 12:50 PM, Eduardo Bellani > wrote: > > provide a why do it here > > http://www.dwheeler.com/readable/retort-lisp-can-be-readable.html . > > This is largely a rehashing of all kinds of garbage. I especially like > this: > > "Guy Steele? The guy who developed both Common Lisp and Scheme, but > has now moved on from Lisp to lead the development of Java? Java, a > decidedly non s-expression-based language? Oh, yeah, that guy." > > As if Steele's work at Sun on Java (in an infix syntax) was simply > because S-expressions are intractable. Next, they'll be saying that > Matthias Felleisen works with Scheme because he could never master the > state monad in Haskell! > > I would honestly encourage you to simply attempt to use the language > as-is. Perhaps dive into HtDP (http://www.htdp.org), or (if you're > keen) take a look at projects like LeftParen: > > http://blog.leftparen.com/ > > which will drop you into developing web applications in a rather > Rails-like environment. Either way, I wouldn't let yourself get caught > up in syntax malarky. C is different than Java is different than Ruby > is different than Scheme is different than Erlang is different than > Damian Conway's Latin syntax for Perl is different... > > My point is, instead of learning enough Scheme to end up programming > in a syntax that is decidedly not that of Scheme, why not just learn > the language and get rolling? > > But, up to you. If you have questions about your porting effort (that > is, if you don't get explicit offers for help), by all means do ask > questions. It isn't my intent to discourage you... but instead to > encourage you to embrace the language as-is. > > Cheers, > Matt > -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081103/f49f6fdc/attachment.html From grettke at acm.org Mon Nov 3 14:22:33 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:20 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> Message-ID: <756daca50811031122y5266cdbfr906253fc6bad9e0b@mail.gmail.com> On Mon, Nov 3, 2008 at 11:50 AM, Eduardo Bellani wrote: > I'm new to LISP/scheme (I'm from the ruby world), trying a lot of stuff to > make sense of this new environment. One particular thing I've found that would > really smooth the line of effort is sweet-expressions > (http://www.dwheeler.com/readable/). The author was gentle enough even to > provide a why do it here http://www.dwheeler.com/readable/retort-lisp-can-be-readable.html . Hi Eduardo, It makes sense that you want to make the learning process easier, but avoiding s-expressions won't help you here. Take the approach like you would any other development task, first learn how it is supposed to work, and then decided for yourself whether you want to do it differently. Ultimately you would be worse off if you used sweet-expressions but weren't even sure what so bad about s-expressions to begin with, and, there isn't anything wrong with s-expressions, you get over it in a few hours. From ebellani at gmail.com Mon Nov 3 14:28:50 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:21 2009 Subject: Fwd: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <184222e50811031128i540fb0cwcdead4f35246d0f2@mail.gmail.com> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <756daca50811031122y5266cdbfr906253fc6bad9e0b@mail.gmail.com> <184222e50811031128i540fb0cwcdead4f35246d0f2@mail.gmail.com> Message-ID: <184222e50811031128s478b6d3bhf5e9e8ccb8a4be50@mail.gmail.com> ---------- Forwarded message ---------- From: Eduardo Bellani Date: Mon, Nov 3, 2008 at 5:28 PM Subject: Re: [plt-scheme] Sweet-expressions on PLT To: Grant Rettke No man, I think I've not made myself as clear as I could. I'm looking at sweet-expressions not as a way for me to learn scheme more easily (that would be cool, but it's not my main goal), but to teach it/showcase it to other people, because what I think the "problem" sweet-expressions fix is the readability of the code, which for me (and I'm pretty sure for my target audience, consisted of ruby/java/c++ and some python guys, too), is somewhat hard to read. Thanks for the tips though. On Mon, Nov 3, 2008 at 5:22 PM, Grant Rettke wrote: > On Mon, Nov 3, 2008 at 11:50 AM, Eduardo Bellani > wrote: > > I'm new to LISP/scheme (I'm from the ruby world), trying a lot of stuff > to > > make sense of this new environment. One particular thing I've found that > would > > really smooth the line of effort is sweet-expressions > > (http://www.dwheeler.com/readable/). The author was gentle enough even > to > > provide a why do it here > http://www.dwheeler.com/readable/retort-lisp-can-be-readable.html . > > Hi Eduardo, > > It makes sense that you want to make the learning process easier, but > avoiding s-expressions won't help you here. > > Take the approach like you would any other development task, first > learn how it is supposed to work, and then decided for yourself > whether you want to do it differently. > > Ultimately you would be worse off if you used sweet-expressions but > weren't even sure what so bad about s-expressions to begin with, and, > there isn't anything wrong with s-expressions, you get over it in a > few hours. > -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081103/cd12c96c/attachment.htm From kbohdan at mail.ru Mon Nov 3 14:14:08 2008 From: kbohdan at mail.ru (bad) Date: Thu Mar 26 02:32:21 2009 Subject: [plt-scheme] Which Programming Languages Book to read? In-Reply-To: <756daca50811031051t7306c5c7x81e2aa040c484a0b@mail.gmail.com> References: <756daca50811031051t7306c5c7x81e2aa040c484a0b@mail.gmail.com> Message-ID: <490F4D80.1020702@mail.ru> Grant Rettke wrote: > On Mon, Nov 3, 2008 at 12:13 PM, wrote: > >> 1. Programming Languages: Application and Interpretation >> (by Shriram Krishnamurthi) >> >> 2. ESSENTIALS OF PROGRAMMING LANGUAGES (by Daniel P. Friedman, >> Mitchell Wand). >> ! 3rd-edition ! > > See "How do you compare this book to Friedman, Wand and Haynes's > Essentials of Programming Languages (EoPL)?": > > http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/FAQ/ > Missed this, thx. Just want to note that there is a new 3rd edition of this book. At least some critique issues are still true (ex: GC), but it would be nice to update this comparison. -- Bohdan From kbohdan at mail.ru Mon Nov 3 17:07:37 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:32:21 2009 Subject: [plt-scheme] Re: Fwd: Sweet-expressions on PLT In-Reply-To: <184222e50811031128s478b6d3bhf5e9e8ccb8a4be50@mail.gmail.com> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <756daca50811031122y5266cdbfr906253fc6bad9e0b@mail.gmail.com> <184222e50811031128i540fb0cwcdead4f35246d0f2@mail.gmail.com> <184222e50811031128s478b6d3bhf5e9e8ccb8a4be50@mail.gmail.com> Message-ID: Eduardo Bellani wrote: > I'm looking at sweet-expressions not as a way for me to learn scheme > more easily (that > would be cool, but it's not my main goal), but to teach it/showcase it > to other people, > because what I think the "problem" sweet-expressions fix is the > readability of the code, > which for me (and I'm pretty sure for my target audience, consisted of > ruby/java/c++ and some python guys, too), > is somewhat hard to read. Assuming that most of "java ... python" guys are forced to use XML&XSLT: Do you think that representing XML/XSLT in a "sweet" form to promote learning it is a good idea ? -- Bohdan From ebellani at gmail.com Mon Nov 3 18:08:31 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:22 2009 Subject: [plt-scheme] Re: Fwd: Sweet-expressions on PLT In-Reply-To: References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <756daca50811031122y5266cdbfr906253fc6bad9e0b@mail.gmail.com> <184222e50811031128i540fb0cwcdead4f35246d0f2@mail.gmail.com> <184222e50811031128s478b6d3bhf5e9e8ccb8a4be50@mail.gmail.com> Message-ID: <184222e50811031508j464a5aa6y2212bfd65cc35369@mail.gmail.com> Hey there Bohdan, If I could present XML/XSLT in a "sweeter" form, but maintaining the meaning and power of the language, sure, why not? I take all my teaching/learning cues from Seymour Papert mate, and he created LOGO... Anyway, pointers are more than welcome. Hugs and thanks again for all the replies guys. On Mon, Nov 3, 2008 at 8:07 PM, wrote: > > Eduardo Bellani wrote: > > I'm looking at sweet-expressions not as a way for me to learn scheme more >> easily (that >> would be cool, but it's not my main goal), but to teach it/showcase it to >> other people, >> because what I think the "problem" sweet-expressions fix is the >> readability of the code, >> which for me (and I'm pretty sure for my target audience, consisted of >> ruby/java/c++ and some python guys, too), >> is somewhat hard to read. >> > > Assuming that most of "java ... python" guys are forced to use XML&XSLT: > > Do you think that representing XML/XSLT in a "sweet" form to promote > learning it is a good idea ? > > -- > Bohdan > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081103/e1a48b97/attachment.html From ebellani at gmail.com Mon Nov 3 18:24:12 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:22 2009 Subject: [plt-scheme] Re: Fwd: Sweet-expressions on PLT In-Reply-To: <184222e50811031508j464a5aa6y2212bfd65cc35369@mail.gmail.com> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <756daca50811031122y5266cdbfr906253fc6bad9e0b@mail.gmail.com> <184222e50811031128i540fb0cwcdead4f35246d0f2@mail.gmail.com> <184222e50811031128s478b6d3bhf5e9e8ccb8a4be50@mail.gmail.com> <184222e50811031508j464a5aa6y2212bfd65cc35369@mail.gmail.com> Message-ID: <184222e50811031524j322915cdwf16ea87f81296718@mail.gmail.com> Damn, pressed the send button a tad earlier than what I should have, sorry, here is an elaboration. Papert created a learning theory called constructionism, which, amongst other things, advocates for the creation of "microworlds", where students can related physically, intellectually and culturally to the subject, and to build or construct it's own version of it. So, by presenting people with something they can relate more easily to, I smooth the process of building the knowledge for the students, and by doing that they have a better chance to learn and actually enjoy it. If anyone wants to discuss Papert and constructionism (which are waaaay offtopic here), just email me ;) Hugs On Mon, Nov 3, 2008 at 9:08 PM, Eduardo Bellani wrote: > Hey there Bohdan, > > If I could present XML/XSLT in a "sweeter" form, but maintaining the > meaning and power of the language, sure, why not? > I take all my teaching/learning cues from Seymour Papert mate, and he > created LOGO... > > Anyway, pointers are more than welcome. > Hugs and thanks again for all the replies guys. > > > > On Mon, Nov 3, 2008 at 8:07 PM, wrote: > >> >> Eduardo Bellani wrote: >> >> I'm looking at sweet-expressions not as a way for me to learn scheme more >>> easily (that >>> would be cool, but it's not my main goal), but to teach it/showcase it to >>> other people, >>> because what I think the "problem" sweet-expressions fix is the >>> readability of the code, >>> which for me (and I'm pretty sure for my target audience, consisted of >>> ruby/java/c++ and some python guys, too), >>> is somewhat hard to read. >>> >> >> Assuming that most of "java ... python" guys are forced to use XML&XSLT: >> >> Do you think that representing XML/XSLT in a "sweet" form to promote >> learning it is a good idea ? >> >> -- >> Bohdan >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > Eduardo Bellani > > www.cnxs.com.br > > "What is hateful to you, do not to your fellow men. That is the entire Law; > all the rest is commentary." The Talmud > -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081103/662baa53/attachment.htm From esmith at acanac.net Mon Nov 3 18:57:33 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:32:23 2009 Subject: [plt-scheme] Which Programming Languages Book to read? In-Reply-To: <490F4D80.1020702@mail.ru> References: <756daca50811031051t7306c5c7x81e2aa040c484a0b@mail.gmail.com> <490F4D80.1020702@mail.ru> Message-ID: <490F8FED.1070107@acanac.net> bad wrote: > Grant Rettke wrote: >> On Mon, Nov 3, 2008 at 12:13 PM, wrote: >> >>> 1. Programming Languages: Application and Interpretation >>> (by Shriram Krishnamurthi) >>> >>> 2. ESSENTIALS OF PROGRAMMING LANGUAGES (by Daniel P. Friedman, >>> Mitchell Wand). >>> > ! 3rd-edition ! >> >> See "How do you compare this book to Friedman, Wand and Haynes's >> Essentials of Programming Languages (EoPL)?": >> >> http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/FAQ/ >> > > Missed this, thx. Just want to note that there is a new 3rd edition of > this book. > At least some critique issues are still true (ex: GC), but it would be > nice to update this comparison. > > -- > Bohdan > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > I'll vouch for 1. I haven't read 2. I read 1 when I was looking for something a little deeper than Htdp to re-educate myself on the subject of programming languages. I only just now notice that the author is someone with whom I have had a somewhat heated private email exchanges on this list. ..doh Allow me to take the opportunity to thank you for book Shriram. I got a lot out of it. From ebellani at gmail.com Mon Nov 3 19:01:06 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:23 2009 Subject: Fwd: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <490F8D14.1080006@acanac.net> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <756daca50811031122y5266cdbfr906253fc6bad9e0b@mail.gmail.com> <184222e50811031128i540fb0cwcdead4f35246d0f2@mail.gmail.com> <184222e50811031128s478b6d3bhf5e9e8ccb8a4be50@mail.gmail.com> <490F8D14.1080006@acanac.net> Message-ID: <184222e50811031601j24216fd8wb46ea8f355019abe@mail.gmail.com> Hey there Ernie, This thread, at least from my point of view, is about a request to help a newbie with the adaptation of a software that works on a version of scheme (guile) to PLT. It kind of deviated a bit on if scheme is hard to read,which I think so, and provided a link to a lengthy argument which I agree with http://www.dwheeler.com/readable/retort-lisp-can-be-readable.html (Sure it's a newbie opinion, but what the heck). Keep in mind that I'm liking the language, and I am finding the experience very rewarding. But it isn't about popularity mate. I've learned ruby 3~4 years ago, here in Brazil, Florianopolis for a study at a security lab I worked for. Nothing to do with rails initially for me. I lucked out that someone released a great web framework in a language that I had familiarity with, so I began to work with that. I research languages based on merit and curiosity, not hype or popularity. I do think the syntax provided by this software (sweet-expressions) fits my mind better, and I think that it would make the process of building a case for it's adoption easier. It's not inflexibility, because if I suffered from that I would have stayed within my (popular and embarrassedly hyped) ruby/rails domain. Instead I've convinced a couple of web developers friends I know to research alternatives to make the case that ruby/rails isn't a silver bullet for web dev, and that there are great alternatives so we can present them in some lectures I'm giving at a local university (I've delegated erlyweb and seaside for them :P). Hugs mate, and thanks for the valuable opinions On Mon, Nov 3, 2008 at 9:45 PM, Ernie Smith wrote: > Eduardo Bellani wrote: > >> >> I'm looking at sweet-expressions not as a way for me to learn scheme more >> easily (that >> would be cool, but it's not my main goal), but to teach it/showcase it to >> other people, >> because what I think the "problem" sweet-expressions fix is the >> readability of the code, >> > There has been no case made at all here for the proposition 'scheme is hard > to read'. > The only case made so far is 'parens are hard to count without assistance'. > Indenting without assistance is even harder because tabs are invisible, > spaces > are variable in size and browsers move things around. > Yet nobody leaps to the conclusion that this implies that Python is > unreadable. > Let's keep our heads and not connect from paren counting to scheme > unreadability either. > The fact is, there is no need to count parens. > > Whether a program is readable or not depends on of how well the expression > of the problem and its solution matches the existing familiar language(s) > of the problem > domain. It is in those familiar languages that one gains most of the > necessary > understanding of the problem that needs solving. > > Scheme shines at that. It can be bent to the needs of the problem > domain in order to solve the problem well and clearly. That makes scheme > eminently readable in my book. > So if it ain't broke.. don't fix it. > > Here is the elephant in the room: > This thread is not really about readability, it is about popularity. > > A thundering herd of people locked into an inflexible mind set > will find everything hard to read except what fits strictly inside > that mindset. Syntax sugar won't change that. > Your only hope with them is by attrition, use it yourself, let > them see the results and get curious. > > > > > > -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081103/6e143e54/attachment.html From sk at cs.brown.edu Mon Nov 3 19:13:39 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:23 2009 Subject: [plt-scheme] Which Programming Languages Book to read? In-Reply-To: <490F8FED.1070107@acanac.net> References: <756daca50811031051t7306c5c7x81e2aa040c484a0b@mail.gmail.com> <490F4D80.1020702@mail.ru> <490F8FED.1070107@acanac.net> Message-ID: > I only just now notice that the author is someone with > whom I have had a somewhat heated private email exchanges on this list. > ..doh > > Allow me to take the opportunity to thank you for book Shriram. I got a lot > out of it. And thanks, Ernie. I enjoyed the reading you pointed me to! Shriram From hendrik at topoi.pooq.com Tue Nov 4 07:23:04 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:32:24 2009 Subject: [plt-scheme] Re: Fwd: Sweet-expressions on PLT In-Reply-To: References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <756daca50811031122y5266cdbfr906253fc6bad9e0b@mail.gmail.com> <184222e50811031128i540fb0cwcdead4f35246d0f2@mail.gmail.com> <184222e50811031128s478b6d3bhf5e9e8ccb8a4be50@mail.gmail.com> Message-ID: <20081104122304.GA12937@topoi.pooq.com> On Tue, Nov 04, 2008 at 12:07:37AM +0200, kbohdan@mail.ru wrote: > > Do you think that representing XML/XSLT in a "sweet" form to promote > learning it is a good idea ? You bet! I'd turn them into S-expressions! -- hendrik From marek at xivilization.net Tue Nov 4 06:02:19 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:32:24 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> Message-ID: <20081104120219.52e8f646@halmanfloyd.lan.local> On Mon, 3 Nov 2008 13:45:04 -0500 "Matt Jadud" wrote: > I would honestly encourage you to simply attempt to use the language > as-is. Perhaps dive into HtDP (http://www.htdp.org), or (if you're > keen) take a look at projects like LeftParen: I thought about using LaftParen but decided against it. Why? Because as far as I see, it provides the next Rails-like framework. There's nothing wrong with this approach, but I'm already sick of seeing all these frameworks which port the Rails-way over. I tried running Seaside, but haven't yet managed to get it running on any Smalltalk that's not called Squeak. So I settled for Nagare (Python continuation based framework) and the PLT web server. My projects are currently on hold, though, since I don't have much time these days. As of the sweet-expressions.. while I acknowledge the importance of readable code, these sweet-expressions do not look particularly radable to me. They are like enhancing the verboseness of parens with quirky rules for the {}. And I would be really bored if all languages used the exact same syntax, as sweet-expressions try to force them on Scheme. But sure, Eduardo, go ahead and use them. Be sure also to try S-Expressions (together with DrScheme) and find out which ones you prefer. regards, Marek From ebellani at gmail.com Tue Nov 4 08:54:37 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:25 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <20081104120219.52e8f646@halmanfloyd.lan.local> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <20081104120219.52e8f646@halmanfloyd.lan.local> Message-ID: <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> Hmmm, this nagare looks pretty sweet. I though the same about LeftParen too mate, RoR is already the best RoR in the world in my view :P. Time to switch paradigms for me, not to incrementally improve something. I've started on that one because, well, it does have a small hello world example that just works! :D Since my initial purpose is to just build a blog (the hello world of web apps, as the docs of LeftParen so wisely says) I've initially stayed with that, but I'm still searching. Anyway, thanks for everyone who replied, this thread was very nutritious to the brain, hope to see more of it. hugs On Tue, Nov 4, 2008 at 9:02 AM, Marek Kubica wrote: > On Mon, 3 Nov 2008 13:45:04 -0500 > "Matt Jadud" wrote: > > > I would honestly encourage you to simply attempt to use the language > > as-is. Perhaps dive into HtDP (http://www.htdp.org), or (if you're > > keen) take a look at projects like LeftParen: > > I thought about using LaftParen but decided against it. Why? Because as > far as I see, it provides the next Rails-like framework. There's > nothing wrong with this approach, but I'm already sick of seeing all > these frameworks which port the Rails-way over. I tried running > Seaside, but haven't yet managed to get it running on any Smalltalk > that's not called Squeak. So I settled for Nagare (Python continuation > based framework) and the PLT web server. My projects are currently on > hold, though, since I don't have much time these days. > > As of the sweet-expressions.. while I acknowledge the importance of > readable code, these sweet-expressions do not look particularly radable > to me. They are like enhancing the verboseness of parens with quirky > rules for the {}. And I would be really bored if all languages used the > exact same syntax, as sweet-expressions try to force them on Scheme. > But sure, Eduardo, go ahead and use them. Be sure also to try > S-Expressions (together with DrScheme) and find out which ones you > prefer. > > regards, > Marek > -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081104/52ea646f/attachment.htm From spdegabrielle at gmail.com Tue Nov 4 09:20:13 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:32:25 2009 Subject: [plt-scheme] reading a whole file Message-ID: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> This is embarassing, as I'm sure I've asked it before, but can't find the answer; Is there a function to read a whole file into memory (as a string) (lambda (i) (read-string 80000 i)) or is there something better? Cheers, Stephen From diggerrrrr at gmail.com Tue Nov 4 09:34:19 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:32:25 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> Message-ID: How about this : (call-with-input-file filename (lambda (in) (bytes->string/utf-8 (read-bytes (file-size filename) in))))) On 11/4/08, Stephen De Gabrielle wrote: > This is embarassing, as I'm sure I've asked it before, but can't find > the answer; > > Is there a function to read a whole file into memory (as a string) > > (lambda (i) (read-string 80000 i)) > or is there something better? > > Cheers, > > Stephen > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From grettke at acm.org Tue Nov 4 09:38:25 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:25 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> Message-ID: <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> On Tue, Nov 4, 2008 at 8:34 AM, Veer wrote: >> Is there a function to read a whole file into memory (as a string) Here is one approach: http://schemecookbook.org/Cookbook/FileRead From noelwelsh at gmail.com Tue Nov 4 09:41:52 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:32:25 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> Message-ID: port->string in the port.plt package, IIRC. N. On Tue, Nov 4, 2008 at 2:20 PM, Stephen De Gabrielle wrote: > > Is there a function to read a whole file into memory (as a string) > From sk at cs.brown.edu Tue Nov 4 09:42:05 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:25 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> Message-ID: The Cookbook version has a slight non-atomicity problem (the file size may change between the FILE-SIZE and the READ-STRING). I don't know quite how that works out in the version Veer posted (presumably the same problem, because FILE-SIZE is being called on the file*name*, not on the port descriptor). I guess file operation atomicity is OS-specific anyway. Shriram From robby at cs.uchicago.edu Tue Nov 4 09:46:11 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:26 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> Message-ID: <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> With a reasonable filesystem (I'm not sure if Windows counts as sane in this regard, but mac os x and linux's both do I believe), this will work and not be subject to race conditions (all of the heavy lifting is in copy-port): #lang scheme (require scheme/port) (define (file->string f) (let ([sp (open-output-string)]) (call-with-input-file f (? (fp) (copy-port fp sp))) (get-output-string sp))) but I do not recommend reading files into strings. Instead, it is much better to just operate on the port if you possibly can. Probably I or others can help if you're not sure how to write whatever function you wanted directly on the port instead of on the string. Robby On Tue, Nov 4, 2008 at 9:42 AM, Shriram Krishnamurthi wrote: > The Cookbook version has a slight non-atomicity problem (the file size > may change between the FILE-SIZE and the READ-STRING). I don't know > quite how that works out in the version Veer posted (presumably the > same problem, because FILE-SIZE is being called on the file*name*, not > on the port descriptor). I guess file operation atomicity is > OS-specific anyway. > > Shriram > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From sk at cs.brown.edu Tue Nov 4 09:52:55 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:26 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> Message-ID: Thanks, Robby. 1. It might be nice if someone w/ Cookbook access posted this version w/ a comment about atomicity. 2. It is often *awfully convenient* to just read the file in as a string. This semester I'm co-teaching a mini-course for social science students, and just about everything we do is content analysis. The files tend to be no more than 10-30k long. With modern computer memories and processing speeds, it's just not worth the effort to do anything other than a brute-force "read everything in as one string and search over it" unless that proves to be insufficient. (And doing it that way in Python proves to be dreadfully convenient.) It feels to me like a bit like mucking about with fixnums when you could have bignums instead. And if you continue to complain, I'll G"odel-encode the file -- since you only enjoin against strings, not numbers. (-: Shriram From matthias at ccs.neu.edu Tue Nov 4 09:58:32 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:26 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> Message-ID: <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> On Nov 4, 2008, at 9:52 AM, Shriram Krishnamurthi wrote: > Thanks, Robby. > > 1. It might be nice if someone w/ Cookbook access posted this version > w/ a comment about atomicity. Could someone explain why the cookbook uses an accumulator and reverse? Last time I measured, this improved the performance in Chez but not in Mz. > 2. It is often *awfully convenient* to just read the file in as a > string. This semester I'm co-teaching a mini-course for social > science students, and just about everything we do is content analysis. > The files tend to be no more than 10-30k long. With modern computer > memories and processing speeds, it's just not worth the effort to do > anything other than a brute-force "read everything in as one string > and search over it" unless that proves to be insufficient. (And doing > it that way in Python proves to be dreadfully convenient.) It feels > to me like a bit like mucking about with fixnums when you could have > bignums instead. Do you use regexp on ports? My experience -- via Daniel -- was once Matthew included that my code was as short and compact as Python stuff. > And if you continue to complain, I'll G"odel-encode the file -- since > you only enjoin against strings, not numbers. (-: I claim 0 for this message. From robby at cs.uchicago.edu Tue Nov 4 10:01:12 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:26 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> Message-ID: <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> If you're just regexp matching, would regexp-matching on the port work? On Tue, Nov 4, 2008 at 9:52 AM, Shriram Krishnamurthi wrote: > Thanks, Robby. > > 1. It might be nice if someone w/ Cookbook access posted this version > w/ a comment about atomicity. > > 2. It is often *awfully convenient* to just read the file in as a > string. This semester I'm co-teaching a mini-course for social > science students, and just about everything we do is content analysis. > The files tend to be no more than 10-30k long. With modern computer > memories and processing speeds, it's just not worth the effort to do > anything other than a brute-force "read everything in as one string > and search over it" unless that proves to be insufficient. (And doing > it that way in Python proves to be dreadfully convenient.) It feels > to me like a bit like mucking about with fixnums when you could have > bignums instead. > > And if you continue to complain, I'll G"odel-encode the file -- since > you only enjoin against strings, not numbers. (-: > > Shriram > > From robby at cs.uchicago.edu Tue Nov 4 10:06:57 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:26 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> Message-ID: <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> On Tue, Nov 4, 2008 at 10:04 AM, Stephen De Gabrielle wrote: > Wow - thanks for all the good advice, > > I'm guessing that (port->string [input-port]) in (planet "port.ss" > ("schematics" "port.plt" 1 2)) is similar to the method below. If you look at the code, you see it is identical. :) > I asked the question - so I'll copy the answer into the cookbook. > > I understand the point about operating on files, but I feel this is > the special case of large numbers of small files, read only, and at > least 2gb RAM to work with. I may be wrong... As long as you don't give the program out to others, you're probably fine. But the ports library in plt scheme is powerful and many things that seem easier on strings just aren't. Robby > Cheers, > > Stephen > > On Tue, Nov 4, 2008 at 2:46 PM, Robby Findler wrote: >> With a reasonable filesystem (I'm not sure if Windows counts as sane >> in this regard, but mac os x and linux's both do I believe), this will >> work and not be subject to race conditions (all of the heavy lifting >> is in copy-port): >> >> #lang scheme >> (require scheme/port) >> (define (file->string f) >> (let ([sp (open-output-string)]) >> (call-with-input-file f >> (? (fp) (copy-port fp sp))) >> (get-output-string sp))) >> >> but I do not recommend reading files into strings. Instead, it is much >> better to just operate on the port if you possibly can. >> >> Probably I or others can help if you're not sure how to write whatever >> function you wanted directly on the port instead of on the string. >> >> Robby >> >> On Tue, Nov 4, 2008 at 9:42 AM, Shriram Krishnamurthi wrote: >>> The Cookbook version has a slight non-atomicity problem (the file size >>> may change between the FILE-SIZE and the READ-STRING). I don't know >>> quite how that works out in the version Veer posted (presumably the >>> same problem, because FILE-SIZE is being called on the file*name*, not >>> on the port descriptor). I guess file operation atomicity is >>> OS-specific anyway. >>> >>> Shriram >>> _________________________________________________ >>> 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 s.degabrielle at cs.ucl.ac.uk Tue Nov 4 10:21:09 2008 From: s.degabrielle at cs.ucl.ac.uk (Stephen De Gabrielle) Date: Thu Mar 26 02:32:26 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> Message-ID: <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> Thanks On Tue, Nov 4, 2008 at 3:06 PM, Robby Findler wrote: > As long as you don't give the program out to others, you're probably fine. > > But the ports library in plt scheme is powerful and many things that > seem easier on strings just aren't. I'm assuming disk reads are an order of magnitude slower than operations in memory? but that is assuming I am keeping things to a reasonable size, and the OS in question isn't using virtual memory/swap. I'm working with the Enron email collection, uncompressed it is 2.54 Gb(across 500k files) , so it should be possible to play with the whole thing in RAM. Thanks again, I never thought my dumb question could evoke such a debate. PS http://schemecookbook.org/Cookbook/FileRead has been updated, but only the 'copy-port' technique, not the associated discussion on the merits on working directly on a port as compared to strings. From s.degabrielle at cs.ucl.ac.uk Tue Nov 4 10:04:01 2008 From: s.degabrielle at cs.ucl.ac.uk (Stephen De Gabrielle) Date: Thu Mar 26 02:32:26 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> Message-ID: <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> Wow - thanks for all the good advice, I'm guessing that (port->string [input-port]) in (planet "port.ss" ("schematics" "port.plt" 1 2)) is similar to the method below. I asked the question - so I'll copy the answer into the cookbook. I understand the point about operating on files, but I feel this is the special case of large numbers of small files, read only, and at least 2gb RAM to work with. I may be wrong... Cheers, Stephen On Tue, Nov 4, 2008 at 2:46 PM, Robby Findler wrote: > With a reasonable filesystem (I'm not sure if Windows counts as sane > in this regard, but mac os x and linux's both do I believe), this will > work and not be subject to race conditions (all of the heavy lifting > is in copy-port): > > #lang scheme > (require scheme/port) > (define (file->string f) > (let ([sp (open-output-string)]) > (call-with-input-file f > (? (fp) (copy-port fp sp))) > (get-output-string sp))) > > but I do not recommend reading files into strings. Instead, it is much > better to just operate on the port if you possibly can. > > Probably I or others can help if you're not sure how to write whatever > function you wanted directly on the port instead of on the string. > > Robby > > On Tue, Nov 4, 2008 at 9:42 AM, Shriram Krishnamurthi wrote: >> The Cookbook version has a slight non-atomicity problem (the file size >> may change between the FILE-SIZE and the READ-STRING). I don't know >> quite how that works out in the version Veer posted (presumably the >> same problem, because FILE-SIZE is being called on the file*name*, not >> on the port descriptor). I guess file operation atomicity is >> OS-specific anyway. >> >> Shriram >> _________________________________________________ >> 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 esmith at acanac.net Tue Nov 4 10:31:24 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:32:27 2009 Subject: [plt-scheme] Bug report / request for comment concerning foreign.ss Message-ID: <49106ACC.20108@acanac.net> (module ffi-bug mzscheme (require (lib "foreign.ss" )) ;; (unsafe!) ;; ;; BUG / FEATURE ;; ;; When declaring a c structure using define-cstruct ;; ctype-sizeof reports more bytes than was asked for ;; in the declaration. ;; ;; This bug is illustrated by the code and results below. ;; ;; The response I expect to this bug report is that it is in fact ;; a feature as opposed to a bug. ;; ;; To save an iteration on the Q & A loop. ;; I'm going to anticipate that response and reply to it: ;; ;; Whether or not a structure is implicitly padded may not be in the ;; control of the programmer developing the scheme interface to a C ;; library. Some structures will be padded others won't be so the ;; marshalling infrastructure has to expose control of padding and ;; alignment to the programmer defining an interface. ;; ;; In my opinion it is generally a mistake to hide such ;; behaviour because the programmer needs to be thinking about ;; the issue. Hiding it leads to mistakes. ;; It is desirable to leave the padding/alignment issue in the open. ;; ;; To be clear, individual interfaces can vary on the same O.S. on ;; the same hardware. C compiler features permit individual structures ;; to be padded or not as and when required. ;; ;; See MSVC #pragma Pack. ;; ;; See Gnu C compiler: __attribute__((__packed__)) ;; ;; (discussed here : http://www.grok2.com/structure_packing.html ) ;; ;; In fact it is quite possible to have a situation where an outer ;; structure is padded, and an inner field member structure is not, ;; or vice versa. Granted, that is a C programmer looking for trouble. ;; ;; Code to illustrate the issue below: ;; ;; This test ran as is, producing the results shown below as comments ;; I'm hoping it won't get munged by email sw along the ;; the way, and anyone can just cut it and run it in Drscheme. ;; (define _bugtest2 (make-cstruct-type (list _int32 _int32))) (display "Expect 8:") (display (format "_bugtest2 size: ~a" (ctype-sizeof _bugtest2))) (newline) (define _bugtest3 (make-cstruct-type (list _int32 _int32 _int32))) (display "Expect 12:") (display (format "_bugtest3 size: ~a" (ctype-sizeof _bugtest3))) (newline) (define _bugtest4 (make-cstruct-type (list _int32 _int32 _int32 _int32))) (display "Expect 16:") (display (format "_bugtest4 size: ~a" (ctype-sizeof _bugtest4))) (newline) (define-cstruct _define-struct-test1 ((field1 _int32) (field2 _int32) (field3 _int64))) (display "Expect 16:") (display (format "_define-struct-test1 size: ~a" (ctype-sizeof _define-struct-test1))) (newline) (define-cstruct _define-struct-test2 ((field1 _int32) (field2 _int32) (field3 _int64) (field_sub1 _bugtest2))) (display "Expect 24:") (display (format "_define-struct-test2 size: ~a" (ctype-sizeof _define-struct-test2))) (newline) (define-cstruct _define-struct-test3 ((field1 _int32) (field2 _int32) (field3 _int64) (field_sub1 _bugtest3))) (display "Expect 28:") (display (format "_define-struct-test3 size: ~a" (ctype-sizeof _define-struct-test3))) (newline) (define-cstruct _define-struct-test4 ((field1 _int32) (field2 _int32) (field3 _int64) (field_sub1 _bugtest4))) (display "Expect 32:") (display (format "_define-struct-test4 size: ~a" (ctype-sizeof _define-struct-test4))) (newline) (define-cstruct _define-comp-struct1 ((field_sub1 _define-struct-test3) (field_sub2 _define-struct-test3))) (display "Expect 56:") (display (format "_define-comp-struct1 size: ~a" (ctype-sizeof _define-comp-struct1))) (newline) ) ;;; ;;; results ;;; ;Expect 8:_bugtest2 size: 8 ;Expect 12:_bugtest3 size: 12 ;Expect 16:_bugtest4 size: 16 ;Expect 16:_define-struct-test1 size: 16 ;Expect 24:_define-struct-test2 size: 24 ;Expect 28:_define-struct-test3 size: 32 <===== 4 byte discrepancy. ;Expect 32:_define-struct-test4 size: 32 ;Expect 56:_define-comp-struct1 size: 64 <===== propagated now 8 byte discrepancy. ;;; ;;; Test environment information ;;; ; context -> mzscheme version 372 ; context -> time of test is 2008-11-04 09:33:17 ; context -> O.S. windows ; context -> Machine Windows NT 5.0 (Build 2195) Service Pack 4 ; context -> Garbage Collector (gcc or 3m) 3m ; context -> Link dll ; context -> Shared Object suffix .dll ; context -> language/country English_Canada From spdegabrielle at gmail.com Tue Nov 4 10:37:12 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:32:27 2009 Subject: [plt-scheme] Lexer capture precedence? Message-ID: <595b9ab20811040737w6da69900x2a9fa95af3dd1c4@mail.gmail.com> Another dumb question, I'm trying to use the lexer to recognise some basic bit's of XML, and I'm having trouble working out what I'm doing wrong. It seems to greedily capture more than I want it to? Is there a way to cut the greediness down? eg I want I to find token --> in a string "kjas kdflkasjfd afkj a-->flkjjasf as" but it grabs the "kjas kdflkasjfd afkj a--" instead of capturing the "-->" as a token. Cheers, Stephen (define-lex-abbrevs (CR #\015) (LF #\012) (LineTerminator (re:or CR LF (re:: CR LF))) (FF #\014) (TAB #\011) (WhiteSpace (re:or #\space TAB FF LineTerminator)) (Tag-set (re:or "" "" "<" ">")) ; ) (define (syn-val lex a b c d) (newline) (display (list lex a b (position-offset c) (position-offset d))) (newline) (values lex a b (position-offset c) (position-offset d))) ; (define get-syntax-token (lexer ((re:+ WhiteSpace) (syn-val lexeme 'white-space #f start-pos end-pos)) ((complement Tag-set) (syn-val lexeme 'no-color #f start-pos end-pos)) (Tag-set (syn-val lexeme 'keyword (string->symbol lexeme) start-pos end-pos)) ((eof) (syn-val lexeme 'no-color #f start-pos end-pos)) )) From jensaxel at soegaard.net Tue Nov 4 10:39:59 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:32:27 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> Message-ID: <49106CCF.4050403@soegaard.net> Matthias Felleisen wrote: > On Nov 4, 2008, at 9:52 AM, Shriram Krishnamurthi wrote: >> Thanks, Robby. >> >> 1. It might be nice if someone w/ Cookbook access posted this version >> w/ a comment about atomicity. > > Could someone explain why the cookbook uses an accumulator and reverse? I guess you are referring to this snippet? (define (readlines filename) (call-with-input-file filename (lambda (p) (let loop ((line (read-line p)) (result '())) (if (eof-object? line) (reverse result) (loop (read-line p) (cons line result))))))) But what would you use instead of an accumulator? The obvious solution (define (readlines filename) (call-with-input-file filename (lambda (p) (let loop () (let ((line (read-line p))) (if (eof-object? line) '() (cons line (loop)))))))) breaks on implementations with a small stack. -- Jens Axel S?gaard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081104/d809848d/attachment.html From matthias at ccs.neu.edu Tue Nov 4 10:48:05 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:28 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <49106CCF.4050403@soegaard.net> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> <49106CCF.4050403@soegaard.net> Message-ID: <364C543B-B6E9-4FCC-9820-C54DB58085AF@ccs.neu.edu> On Nov 4, 2008, at 10:39 AM, Jens Axel Soegaard wrote: > The obvious solution > > (define (readlines filename) > (call-with-input-file filename > (lambda (p) > (let loop () > (let ((line (read-line p))) > (if (eof-object? line) > '() > (cons line (loop)))))))) > > breaks on implementations with a small stack. I don't know what those implementations implement but it's certainly not Scheme :-) From jensaxel at soegaard.net Tue Nov 4 10:59:02 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:32:28 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <364C543B-B6E9-4FCC-9820-C54DB58085AF@ccs.neu.edu> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> <49106CCF.4050403@soegaard.net> <364C543B-B6E9-4FCC-9820-C54DB58085AF@ccs.neu.edu> Message-ID: <49107146.9000006@soegaard.net> Matthias Felleisen wrote: > > On Nov 4, 2008, at 10:39 AM, Jens Axel Soegaard wrote: > >> The obvious solution >> >> (define (readlines filename) >> (call-with-input-file filename >> (lambda (p) >> (let loop () >> (let ((line (read-line p))) >> (if (eof-object? line) >> '() >> (cons line (loop)))))))) >> >> breaks on implementations with a small stack. > > I don't know what those implementations implement but it's certainly > not Scheme :-) Well, the recursive call to loop is not in tail-call position, and there is no guarantee on the upper bound of the number of active calls in RnRS, so this could become a problem in simple implementations (for example implementations that use inherit the a maximum stack size from C). -- Jens Axel S?gaard From sk at cs.brown.edu Tue Nov 4 11:00:59 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:28 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> Message-ID: Yes if you're doing only one string. It's nice to be able to say (define c ...contents of file...) (match ... c) (match ... c) as you formulate and test hypotheses about the content of the file. That is, it's nice to type the code to get the file content just once, rather than over and over again. Shriram From robby at cs.uchicago.edu Tue Nov 4 11:11:46 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:28 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> Message-ID: <932b2f1f0811040811p2f2cfeb3t6494dd436cb4dd2c@mail.gmail.com> Okay, I got curious. Below are some timing tests that suggest that, when it is possible, reading the file into a string has more consistent performance. Matching directly on the port can be much faster if the match is near the beginning of the file, but much worse if it is at the end of the file. The code is below. The file in question is 96k in size. This is the output I get (on a mac 2.8ghz intel w/ a pretty fast filesystem): Welcome to DrScheme, version 4.1.2.2-svn3nov2008 [3m]. Language: Module; memory limit: 128 megabytes. port/beginning-of-file cpu time: 11 real time: 11 gc time: 0 string/beginning-of-file cpu time: 180 real time: 180 gc time: 30 port/end-of-file cpu time: 2695 real time: 2715 gc time: 0 string/end-of-file cpu time: 226 real time: 226 gc time: 10 > Robby #lang scheme (require scheme/port) (define ((check-matches-port file) r) (call-with-input-file file (? (port) (regexp-match r port)))) (define (check-matches-string file) (let ([s (let ([sp (open-output-string)]) (call-with-input-file file (? (fp) (copy-port fp sp))) (get-output-string sp))]) (? (r) (regexp-match r s)))) (define (test check-matches reg) (time (let ([matcher (check-matches (build-path (collection-path "framework") "private" "frame.ss"))]) (let loop ([n 300]) (unless (zero? n) (matcher reg) (loop (- n 1))))))) 'port/beginning-of-file (test check-matches-port #rx"unit") 'string/beginning-of-file (test check-matches-string #rx"unit") 'port/end-of-file (test check-matches-port #rx"pasteboard-mixin open-here%") 'string/end-of-file (test check-matches-string #rx"pasteboard-mixin open-here%") On Tue, Nov 4, 2008 at 11:00 AM, Shriram Krishnamurthi wrote: > Yes if you're doing only one string. It's nice to be able to say > > (define c ...contents of file...) > > (match ... c) > (match ... c) > > as you formulate and test hypotheses about the content of the file. > That is, it's nice to type the code to get the file content just once, > rather than over and over again. > > Shriram > > From rob.hunter at gmail.com Tue Nov 4 11:21:10 2008 From: rob.hunter at gmail.com (Rob Hunter) Date: Thu Mar 26 02:32:29 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <20081104120219.52e8f646@halmanfloyd.lan.local> <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> Message-ID: Really-quick regarding LeftParen: All this Rails talk is a "marketing" attempt that apparently has gone bad, and it's totally my fault. LeftParen really only stole the idea of project directory generation from Rails. So, with minimal effort, you can type % ./script/server and see something work. The rest of LP is 100% to help you (the programmer) so you can just program in (PLT) Scheme. --rob On Tue, Nov 4, 2008 at 5:54 AM, Eduardo Bellani wrote: > Hmmm, this nagare looks pretty sweet. > I though the same about LeftParen too mate, RoR is already the best RoR in > the world > in my view :P. Time to switch paradigms for me, not to incrementally improve > something. > > I've started on that one because, well, it does have a small hello world > example that just works! :D > Since my initial purpose is to just build a blog (the hello world of web > apps, as the docs of LeftParen > so wisely says) I've initially stayed with that, but I'm still searching. > > Anyway, thanks for everyone who replied, this thread was very nutritious to > the brain, hope to > see more of it. > > hugs > On Tue, Nov 4, 2008 at 9:02 AM, Marek Kubica wrote: >> >> On Mon, 3 Nov 2008 13:45:04 -0500 >> "Matt Jadud" wrote: >> >> > I would honestly encourage you to simply attempt to use the language >> > as-is. Perhaps dive into HtDP (http://www.htdp.org), or (if you're >> > keen) take a look at projects like LeftParen: >> >> I thought about using LaftParen but decided against it. Why? Because as >> far as I see, it provides the next Rails-like framework. There's >> nothing wrong with this approach, but I'm already sick of seeing all >> these frameworks which port the Rails-way over. I tried running >> Seaside, but haven't yet managed to get it running on any Smalltalk >> that's not called Squeak. So I settled for Nagare (Python continuation >> based framework) and the PLT web server. My projects are currently on >> hold, though, since I don't have much time these days. >> >> As of the sweet-expressions.. while I acknowledge the importance of >> readable code, these sweet-expressions do not look particularly radable >> to me. They are like enhancing the verboseness of parens with quirky >> rules for the {}. And I would be really bored if all languages used the >> exact same syntax, as sweet-expressions try to force them on Scheme. >> But sure, Eduardo, go ahead and use them. Be sure also to try >> S-Expressions (together with DrScheme) and find out which ones you >> prefer. >> >> regards, >> Marek > > > > -- > Eduardo Bellani > > www.cnxs.com.br > > "What is hateful to you, do not to your fellow men. That is the entire Law; > all the rest is commentary." The Talmud > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From noelwelsh at gmail.com Tue Nov 4 11:24:16 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:32:29 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <20081104120219.52e8f646@halmanfloyd.lan.local> <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> Message-ID: It's not an exclusive or. You can use continuations and Rails style routes to good effect in the same application. If I get time I'll write up something about how we use both in our web apps. N. On Tue, Nov 4, 2008 at 1:54 PM, Eduardo Bellani wrote: > Hmmm, this nagare looks pretty sweet. > I though the same about LeftParen too mate, RoR is already the best RoR in > the world > in my view :P. Time to switch paradigms for me, not to incrementally improve > something. ... > On Tue, Nov 4, 2008 at 9:02 AM, Marek Kubica wrote: >> ... >> I thought about using LaftParen but decided against it. Why? Because as >> far as I see, it provides the next Rails-like framework. There's >> nothing wrong with this approach, but I'm already sick of seeing all >> these frameworks which port the Rails-way over. I tried running >> Seaside, but haven't yet managed to get it running on any Smalltalk >> that's not called Squeak. So I settled for Nagare (Python continuation >> based framework) and the PLT web server. My projects are currently on >> hold, though, since I don't have much time these days. From matthias at ccs.neu.edu Tue Nov 4 12:02:45 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:29 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <932b2f1f0811040811p2f2cfeb3t6494dd436cb4dd2c@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> <932b2f1f0811040811p2f2cfeb3t6494dd436cb4dd2c@mail.gmail.com> Message-ID: Now that's good for the cookbook. On Nov 4, 2008, at 11:11 AM, Robby Findler wrote: > Okay, I got curious. Below are some timing tests that suggest that, > when it is possible, reading the file into a string has more > consistent performance. Matching directly on the port can be much > faster if the match is near the beginning of the file, but much worse > if it is at the end of the file. The code is below. The file in > question is 96k in size. > > This is the output I get (on a mac 2.8ghz intel w/ a pretty fast > filesystem): > > Welcome to DrScheme, version 4.1.2.2-svn3nov2008 [3m]. > Language: Module; memory limit: 128 megabytes. > port/beginning-of-file > cpu time: 11 real time: 11 gc time: 0 > string/beginning-of-file > cpu time: 180 real time: 180 gc time: 30 > port/end-of-file > cpu time: 2695 real time: 2715 gc time: 0 > string/end-of-file > cpu time: 226 real time: 226 gc time: 10 >> > > Robby > > #lang scheme > (require scheme/port) > > (define ((check-matches-port file) r) > (call-with-input-file file > (? (port) > (regexp-match r port)))) > > (define (check-matches-string file) > (let ([s > (let ([sp (open-output-string)]) > (call-with-input-file file > (? (fp) > (copy-port fp sp))) > (get-output-string sp))]) > (? (r) > (regexp-match r s)))) > > (define (test check-matches reg) > (time > (let ([matcher (check-matches (build-path (collection-path > "framework") > "private" > "frame.ss"))]) > (let loop ([n 300]) > (unless (zero? n) > (matcher reg) > (loop (- n 1))))))) > > 'port/beginning-of-file > (test check-matches-port #rx"unit") > > 'string/beginning-of-file > (test check-matches-string #rx"unit") > > > 'port/end-of-file > (test check-matches-port #rx"pasteboard-mixin open-here%") > > 'string/end-of-file > (test check-matches-string #rx"pasteboard-mixin open-here%") > > > On Tue, Nov 4, 2008 at 11:00 AM, Shriram Krishnamurthi > wrote: >> Yes if you're doing only one string. It's nice to be able to say >> >> (define c ...contents of file...) >> >> (match ... c) >> (match ... c) >> >> as you formulate and test hypotheses about the content of the file. >> That is, it's nice to type the code to get the file content just >> once, >> rather than over and over again. >> >> Shriram >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From andre.mayers at usherbrooke.ca Tue Nov 4 12:46:45 2008 From: andre.mayers at usherbrooke.ca (Andre Mayers) Date: Thu Mar 26 02:32:29 2009 Subject: [plt-scheme] How to let a new symbol (created in _syntax-case_) visible at top level ? In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> <932b2f1f0811040811p2f2cfeb3t6494dd436cb4dd2c@mail.gmail.com> Message-ID: <001b01c93ea5$4e4d1410$eae73c30$@mayers@usherbrooke.ca> #lang scheme (define-syntax defsymbol (? (stx) (syntax-case stx () [(_ name val) (with-syntax ([new-name (string->symbol (string-append "nv-" (symbol->string (syntax->datum #'name))))]) (datum->syntax #f (list #'define (syntax->datum #'new-name) #'val) #f))]))) (defsymbol biz 4) nv-biz ==> expand: unbound identifier in module in: nv-biz I am pretty sure that I am not the first to ask the question but I can't find the answer. Andr? Mayers, Ph.D., M. Ps. professeur agr?g? D?partement d'informatique Universit? de Sherbrooke Sherbrooke (Qu?bec) Canada J1K 2R1 t?l: +1 819-821-8000 poste 62041 fax: +1 819-821-8200 andre.mayers@usherbrooke.ca http://www.dmi.usherb.ca/~amayers From diggerrrrr at gmail.com Tue Nov 4 13:28:02 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:32:29 2009 Subject: [plt-scheme] How to let a new symbol (created in _syntax-case_) visible at top level ? In-Reply-To: <3024566839086741652@unknownmsgid> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> <932b2f1f0811040811p2f2cfeb3t6494dd436cb4dd2c@mail.gmail.com> <3024566839086741652@unknownmsgid> Message-ID: b2sgLCBpIGRvbid0IHJlYWxseSB1bmRlcnN0YW5kIG1hY3JvcyAsIHNvIHRoaXMgaXMgYSBibGlu ZCBoYWNrIGFuZCBpdApzZWVtcyB0byB3b3JrCgoocmVxdWlyZSBzY2hlbWUpCgooZGVmaW5lLXN5 bnRheCBkZWZzeW1ib2wKICAopssgKHN0eCkKICAgIChzeW50YXgtY2FzZSBzdHggKCkKICAgICAg WyhrIG5hbWUgdmFsKQogICAgICAgKHdpdGgtc3ludGF4CiAgICAgICAgICAgKFtuZXctbmFtZQog ICAgICAgICAgICAgKGRhdHVtLT5zeW50YXggIydrCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAoc3RyaW5nLT5zeW1ib2wKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoc3RyaW5nLWFw cGVuZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibnYtIiAoc3ltYm9sLT5zdHJpbmcg KHN5bnRheC0+ZGF0dW0gIyduYW1lKSkpKSldKQoKICAgICAgICAgIycoZGVmaW5lIG5ldy1uYW1l IHZhbCkpXSkpKQoKCihkZWZzeW1ib2wgYml6IDQpCm52LWJpegoKCgpPbiAxMS80LzA4LCBBbmRy ZSBNYXllcnMgPGFuZHJlLm1heWVyc0B1c2hlcmJyb29rZS5jYT4gd3JvdGU6Cj4gI2xhbmcgc2No ZW1lCj4gKGRlZmluZS1zeW50YXggZGVmc3ltYm9sCj4gICAopssgKHN0eCkKPiAgICAgKHN5bnRh eC1jYXNlIHN0eCAoKQo+ICAgICAgIFsoXyBuYW1lIHZhbCkKPiAgICAgICAgKHdpdGgtc3ludGF4 Cj4gICAgICAgICAgICAoW25ldy1uYW1lCj4gICAgICAgICAgICAgIChzdHJpbmctPnN5bWJvbAo+ ICAgICAgICAgICAgICAgKHN0cmluZy1hcHBlbmQgIm52LSIgKHN5bWJvbC0+c3RyaW5nIChzeW50 YXgtPmRhdHVtCj4gIyduYW1lKSkpKV0pCj4gICAgICAgICAgKGRhdHVtLT5zeW50YXgKPiAgICAg ICAgICAgI2YKPiAgICAgICAgICAgKGxpc3QgIydkZWZpbmUgKHN5bnRheC0+ZGF0dW0gIyduZXct bmFtZSkgIyd2YWwpCj4gICAgICAgICAgICNmKSldKSkpCj4KPiAoZGVmc3ltYm9sIGJpeiA0KQo+ Cj4gbnYtYml6Cj4gPT0+Cj4gZXhwYW5kOiB1bmJvdW5kIGlkZW50aWZpZXIgaW4gbW9kdWxlIGlu OiBudi1iaXoKPgo+IEkgYW0gcHJldHR5IHN1cmUgdGhhdCBJIGFtIG5vdCB0aGUgZmlyc3QgdG8g YXNrIHRoZSBxdWVzdGlvbiBidXQgSSBjYW4ndAo+IGZpbmQgdGhlIGFuc3dlci4KPgo+Cj4gQW5k cqimIE1heWVycywgUGguRC4sIE0uIFBzLgo+IHByb2Zlc3NldXIgYWdyqKZnqKYKPiBEqKZwYXJ0 ZW1lbnQgZCdpbmZvcm1hdGlxdWUKPiBVbml2ZXJzaXSopiBkZSBTaGVyYnJvb2tlCj4gU2hlcmJy b29rZSAoUXWopmJlYykgQ2FuYWRhIEoxSyAyUjEKPiB0qKZsOiArMSA4MTktODIxLTgwMDAgcG9z dGUgNjIwNDEKPiBmYXg6ICsxIDgxOS04MjEtODIwMAo+IGFuZHJlLm1heWVyc0B1c2hlcmJyb29r ZS5jYQo+IGh0dHA6Ly93d3cuZG1pLnVzaGVyYi5jYS9+YW1heWVycwo+Cj4KPgo+IF9fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KPiAgIEZvciBsaXN0LXJl bGF0ZWQgYWRtaW5pc3RyYXRpdmUgdGFza3M6Cj4gICBodHRwOi8vbGlzdC5jcy5icm93bi5lZHUv bWFpbG1hbi9saXN0aW5mby9wbHQtc2NoZW1lCj4K From cce at ccs.neu.edu Tue Nov 4 13:29:19 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:32:29 2009 Subject: [plt-scheme] How to let a new symbol (created in _syntax-case_) visible at top level ? In-Reply-To: <3024566839086741652@unknownmsgid> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> <932b2f1f0811040811p2f2cfeb3t6494dd436cb4dd2c@mail.gmail.com> <3024566839086741652@unknownmsgid> Message-ID: <990e0c030811041029o31f3842dx75d28ceac484c5c3@mail.gmail.com> SGVyZSdzIGEgdmVyc2lvbiB0aGF0IG91Z2h0IHRvIHdvcmsuICBJdCBjb25zdHJ1Y3RzIG5ldy1u YW1lIHdpdGggdGhlCmxleGljYWwgY29udGV4dCBvZiB0aGUgaW5wdXQgc3ludGF4LCBzbyBpdCB3 aWxsIGJlIHZpc2libGUgaW4gdGhlCm1hY3JvIHVzZXIncyBzY29wZS4gIEl0IGNvbnN0cnVjdHMg dGhlIGRlZmluZSwgaG93ZXZlciwgdXNpbmcgdGhlCmNvbnRleHQgb2YgdGhlIG1hY3JvIGRlZmlu aXRpb24sIHNvIHRoYXQgZXZlbiBpZiB0aGUgbWFjcm8gdXNlciBpcyBpbgpzb21lIGZ1bm55IGxh bmd1YWdlIHdpdGggYSBkaWZmZXJlbnQgYmluZGluZyAob3Igbm8gYmluZGluZykgZm9yCiJkZWZp bmUiLCB0aGlzIG1hY3JvIHdpbGwgc3RpbGwgYmVoYXZlIHByb3Blcmx5LgoKI2xhbmcgc2NoZW1l CihkZWZpbmUtc3ludGF4IGRlZnN5bWJvbAogKKbLIChzdHgpCiAgIChzeW50YXgtY2FzZSBzdHgg KCkKICAgICBbKF8gbmFtZSB2YWwpCiAgICAgICh3aXRoLXN5bnRheAogICAgICAgICAgKFtuZXct bmFtZQogICAgICAgICAgICAoZGF0dW0tPnN5bnRheAogICAgICAgICAgICAgIyduYW1lCiAgICAg ICAgICAgICAoc3RyaW5nLT5zeW1ib2wKICAgICAgICAgICAgICAoc3RyaW5nLWFwcGVuZCAibnYt IiAoc3ltYm9sLT5zdHJpbmcgKHN5bnRheC0+ZGF0dW0gIyduYW1lKSkpKSldKQogICAgICAgIChz eW50YXgvbG9jIHN0eAogICAgICAgICAgKGRlZmluZSBuZXctbmFtZSB2YWwpKSldKSkpCgooZGVm c3ltYm9sIGJpeiA0KQoKbnYtYml6CgpPbiBUdWUsIE5vdiA0LCAyMDA4IGF0IDEyOjQ2IFBNLCBB bmRyZSBNYXllcnMKPGFuZHJlLm1heWVyc0B1c2hlcmJyb29rZS5jYT4gd3JvdGU6Cj4gI2xhbmcg c2NoZW1lCj4gKGRlZmluZS1zeW50YXggZGVmc3ltYm9sCj4gICimyyAoc3R4KQo+ICAgIChzeW50 YXgtY2FzZSBzdHggKCkKPiAgICAgIFsoXyBuYW1lIHZhbCkKPiAgICAgICAod2l0aC1zeW50YXgK PiAgICAgICAgICAgKFtuZXctbmFtZQo+ICAgICAgICAgICAgIChzdHJpbmctPnN5bWJvbAo+ICAg ICAgICAgICAgICAoc3RyaW5nLWFwcGVuZCAibnYtIiAoc3ltYm9sLT5zdHJpbmcgKHN5bnRheC0+ ZGF0dW0gIyduYW1lKSkpKV0pCj4gICAgICAgICAoZGF0dW0tPnN5bnRheAo+ICAgICAgICAgICNm Cj4gICAgICAgICAgKGxpc3QgIydkZWZpbmUgKHN5bnRheC0+ZGF0dW0gIyduZXctbmFtZSkgIyd2 YWwpCj4gICAgICAgICAgI2YpKV0pKSkKPgo+IChkZWZzeW1ib2wgYml6IDQpCj4KPiBudi1iaXoK PiA9PT4KPiBleHBhbmQ6IHVuYm91bmQgaWRlbnRpZmllciBpbiBtb2R1bGUgaW46IG52LWJpego+ Cj4gSSBhbSBwcmV0dHkgc3VyZSB0aGF0IEkgYW0gbm90IHRoZSBmaXJzdCB0byBhc2sgdGhlIHF1 ZXN0aW9uIGJ1dCBJIGNhbid0IGZpbmQgdGhlIGFuc3dlci4KPgo+Cj4gQW5kcqimIE1heWVycywg UGguRC4sIE0uIFBzLgo+IHByb2Zlc3NldXIgYWdyqKZnqKYKPiBEqKZwYXJ0ZW1lbnQgZCdpbmZv cm1hdGlxdWUKPiBVbml2ZXJzaXSopiBkZSBTaGVyYnJvb2tlCj4gU2hlcmJyb29rZSAoUXWopmJl YykgQ2FuYWRhIEoxSyAyUjEKPiB0qKZsOiArMSA4MTktODIxLTgwMDAgcG9zdGUgNjIwNDEKPiBm YXg6ICsxIDgxOS04MjEtODIwMAo+IGFuZHJlLm1heWVyc0B1c2hlcmJyb29rZS5jYQo+IGh0dHA6 Ly93d3cuZG1pLnVzaGVyYi5jYS9+YW1heWVycwo= From eli at barzilay.org Tue Nov 4 14:06:18 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:32:30 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <49106CCF.4050403@soegaard.net> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> <49106CCF.4050403@soegaard.net> Message-ID: <18704.40234.515988.243696@arabic.ccs.neu.edu> On Nov 4, Jens Axel Soegaard wrote: > > But what would you use instead of an accumulator? How about this: (define (readlines filename) (call-with-input-file filename (lambda (p) (for/list ([x (in-lines p)]) x)))) Which conveniently throws the accumulator to a different place... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From cce at ccs.neu.edu Tue Nov 4 14:16:39 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:32:30 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <18704.40234.515988.243696@arabic.ccs.neu.edu> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> <49106CCF.4050403@soegaard.net> <18704.40234.515988.243696@arabic.ccs.neu.edu> Message-ID: <990e0c030811041116o32688d33pec1ce56c9df2dbf0@mail.gmail.com> On Tue, Nov 4, 2008 at 2:06 PM, Eli Barzilay wrote: > On Nov 4, Jens Axel Soegaard wrote: >> >> But what would you use instead of an accumulator? > > How about this: > > (define (readlines filename) > (call-with-input-file filename > (lambda (p) (for/list ([x (in-lines p)]) x)))) > > Which conveniently throws the accumulator to a different place... Caveat: you can't reproduce the input 100% faithfully from this; read-line discards line separators. --Carl From eli at barzilay.org Tue Nov 4 14:28:36 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:32:30 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> Message-ID: <18704.41572.885844.714150@arabic.ccs.neu.edu> On Nov 4, Stephen De Gabrielle wrote: > I'm working with the Enron email collection, uncompressed it is 2.54 > Gb(across 500k files) , so it should be possible to play with the > whole thing in RAM. Just in case you plan to actually do that: at these sizes multipler factors become things that you should be aware of: * In general, the GC requires more memory than you actually use. I think that generally speaking you should plan on it holding twice the ram that you actually need. (Even though it can be smaller with generations.) * MzScheme holds strings in UCS-4 format, so each character is 4 bytes. In other words, you might need around 20gb of ram just to read it all in. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jensaxel at soegaard.net Tue Nov 4 14:29:12 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:32:30 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <18704.40234.515988.243696@arabic.ccs.neu.edu> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <76B051E0-732F-45E6-A9BC-888ED22DBB32@ccs.neu.edu> <49106CCF.4050403@soegaard.net> <18704.40234.515988.243696@arabic.ccs.neu.edu> Message-ID: <4910A288.1000803@soegaard.net> Eli Barzilay wrote: > On Nov 4, Jens Axel Soegaard wrote: > >> But what would you use instead of an accumulator? >> > > How about this: > > (define (readlines filename) > (call-with-input-file filename > (lambda (p) (for/list ([x (in-lines p)]) x)))) > > Which conveniently throws the accumulator to a different place... > > Short and to the point. (Note that the original is from 2004, and thus for/list wasn't available then). For the functionally inclined, here is srfi-1 solution: (define (readlines filename) (with-input-from-file filename (? () (unfold eof-object? values (? (s) (read-line)) (read-line))))) Which also hides the accumulator... -- Jens Axel S?gaard, watching the election coverage From spdegabrielle at gmail.com Tue Nov 4 15:03:03 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:32:31 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <18704.41572.885844.714150@arabic.ccs.neu.edu> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> Message-ID: <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> You're right. Even if I partition my data (say 2 gb chunks) I'm probably not that much faster than disk. (based on robby's data) I think I better start reading the ports library docs. (or stick to document sets <100mb) s. On Tue, Nov 4, 2008 at 7:28 PM, Eli Barzilay wrote: > On Nov 4, Stephen De Gabrielle wrote: > > I'm working with the Enron email collection, uncompressed it is 2.54 > > Gb(across 500k files) , so it should be possible to play with the > > whole thing in RAM. > > Just in case you plan to actually do that: at these sizes multipler > factors become things that you should be aware of: > > * In general, the GC requires more memory than you actually use. I > think that generally speaking you should plan on it holding twice > the ram that you actually need. (Even though it can be smaller with > generations.) > > * MzScheme holds strings in UCS-4 format, so each character is 4 > bytes. > > In other words, you might need around 20gb of ram just to read it all > in. > > -- > ((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/20081104/afbf46cd/attachment.htm From andre.mayers at usherbrooke.ca Tue Nov 4 15:09:50 2008 From: andre.mayers at usherbrooke.ca (Andre Mayers) Date: Thu Mar 26 02:32:31 2009 Subject: [plt-scheme] How to let a new symbol (created in _syntax-case_) visible at top level ? In-Reply-To: <990e0c030811041029o31f3842dx75d28ceac484c5c3@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <932b2f1f0811040701h1d371cd6t19f95f52a4076f73@mail.gmail.com> <932b2f1f0811040811p2f2cfeb3t6494dd436cb4dd2c@mail.gmail.com> <3024566839086741652@unknownmsgid> <990e0c030811041029o31f3842dx75d28ceac484c5c3@mail.gmail.com> Message-ID: <002901c93eb9$4aebd090$e0c371b0$@mayers@usherbrooke.ca> Thank you, I didn't understand the use of the first (context) and the third (source location) parameters of datum->syntax. Now, it is clear. Andr? -----Message d'origine----- De : carl.eastlund@gmail.com [mailto:carl.eastlund@gmail.com] De la part de Carl Eastlund Envoy? : November-04-08 1:29 PM ? : andre.mayers@usherbrooke.ca Cc : PLT Scheme Mailing List Objet : Re: [plt-scheme] How to let a new symbol (created in _syntax-case_) visible at top level ? Here's a version that ought to work. It constructs new-name with the lexical context of the input syntax, so it will be visible in the macro user's scope. It constructs the define, however, using the context of the macro definition, so that even if the macro user is in some funny language with a different binding (or no binding) for "define", this macro will still behave properly. #lang scheme (define-syntax defsymbol (? (stx) (syntax-case stx () [(_ name val) (with-syntax ([new-name (datum->syntax #'name (string->symbol (string-append "nv-" (symbol->string (syntax->datum #'name)))))]) (syntax/loc stx (define new-name val)))]))) (defsymbol biz 4) nv-biz On Tue, Nov 4, 2008 at 12:46 PM, Andre Mayers wrote: > #lang scheme > (define-syntax defsymbol > (? (stx) > (syntax-case stx () > [(_ name val) > (with-syntax > ([new-name > (string->symbol > (string-append "nv-" (symbol->string (syntax->datum #'name))))]) > (datum->syntax > #f > (list #'define (syntax->datum #'new-name) #'val) > #f))]))) > > (defsymbol biz 4) > > nv-biz > ==> > expand: unbound identifier in module in: nv-biz > > I am pretty sure that I am not the first to ask the question but I can't find the answer. > > > Andr? Mayers, Ph.D., M. Ps. > professeur agr?g? > D?partement d'informatique > Universit? de Sherbrooke > Sherbrooke (Qu?bec) Canada J1K 2R1 > t?l: +1 819-821-8000 poste 62041 > fax: +1 819-821-8200 > andre.mayers@usherbrooke.ca > http://www.dmi.usherb.ca/~amayers From info at reatlas.com Tue Nov 4 15:36:16 2008 From: info at reatlas.com (Ethan Herdrick) Date: Thu Mar 26 02:32:31 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> Message-ID: <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> Isn't it silly that we all have our own version of this? Mine has some very basic error handling but probably doesn't do the right thing about Unicode. The inverse, something like string->file, is also indispensible. These functions and their like are some of the first things you need for hacking useful things up. Shouldn't they be in a SFRI? Better yet, built in? On Tue, Nov 4, 2008 at 12:03 PM, Stephen De Gabrielle wrote: > You're right. Even if I partition my data (say 2 gb chunks) I'm probably not > that much faster than disk. (based on robby's data) > I think I better start reading the ports library docs. (or stick to document > sets <100mb) > > s. > > > On Tue, Nov 4, 2008 at 7:28 PM, Eli Barzilay wrote: >> >> On Nov 4, Stephen De Gabrielle wrote: >> > I'm working with the Enron email collection, uncompressed it is 2.54 >> > Gb(across 500k files) , so it should be possible to play with the >> > whole thing in RAM. >> >> Just in case you plan to actually do that: at these sizes multipler >> factors become things that you should be aware of: >> >> * In general, the GC requires more memory than you actually use. I >> think that generally speaking you should plan on it holding twice >> the ram that you actually need. (Even though it can be smaller with >> generations.) >> >> * MzScheme holds strings in UCS-4 format, so each character is 4 >> bytes. >> >> In other words, you might need around 20gb of ram just to read it all >> in. >> >> -- >> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >> http://www.barzilay.org/ Maze is Life! >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Tue Nov 4 15:40:43 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:32 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> Message-ID: <932b2f1f0811041240h7b3b9691m628f2e41a68c8219@mail.gmail.com> Eli made the same point elsewhere today, so I think you can expect them to be in the next release. Robby On Tue, Nov 4, 2008 at 2:36 PM, Ethan Herdrick wrote: > Isn't it silly that we all have our own version of this? Mine has > some very basic error handling but probably doesn't do the right thing > about Unicode. The inverse, something like string->file, is also > indispensible. These functions and their like are some of the first > things you need for hacking useful things up. Shouldn't they be in a > SFRI? Better yet, built in? > > > On Tue, Nov 4, 2008 at 12:03 PM, Stephen De Gabrielle > wrote: >> You're right. Even if I partition my data (say 2 gb chunks) I'm probably not >> that much faster than disk. (based on robby's data) >> I think I better start reading the ports library docs. (or stick to document >> sets <100mb) >> >> s. >> >> >> On Tue, Nov 4, 2008 at 7:28 PM, Eli Barzilay wrote: >>> >>> On Nov 4, Stephen De Gabrielle wrote: >>> > I'm working with the Enron email collection, uncompressed it is 2.54 >>> > Gb(across 500k files) , so it should be possible to play with the >>> > whole thing in RAM. >>> >>> Just in case you plan to actually do that: at these sizes multipler >>> factors become things that you should be aware of: >>> >>> * In general, the GC requires more memory than you actually use. I >>> think that generally speaking you should plan on it holding twice >>> the ram that you actually need. (Even though it can be smaller with >>> generations.) >>> >>> * MzScheme holds strings in UCS-4 format, so each character is 4 >>> bytes. >>> >>> In other words, you might need around 20gb of ram just to read it all >>> in. >>> >>> -- >>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >>> http://www.barzilay.org/ Maze is Life! >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From rcleis at mac.com Tue Nov 4 17:04:35 2008 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:32:32 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <756daca50811040638l5a72c65wfb78aed8345ab616@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> Message-ID: On Nov 4, 2008, at 12:36 PM, Ethan Herdrick wrote: > Isn't it silly that we all have our own version of this? Do we not all have our own versions because the requirements, os's, and environments aren't always the same? This discussion has revealed that separators, error messages, and size are issues that warrant the use of different solutions. Isn't it better to write the function in less time than would be required to sift through SRFI's? Isn't it also true that the first pass through a file ought to be doing 'one step more' than simply creating a Moby String Object? In other words, efficiency impressions can be skewed by the adoption of general file I/O functions, whereas specific functions can be written to match the problem. RAC > Mine has > some very basic error handling but probably doesn't do the right thing > about Unicode. The inverse, something like string->file, is also > indispensible. These functions and their like are some of the first > things you need for hacking useful things up. Shouldn't they be in a > SFRI? Better yet, built in? > > > On Tue, Nov 4, 2008 at 12:03 PM, Stephen De Gabrielle > wrote: >> You're right. Even if I partition my data (say 2 gb chunks) I'm >> probably not >> that much faster than disk. (based on robby's data) >> I think I better start reading the ports library docs. (or stick to >> document >> sets <100mb) >> >> s. >> >> >> On Tue, Nov 4, 2008 at 7:28 PM, Eli Barzilay >> wrote: >>> >>> On Nov 4, Stephen De Gabrielle wrote: >>>> I'm working with the Enron email collection, uncompressed it is >>>> 2.54 >>>> Gb(across 500k files) , so it should be possible to play with the >>>> whole thing in RAM. >>> >>> Just in case you plan to actually do that: at these sizes multipler >>> factors become things that you should be aware of: >>> >>> * In general, the GC requires more memory than you actually use. I >>> think that generally speaking you should plan on it holding twice >>> the ram that you actually need. (Even though it can be smaller with >>> generations.) >>> >>> * MzScheme holds strings in UCS-4 format, so each character is 4 >>> bytes. >>> >>> In other words, you might need around 20gb of ram just to read it >>> all >>> in. >>> >>> -- >>> ((lambda (x) (x x)) (lambda (x) (x x))) Eli >>> Barzilay: >>> http://www.barzilay.org/ Maze is >>> Life! >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Tue Nov 4 17:13:44 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:32 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> Message-ID: All that is true, Richard, but it is equally true that some languages have libraries that do a very nice job of the common case. I can't count the number of times I've fired up code like (let ([p (open-input-file ...)]) (let loop () (let ([l (read-line p)]) (if (eof-object? l) empty (cons l (loop)))))) In my context, where I'm teaching content analysis, it's hard to convince someone that this code (or any variant of it) is worth writing in contrast to something like f = open(...) content = f.read() Shriram From marek at xivilization.net Tue Nov 4 17:12:14 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:32:32 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <20081104120219.52e8f646@halmanfloyd.lan.local> <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> Message-ID: <20081104231214.2df63c0c@halmanfloyd.lan.local> On Tue, 4 Nov 2008 08:21:10 -0800 "Rob Hunter" wrote: > and see something work. The rest of LP is 100% to help you (the > programmer) so you can just program in (PLT) Scheme. I'm sure it is, I just have had issues initially + the documentation is not as extensive as the one that the PLT web server has. I'm absolutely not trying to drive people away from LeftParen - it is probably quite useful when writing something bigger than toy-applications that just print the HTTP headers, so I'm definitely going to take a look when I'm a bit more experienced with the whole Scheme+web topic. regards, Marek From marek at xivilization.net Tue Nov 4 17:17:17 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:32:32 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <20081104120219.52e8f646@halmanfloyd.lan.local> <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> Message-ID: <20081104231717.59acb82c@halmanfloyd.lan.local> On Tue, 4 Nov 2008 16:24:16 +0000 "Noel Welsh" wrote: > It's not an exclusive or. You can use continuations and Rails style > routes to good effect in the same application. If I get time I'll > write up something about how we use both in our web apps. I'm looking forward to it - documentation is equally important as good code to get more adaptation. Experience shows that documentation and ease of use is even more important, giving birth to monsters like WordPress or phpBB. But one part of the broad adaptation of Django was exactly that the documentation was outstanding (while the code was, uhm, pretty okay). While I don't think that Scheme will ever be as popular as Rails for web development, I really have to thank the authors of the "Continue" guide for their good introduction! I hope to see more and I'm also willing to contribute back as soon as I have something useful to say about this topic. regards, Marek From grettke at acm.org Tue Nov 4 17:17:54 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:32 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> Message-ID: <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> On Tue, Nov 4, 2008 at 4:04 PM, Richard Cleis wrote: >> Isn't it silly that we all have our own version of this? > > Do we not all have our own versions because the requirements, os's, and > environments aren't always the same? 80% rule. From jay.mccarthy at gmail.com Tue Nov 4 17:46:31 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:32:33 2009 Subject: [plt-scheme] Sweet-expressions on PLT In-Reply-To: <20081104231717.59acb82c@halmanfloyd.lan.local> References: <184222e50811030950n3769ccbfs95f855b30707afba@mail.gmail.com> <20081104120219.52e8f646@halmanfloyd.lan.local> <184222e50811040554n4a160783yfc9ae770a146856f@mail.gmail.com> <20081104231717.59acb82c@halmanfloyd.lan.local> Message-ID: On Tue, Nov 4, 2008 at 3:17 PM, Marek Kubica wrote: > uhm, pretty okay). While I don't think that Scheme will ever be as > popular as Rails for web development, I really have to thank the > authors of the "Continue" guide for their good introduction! I hope to > see more and I'm also willing to contribute back as soon as I have > something useful to say about this topic. Thanks! One way to contribute is to suggest things that need more explanation and tutorial. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From tmcguire at world.std.com Mon Nov 3 23:05:37 2008 From: tmcguire at world.std.com (stig) Date: Thu Mar 26 02:32:33 2009 Subject: [plt-scheme] Help with redirecting ports Message-ID: <981b6df0-27ef-41e3-aa61-dd487a46321c@x1g2000prh.googlegroups.com> I am trying to read a content.xml from an openoffice .odt file. using unzip-entry from the zip.plt library. Which works fine, I can pump the output into ssax:xml->sxml but I can't seem to redirect the output to a file my latest attempt (below) only dumps the sxml output onto the screen in DrScheme. Any help would be much appreciated ( I commented out the copy-port because it also wasn't doing what I wanted) (require (planet "unzip.ss" ("dherman" "zip.plt" 2))) (require (planet "sxml.ss" ("lizorkin" "sxml.plt" 2 0))) (require (planet "ssax.ss" ("lizorkin" "ssax.plt" 2 0))) (require (lib "port.ss")) (define (odt2sxml filename) (unzip-entry filename (read-zip-directory filename ) #"content.xml" (lambda (name dir in) (with-output-to-file "local-copy.sxml" (lambda () (ssax:xml->sxml in (quote ())) ;(copy-port in (current-output-port) ) )))) From rokfaith at gmail.com Tue Nov 4 02:43:19 2008 From: rokfaith at gmail.com (rf) Date: Thu Mar 26 02:32:33 2009 Subject: [plt-scheme] Re: Unreasonably slow In-Reply-To: <49087583.2070704@soegaard.net> References: <62575ba60810290628t79e9665tcbbe8956837f7550@mail.gmail.com> <49087583.2070704@soegaard.net> Message-ID: This is a bit late, but the solution to "What is the smallest number that is evenly divisible by all of the numbers from 1 to 20" is much simpler: (require (planet "math.ss" ("soegaard" "math.plt" 1 3))) (apply lcm (interval 1 20)) On Oct 29, 3:38?pm, Jens Axel Soegaard wrote: > Alex Rozenshteyn wrote: > > I wrote this code for project euler problem 7: > > Project Euler is great fun. Obviously part of the fun is to write > your own number theoretic functions, but since there are quite > a few exercises at Project Euler that use the same concepts, > it is convenient to use a library. For example: > > http://planet.plt-scheme.org/package-source/soegaard/math.plt/1/3/doc... > > ? > (require (planet "math.ss" ("soegaard" "math.plt" 1 3))) > ? > (nth-prime 10000) > > With respect to the stream code, I suspect the problem is that the algorithm > you use are quadratic. I tried replacing the two uses of stream-append with > stream-cons, but the code was still slow. > > > (require r5rs) > > (require srfi/41) > > > (define stream-primes > > ? (let ((numbers (stream-cons 2 (stream-from 3 2))) > > ? ? ? ? (filter-stream > > ? ? ? ? ? (stream-lambda > > ? ? ? ? ? ? (divisor strm) > > ? ? ? ? ? ? (let ((not-div > > ? ? ? ? ? ? ? ? ? ? (lambda (dividend) > > ? ? ? ? ? ? ? ? ? ? ? (not (zero? (modulo dividend divisor)))))) > > ? ? ? ? ? ? ? (stream-filter not-div strm))))) > > ? ? (stream-let > > ? ? ? loop > > ? ? ? ((strm numbers) > > ? ? ? ?(primes stream-null)) > > ? ? ? (define prime (stream-car strm)) > > ? ? ? (stream-append > > ? ? ? ? (stream prime) > > ? ? ? ? (loop (filter-stream prime (stream-cdr strm)) > > ? ? ? ? ? ? ? (stream-append primes (stream prime))))))) > > > and I ran (stream-ref stream-primes 10000) > > > It took unreasonably long to run. ?Much longer than it took my python > > code (which uses python's generators, to which srfi/41's lazy > > comprehensions are as close as I can find in scheme). ?I'm curious as > > to whether this is an artifact of lazy comprehensions in scheme being > > slow or just my code being wrong. > > There are alternatives to streams though. Two options come to > mind, namely srfi 42 and the for construct. As an example > of the use of srfi 42 here is a solution to an earlier Euler exercise > that you probably already have solved: > > ? ? What is the smallest number that is evenly divisible by > ? ? all of the numbers from 1 to 20? > > ?> (require srfi/42 (planet "math.ss" ("soegaard" "math.plt" 1 3))) > > ; The largest prime factor of any n in 1..20 is 19. > ; The primes below 20 is given by: (prev-primes 20 20) > > ?> (list-ec (:list p (prev-primes 20 20)) > ? ? ? ? ?(list p (max-ec (: n 1 21) ? ; n runs from 0 to 20 > ? ? ? ? ? ? ? ? ? ? ? ? ?(max-dividing-power p n)))) > ({19 1} {17 1} {13 1} {11 1} {7 1} {5 1} {3 2} {2 4}) > > And given the prime number factorization it is easy to get > the number: > > ?> (apply * (map (lambda (l) (apply expt l)) > ? ? ? ? ? ? ? ? '({19 1} {17 1} {13 1} {11 1} {7 1} {5 1} {3 2} {2 4}))) > > -- > Jens Axel S?gaard > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jvjulien at free.fr Tue Nov 4 13:47:12 2008 From: jvjulien at free.fr (jeeve) Date: Thu Mar 26 02:32:33 2009 Subject: [plt-scheme] imperative vs functional Message-ID: I made a little program with DrScheme and world.ss teachpack my goal is to try to use the functional programming concept mixin object oriented programming I 'm french beginner in Scheme... source code (imperative OO) is here : http://jvjulien.free.fr/site/scheme/ping-pong/ping-pong.ss and the equivalent (functional / imperative OO) code test is here : http://jvjulien.free.fr/site/scheme/ping-pong/ping-pong-ft.ss the second version obliges methods to create a new object instance at each call. so it's necessary to initialize each fields of this new object... if it's a complex class, that does not seem very effective... exist there a method to reconcile the two approaches (OO and functional) ? thanks From ryanc at ccs.neu.edu Tue Nov 4 18:19:34 2008 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:32:33 2009 Subject: [plt-scheme] Help with redirecting ports In-Reply-To: <981b6df0-27ef-41e3-aa61-dd487a46321c@x1g2000prh.googlegroups.com> References: <981b6df0-27ef-41e3-aa61-dd487a46321c@x1g2000prh.googlegroups.com> Message-ID: <4910D886.8050505@ccs.neu.edu> stig wrote: > I am trying to read a content.xml from an openoffice .odt file. using > unzip-entry from the zip.plt library. Which works fine, I can pump the > output into ssax:xml->sxml but I can't seem to redirect the output to > a file my latest attempt (below) only dumps the sxml output onto the > screen in DrScheme. Any help would be much appreciated ( I commented > out the copy-port because it also wasn't doing what I wanted) > > (require (planet "unzip.ss" ("dherman" "zip.plt" 2))) > (require (planet "sxml.ss" ("lizorkin" "sxml.plt" 2 0))) > (require (planet "ssax.ss" ("lizorkin" "ssax.plt" 2 0))) > > (require (lib "port.ss")) > > (define (odt2sxml filename) > (unzip-entry > filename > (read-zip-directory filename ) > #"content.xml" > (lambda (name dir in) > (with-output-to-file "local-copy.sxml" > (lambda () > (ssax:xml->sxml in (quote ())) > ;(copy-port in (current-output-port) ) > )))) The 'with-output-to-file' procedure only redirects the thunk's *output*, not its result. You need to insert a call to 'write'. Here's how I would do it: ;; read-odt-as-sxml : path -> SXML (define (read-odt-as-sxml filename) (unzip-entry filename (read-zip-directory filename) #"content.xml" (lambda (name dir in) (ssax:xml->sxml in (quote ()))))) ;; convert-odt-to-sxml : path path -> void (define (convert-odt-to-sxml in-file out-file) (with-output-to-file out-file (lambda () (write (read-odt-as-sxml in-file))))) Ryan > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From chust at web.de Tue Nov 4 18:43:36 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:32:33 2009 Subject: [plt-scheme] Re: Unreasonably slow In-Reply-To: References: <62575ba60810290628t79e9665tcbbe8956837f7550@mail.gmail.com> <49087583.2070704@soegaard.net> Message-ID: <4910DE28.4070904@web.de> rf schrieb: > This is a bit late, but the solution to "What is the smallest number > that is evenly divisible by all of the numbers from 1 to 20" > is much simpler: > (require (planet "math.ss" ("soegaard" "math.plt" 1 3))) > (apply lcm (interval 1 20)) Hello, although (planet soegaard/math:1) is a very nice and useful library, I see no need to load extension modules for built-in functionality: (apply lcm (build-list 20 add1)) lcm is part of R5RS and loading the math library to construct a list of integers is clearly overkill. However, solving the problems by throwing some library functionality at them is maybe not the intention of Project Euler ;-) cu, Thomas From rcleis at mac.com Tue Nov 4 19:19:22 2008 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:32:33 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <932b2f1f0811040646w69644c8ana77558cc40610378@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> Message-ID: The optical community fusses over reflectivity because a few percent lost at every element quickly multiplies into nothingness. It's a good thing programming languages don't work that way; a program that uses 3 80% functions would only pass a 50% rule ;) RAC On Nov 4, 2008, at 2:17 PM, Grant Rettke wrote: > On Tue, Nov 4, 2008 at 4:04 PM, Richard Cleis wrote: >>> Isn't it silly that we all have our own version of this? >> >> Do we not all have our own versions because the requirements, os's, >> and >> environments aren't always the same? > > 80% rule. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From tmcguire at world.std.com Tue Nov 4 21:42:38 2008 From: tmcguire at world.std.com (stig) Date: Thu Mar 26 02:32:34 2009 Subject: [plt-scheme] Re: Help with redirecting ports In-Reply-To: <4910D886.8050505@ccs.neu.edu> References: <981b6df0-27ef-41e3-aa61-dd487a46321c@x1g2000prh.googlegroups.com> <4910D886.8050505@ccs.neu.edu> Message-ID: That works. Thanks. On Nov 4, 6:19?pm, Ryan Culpepper wrote: > stig wrote: > > I am trying to read a content.xml from an openoffice .odt file. using > > unzip-entry from the zip.plt library. Which works fine, I can pump the > > output into ssax:xml->sxml but I can't seem to redirect the output to > > a file my latest attempt (below) only dumps the sxml output onto the > > screen in DrScheme. Any help would be much appreciated ( I commented > > out the copy-port because it also wasn't doing what I wanted) > > > (require (planet "unzip.ss" ("dherman" "zip.plt" 2))) > > (require (planet "sxml.ss" ("lizorkin" "sxml.plt" 2 0))) > > (require (planet "ssax.ss" ("lizorkin" "ssax.plt" 2 0))) > > > (require (lib "port.ss")) > > > (define (odt2sxml filename) > > ? (unzip-entry > > ? ? ?filename > > ? ? ?(read-zip-directory filename ) > > ? ? ? #"content.xml" > > ? ? ? (lambda (name dir in) > > ? ? ? ? ? (with-output-to-file "local-copy.sxml" > > ? ? ? ? ? ? ? (lambda () > > ? ? ? ? ? ? ? ? (ssax:xml->sxml in (quote ())) > > ? ? ? ? ? ? ? ? ;(copy-port in (current-output-port) ) > > ? ? ? ? ? ? ? ? )))) > > The 'with-output-to-file' procedure only redirects the thunk's *output*, > not its result. You need to insert a call to 'write'. Here's how I would > do it: > > ;; read-odt-as-sxml : path -> SXML > (define (read-odt-as-sxml filename) > ? ?(unzip-entry > ? ? filename > ? ? (read-zip-directory filename) > ? ? #"content.xml" > ? ? (lambda (name dir in) > ? ? ? (ssax:xml->sxml in (quote ()))))) > > ;; convert-odt-to-sxml : path path -> void > (define (convert-odt-to-sxml in-file out-file) > ? ?(with-output-to-file out-file > ? ? ?(lambda () > ? ? ? ?(write (read-odt-as-sxml in-file))))) > > Ryan > > > _________________________________________________ > > ? For list-related administrative tasks: > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From bass at cs.uu.nl Wed Nov 5 09:01:11 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:34 2009 Subject: [plt-scheme] SLaTeX: getting it to work Message-ID: <4911A727.3060507@cs.uu.nl> Hello, Judging from http://docs.plt-scheme.org/slatex-wrap/, running SLaTeX sounds very easy. So I made a test file and typed in DrScheme: (require slatex/slatex-wrapper) (slatex "D:\\mydir\\quick.tex") However, hitting 'run' produces: SLaTeX v. 20050609 typesetting code[quick.tex]done . . collects\slatex\slatex-wrapper.ss:37:16: latex: could not find latex binary: "latex.exe" I have MiKTeX installed and use WinEdt daily, which has no trouble finding latex binaries. How does one direct SLaTeX to these binaries? Kind regards, Bas From goetter at mazama.net Wed Nov 5 09:42:11 2008 From: goetter at mazama.net (Ben Goetter) Date: Thu Mar 26 02:32:34 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <4911A727.3060507@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> Message-ID: <4911B0C3.8070206@mazama.net> Bas Steunebrink wrote: > . . collects\slatex\slatex-wrapper.ss:37:16: latex: could not find > latex binary: "latex.exe" > > I have MiKTeX installed and use WinEdt daily, which has no trouble > finding latex binaries. How does one direct SLaTeX to these binaries? slatex.exe must have latex.exe on its PATH. From robby at cs.uchicago.edu Wed Nov 5 09:49:50 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:34 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <4911B0C3.8070206@mazama.net> References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> Message-ID: <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> Also: I sometimes just run slatex (which you can run from the commandline, btw) and when it fails like that, just run latex. slatex has already done its job at that point and it runs latex as a convenience, but you can just run it manually. Robby On Wed, Nov 5, 2008 at 8:42 AM, Ben Goetter wrote: > Bas Steunebrink wrote: >> >> . . collects\slatex\slatex-wrapper.ss:37:16: latex: could not find latex >> binary: "latex.exe" >> >> I have MiKTeX installed and use WinEdt daily, which has no trouble finding >> latex binaries. How does one direct SLaTeX to these binaries? > > slatex.exe must have latex.exe on its PATH. > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From sk at cs.brown.edu Wed Nov 5 10:36:44 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:34 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> Message-ID: +1 I actually have never fixed this bug because I consider it a "feature". In run LaTeX from within Emacs, so I only need to shift to the shell to run SLaTeX, which is much less often. S. On Wed, Nov 5, 2008 at 10:49 AM, Robby Findler wrote: > Also: I sometimes just run slatex (which you can run from the > commandline, btw) and when it fails like that, just run latex. slatex > has already done its job at that point and it runs latex as a > convenience, but you can just run it manually. > > Robby > > On Wed, Nov 5, 2008 at 8:42 AM, Ben Goetter wrote: >> Bas Steunebrink wrote: >>> >>> . . collects\slatex\slatex-wrapper.ss:37:16: latex: could not find latex >>> binary: "latex.exe" >>> >>> I have MiKTeX installed and use WinEdt daily, which has no trouble finding >>> latex binaries. How does one direct SLaTeX to these binaries? >> >> slatex.exe must have latex.exe on its PATH. >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at cs.uchicago.edu Wed Nov 5 12:09:29 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:34 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> Message-ID: <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> But you can run slatex or latex from Emacs with equal ease, no? They're both .exe's? Robby On Wed, Nov 5, 2008 at 9:36 AM, Shriram Krishnamurthi wrote: > +1 > > I actually have never fixed this bug because I consider it a > "feature". In run LaTeX from within Emacs, so I only need to shift to > the shell to run SLaTeX, which is much less often. > > S. > > On Wed, Nov 5, 2008 at 10:49 AM, Robby Findler wrote: >> Also: I sometimes just run slatex (which you can run from the >> commandline, btw) and when it fails like that, just run latex. slatex >> has already done its job at that point and it runs latex as a >> convenience, but you can just run it manually. >> >> Robby >> >> On Wed, Nov 5, 2008 at 8:42 AM, Ben Goetter wrote: >>> Bas Steunebrink wrote: >>>> >>>> . . collects\slatex\slatex-wrapper.ss:37:16: latex: could not find latex >>>> binary: "latex.exe" >>>> >>>> I have MiKTeX installed and use WinEdt daily, which has no trouble finding >>>> latex binaries. How does one direct SLaTeX to these binaries? >>> >>> slatex.exe must have latex.exe on its PATH. >>> >>> _________________________________________________ >>> 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 Wed Nov 5 13:05:24 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:34 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> Message-ID: I have a slow laptop and often run it on quite large documents, and tend to have a very rapid edit-run-view cycle, so I like having the default operation be quick and the slow operation be not-the-default. On Wed, Nov 5, 2008 at 1:09 PM, Robby Findler wrote: > But you can run slatex or latex from Emacs with equal ease, no? > They're both .exe's? > > Robby > > On Wed, Nov 5, 2008 at 9:36 AM, Shriram Krishnamurthi wrote: >> +1 >> >> I actually have never fixed this bug because I consider it a >> "feature". In run LaTeX from within Emacs, so I only need to shift to >> the shell to run SLaTeX, which is much less often. >> >> S. >> >> On Wed, Nov 5, 2008 at 10:49 AM, Robby Findler wrote: >>> Also: I sometimes just run slatex (which you can run from the >>> commandline, btw) and when it fails like that, just run latex. slatex >>> has already done its job at that point and it runs latex as a >>> convenience, but you can just run it manually. >>> >>> Robby >>> >>> On Wed, Nov 5, 2008 at 8:42 AM, Ben Goetter wrote: >>>> Bas Steunebrink wrote: >>>>> >>>>> . . collects\slatex\slatex-wrapper.ss:37:16: latex: could not find latex >>>>> binary: "latex.exe" >>>>> >>>>> I have MiKTeX installed and use WinEdt daily, which has no trouble finding >>>>> latex binaries. How does one direct SLaTeX to these binaries? >>>> >>>> slatex.exe must have latex.exe on its PATH. >>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> >> > From grettke at acm.org Wed Nov 5 14:40:52 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:35 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? Message-ID: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> Hi, Any recommended books on Lisp interpreter implementation in C? Best wishes, Grant From anesward at mac.com Wed Nov 5 16:24:07 2008 From: anesward at mac.com (mike) Date: Thu Mar 26 02:32:35 2009 Subject: [plt-scheme] exercise 11.5.3 Message-ID: I assume that x is also a natural number ? mike From bass at cs.uu.nl Wed Nov 5 16:06:08 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:35 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> Message-ID: <49120AC0.2040404@cs.uu.nl> Ah great, thanks a lot for the quick replies! :-) On my home computer it does succeed in running LaTeX but hangs immediately on \begin{document}, which I think is quite odd.... --------------------------------------- ! Undefined control sequence. \\ ->\let \reserved@e \relax \let \reserved@f \relax \@ifstar {\let \reserv... l.14 \begin {document} --------------------------------------- Any ideas what might be the problem here? I hope my questions don't seem too 'basic'. But I think that, if I fail at getting this to work, while being an experienced LaTeX user and Schemer, maybe the SLaTeX documentation could be beefed up a bit... just a kind suggestion. :-) BTW here I'm just trying to get the example from http://www.ccs.neu.edu/home/dorai/slatex/slatxdoc-Z-H-1.html to work; nothing fancy... Bas Shriram Krishnamurthi schreef: > I have a slow laptop and often run it on quite large documents, and > tend to have a very rapid edit-run-view cycle, so I like having the > default operation be quick and the slow operation be not-the-default. > > On Wed, Nov 5, 2008 at 1:09 PM, Robby Findler wrote: > >> But you can run slatex or latex from Emacs with equal ease, no? >> They're both .exe's? >> >> Robby >> >> On Wed, Nov 5, 2008 at 9:36 AM, Shriram Krishnamurthi wrote: >> >>> +1 >>> >>> I actually have never fixed this bug because I consider it a >>> "feature". In run LaTeX from within Emacs, so I only need to shift to >>> the shell to run SLaTeX, which is much less often. >>> >>> S. >>> >>> On Wed, Nov 5, 2008 at 10:49 AM, Robby Findler wrote: >>> >>>> Also: I sometimes just run slatex (which you can run from the >>>> commandline, btw) and when it fails like that, just run latex. slatex >>>> has already done its job at that point and it runs latex as a >>>> convenience, but you can just run it manually. >>>> >>>> Robby >>>> >>>> On Wed, Nov 5, 2008 at 8:42 AM, Ben Goetter wrote: >>>> >>>>> Bas Steunebrink wrote: >>>>> >>>>>> . . collects\slatex\slatex-wrapper.ss:37:16: latex: could not find latex >>>>>> binary: "latex.exe" >>>>>> >>>>>> I have MiKTeX installed and use WinEdt daily, which has no trouble finding >>>>>> latex binaries. How does one direct SLaTeX to these binaries? >>>>>> >>>>> slatex.exe must have latex.exe on its PATH. >>>>> >>>>> _________________________________________________ >>>>> 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 - Wed > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081105/efacf95a/attachment.html From noelwelsh at gmail.com Wed Nov 5 16:44:18 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:32:36 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> Message-ID: Maybe Lisp in Small Pieces, though I think it focuses on compilers. However the interpreter techniques in, say, SICP or PLAI carry over to C -- they're just more work to implement in C. N. On Wed, Nov 5, 2008 at 7:40 PM, Grant Rettke wrote: > Hi, > > Any recommended books on Lisp interpreter implementation in C? > > Best wishes, > > Grant From noelwelsh at gmail.com Wed Nov 5 16:48:45 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:32:36 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <49120AC0.2040404@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> Message-ID: On Wed, Nov 5, 2008 at 9:06 PM, Bas Steunebrink wrote: > Ah great, thanks a lot for the quick replies! :-) On my home computer it > does succeed in running LaTeX but hangs immediately on \begin{document}, > which I think is quite odd.... ... > Any ideas what might be the problem here? I don't know enough Latex to say what is causing that error, but I there is simple debugging you can do to find out if the problem is with latex or slatex: cut out the slatex specific parts and see if works w/ plain latex. I suggest this because I once had an issue with unprintable characters in a slatex file causing problems (unprintable meaning I couldn't see them in my editor) and it wasn't until I ruled out slatex as the problem that I made progress towards a solution. N. From plragde at uwaterloo.ca Wed Nov 5 17:02:12 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:32:36 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: Message-ID: <491217E4.8030202@uwaterloo.ca> Noel wrote (in reply to Grant): >> Any recommended books on Lisp interpreter implementation in C? > > Maybe Lisp in Small Pieces, though I think it focuses on compilers. > However the interpreter techniques in, say, SICP or PLAI carry over to > C -- they're just more work to implement in C. I second the recommendation of Lisp in Small Pieces for anything but a toy interpreter [1]. But even for those, the PLAI or EOPL techniques aren't entirely straightforward to transfer to C, as there are going to be stack issues. You pretty much have to get to the later chapters of those references to really understand how to do it properly. --PR [1] Note that the word "toy" is not intended to be derogatory here. Writing these and playing with them has considerable educational value. From randomtalk at gmail.com Wed Nov 5 17:16:01 2008 From: randomtalk at gmail.com (Jason Wang) Date: Thu Mar 26 02:32:36 2009 Subject: [plt-scheme] exercise 11.5.3 In-Reply-To: References: Message-ID: <939cf200811051416t4150222fwa9c121d3fc3c9f79@mail.gmail.com> I don't think you should, because if it says a natural number n and a number x, then if they want you to assume x to be a natural number, they would've stated it explicitly as is the case with n. On Wed, Nov 5, 2008 at 4:24 PM, mike wrote: > I assume that x is also a natural number ? > mike > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- "It's a wonderful world hobbes ol' buddy, let's go explorin'!" - Calvin in "Calvin and Hobbes" From matthias at ccs.neu.edu Wed Nov 5 18:03:37 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:36 2009 Subject: [plt-scheme] exercise 11.5.3 In-Reply-To: <939cf200811051416t4150222fwa9c121d3fc3c9f79@mail.gmail.com> References: <939cf200811051416t4150222fwa9c121d3fc3c9f79@mail.gmail.com> Message-ID: <5812AC54-D6DB-4A5C-92A6-B414FD9B1CD1@ccs.neu.edu> exactly On Nov 5, 2008, at 5:16 PM, Jason Wang wrote: > I don't think you should, because if it says a natural number n and a > number x, then if they want you to assume x to be a natural number, > they would've stated it explicitly as is the case with n. > > On Wed, Nov 5, 2008 at 4:24 PM, mike wrote: >> I assume that x is also a natural number ? >> mike >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > "It's a wonderful world hobbes ol' buddy, let's go explorin'!" - > Calvin in "Calvin and Hobbes" > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From anesward at mac.com Wed Nov 5 18:12:27 2008 From: anesward at mac.com (mike) Date: Thu Mar 26 02:32:37 2009 Subject: [plt-scheme] Re: exercise 11.5.3 In-Reply-To: <939cf200811051416t4150222fwa9c121d3fc3c9f79@mail.gmail.com> References: <939cf200811051416t4150222fwa9c121d3fc3c9f79@mail.gmail.com> Message-ID: <91b461ef-46b9-4de4-a5d6-818e14ca237c@k1g2000prb.googlegroups.com> Since " * " cant be used therefore I assumed that i have to use my defined " multiply " function from the previous exercise which only works on natural numbers mike On Nov 5, 2:16?pm, "Jason Wang" wrote: > I don't think you should, because if it says a natural number n and a > number x, then if they want you to assume x to be a natural number, > they would've stated it explicitly as is the case with n. > > On Wed, Nov 5, 2008 at 4:24 PM, mike wrote: > > I assume that x is also a natural number ? > > mike > > _________________________________________________ > > ?For list-related administrative tasks: > > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- > "It's a wonderful world hobbes ol' buddy, let's go explorin'!" - > Calvin in "Calvin and Hobbes" > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Wed Nov 5 18:14:44 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:37 2009 Subject: [plt-scheme] Re: exercise 11.5.3 In-Reply-To: <91b461ef-46b9-4de4-a5d6-818e14ca237c@k1g2000prb.googlegroups.com> References: <939cf200811051416t4150222fwa9c121d3fc3c9f79@mail.gmail.com> <91b461ef-46b9-4de4-a5d6-818e14ca237c@k1g2000prb.googlegroups.com> Message-ID: <8158FCB7-8250-48B5-BB49-424EE1B617EF@ccs.neu.edu> yes. On Nov 5, 2008, at 6:12 PM, mike wrote: > Since " * " cant be used therefore I assumed that i have to use my > defined " multiply " function from the previous exercise which only > works on natural numbers > mike > > On Nov 5, 2:16 pm, "Jason Wang" wrote: >> I don't think you should, because if it says a natural number n and a >> number x, then if they want you to assume x to be a natural number, >> they would've stated it explicitly as is the case with n. >> >> On Wed, Nov 5, 2008 at 4:24 PM, mike wrote: >>> I assume that x is also a natural number ? >>> mike >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> -- >> "It's a wonderful world hobbes ol' buddy, let's go explorin'!" - >> Calvin in "Calvin and Hobbes" >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From michael at schuerig.de Wed Nov 5 18:33:41 2008 From: michael at schuerig.de (Michael Schuerig) Date: Thu Mar 26 02:32:37 2009 Subject: [plt-scheme] Re: Books on Lisp interpreter implementation in C? In-Reply-To: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> Message-ID: <200811060033.41361.michael@schuerig.de> On Wednesday 05 November 2008, Grant Rettke wrote: > Any recommended books on Lisp interpreter implementation in C? LiSP by Queinnec has already been recommended an is excellent, from my non-expert point of view. Also, have a look at the page of Abdulaziz Ghuloum, who, incidentally, is writing on this list, too. http://www.cs.indiana.edu/~aghuloum/ Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/ From matthias at ccs.neu.edu Wed Nov 5 19:05:07 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:37 2009 Subject: [plt-scheme] imperative vs functional In-Reply-To: References: Message-ID: I don't have time to look through the code BUT world.ss wasn't intended for OO approaches at all. There is an alternative OO framework for world, which we use for "how to design classes". Here is the rough idea: abstract world class define abstract/void methods: -- onTick -- onKey -- onMouse -- draw plus lots of "real" methods that do the set!'y work then you derive a class that overrides the four "hook" methods with methods that accomplish something. 1. In general, this looks more compact than world.ss code, because "this" (aka self) just is the right "thing". 2. You will retain the problem of desconstructing and reconstructing a new object every time around. 3. BUT, if you feel you need to replace this with real state, you can create just about the right mix. -- Matthias On Nov 4, 2008, at 1:47 PM, jeeve wrote: > I made a little program with DrScheme and world.ss teachpack > > my goal is to try to use the functional programming concept mixin > object oriented programming > I 'm french beginner in Scheme... > > source code (imperative OO) is here : > http://jvjulien.free.fr/site/scheme/ping-pong/ping-pong.ss > > and the equivalent (functional / imperative OO) code test is here : > http://jvjulien.free.fr/site/scheme/ping-pong/ping-pong-ft.ss > > the second version obliges methods to create a new object instance at > each call. so it's necessary to initialize each fields of this new > object... if it's a complex class, that does not seem very > effective... > > exist there a method to reconcile the two approaches (OO and > functional) ? > thanks > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dvanhorn at ccs.neu.edu Wed Nov 5 19:09:41 2008 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:32:37 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> Message-ID: <491235C5.2060909@ccs.neu.edu> Grant Rettke wrote: > Any recommended books on Lisp interpreter implementation in C? Grant, What are you looking to get out of such a book? We can make better recommendations based on that info. Here is my guess on what you're asking: how can does one implement the interpreter for a higher-order (maybe garbage-collected, maybe tail-recursive) language (like Scheme) in a first-order (maybe explicitly memory-managed, maybe non-tail-recursive) language (like C)? If this is the question, what you are looking for is a reference on "abstract machines". An abstract machine is just an interpreter which is 1) first-order, and where 2) all calls are tail calls. It is easy to implement such an abstract machine in a language like C. If you're interested in abstract machines, see Felleisen and Flatt's monograph. I can't remember if that book deals with implementing garbage collection, but Krishnamurthi's PLAI is a great reference on the topic. Finally, I'll mention that you can from a higher-order functional evaluator to an abstract machine via standard tools in the functional programmer's toolkit: CPS and defunctionalization. For this you want to see Danvy's invited ICFP talk from this year. David From raould at gmail.com Wed Nov 5 19:13:51 2008 From: raould at gmail.com (Raoul Duke) Date: Thu Mar 26 02:32:38 2009 Subject: Fwd: [plt-scheme] imperative vs functional In-Reply-To: <91a2ba3e0811051613i3cda93a3r407f6fcabe96d79c@mail.gmail.com> References: <91a2ba3e0811051613i3cda93a3r407f6fcabe96d79c@mail.gmail.com> Message-ID: <91a2ba3e0811051613s150061bbgae21ee48c54e6a8f@mail.gmail.com> >> the second version obliges methods to create a new object instance at >> each call. so it's necessary to initialize each fields of this new >> object... if it's a complex class, that does not seem very >> effective... i should think it depends on how "pure" the particular FP system is: in schemes and lisps and o'caml iirc you can more easily directly mutate state than in, say, haskell. so you could implement your OO system as mutating state directly in many otherwise-labeled "FP" systems. in systems which don't let you do the mutation and require copying, one could do some trickery under the covers a la Okasaki's purely functional data structures. sincerely. From matthias at ccs.neu.edu Wed Nov 5 19:14:02 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:38 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: <491235C5.2060909@ccs.neu.edu> References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> <491235C5.2060909@ccs.neu.edu> Message-ID: On Nov 5, 2008, at 7:09 PM, David Van Horn wrote: > I'll mention that you can from a higher-order functional evaluator > to an abstract machine via standard tools in the functional > programmer's toolkit: CPS and defunctionalization. Grant, this stuff is so standard, it dates back to 1972 (Reynolds and friends). And I learned it all from EOPL, especially the register machine stuff. SO if you have exhausted EOPL and/or PLAI (which covers these things differently) you know it. -- Matthias From sk at cs.brown.edu Wed Nov 5 19:18:08 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:38 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> <491235C5.2060909@ccs.neu.edu> Message-ID: In particular, I recommend reading the first edition of EOPL, which does some of these things in good detail (but not the translation to C). On Wed, Nov 5, 2008 at 7:14 PM, Matthias Felleisen wrote: > > On Nov 5, 2008, at 7:09 PM, David Van Horn wrote: > >> I'll mention that you can from a higher-order functional evaluator to an >> abstract machine via standard tools in the functional programmer's toolkit: >> CPS and defunctionalization. > > > Grant, this stuff is so standard, it dates back to 1972 (Reynolds and > friends). And I learned it all from EOPL, especially the register machine > stuff. SO if you have exhausted EOPL and/or PLAI (which covers these things > differently) you know it. > > -- Matthias > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From anesward at mac.com Wed Nov 5 20:08:06 2008 From: anesward at mac.com (mike) Date: Thu Mar 26 02:32:38 2009 Subject: [plt-scheme] calculation time for 11.5.3 Message-ID: Using my def for add ,multiply and finally exponent which is dependent on the def for add and multiply i find calculation times increase dramatically as i raise the exponent. (exponent 10 4) takes a long long time. Can i assume that the nature of the functions is such that the number of calculations increases hyperbolically?? and not a function of sick computer? code is: (define (multiply n x) (cond ((= x 0) 0) (else (add n (multiply n (sub1 x)))))) which is used for: (define (exponent x n) (cond ( (= n 0) 1) (else (multiply x (exponent x (sub1 n)))))) mike From yinso.chen at gmail.com Wed Nov 5 20:13:13 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:32:39 2009 Subject: [plt-scheme] web-server struct binding:file - content-type ? Message-ID: <779bf2730811051713s3bd6c9f9wc851bc0b7ad7a4d4@mail.gmail.com> Hi - in the web-server module, the request struct `binding:file` doesn't include a content-type binding - can it be included? As far as I can tell, when uploading a file through browsers the content-type header is included (yes it can be unreliable, but so can other data...). Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081105/5a54d9d4/attachment.htm From grettke at acm.org Thu Nov 6 00:07:47 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:39 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: <491235C5.2060909@ccs.neu.edu> References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> <491235C5.2060909@ccs.neu.edu> Message-ID: <756daca50811052107u2f8d0da9w4f3bf4ead2f8268c@mail.gmail.com> On Wed, Nov 5, 2008 at 6:09 PM, David Van Horn wrote: >> Any recommended books on Lisp interpreter implementation in C? > What are you looking to get out of such a book? We can make better > recommendations based on that info. The last time I used C was Freshman year Computer Science and I wanted a motivational vehicle to "relearn" it. > Here is my guess on what you're asking: how can does one implement the > interpreter for a higher-order (maybe garbage-collected, maybe > tail-recursive) language (like Scheme) in a first-order (maybe explicitly > memory-managed, maybe non-tail-recursive) language (like C)? Yes, that too. > If you're interested in abstract machines, see Felleisen and Flatt's > monograph. I can't remember if that book deals with implementing garbage > collection, but Krishnamurthi's PLAI is a great reference on the topic. > Finally, I'll mention that you can from a higher-order functional evaluator > to an abstract machine via standard tools in the functional programmer's > toolkit: CPS and defunctionalization. For this you want to see Danvy's > invited ICFP talk from this year. Understood. Thanks. From grettke at acm.org Thu Nov 6 00:08:12 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:39 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> <491235C5.2060909@ccs.neu.edu> Message-ID: <756daca50811052108h37ed1842sefbd21e0a94dadc1@mail.gmail.com> On Wed, Nov 5, 2008 at 6:14 PM, Matthias Felleisen wrote: > SO if you have exhausted EOPL and/or PLAI (which covers these things differently) you know it. That I have not, thanks. From grettke at acm.org Thu Nov 6 00:10:56 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:39 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> <491235C5.2060909@ccs.neu.edu> Message-ID: <756daca50811052110i75d93bc4g7aea7dbc1a69ef9a@mail.gmail.com> On Wed, Nov 5, 2008 at 6:18 PM, Shriram Krishnamurthi wrote: > In particular, I recommend reading the first edition of EOPL, which > does some of these things in good detail (but not the translation to > C). What does the 2nd edition do well? I've already got a copy of that. I'll dig around for a first edition. From noelwelsh at gmail.com Thu Nov 6 02:19:06 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:32:40 2009 Subject: [plt-scheme] web-server struct binding:file - content-type ? In-Reply-To: <779bf2730811051713s3bd6c9f9wc851bc0b7ad7a4d4@mail.gmail.com> References: <779bf2730811051713s3bd6c9f9wc851bc0b7ad7a4d4@mail.gmail.com> Message-ID: Isn't that part of the headers? The web server exposes those in the request struct. N. On Thu, Nov 6, 2008 at 1:13 AM, YC wrote: > Hi - > > in the web-server module, the request struct `binding:file` doesn't include > a content-type binding - can it be included? As far as I can tell, when > uploading a file through browsers the content-type header is included (yes > it can be unreliable, but so can other data...). > > Thanks, > yc > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From yinso.chen at gmail.com Thu Nov 6 02:43:53 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:32:40 2009 Subject: [plt-scheme] web-server struct binding:file - content-type ? In-Reply-To: References: <779bf2730811051713s3bd6c9f9wc851bc0b7ad7a4d4@mail.gmail.com> Message-ID: <779bf2730811052343w660c9b26uade7008099fcb3c5@mail.gmail.com> It's not part of the headers (unless it's a PUT) - it's part of the multipart/form-data being posted by the browser. Thanks, yc On Wed, Nov 5, 2008 at 11:19 PM, Noel Welsh wrote: > Isn't that part of the headers? The web server exposes those in the > request struct. > > N. > > On Thu, Nov 6, 2008 at 1:13 AM, YC wrote: > > Hi - > > > > in the web-server module, the request struct `binding:file` doesn't > include > > a content-type binding - can it be included? As far as I can tell, when > > uploading a file through browsers the content-type header is included > (yes > > it can be unreliable, but so can other data...). > > > > 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/20081105/bb0216ab/attachment.html From bass at cs.uu.nl Thu Nov 6 04:54:45 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:41 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> Message-ID: <4912BEE5.2040603@cs.uu.nl> OK so this one was due to the path of the slatex.sty file containing spaces... Grrrr.... Now SLaTeX seems to run fine, in the sense that it doesn't give any errors and says everything is OK. However, somehow it fails to generate .Z* files, so running (PDF)LaTeX afterwards fails saying it can't find the appropriate .Z* file... Any ideas still? BTW I'm running Vista and I've tried unhiding all files and searching for .Z* files, to no avail. It seems it just didn't make them. :-( Bas Noel Welsh wrote: > On Wed, Nov 5, 2008 at 9:06 PM, Bas Steunebrink wrote: > >> Ah great, thanks a lot for the quick replies! :-) On my home computer it >> does succeed in running LaTeX but hangs immediately on \begin{document}, >> which I think is quite odd.... >> > ... > >> Any ideas what might be the problem here? >> > > I don't know enough Latex to say what is causing that error, but I > there is simple debugging you can do to find out if the problem is > with latex or slatex: cut out the slatex specific parts and see if > works w/ plain latex. I suggest this because I once had an issue with > unprintable characters in a slatex file causing problems (unprintable > meaning I couldn't see them in my editor) and it wasn't until I ruled > out slatex as the problem that I made progress towards a solution. > > N. > -- Bas Steunebrink Intelligent Systems Group Utrecht University P.O. Box 80.089 3508TB Utrecht The Netherlands Tel: +31 (30) 253 2993 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081106/2b064a7a/attachment.htm From mflatt at cs.utah.edu Thu Nov 6 13:05:42 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:41 2009 Subject: [plt-scheme] Code for catching exceptions in embedding applications In-Reply-To: <134cebf50811060712s66cbe84t3325c3f3fa32d1d6@mail.gmail.com> References: <48E78592.1060400@gmail.com> <20081006001954.2D0A965008C@mail-svr1.cs.utah.edu> <134cebf50811030014k3a3514s5f26fcc6b2b8ed9d@mail.gmail.com> <20081103143934.AF8416500B1@mail-svr1.cs.utah.edu> <134cebf50811060712s66cbe84t3325c3f3fa32d1d6@mail.gmail.com> Message-ID: <20081106180543.1E9EE6500AA@mail-svr1.cs.utah.edu> At Thu, 6 Nov 2008 18:12:10 +0300, "Sergey Khorev" wrote: > Great thanks and now, I hope, the last question in the series: I > cannot find `exn?' and `exn-message' in the basic environment, i.e. > scheme_lookup_global(scheme_intern_symbol("exn?"), environment) > returns NULL. > > I tried to `require' scheme instead of scheme/base but this did not help. > > Can you advise what is required for code to work. > > environment = scheme_basic_env(); > declare_modules(environment); > scheme_namespace_require(scheme_intern_symbol("scheme/base")); > exn_p = scheme_lookup_global(scheme_intern_symbol("exn?"), environment); When you `require' a module, it doesn't create top-level variables --- only import bindings. The scheme_lookup_global() function looks only for top-level variables, ignoring bindings. You could use eval. In this case, though, just use scheme_builtin_value(): exn_p = scheme_builtin_value("exn?"); Matthew From jadudm at gmail.com Thu Nov 6 10:08:14 2008 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:32:41 2009 Subject: [plt-scheme] mzc banner suppression? Message-ID: Hi all, Is it possible to suppress the 'mzc' banner when compiling? Cheers, Matt From sk at cs.brown.edu Thu Nov 6 13:42:40 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:42 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <49130175.2050909@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> Message-ID: I was concerned about this from your previous posting already. You showed > typesetting code[quick.tex]done But SLaTeX prints a dot for each Scheme expression it is asked to typeset, so this should have shown up as > typesetting code[quick.tex].done Honestly, I've never, ever in 15 years used SLaTeX from within Scheme (nor can I imagine why I'd want to). Have you tried running the command-line version? Do you get the same problem? Shriram From mflatt at cs.utah.edu Thu Nov 6 13:54:05 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:42 2009 Subject: [plt-scheme] mzc banner suppression? In-Reply-To: References: Message-ID: <20081106185405.994176500AA@mail-svr1.cs.utah.edu> At Thu, 6 Nov 2008 10:08:14 -0500, "Matt Jadud" wrote: > Is it possible to suppress the 'mzc' banner when compiling? This has been bothering me, too, especially with modes like `--expand' and `--decompile'. In SVN, I've changed `-v' to enable the information that used to be printed by default, and the new `--vv' has taken over the old role of `-v'. Matthew From sergey.khorev at gmail.com Thu Nov 6 10:12:10 2008 From: sergey.khorev at gmail.com (Sergey Khorev) Date: Thu Mar 26 02:32:42 2009 Subject: [plt-scheme] Code for catching exceptions in embedding applications In-Reply-To: <20081103143934.AF8416500B1@mail-svr1.cs.utah.edu> References: <48E78592.1060400@gmail.com> <20081006001954.2D0A965008C@mail-svr1.cs.utah.edu> <134cebf50811030014k3a3514s5f26fcc6b2b8ed9d@mail.gmail.com> <20081103143934.AF8416500B1@mail-svr1.cs.utah.edu> Message-ID: <134cebf50811060712s66cbe84t3325c3f3fa32d1d6@mail.gmail.com> Great thanks and now, I hope, the last question in the series: I cannot find `exn?' and `exn-message' in the basic environment, i.e. scheme_lookup_global(scheme_intern_symbol("exn?"), environment) returns NULL. I tried to `require' scheme instead of scheme/base but this did not help. Can you advise what is required for code to work. environment = scheme_basic_env(); declare_modules(environment); scheme_namespace_require(scheme_intern_symbol("scheme/base")); exn_p = scheme_lookup_global(scheme_intern_symbol("exn?"), environment); From bass at cs.uu.nl Thu Nov 6 09:38:45 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:42 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> Message-ID: <49130175.2050909@cs.uu.nl> Thanks for your interest. :-) I create this file called quick.tex: \documentclass{article} \usepackage{slatex} \begin{document} In Scheme, \scheme{lambda} creates a function. \end{document} Then I save it in the PLT/collects/slatex/ folder so that it is together with slatex.sty. I fire up DrScheme and type: (require slatex/slatex-wrapper) (slatex/no-latex "C:/apps/PLT/collects/slatex/quick.tex") Running this gives me: Welcome to DrScheme, version 4.1 [3m]. Language: Pretty Big custom; memory limit: 128 megabytes. SLaTeX v. 20050609 typesetting code[quick.tex]done > However, no .Z* file is to be found in either PLT/ or PLT/collects/slatex/ or anywhere else for that matter. I get the same result on Vista and Windows 2000, which makes me suspect I'm missing some crucial trick or something. A test file containing a schemedisplay environment doesn't produce anything either. Bas Shriram Krishnamurthi wrote: > Very surprising. Can you post the smallest SLaTeX file on which you > have this problem? > From sbloch at adelphi.edu Thu Nov 6 10:05:55 2008 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:32:42 2009 Subject: [plt-scheme] calculation time for 11.5.3 In-Reply-To: References: Message-ID: <09D6F553-96A1-4B38-ACF0-CF73E91CAD1F@adelphi.edu> On Nov 5, 2008, at 8:08 PM, mike wrote: > Using my def for add ,multiply and finally exponent which is > dependent > on the def for add and multiply i find calculation times increase > dramatically as i raise the exponent. (exponent 10 4) takes a long > long > time. > Can i assume that the nature of the functions is such that the > number > of calculations increases hyperbolically?? and not a function of sick > computer? Doing this in the "obvious" way, by structural recursion on Peano natural numbers, the add function should take linear time, the multiply function quadratic time, and the exponent function cubic time. No, wait... that's too easy. add(n1,n2) takes O(n1) time (assuming that's the parameter you recur on). mult(n1, n2) takes sum_n1(O(n2)) time, i.e. O(n1 * n2) time. raise(x, n) takes sum_{i=1}^n{x^i}, which is O(x^n) time. In other words, the time the function takes is approximately equal to its answer. Which is obvious in retrospect, since the only fundamental operation it does on answers is add1; you can't get 10^4 from 0 without doing that operation at least 10^4 times. On my computer, (raise 10 4) takes well under a second, but (raise 10 6) takes about four seconds. BTW, I tried rewriting all three functions to be tail-recursive, and it didn't make any noticeable difference. As long as you're using Peano numbers (whose only constructor is add1), this is unavoidable. You can do much better, of course, if you use binary representation: ; A nat-num is either ; 0, ; 2n where n is a nat-num, or ; 2n+1 where n is a nat-num Note that this uses "multiplication", but only the restricted case of multiplication by 2. With this representation, add(n1, n2) takes O(max(log(n1), log(n2)) time mult(n1, n2) takes O(log(n1) * log(n2)) time (assuming you don't start doing fast Fourier transforms!) raise(x, n) takes O(n*log(x)) time by the obvious algorithm, or O(log(n)*log(x)) time by a less-obvious but fairly straightforward algorithm. Homework problem: define a data structure to represent natural numbers in binary form (not using the built-in number type), and define these functions on that data type. Stephen Bloch sbloch@adelphi.edu From sk at cs.brown.edu Thu Nov 6 09:08:49 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:42 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <4912BEE5.2040603@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <4911B0C3.8070206@mazama.net> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> Message-ID: Very surprising. Can you post the smallest SLaTeX file on which you have this problem? From bass at cs.uu.nl Thu Nov 6 15:30:52 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:43 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> Message-ID: <491353FC.3070800@cs.uu.nl> Yes, same problem: --------------------------------------------------------------------- C:\Program Files\PLT>slatex collects/slatex/quick.tex SLaTeX v. 20050609 typesetting code[quick.tex]done This is pdfTeX, Version 3.1415926-1.40.8-alpha-20080323 (MiKTeX 2.7) entering extended mode (collects/slatex/quick.tex LaTeX2e <2005/12/01> Babel and hyphenation patterns for english, dumylang, nohyphenation, ge rman, ngerman, french, loaded. ("C:\Program Files\MiKTeX\tex\latex\base\article.cls" Document Class: article 2005/09/16 v1.4f Standard LaTeX document class ("C:\Program Files\MiKTeX\tex\latex\base\size10.clo")) ! LaTeX Error: File `slatex.sty' not found. Type X to quit or to proceed, or enter new name. (Default extension: sty) Enter file name: collects/slatex/slatex.sty (collects/slatex/slatex.sty *** Check: Are you sure you called SLaTeX 20050609 or later? ***) (quick.aux) ! I can't find file `.Z0quick.tex'. \ZZZZinput #1->\input #1 \relax l.4 In Scheme, \scheme {lambda} creates a function. Please type another input file name: ------------------------------------------------------------------ Still no dot in front of "done", in Vista nor Windows 2000. But even if one prefers the command line, it should work from within Scheme all the same right? It should just work either way. Quite frustrating... :-S Bas Shriram Krishnamurthi schreef: > I was concerned about this from your previous posting already. You showed > > >> typesetting code[quick.tex]done >> > > But SLaTeX prints a dot for each Scheme expression it is asked to > typeset, so this should have shown up as > > >> typesetting code[quick.tex].done >> > > Honestly, I've never, ever in 15 years used SLaTeX from within Scheme > (nor can I imagine why I'd want to). Have you tried running the > command-line version? Do you get the same problem? > > Shriram > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081106/985f4c86/attachment.html From sk at cs.brown.edu Thu Nov 6 15:46:20 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:43 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <491353FC.3070800@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> Message-ID: I am baffled as to why this might be, so I'm CCing the creator of SLaTeX in case he has a ready idea. [And yes, it should run under Scheme; I was trying to eliminate a variable.] Shriram On Thu, Nov 6, 2008 at 3:30 PM, Bas Steunebrink wrote: > Yes, same problem: > > --------------------------------------------------------------------- > C:\Program Files\PLT>slatex collects/slatex/quick.tex > SLaTeX v. 20050609 > typesetting code[quick.tex]done > This is pdfTeX, Version 3.1415926-1.40.8-alpha-20080323 (MiKTeX 2.7) > entering extended mode > (collects/slatex/quick.tex > LaTeX2e <2005/12/01> > Babel and hyphenation patterns for english, dumylang, nohyphenation, > ge > rman, ngerman, french, loaded. > ("C:\Program Files\MiKTeX\tex\latex\base\article.cls" > Document Class: article 2005/09/16 v1.4f Standard LaTeX document class > ("C:\Program Files\MiKTeX\tex\latex\base\size10.clo")) > > ! LaTeX Error: File `slatex.sty' not found. > > Type X to quit or to proceed, > or enter new name. (Default extension: sty) > > Enter file name: collects/slatex/slatex.sty > (collects/slatex/slatex.sty > *** Check: Are you sure you called SLaTeX 20050609 or later? ***) > (quick.aux) > ! I can't find file `.Z0quick.tex'. > \ZZZZinput #1->\input #1 > \relax > l.4 In Scheme, \scheme > {lambda} creates a function. > Please type another input file name: > ------------------------------------------------------------------ > > Still no dot in front of "done", in Vista nor Windows 2000. But even if one > prefers the command line, it should work from within Scheme all the same > right? It should just work either way. > > Quite frustrating... :-S > > Bas > > > > Shriram Krishnamurthi schreef: > > I was concerned about this from your previous posting already. You showed > > > > typesetting code[quick.tex]done > > > But SLaTeX prints a dot for each Scheme expression it is asked to > typeset, so this should have shown up as > > > > typesetting code[quick.tex].done > > > Honestly, I've never, ever in 15 years used SLaTeX from within Scheme > (nor can I imagine why I'd want to). Have you tried running the > command-line version? Do you get the same problem? > > Shriram > From grettke at acm.org Thu Nov 6 16:40:22 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:43 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <491353FC.3070800@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> Message-ID: <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: > Yes, same problem: Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? Bas, perhaps it would work correctly using cygwin's LaTeX? (totally guessing) From sk at cs.brown.edu Thu Nov 6 16:45:55 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:44 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> References: <4911A727.3060507@cs.uu.nl> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> Message-ID: I use it w/ MiKTeX all the time. S. On Thu, Nov 6, 2008 at 4:40 PM, Grant Rettke wrote: > On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: >> Yes, same problem: > > Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? > > Bas, perhaps it would work correctly using cygwin's LaTeX? (totally guessing) > From sk at cs.brown.edu Thu Nov 6 16:48:03 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:44 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> References: <4911A727.3060507@cs.uu.nl> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> Message-ID: PS: The problem here has nothing to do (afaict) with MikTeX vs other TeX installations. When run, the SLaTeX code seems to begin running and then stop running, but in-between it doesn't seem to be spitting out the .Z files. So, later, the LaTeX package appears to load slatex.sty correctly and looks for the .Z files and doesn't find them, and blows up. The absence of the dots, to my mind, is the key, and that appears to be completely independent of the TeX installation. Bas, is it just possible that you somehow don't have write access in the directory you're trying to write in? Have you tried it from your My Documents or some other such place, instead of within the PLT installation directory? On Thu, Nov 6, 2008 at 4:40 PM, Grant Rettke wrote: > On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: >> Yes, same problem: > > Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? > > Bas, perhaps it would work correctly using cygwin's LaTeX? (totally guessing) > From sbloch at adelphi.edu Thu Nov 6 17:19:02 2008 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:32:44 2009 Subject: [plt-scheme] calculation time for 11.5.3 In-Reply-To: <09D6F553-96A1-4B38-ACF0-CF73E91CAD1F@adelphi.edu> References: <09D6F553-96A1-4B38-ACF0-CF73E91CAD1F@adelphi.edu> Message-ID: On Nov 6, 2008, at 10:05 AM, I wrote: > As long as you're using Peano numbers (whose only constructor is > add1), this is unavoidable. You can do much better, of course, if > you use binary representation: > > ; A nat-num is either > ; 0, > ; 2n where n is a nat-num, or > ; 2n+1 where n is a nat-num > > Note that this uses "multiplication", but only the restricted case > of multiplication by 2. With this representation, > > add(n1, n2) takes O(max(log(n1), log(n2)) time > mult(n1, n2) takes O(log(n1) * log(n2)) time (assuming you don't > start doing fast Fourier transforms!) > raise(x, n) takes O(n*log(x)) time by the obvious algorithm, or > O(log(n)*log(x)) time by a less-obvious but fairly straightforward > algorithm. > > Homework problem: define a data structure to represent natural > numbers in binary form (not using the built-in number type), and > define these functions on that data type. I just tried this as an exercise, in ISL+lambda. A binary-number is a list of 0's and 1's, with the least significant digit first. > fifty (list 0 1 0 0 1 1) > (time (raise fifty four)) cpu time: 2 real time: 1 gc time: 0 (list 0 0 0 0 1 0 0 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1) > (time (raise four fifty)) cpu time: 2 real time: 1 gc time: 0 (list [long list of digits] ) > (time (raise fifty fifty)) cpu time: 240 real time: 243 gc time: 0 (list [even longer list of digits]) Not bad.... Stephen Bloch sbloch@adelphi.edu From jay.mccarthy at gmail.com Thu Nov 6 18:41:30 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:32:44 2009 Subject: [plt-scheme] web-server struct binding:file - content-type ? In-Reply-To: <779bf2730811052343w660c9b26uade7008099fcb3c5@mail.gmail.com> References: <779bf2730811051713s3bd6c9f9wc851bc0b7ad7a4d4@mail.gmail.com> <779bf2730811052343w660c9b26uade7008099fcb3c5@mail.gmail.com> Message-ID: I'll add it. Do you know if I need to use any particular browser to get it sent? Jay On Thu, Nov 6, 2008 at 12:43 AM, YC wrote: > It's not part of the headers (unless it's a PUT) - it's part of the > multipart/form-data being posted by the browser. > > Thanks, > yc > > On Wed, Nov 5, 2008 at 11:19 PM, Noel Welsh wrote: >> >> Isn't that part of the headers? The web server exposes those in the >> request struct. >> >> N. >> >> On Thu, Nov 6, 2008 at 1:13 AM, YC wrote: >> > Hi - >> > >> > in the web-server module, the request struct `binding:file` doesn't >> > include >> > a content-type binding - can it be included? As far as I can tell, when >> > uploading a file through browsers the content-type header is included >> > (yes >> > it can be unreliable, but so can other data...). >> > >> > 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://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From yinso.chen at gmail.com Thu Nov 6 18:57:21 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:32:45 2009 Subject: [plt-scheme] web-server struct binding:file - content-type ? In-Reply-To: References: <779bf2730811051713s3bd6c9f9wc851bc0b7ad7a4d4@mail.gmail.com> <779bf2730811052343w660c9b26uade7008099fcb3c5@mail.gmail.com> Message-ID: <779bf2730811061557n14682213ufecee347631098c0@mail.gmail.com> I've tested on Firefox, Lynx, and IE. I suspect other browsers will also send it. Content-Type generally sits right below the Content-Disposition line in the MIME parts. Thanks, yc On Thu, Nov 6, 2008 at 3:41 PM, Jay McCarthy wrote: > I'll add it. Do you know if I need to use any particular browser to get it > sent? > > Jay > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081106/f17ed327/attachment.htm From plragde at uwaterloo.ca Thu Nov 6 19:17:28 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:32:45 2009 Subject: [plt-scheme] calculation time for 11.5.3 In-Reply-To: <09D6F553-96A1-4B38-ACF0-CF73E91CAD1F@adelphi.edu> Message-ID: <49138918.6080004@uwaterloo.ca> Stephen Bloch wrote: > As long as you're using Peano numbers (whose only constructor is > add1), this is unavoidable. You can do much better, of course, if > you use binary representation: > > ; A nat-num is either > ; 0, > ; 2n where n is a nat-num, or > ; 2n+1 where n is a nat-num I have used this definition, which I call "the binary definition of a natural number" (the definition given in HtDP I call "the unary definition") in my HtDP-based course for several years now. It comes in handy when doing modular exponentiation, which is an important component of the RSA encryption/decryption algorithms. > Note that this uses "multiplication", but only the restricted case of > multiplication by 2. With this representation, > > add(n1, n2) takes O(max(log(n1), log(n2)) time > mult(n1, n2) takes O(log(n1) * log(n2)) time (assuming you don't > start doing fast Fourier transforms!) > raise(x, n) takes O(n*log(x)) time by the obvious algorithm, or > O(log(n)*log(x)) time by a less-obvious but fairly straightforward > algorithm. Only if you count manipulation of large numbers in Scheme as taking constant time. I think technically we need to toss in another O(log n) factor for raise (not for modular exponentiation). > Homework problem: define a data structure to represent natural > numbers in binary form (not using the built-in number type), and > define these functions on that data type. Given as an exercise in my first-term CS course this term (an "advanced" course for the best students) and handled very nicely. This is a really good exercise for CS majors, as it foreshadows the algorithms they should see as part of their computer organization and design course. And all of this is structurally recursive! --PR From dyrueta at gmail.com Thu Nov 6 22:53:42 2008 From: dyrueta at gmail.com (David Yrueta) Date: Thu Mar 26 02:32:46 2009 Subject: [plt-scheme] Problem with Contracts - HtDP 21.1.3 Message-ID: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> If function "natural-f" -- ;apply function f to x n times with a base case of TH where n=0 ;(check-expect (natural-f cons 'x empty 5) (list 'x 'x 'x 'x 'x)) ;(check-expect (natural-f + 1 5 9) 14) (define (natural-f f x TH n) (cond [(zero? n) TH] [else (f x (natural-f f x TH (sub1 n) ))])) -- properly abstracts over the the functions ;; copy : *N* X -> (listof X);; to create a list that contains;; obj n times (define (copy n obj) (cond [(zero? n) empty] [else (cons obj (copy (sub1 n) obj))])) ;; n-adder : *N* number -> number;; to add n to x using;; (+ 1 ...) only (define (n-adder n x) (cond [(zero? n) x] [else (+ 1 (n-adder (sub1 n) x))])) --then what is the general contract for "natural-f"? Considering "natural-f" as an abstraction of function "n-adder" above, the resulting contract would be: (number number -> number) number number number -> number (ex. (check-expect (natural-f + 1 5 9) 14) But what would the contract for "natural-f" be if it was viewed as an abstraction of function "copy?" (ex.(check-expect (natural-f cons 'x empty 5) (list 'x 'x 'x 'x 'x)) In that case, argument "f" would take the value of "cons," so the question (for me) comes down to how to represent the primitive "cons" as a function type within a contract. Is "cons" represented as (X Y -> Y) where X is any Scheme ITEM, Y is the Scheme-value list, and the result is basic type Y (Scheme-value list)? Or is "cons" represented as (X list -> (listof X) where X is any Scheme ITEM, "list" is Scheme-value list, and the result is defined type (listof X)? The difference between the two contracts appears to be in the output types. The first output type is basic, which is consistent with the contract output for "n-adder"; the second output type is defined, which conflicts with "n-adder." Avoiding conflict means choosing the first representation of "cons" in place of f in "natural-f"'s contract. S my guess is that the proper general contract for "natural-f" would be: ;natural-f: (X Y -> Y) X Y number -> Y Is this right? If not, where am I going wrong? Thanks, Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081106/f275b6df/attachment.html From bass at cs.uu.nl Fri Nov 7 03:14:09 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:46 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS Message-ID: <4913F8D1.5010906@cs.uu.nl> Hi all, I was a bit puzzled when I tried the following code in DrScheme: (define x 0) (let ((x 1)) (eval '(set! x 2) (interaction-environment)) x) x When running this in R5RS mode, it outputs 1 and then 2, while I would expect 2 and then 0. About interaction-environment, R5RS states that "The intent is that this procedure will return the environment in which the implementation would evaluate expressions dynamically typed by the user". So I expected the set! expression to work on the local x variable, while PLT appears to take the top-level one. What do you think? Bas From jensaxel at soegaard.net Fri Nov 7 07:58:34 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:32:46 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> Message-ID: <49143B7A.9080002@soegaard.net> Noel Welsh skrev: > Maybe Lisp in Small Pieces, though I think it focuses on compilers. > There is actually quite a few interpreters in the book. From the book's webpage: To sum it up in a few figures: 500 pages, 11 chapters, 11 interpreters and 2 compilers. There is even a chapter where a Scheme to C compiler is decribed. -- Jens Axel S?gaard From geoff at knauth.org Fri Nov 7 08:23:09 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:32:46 2009 Subject: [plt-scheme] Books on Lisp interpreter implementation in C? In-Reply-To: <49143B7A.9080002@soegaard.net> References: <756daca50811051140m7c7b471ex7d1d7ef5d6a29c71@mail.gmail.com> <49143B7A.9080002@soegaard.net> Message-ID: <94C618D2-3B12-4D94-B338-9FEC08F19135@knauth.org> I was so amazed at the amount of material in LiSP that I also bought the 2nd edition of the original French book, "Les Languages Lisp." (I went to the Ly??e Fran?ais as a child.) The plural noun is an understatement. If there's ever a world financial panic, it's a book that will fix your mind on constructive thoughts. Here's a URL of Lisp Books: http://www.ai.sri.com/~delacaze/alu-site/alu/table/books.htm Geoff On Nov 7, 2008, at 07:58, Jens Axel Soegaard wrote: > Noel Welsh skrev: >> Maybe Lisp in Small Pieces, though I think it focuses on compilers. >> > There is actually quite a few interpreters in the book. From the > book's > webpage: > > To sum it up in a few figures: 500 pages, 11 chapters, 11 > interpreters and 2 compilers. > > There is even a chapter where a Scheme to C compiler is described. From mflatt at cs.utah.edu Fri Nov 7 08:42:25 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:46 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS In-Reply-To: <4913F8D1.5010906@cs.uu.nl> References: <4913F8D1.5010906@cs.uu.nl> Message-ID: <20081107134227.77B936500AF@mail-svr1.cs.utah.edu> At Fri, 07 Nov 2008 09:14:09 +0100, Bas Steunebrink wrote: > I was a bit puzzled when I tried the following code in DrScheme: > > (define x 0) > (let ((x 1)) > (eval '(set! x 2) (interaction-environment)) > x) > x > > When running this in R5RS mode, it outputs 1 and then 2, while I would > expect 2 and then 0. About interaction-environment, R5RS states that > "The intent is that this procedure will return the environment in which > the implementation would evaluate expressions dynamically typed by the > user". Although R5RS leaves the details to implementations, I believe the intent behind the R5RS description is that `interaction-environment' mimics a top-level read-eval-print loop. (All R5RS implementations that I know implement it that way.) > So I expected the set! expression to work on the local x > variable, while PLT appears to take the top-level one. What do you think? See also http://docs.plt-scheme.org/guide/eval.html#(part._.Local_.Scopes) That explanation is specific to PLT Scheme, and it relies on a default second argument to `eval' that is essentially `(interaction-environment)'. But `eval' in a typical Scheme behaves the way for the same reason. Matthew From bass at cs.uu.nl Fri Nov 7 09:42:40 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:47 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS In-Reply-To: <20081107134227.77B936500AF@mail-svr1.cs.utah.edu> References: <4913F8D1.5010906@cs.uu.nl> <20081107134227.77B936500AF@mail-svr1.cs.utah.edu> Message-ID: <491453E0.1020302@cs.uu.nl> Ah thanks for the link, Matthew. Initially it seemed to me that R5RS requires interaction-environment to be defined such that (eval (quote ) (interaction-environment)) is always equivalent to just . However, the explanation in the PLT documentation convinced me this may not be a good requirement or even be impossible in general. Bas Matthew Flatt wrote: > At Fri, 07 Nov 2008 09:14:09 +0100, Bas Steunebrink wrote: > >> I was a bit puzzled when I tried the following code in DrScheme: >> >> (define x 0) >> (let ((x 1)) >> (eval '(set! x 2) (interaction-environment)) >> x) >> x >> >> When running this in R5RS mode, it outputs 1 and then 2, while I would >> expect 2 and then 0. About interaction-environment, R5RS states that >> "The intent is that this procedure will return the environment in which >> the implementation would evaluate expressions dynamically typed by the >> user". >> > > Although R5RS leaves the details to implementations, I believe the > intent behind the R5RS description is that `interaction-environment' > mimics a top-level read-eval-print loop. (All R5RS implementations that > I know implement it that way.) > > >> So I expected the set! expression to work on the local x >> variable, while PLT appears to take the top-level one. What do you think? >> > > See also > > http://docs.plt-scheme.org/guide/eval.html#(part._.Local_.Scopes) > > That explanation is specific to PLT Scheme, and it relies on a default > second argument to `eval' that is essentially > `(interaction-environment)'. But `eval' in a typical Scheme behaves the > way for the same reason. > > > Matthew > > -- Bas Steunebrink Intelligent Systems Group Utrecht University P.O. Box 80.089 3508TB Utrecht The Netherlands Tel: +31 (30) 253 2993 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081107/4522f33b/attachment.htm From pivanyi at freemail.hu Fri Nov 7 11:25:11 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:32:47 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS In-Reply-To: <20081107134227.77B936500AF@mail-svr1.cs.utah.edu> Message-ID: Hi, I also have a similar problem, which I cannot solve by scanning through the document. The code below will fail in PLT-Scheme 4.x with: compile: bad syntax; reference to top-level identifier is not allowed, because no #%top syntax transformer is bound in: max However this used to work in version < 4.0. How can I transform it to version >4.0 in a least intrusive way? (This code is only a simplified version and just changing to scheme or scheme/base does not solve my problem because my code uses several features of mzscheme.) Is there an "easy" way to get the proper namespace for eval under mzscheme? Thanks for your help. Best regards, Peter Ivanyi --------------------------------------------------------------- (module test mzscheme (define (a w) (display (apply (eval w) '(1 3 7 4 2))) ) (a (quote max)) ) ______________________________________________________________________ Digit?lis f?nyk?pez?g?pek ak?r 5000 Ft aj?nd?k fot?kidolgoz?ssal a FotoMarket Online Fot??ruh?zban! - www.fotomarket.hu From mflatt at cs.utah.edu Fri Nov 7 11:35:19 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:47 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS In-Reply-To: References: Message-ID: <20081107163519.6FA3265009D@mail-svr1.cs.utah.edu> That's the next sub-section in the guide. :) http://docs.plt-scheme.org/guide/eval.html#(part._namespaces) Within the `mzscheme' language (instead of `scheme/base'), assuming you want a namespace that has `mzscheme', use `make-namespace' instead of `make-base-namespace'. Matthew At Fri, 7 Nov 2008 17:25:11 +0100 (CET), Ivanyi Peter wrote: > Hi, > > I also have a similar problem, which I cannot solve by scanning > through the document. The code below will fail in PLT-Scheme 4.x > with: > compile: bad syntax; reference to top-level identifier is > not allowed, because no #%top syntax transformer is bound > in: max > > However this used to work in version < 4.0. > How can I transform it to version >4.0 in a least intrusive > way? > (This code is only a simplified version and just changing to > scheme > or scheme/base does not solve my problem because my code > uses several features of mzscheme.) Is there an "easy" way > to get the > proper namespace for eval under mzscheme? > > Thanks for your help. > > Best regards, > > Peter Ivanyi > > --------------------------------------------------------------- > > (module test mzscheme > (define (a w) > (display (apply (eval w) '(1 3 7 4 2))) > ) > > (a (quote max)) > ) From matthias at ccs.neu.edu Fri Nov 7 11:57:07 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:48 2009 Subject: [plt-scheme] Problem with Contracts - HtDP 21.1.3 In-Reply-To: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> References: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> Message-ID: <64025293-3BDD-4C53-828C-5033B70059BC@ccs.neu.edu> On Nov 6, 2008, at 10:53 PM, David Yrueta wrote: Think of cons as a function with contract X [Listof X] -> [Listof X] The key is to start this "pattern matching exercises" by using variables for the various components of the contract: 1. natural-f takes four arguments and returns the third one. Also the fourth one is guaranteed to be a Nat and the first is a function of two args: (X Y -> Z) W U Nat -> U 2. The result of f is also a possible result of the function, so let's say Z = U (X Y -> U) W U Nat -> U 3. The second input to f is the result of natural-f, so Y = U (X U -> U) W U Nat -> U 4. The second argument is used as the first input to f so U = W (X U -> U) U U Nat -> U 5. No other constraints so we're fine And I may have made a mistake so check the calculation -- Matthias > If function "natural-f" -- > > ;apply function f to x n times with a base case of TH where n=0 > ;(check-expect (natural-f cons 'x empty 5) (list 'x 'x 'x 'x 'x)) > ;(check-expect (natural-f + 1 5 9) 14) > (define (natural-f f x TH n) > (cond > [(zero? n) TH] > [else (f x > (natural-f f x TH (sub1 n) ))])) > > -- properly abstracts over the the functions > > ;; copy : N X -> (listof X) > ;; to create a list that contains > ;; obj n times > (define (copy n obj) > (cond > [(zero? n) empty] > [else (cons obj > (copy (sub1 n) obj))])) > > ;; n-adder : N number -> number > ;; to add n to x using > ;; (+ 1 ...) only > (define (n-adder n x) > (cond > [(zero? n) x] > [else (+ 1 > (n-adder (sub1 n) x))])) > --then what is the general contract for "natural-f"? > > Considering "natural-f" as an abstraction of function "n-adder" > above, the resulting contract would be: > (number number -> number) number number number -> number > (ex. (check-expect (natural-f + 1 5 9) 14) > > But what would the contract for "natural-f" be if it was viewed as > an abstraction of function "copy?" > (ex.(check-expect (natural-f cons 'x empty 5) (list 'x 'x 'x 'x 'x)) > > In that case, argument "f" would take the value of "cons," so the > question (for me) comes down to how to represent the primitive > "cons" as a function type within a contract. > > Is "cons" represented as (X Y -> Y) > where X is any Scheme ITEM, Y is the Scheme-value list, and the > result is basic type Y (Scheme-value list)? > > Or is "cons" represented as (X list -> (listof X) > where X is any Scheme ITEM, "list" is Scheme-value list, and the > result is defined type (listof X)? > > The difference between the two contracts appears to be in the > output types. The first output type is basic, which is consistent > with the contract output for "n-adder"; the second output type is > defined, which conflicts with "n-adder." Avoiding conflict means > choosing the first representation of "cons" in place of f in > "natural-f"'s contract. S my guess is that the proper general > contract for "natural-f" would be: > > ;natural-f: (X Y -> Y) X Y number -> Y > > Is this right? If not, where am I going wrong? > > Thanks, > Dave > > > > > > > > > > > _________________________________________________ > 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/20081107/0171b2ce/attachment.html From pivanyi at freemail.hu Fri Nov 7 12:30:32 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:32:48 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS In-Reply-To: <20081107163519.6FA3265009D@mail-svr1.cs.utah.edu> Message-ID: Matthew Flatt ?rta: > That's the next sub-section in the guide. :) > > http://docs.plt-scheme.org/guide/eval.html#(part._namespaces) > > > Within the `mzscheme' language (instead of `scheme/base'), assuming you > want a namespace that has `mzscheme', use `make-namespace' instead of > `make-base-namespace'. Hi Matthew, Ok, I have tried it, but now when I make an EXE file from the program I get the following: mzscheme: standard-module-name-resolver: collection not found: "mzscheme" in any of: (......\collects) in: mzscheme The EXE is created in the standard way: mzc --gui-exe prg.exe prog.scm mzc --exe-dir dist prg.exe What is worng here? Maybe mzc do not pack something with the EXE? Thanks for any help, Peter Ivanyi ______________________________________________________________________ Digit?lis f?nyk?pez?g?pek ak?r 5000 Ft aj?nd?k fot?kidolgoz?ssal a FotoMarket Online Fot??ruh?zban! - www.fotomarket.hu From mflatt at cs.utah.edu Fri Nov 7 12:37:28 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:48 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS In-Reply-To: References: Message-ID: <20081107173728.BF30B6500A2@mail-svr1.cs.utah.edu> At Fri, 7 Nov 2008 18:30:32 +0100 (CET), Ivanyi Peter wrote: > Ok, I have tried it, but now when I make an EXE file > from the program I get the following: > > mzscheme: standard-module-name-resolver: collection not > found: "mzscheme" in any of: (......\collects) in: mzscheme > > The EXE is created in the standard way: > mzc --gui-exe prg.exe prog.scm > mzc --exe-dir dist prg.exe > > What is worng here? Maybe mzc do not pack something with the > EXE? Yes, I think this is the same problem that I recently fixed. Can you try the nightly build (assuming that you're not using it already)? Matthew From pivanyi at freemail.hu Fri Nov 7 12:55:54 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:32:48 2009 Subject: [plt-scheme] eval and interaction-enviroment in R5RS In-Reply-To: <20081107173728.BF30B6500A2@mail-svr1.cs.utah.edu> Message-ID: Matthew Flatt ?rta: > Yes, I think this is the same problem that I recently fixed. Can you > try the nightly build (assuming that you're not using it already)? Ok, I have tried the latest nightly build (4.1.2.4) and it seems the small example works. Now I will try with the large application. Thanks, Peter ______________________________________________________________________ Digit?lis f?nyk?pez?g?pek ak?r 5000 Ft aj?nd?k fot?kidolgoz?ssal a FotoMarket Online Fot??ruh?zban! - www.fotomarket.hu From jay.mccarthy at gmail.com Fri Nov 7 14:23:22 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:32:49 2009 Subject: [plt-scheme] web-server/servlet-env in SVN supports top-level servlets and multiple-servlets Message-ID: The following module: #lang scheme (require web-server/servlet web-server/servlet-env) (define (my-app request) `(html (head (title "Hello world!")) (body (p "Hey out there!")))) (serve/servlet my-app #:servlet-path "/") Captures the top-level "/" URL. Change it to (serve/servlet my-app #:servlet-path "/" #:servlet-regexp "") And it captures every request. In the first case, servlets from the web-server's default directory will be served as well. This can be overridden with #:servlets-root or #:server-root-path. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From marek at xivilization.net Fri Nov 7 19:19:46 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:32:49 2009 Subject: [plt-scheme] Combinator parser online documentation? Message-ID: <20081108011946.01e8b194@halmanfloyd.lan.local> Hi, I was browsing through the collects directory when I found combinator-parser which is, yeah, a combinator parser. It has some documentation in a text-file but when searching for HTML documentation on docs.plt-scheme.org I am unable to find it. Am I missing something here? regards, Marek From sbloch at adelphi.edu Fri Nov 7 21:35:58 2008 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:32:49 2009 Subject: [plt-scheme] Problem with Contracts - HtDP 21.1.3 In-Reply-To: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> References: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> Message-ID: <370D82DB-AE79-4930-8EB0-19D9BE8AED8F@adelphi.edu> On Nov 6, 2008, at 10:53 PM, David Yrueta wrote: > ;apply function f to x n times with a base case of TH where n=0 > ;(check-expect (natural-f cons 'x empty 5) (list 'x 'x 'x 'x 'x)) > ;(check-expect (natural-f + 1 5 9) 14) > (define (natural-f f x TH n) > (cond > [(zero? n) TH] > [else (f x > (natural-f f x TH (sub1 n) ))])) > ... > --then what is the general contract for "natural-f"? .. > my guess is that the proper general contract for "natural-f" would be: > > ;natural-f: (X Y -> Y) X Y number -> Y Yes, that looks good to me. > Considering "natural-f" as an abstraction of function "n-adder" > above, the resulting contract would be: > (number number -> number) number number number -> number Right: in this case both X and Y are number. > But what would the contract for "natural-f" be if it was viewed as > an abstraction of function "copy?" > (ex.(check-expect (natural-f cons 'x empty 5) (list 'x 'x 'x 'x 'x)) > > In that case, argument "f" would take the value of "cons," so the > question (for me) comes down to how to represent the primitive > "cons" as a function type within a contract. > > Is "cons" represented as (X Y -> Y) > where X is any Scheme ITEM, Y is the Scheme-value list, and the > result is basic type Y (Scheme-value list)? > > Or is "cons" represented as (X list -> (listof X) > where X is any Scheme ITEM, "list" is Scheme-value list, and the > result is defined type (listof X)? The former is correct, but less informative than it could be. The latter (as amended; see below) is also correct, and more informative. In general, we say cons : X list-of-X -> list-of-X so this fits into the natural-f framework perfectly well with Y = list-of-X What the contract really means is "for any set X, if cons is called on an element of set X and a list all of whose elements are in set X, then the result will be a list all of whose elements are in set X." The set X doesn't have to be a standard data type; it really is ANY set of Scheme-representable objects. So if somebody should happen to call "cons" on a number and a list of strings, the contract still applies but is less informative because you need to define X as "number or string" in order for the preconditions to hold. Stephen Bloch sbloch@adelphi.edu From sbloch at adelphi.edu Sat Nov 8 10:52:09 2008 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:32:49 2009 Subject: [plt-edu] Re: [plt-scheme] calculation time for 11.5.3 In-Reply-To: <49138918.6080004@uwaterloo.ca> References: <49138918.6080004@uwaterloo.ca> Message-ID: <676E23DE-29B7-4FB7-8333-EC78CE7F4887@adelphi.edu> >> Note that this uses "multiplication", but only the restricted case >> of multiplication by 2. With this representation, >> add(n1, n2) takes O(max(log(n1), log(n2)) time >> mult(n1, n2) takes O(log(n1) * log(n2)) time (assuming you don't >> start doing fast Fourier transforms!) >> raise(x, n) takes O(n*log(x)) time by the obvious algorithm, or >> O(log(n)*log(x)) time by a less-obvious but fairly >> straightforward algorithm. > > Only if you count manipulation of large numbers in Scheme as taking > constant time. I think technically we need to toss in another O(log > n) factor for raise (not for modular exponentiation). Perhaps, if you do it with built-in bignums. If you do it with a list representation, as I did in my subsequent post, then checking for even/oddness of n, and halving n, are constant-time operations. Oh, wait: the last multiplication alone, squaring x^(n/2) to get x^n, takes time O(log(x^(n/2))^2) = O(n^2 * log^2(x)) which utterly dwarfs the O(log n) loop and the bignum overhead. > And all of this is structurally recursive! --PR Yes, isn't that elegant? Stephen Bloch sbloch@adelphi.edu From sperber at deinprogramm.de Sat Nov 8 12:39:07 2008 From: sperber at deinprogramm.de (Michael Sperber) Date: Thu Mar 26 02:32:49 2009 Subject: [plt-scheme] Papers on criticism of Scheme? In-Reply-To: <0ABA6434-3E8D-4F57-ACA7-00A876DCD416@ccs.neu.edu> (Matthias Felleisen's message of "Sun, 2 Nov 2008 14:28:23 -0500") References: <756daca50811021111t57b7ddcah6e349cf9fcd655a8@mail.gmail.com> <0ABA6434-3E8D-4F57-ACA7-00A876DCD416@ccs.neu.edu> Message-ID: Matthias Felleisen writes: > On Nov 2, 2008, at 2:11 PM, Grant Rettke wrote: > >> http://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf >> >> was referenced recently. It was interesting to see criticisms of >> Scheme from someone who knew Scheme. I think Wadler knew it well. > > > Phil knows Scheme the way I know Fortran iv. But he has a good point > about the use of primitive Scheme subsets in education. I wish it had come from actual experience with learners rather than teacher-centric hypothesis. -- Cheers =8-} Mike Friede, V?lkerverst?ndigung und ?berhaupt blabla From dherman at ccs.neu.edu Sun Nov 9 07:35:49 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:32:49 2009 Subject: [plt-scheme] read error Message-ID: <276298BE-A2AE-428E-A744-0B6EACF4AF2B@ccs.neu.edu> setup-plt is barfing when it encounters a source file that uses a custom reader. I have a subdirectory "collects" with a file "js.js" that has a custom #reader line at the top. With the Nov. 3rd build, setup-plt seems just to skip this file completely. But with the Nov. 8th build (which I *believe* predates Robby's changes to zo behavior), it insists on compiling the file, even if I create an info.ss that includes it in the compile-omit-paths list. And then I get this error: setup-plt: collects/compiled/js_js.zo::1396: read (compiled): ill- formed code [../../../mzscheme/gc2/../src/read.c:4648] How can I debug this error? Thanks, Dave From bass at cs.uu.nl Sun Nov 9 07:41:27 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:49 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> Message-ID: <4916DA77.4070009@cs.uu.nl> That's a good point, Shriram; one that I had already run into. But LaTeX had already complained that it couldn't create a "quick.log" in the PLT directory to save the fact that it couldn't find the .Z files. So I tried again with administrator priviliges; this time LaTeX had not trouble creating log files but still SLaTeX generated no .Z files. Bas PS: I just noticed your name shows up in the acknowledgments of at least 4 of my Scheme books here (Little/Seasoned/Reasoned Schemer, EOPL), nice! :-) Shriram Krishnamurthi schreef: > PS: The problem here has nothing to do (afaict) with MikTeX vs other > TeX installations. When run, the SLaTeX code seems to begin running > and then stop running, but in-between it doesn't seem to be spitting > out the .Z files. So, later, the LaTeX package appears to load > slatex.sty correctly and looks for the .Z files and doesn't find them, > and blows up. The absence of the dots, to my mind, is the key, and > that appears to be completely independent of the TeX installation. > > Bas, is it just possible that you somehow don't have write access in > the directory you're trying to write in? Have you tried it from your > My Documents or some other such place, instead of within the PLT > installation directory? > > On Thu, Nov 6, 2008 at 4:40 PM, Grant Rettke wrote: > >> On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: >> >>> Yes, same problem: >>> >> Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? >> >> Bas, perhaps it would work correctly using cygwin's LaTeX? (totally guessing) >> >> From sk at cs.brown.edu Sun Nov 9 08:40:13 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:50 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <4916DA77.4070009@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> <4916DA77.4070009@cs.uu.nl> Message-ID: Huh. You did configure your file system to give Dorai Sitaram write-access too, right? Because every running copy of SLaTeX has a bit of Dorai's soul embedded in it. (-: I am still not sure that SLaTeX is actually processing the file at all. I'm trying to think of some kind of \scheme{...} or schemedisplay that one could write that would actually generate a run-time error from SLaTeX. Having just woken up, nothing pops into my head (-:. Anyone? Note that the error must be from SLaTeX, not from the LaTeX (ie, from the code generated by SLaTeX) -- the latter is easy. Shriram On Sun, Nov 9, 2008 at 7:41 AM, Bas Steunebrink wrote: > That's a good point, Shriram; one that I had already run into. But LaTeX had > already complained that it couldn't create a "quick.log" in the PLT > directory to save the fact that it couldn't find the .Z files. So I tried > again with administrator priviliges; this time LaTeX had not trouble > creating log files but still SLaTeX generated no .Z files. > > Bas > > PS: I just noticed your name shows up in the acknowledgments of at least 4 > of my Scheme books here (Little/Seasoned/Reasoned Schemer, EOPL), nice! :-) > > > > Shriram Krishnamurthi schreef: >> >> PS: The problem here has nothing to do (afaict) with MikTeX vs other >> TeX installations. When run, the SLaTeX code seems to begin running >> and then stop running, but in-between it doesn't seem to be spitting >> out the .Z files. So, later, the LaTeX package appears to load >> slatex.sty correctly and looks for the .Z files and doesn't find them, >> and blows up. The absence of the dots, to my mind, is the key, and >> that appears to be completely independent of the TeX installation. >> >> Bas, is it just possible that you somehow don't have write access in >> the directory you're trying to write in? Have you tried it from your >> My Documents or some other such place, instead of within the PLT >> installation directory? >> >> On Thu, Nov 6, 2008 at 4:40 PM, Grant Rettke wrote: >> >>> >>> On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: >>> >>>> >>>> Yes, same problem: >>>> >>> >>> Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? >>> >>> Bas, perhaps it would work correctly using cygwin's LaTeX? (totally >>> guessing) >>> >>> > From robby at cs.uchicago.edu Sun Nov 9 08:47:42 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:50 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> <4916DA77.4070009@cs.uu.nl> Message-ID: <932b2f1f0811090547t50dff5f9u7f4b68923649ca5c@mail.gmail.com> There aren't supposed to be any of those. :) But I think a very long line will do it. Robby On Sun, Nov 9, 2008 at 7:40 AM, Shriram Krishnamurthi wrote: > Huh. You did configure your file system to give Dorai Sitaram > write-access too, right? Because every running copy of SLaTeX has a > bit of Dorai's soul embedded in it. (-: > > I am still not sure that SLaTeX is actually processing the file at > all. I'm trying to think of some kind of \scheme{...} or > schemedisplay that one could write that would actually generate a > run-time error from SLaTeX. Having just woken up, nothing pops into > my head (-:. Anyone? Note that the error must be from SLaTeX, not > from the LaTeX (ie, from the code generated by SLaTeX) -- the latter > is easy. > > Shriram > > On Sun, Nov 9, 2008 at 7:41 AM, Bas Steunebrink wrote: >> That's a good point, Shriram; one that I had already run into. But LaTeX had >> already complained that it couldn't create a "quick.log" in the PLT >> directory to save the fact that it couldn't find the .Z files. So I tried >> again with administrator priviliges; this time LaTeX had not trouble >> creating log files but still SLaTeX generated no .Z files. >> >> Bas >> >> PS: I just noticed your name shows up in the acknowledgments of at least 4 >> of my Scheme books here (Little/Seasoned/Reasoned Schemer, EOPL), nice! :-) >> >> >> >> Shriram Krishnamurthi schreef: >>> >>> PS: The problem here has nothing to do (afaict) with MikTeX vs other >>> TeX installations. When run, the SLaTeX code seems to begin running >>> and then stop running, but in-between it doesn't seem to be spitting >>> out the .Z files. So, later, the LaTeX package appears to load >>> slatex.sty correctly and looks for the .Z files and doesn't find them, >>> and blows up. The absence of the dots, to my mind, is the key, and >>> that appears to be completely independent of the TeX installation. >>> >>> Bas, is it just possible that you somehow don't have write access in >>> the directory you're trying to write in? Have you tried it from your >>> My Documents or some other such place, instead of within the PLT >>> installation directory? >>> >>> On Thu, Nov 6, 2008 at 4:40 PM, Grant Rettke wrote: >>> >>>> >>>> On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: >>>> >>>>> >>>>> Yes, same problem: >>>>> >>>> >>>> Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? >>>> >>>> Bas, perhaps it would work correctly using cygwin's LaTeX? (totally >>>> guessing) >>>> >>>> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Sun Nov 9 08:50:44 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:50 2009 Subject: [plt-scheme] read error In-Reply-To: <276298BE-A2AE-428E-A744-0B6EACF4AF2B@ccs.neu.edu> References: <276298BE-A2AE-428E-A744-0B6EACF4AF2B@ccs.neu.edu> Message-ID: <932b2f1f0811090550q7a102299r6a4747a6c5187ca3@mail.gmail.com> (I don't know the answer to your real question below, but setup-plt was not affected by my changes, only drscheme was.) Robby On Sun, Nov 9, 2008 at 6:35 AM, Dave Herman wrote: > setup-plt is barfing when it encounters a source file that uses a custom > reader. I have a subdirectory "collects" with a file "js.js" that has a > custom #reader line at the top. With the Nov. 3rd build, setup-plt seems > just to skip this file completely. But with the Nov. 8th build (which I > *believe* predates Robby's changes to zo behavior), it insists on compiling > the file, even if I create an info.ss that includes it in the > compile-omit-paths list. And then I get this error: > > setup-plt: collects/compiled/js_js.zo::1396: read (compiled): ill-formed > code [../../../mzscheme/gc2/../src/read.c:4648] > > How can I debug this error? > > Thanks, > Dave > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From sk at cs.brown.edu Sun Nov 9 08:55:02 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:50 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <932b2f1f0811090547t50dff5f9u7f4b68923649ca5c@mail.gmail.com> References: <4911A727.3060507@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> <4916DA77.4070009@cs.uu.nl> <932b2f1f0811090547t50dff5f9u7f4b68923649ca5c@mail.gmail.com> Message-ID: I once tried to construct such a line, even based on studying the SLaTeX source...and failed. On Sun, Nov 9, 2008 at 8:47 AM, Robby Findler wrote: > There aren't supposed to be any of those. :) > > But I think a very long line will do it. > > Robby > > On Sun, Nov 9, 2008 at 7:40 AM, Shriram Krishnamurthi wrote: >> Huh. You did configure your file system to give Dorai Sitaram >> write-access too, right? Because every running copy of SLaTeX has a >> bit of Dorai's soul embedded in it. (-: >> >> I am still not sure that SLaTeX is actually processing the file at >> all. I'm trying to think of some kind of \scheme{...} or >> schemedisplay that one could write that would actually generate a >> run-time error from SLaTeX. Having just woken up, nothing pops into >> my head (-:. Anyone? Note that the error must be from SLaTeX, not >> from the LaTeX (ie, from the code generated by SLaTeX) -- the latter >> is easy. >> >> Shriram >> >> On Sun, Nov 9, 2008 at 7:41 AM, Bas Steunebrink wrote: >>> That's a good point, Shriram; one that I had already run into. But LaTeX had >>> already complained that it couldn't create a "quick.log" in the PLT >>> directory to save the fact that it couldn't find the .Z files. So I tried >>> again with administrator priviliges; this time LaTeX had not trouble >>> creating log files but still SLaTeX generated no .Z files. >>> >>> Bas >>> >>> PS: I just noticed your name shows up in the acknowledgments of at least 4 >>> of my Scheme books here (Little/Seasoned/Reasoned Schemer, EOPL), nice! :-) >>> >>> >>> >>> Shriram Krishnamurthi schreef: >>>> >>>> PS: The problem here has nothing to do (afaict) with MikTeX vs other >>>> TeX installations. When run, the SLaTeX code seems to begin running >>>> and then stop running, but in-between it doesn't seem to be spitting >>>> out the .Z files. So, later, the LaTeX package appears to load >>>> slatex.sty correctly and looks for the .Z files and doesn't find them, >>>> and blows up. The absence of the dots, to my mind, is the key, and >>>> that appears to be completely independent of the TeX installation. >>>> >>>> Bas, is it just possible that you somehow don't have write access in >>>> the directory you're trying to write in? Have you tried it from your >>>> My Documents or some other such place, instead of within the PLT >>>> installation directory? >>>> >>>> On Thu, Nov 6, 2008 at 4:40 PM, Grant Rettke wrote: >>>> >>>>> >>>>> On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: >>>>> >>>>>> >>>>>> Yes, same problem: >>>>>> >>>>> >>>>> Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? >>>>> >>>>> Bas, perhaps it would work correctly using cygwin's LaTeX? (totally >>>>> guessing) >>>>> >>>>> >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > From sk at cs.brown.edu Sun Nov 9 09:52:53 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:50 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <49130175.2050909@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> Message-ID: Okay, here's one way of getting a SLaTeX-time error. Use \schemeinput and name a non-existent source file. For instance, add Also, try \schemeinput{test.tex}. to your source. When a file called test.tex exists (say it just contains "lambda"), the output is GALIBIER ~/Desktop/T> slatex foo SLaTeX v. 20050609 typesetting code[slatex.sty]..done but when it doesn't, slatex foo SLaTeX v. 20050609 typesetting code[slatex.sty].process-scheme-file: test.tex doesn't exist done If you get that error, then at least we know that SLaTeX is walking your source file and trying to process it. Then the problem is almost certainly with writing output. Shriram From dherman at ccs.neu.edu Sun Nov 9 09:55:11 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:32:51 2009 Subject: [plt-scheme] inexpressible module imports Message-ID: I have a whole-module compiler that's trying to construct a require/ rename-in line and I can't create references to the require'd name. Here's the smallest example I could create. Take a module language with three forms: an import line, a definition, and a single variable reference: ;; -- module.ss -- #lang scheme/base (require (for-syntax scheme/base) (for-syntax "compile.ss")) (define-syntax (module-begin stx) (syntax-case stx () [(_ import definition expression) (with-syntax ([program (compile-program (syntax->datum #'import) (syntax->datum #'definition) (syntax->datum #'expression))]) #'(#%plain-module-begin program))])) (provide (except-out (all-from-out scheme/base) #%module-begin) (rename-out [module-begin #%module-begin])) ;; -- Since we called syntax->datum, we need to call `syntax-local- introduce' on any variables that come from the input, so that any introduced references won't be captured. So if we write a program like: ;; -- test.ss -- (module test "module.ss" (import scheme/math [pi newline]) (define print 42) newline) ;; -- neither `print' nor `newline' should capture compiler-introduced references to the scheme/base identifiers of the same name. But I can't come up with any plausible combination of arguments to `datum->syntax' and insertions of `syntax-local-introduce' into the compiler to get that reference to `newline' to refer to the imported name. Here was my best shot: ;; -- compile.ss -- #lang scheme/base (require scheme/match) (require (for-template scheme/base)) (provide compile-program) (define (compile-program import definition reference) #`(begin #,(compile-import import) #,(compile-definition definition) (print #,(compile-reference reference)) (newline))) (define (compile-import import) (match import [(list 'import mod (list (? symbol? external) (? symbol? internal))) (let ([external-id (datum->syntax #'here external)] [internal-id (syntax-local-introduce (datum->syntax #f internal))]) #`(require (rename-in #,mod [#,external-id #,internal-id])))])) (define (compile-definition definition) (match definition [(list 'define (? symbol? x) (? number? n)) (let ([id (syntax-local-introduce (datum->syntax #f x))]) #`(define #,id #,n))])) (define (compile-reference reference) (syntax-local-introduce (datum->syntax #f reference))) ;; -- But for some reason, it tries to turn the reference into a #%top reference. I tried lots of other combinations but to no avail. Is there something secret about module-imports? Thanks, Dave From robby at cs.uchicago.edu Sun Nov 9 10:03:01 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:51 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491353FC.3070800@cs.uu.nl> <756daca50811061340n1a6fd4fl8c354cb7ab8b4eef@mail.gmail.com> <4916DA77.4070009@cs.uu.nl> <932b2f1f0811090547t50dff5f9u7f4b68923649ca5c@mail.gmail.com> Message-ID: <932b2f1f0811090703i6568fe4fscab6b6ae6e948218@mail.gmail.com> It happens to me periodically. string-ref/vector-ref out of bounds or something similar. Robby On Sun, Nov 9, 2008 at 7:55 AM, Shriram Krishnamurthi wrote: > I once tried to construct such a line, even based on studying the > SLaTeX source...and failed. > > On Sun, Nov 9, 2008 at 8:47 AM, Robby Findler wrote: >> There aren't supposed to be any of those. :) >> >> But I think a very long line will do it. >> >> Robby >> >> On Sun, Nov 9, 2008 at 7:40 AM, Shriram Krishnamurthi wrote: >>> Huh. You did configure your file system to give Dorai Sitaram >>> write-access too, right? Because every running copy of SLaTeX has a >>> bit of Dorai's soul embedded in it. (-: >>> >>> I am still not sure that SLaTeX is actually processing the file at >>> all. I'm trying to think of some kind of \scheme{...} or >>> schemedisplay that one could write that would actually generate a >>> run-time error from SLaTeX. Having just woken up, nothing pops into >>> my head (-:. Anyone? Note that the error must be from SLaTeX, not >>> from the LaTeX (ie, from the code generated by SLaTeX) -- the latter >>> is easy. >>> >>> Shriram >>> >>> On Sun, Nov 9, 2008 at 7:41 AM, Bas Steunebrink wrote: >>>> That's a good point, Shriram; one that I had already run into. But LaTeX had >>>> already complained that it couldn't create a "quick.log" in the PLT >>>> directory to save the fact that it couldn't find the .Z files. So I tried >>>> again with administrator priviliges; this time LaTeX had not trouble >>>> creating log files but still SLaTeX generated no .Z files. >>>> >>>> Bas >>>> >>>> PS: I just noticed your name shows up in the acknowledgments of at least 4 >>>> of my Scheme books here (Little/Seasoned/Reasoned Schemer, EOPL), nice! :-) >>>> >>>> >>>> >>>> Shriram Krishnamurthi schreef: >>>>> >>>>> PS: The problem here has nothing to do (afaict) with MikTeX vs other >>>>> TeX installations. When run, the SLaTeX code seems to begin running >>>>> and then stop running, but in-between it doesn't seem to be spitting >>>>> out the .Z files. So, later, the LaTeX package appears to load >>>>> slatex.sty correctly and looks for the .Z files and doesn't find them, >>>>> and blows up. The absence of the dots, to my mind, is the key, and >>>>> that appears to be completely independent of the TeX installation. >>>>> >>>>> Bas, is it just possible that you somehow don't have write access in >>>>> the directory you're trying to write in? Have you tried it from your >>>>> My Documents or some other such place, instead of within the PLT >>>>> installation directory? >>>>> >>>>> On Thu, Nov 6, 2008 at 4:40 PM, Grant Rettke wrote: >>>>> >>>>>> >>>>>> On Thu, Nov 6, 2008 at 2:30 PM, Bas Steunebrink wrote: >>>>>> >>>>>>> >>>>>>> Yes, same problem: >>>>>>> >>>>>> >>>>>> Has anyone successfully used sLaTeX with the Windows MiKTex LaTeX system? >>>>>> >>>>>> Bas, perhaps it would work correctly using cygwin's LaTeX? (totally >>>>>> guessing) >>>>>> >>>>>> >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> > > From mflatt at cs.utah.edu Sun Nov 9 13:02:15 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:51 2009 Subject: [plt-scheme] inexpressible module imports In-Reply-To: References: Message-ID: <20081109180216.7810865009D@mail-svr1.cs.utah.edu> At Sun, 9 Nov 2008 09:55:11 -0500, Dave Herman wrote: > Since we called syntax->datum, we need to call `syntax-local- > introduce' on any variables that come from the input, so that any > introduced references won't be captured. I recommend that you instead use the context of the original `#%module-begin' expression with `datum->syntax', as in the code below, instead of trying to recreate that context via `syntax-local-introduce'. > But I can't come up with any plausible combination of arguments to > `datum->syntax' and insertions of `syntax-local-introduce' into the > compiler to get that reference to `newline' to refer to the imported > name. [...] Is > there something secret about module-imports? I think there's probably a bug here related to module imports --- probably because the module context of the identifiers in question has been stripped away, and yet the identifiers don't have any marks that suggest that they were macro-introduced (since the `syntax-local-introduce' cancels a later mark). So, I'll look into that more. Meanwhile, I think the approach below will work better in general. I also wonder why you're stripping away all the lexical context up front, so that you have to recreate it later. Why not build the compiler around syntax objects, which not only help you track context but also help track source locations? ---------------------------------------- ;; module.ss #lang scheme/base (require (for-syntax scheme/base) (for-syntax "compile.ss")) (define-syntax (module-begin stx) (syntax-case stx () [(_ import definition expression) (with-syntax ([program (compile-program stx (syntax->datum #'import) (syntax->datum #'definition) (syntax->datum #'expression))]) #'(#%plain-module-begin program))])) (provide (except-out (all-from-out scheme/base) #%module-begin) (rename-out [module-begin #%module-begin])) ---------------------------------------- ;; compile.ss #lang scheme/base (require scheme/match) (require (for-template scheme/base)) (provide compile-program) (define (compile-program ctx import definition reference) #`(begin #,(compile-import ctx import) #,(compile-definition ctx definition) (print #,(compile-reference ctx reference)) (newline))) (define (compile-import ctx import) (match import [(list 'import mod (list (? symbol? external) (? symbol? internal))) (let ([external-id (datum->syntax #'here external)] [internal-id (datum->syntax ctx internal)]) #`(require (rename-in #,mod [#,external-id #,internal-id])))])) (define (compile-definition ctx definition) (match definition [(list 'define (? symbol? x) (? number? n)) (let ([id (datum->syntax ctx x)]) #`(define #,id #,n))])) (define (compile-reference ctx reference) (datum->syntax ctx reference)) From dherman at ccs.neu.edu Sun Nov 9 13:09:31 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:32:51 2009 Subject: [plt-scheme] inexpressible module imports In-Reply-To: <20081109180216.7810865009D@mail-svr1.cs.utah.edu> References: <20081109180216.7810865009D@mail-svr1.cs.utah.edu> Message-ID: <4917275B.9000203@ccs.neu.edu> > I recommend that you instead use the context of the original > `#%module-begin' expression with `datum->syntax', as in the code below, > instead of trying to recreate that context via > `syntax-local-introduce'. Okay, thanks. > Meanwhile, I think the approach below will work better in general. I'll give it a try-- thanks! > also wonder why you're stripping away all the lexical context up front, > so that you have to recreate it later. Why not build the compiler > around syntax objects, which not only help you track context but also > help track source locations? In my actual code, the reader is actually a JavaScript parser that generates prefab AST structs, and the compiler operates on those structs. At some point I could potentially change the structure of the compiler to actually use macros, but for now there's just too much code built around this architecture to change it. Thanks as always for the fast turnaround, Dave From bass at cs.uu.nl Sun Nov 9 15:24:23 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:51 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050649o5047d3c8w37efc728c641df06@mail.gmail.com> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> Message-ID: <491746F7.10209@cs.uu.nl> OK this is really weird... I tried your test and SLaTeX was pretending everything was OK even though there was no test.tex, while, of course, failing to generate any .Z files. However, in some desperate attempt I moved quick.tex to the PLT/ directory and retried; this time I almost rolled off my chair after finding it had generated .Z files! I played around a bit more and found that the location of the .tex file is actually the key: if it's exactly in the PLT/ directory it works fine, but anywhere else and SLaTeX exits pretending to be done without having generated any .Z files. For example: C:\Program Files\PLT>slatex --no-latex C:/Users/Bas/Documents/quick.tex SLaTeX v. 20050609 typesetting code[quick.tex]done This results in no .Z files being generated. I've tried putting the .tex file different folders and different ways of typing the path towards quick.tex (e.g., forward slashes, backward slashes, double backward slashes, surrounding by double quotes) but this made no difference. However, a typo in the path does result in an error, so SLaTeX really does find the file, it just doesn't do anything with it. The only way to get it to work is if the .tex file is in the PLT/ directory: C:\Program Files\PLT>slatex --no-latex quick.tex SLaTeX v. 20050609 typesetting code[slatex.sty]....done :-) I wonder if anyone else has recently tried running SLaTeX on a Windows machine? Even though I have finally found a way to get it to work, I suppose it should work wherever you put the .tex file... Again, I really appreciate the time and thought you've put into helping me! :-) Bas Shriram Krishnamurthi schreef: > Okay, here's one way of getting a SLaTeX-time error. Use \schemeinput > and name a non-existent source file. For instance, add > > Also, try \schemeinput{test.tex}. > > to your source. When a file called test.tex exists (say it just > contains "lambda"), the output is > > GALIBIER ~/Desktop/T> slatex foo > SLaTeX v. 20050609 > typesetting code[slatex.sty]..done > > but when it doesn't, > > slatex foo > SLaTeX v. 20050609 > typesetting code[slatex.sty].process-scheme-file: test.tex doesn't exist > done > > If you get that error, then at least we know that SLaTeX is walking > your source file and trying to process it. Then the problem is almost > certainly with writing output. > > Shriram > From sk at cs.brown.edu Sun Nov 9 16:15:42 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:51 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <491746F7.10209@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491746F7.10209@cs.uu.nl> Message-ID: Well, the good news is that you have *something* working. Obviously it's not a long-term solution, but at least SLaTeX is not 100% off (only about 99% <-;). I actually run SLaTeX under Windows all the time. Over 90% of my SLaTeXing happens under Windows. But it's all under XP, not Vista or 2k (which I believe were the two platforms you mentioned), even though I doubt that makes too much difference. Personally, my source .tex files live all over the place -- meaning, all kinds of sub-directories of My Documents and Desktop, but never in Program Files/PLT -- and I run SLaTeX from the directory where the file is. I run it from (until recently) Cygwin or (since the past few weeks, when Robby pointed me to it) Cygterm, which is a shell inside PuTTY. My ~/.bashrc has an explicit entry to my current PLT version: export PATH=...:/cygdrive/c/Program\ Files/PLT/4.1.1/:... I can then run SLaTeX without any path prefix: GALIBIER ~/Desktop/T> which slatex /cygdrive/c/Program Files/PLT/4.1.1/slatex This has always done the trick just fine for me (for years and years). Give that a try. Shriram From sk at cs.brown.edu Sun Nov 9 16:23:24 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:51 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <491746F7.10209@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491746F7.10209@cs.uu.nl> Message-ID: > I played around a bit more and found that the location > of the .tex file is actually the key: if it's exactly in the PLT/ directory > it works fine, but anywhere else and SLaTeX exits pretending to be done > without having generated any .Z files. > > For example: > > C:\Program Files\PLT>slatex --no-latex C:/Users/Bas/Documents/quick.tex > SLaTeX v. 20050609 > typesetting code[quick.tex]done > > This results in no .Z files being generated. I've tried putting the .tex > file different folders and different ways of typing the path towards > quick.tex (e.g., forward slashes, backward slashes, double backward slashes, > surrounding by double quotes) but this made no difference. However, a typo > in the path does result in an error, so SLaTeX really does find the file, it > just doesn't do anything with it. I made a conjecture...I'm less sure of it now, but I'll throw it out there anyway. I wonder if the difference *is* in the pathname. I suspect that you haven't hit on the magical combination that undergoes translation and still makes sense inside Scheme. My guess is that this: > C:\Program Files\PLT>slatex --no-latex quick.tex > SLaTeX v. 20050609 > typesetting code[slatex.sty]....done works not because of the location of quick.tex, but rather because you are specifying quick.tex without any path prefix. (I was going to conjecture that it was because you were providing an *absolute* pathname, but I went back through this thread just now and noticed you did once try with a relative pathname...so maybe my conjecture is off. Still, if you were try to try the PATH setting I suggested earlier, and try running SLaTeX from a "harmless" directory, and still get the error, that would be helpful to know. Also if you have access to an XP system, too...) Shriram From robby at cs.uchicago.edu Sun Nov 9 16:54:27 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:52 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491746F7.10209@cs.uu.nl> Message-ID: <932b2f1f0811091354x3f2c21b7q365d391ea5c56eb2@mail.gmail.com> That's my guess too, fwiw. I think you have to run slatex from the same directory where the latex file lives. Robby On Sun, Nov 9, 2008 at 3:23 PM, Shriram Krishnamurthi wrote: >> I played around a bit more and found that the location >> of the .tex file is actually the key: if it's exactly in the PLT/ directory >> it works fine, but anywhere else and SLaTeX exits pretending to be done >> without having generated any .Z files. >> >> For example: >> >> C:\Program Files\PLT>slatex --no-latex C:/Users/Bas/Documents/quick.tex >> SLaTeX v. 20050609 >> typesetting code[quick.tex]done >> >> This results in no .Z files being generated. I've tried putting the .tex >> file different folders and different ways of typing the path towards >> quick.tex (e.g., forward slashes, backward slashes, double backward slashes, >> surrounding by double quotes) but this made no difference. However, a typo >> in the path does result in an error, so SLaTeX really does find the file, it >> just doesn't do anything with it. > > I made a conjecture...I'm less sure of it now, but I'll throw it out > there anyway. > > I wonder if the difference *is* in the pathname. I suspect that you > haven't hit on the magical combination that undergoes translation and > still makes sense inside Scheme. My guess is that this: > >> C:\Program Files\PLT>slatex --no-latex quick.tex >> SLaTeX v. 20050609 >> typesetting code[slatex.sty]....done > > works not because of the location of quick.tex, but rather because you > are specifying quick.tex without any path prefix. > > (I was going to conjecture that it was because you were providing an > *absolute* pathname, but I went back through this thread just now and > noticed you did once try with a relative pathname...so maybe my > conjecture is off. Still, if you were try to try the PATH setting I > suggested earlier, and try running SLaTeX from a "harmless" directory, > and still get the error, that would be helpful to know. Also if you > have access to an XP system, too...) > > Shriram > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From sk at cs.brown.edu Mon Nov 10 00:05:13 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:52 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> Message-ID: Fast on the heels of this thread, today I had to insert a bunch of JavaScript gobbledygook into each of my HTML files. Here's the Scheme code I wrote: ---------- (define tracker "... gobbledygook goes here ... ") (define (go f) (let ([txt (with-input-from-file f (lambda () (read-string (file-size f))))]) (let ([new-txt (regexp-replace (regexp "") txt (string-append tracker ""))]) (if (string=? txt new-txt) (printf "Pattern not found in ~a~n" f) (with-output-to-file "out" (lambda () (write-string new-txt))))))) (go (vector-ref (current-command-line-arguments) 0)) ---------- [Orthogonal note: writing the gobbledygook was itself a bit painful, and made me better appreciate Python's quoting.] I then launched this from a `find' command in the shell that would locate the .html files, do a quick check relating "out" to the original, and then mv out to override original. I eyeballed the output to make sure there were no instances of "Pattern not found". There was one, and I was able to cross-check why and make sure there was no problem. It sure would have been nice to make the above code both shorter and more robust with FILE->STRING and STRING->FILE... [This is really just a response to Richard, who seemed to be arguing against such primitives. The "optics" argument is actually stood on its head here: my hand-written code is the 80...let's call it 60% solution, because it does no error-checking, probably doesn't handle Unicode, certainly doesn't care about automicity due to assumptions about myself, etc. At any rate, given that this is *not* being used in a compositional manner, the 80% solution of reading the file into memory, processing it, and writing it back out seems to me just the right thing. Counter-argument?] Shriram From robby at cs.uchicago.edu Mon Nov 10 00:33:15 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:52 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> Message-ID: <932b2f1f0811092133g389bc28aje190c6fe518b6919@mail.gmail.com> Looks to me like it handles unicode just fine. Robby On Sun, Nov 9, 2008 at 11:05 PM, Shriram Krishnamurthi wrote: > Fast on the heels of this thread, today I had to insert a bunch of > JavaScript gobbledygook into each of my HTML files. Here's the Scheme > code I wrote: > > ---------- > (define tracker "... gobbledygook goes here ... > ") > > (define (go f) > (let ([txt (with-input-from-file f > (lambda () (read-string (file-size f))))]) > (let ([new-txt > (regexp-replace (regexp "") > txt > (string-append tracker ""))]) > (if (string=? txt new-txt) > (printf "Pattern not found in ~a~n" f) > (with-output-to-file "out" > (lambda () (write-string new-txt))))))) > > (go (vector-ref (current-command-line-arguments) 0)) > ---------- > > [Orthogonal note: writing the gobbledygook was itself a bit painful, > and made me better appreciate Python's quoting.] > > I then launched this from a `find' command in the shell that would > locate the .html files, do a quick check relating "out" to the > original, and then mv out to override original. > > I eyeballed the output to make sure there were no instances of > "Pattern not found". There was one, and I was able to cross-check why > and make sure there was no problem. > > It sure would have been nice to make the above code both shorter and > more robust with FILE->STRING and STRING->FILE... > > [This is really just a response to Richard, who seemed to be arguing > against such primitives. The "optics" argument is actually stood on > its head here: my hand-written code is the 80...let's call it 60% > solution, because it does no error-checking, probably doesn't handle > Unicode, certainly doesn't care about automicity due to assumptions > about myself, etc. At any rate, given that this is *not* being used > in a compositional manner, the 80% solution of reading the file into > memory, processing it, and writing it back out seems to me just the > right thing. Counter-argument?] > > Shriram > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From clements at brinckerhoff.org Mon Nov 10 02:08:38 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:32:53 2009 Subject: [plt-scheme] Whoa... error font MUCH nicer. Message-ID: <0CA7DB59-51B9-4184-999E-850436370BE7@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/20081109/06d381a1/smime.bin From alexshinn at gmail.com Mon Nov 10 02:14:41 2008 From: alexshinn at gmail.com (Alex Shinn) Date: Thu Mar 26 02:32:54 2009 Subject: [plt-scheme] `shared' syntax confusing Message-ID: Hi, I was somewhat surprised that the expression (shared ((x (list* 1 2 3 x))) x) did not patch the `x' in the body of the `list*'. The manual is not particularly enlightening: (shared ([id expr] ...) expr) Like letrec, but when an expr next to an id is a cons, list, vector, quasiquoted expression, or make-structid from a define-struct, the expr can refer directly to any id, not just ids defined earlier. Thus, shared can be used to create cyclic data structures. I think it's trying to say that if the binding `expr's are a list whose car is one of the listed identifiers, then any of the arguments may directly refer to any `id', but _not_ use an `id' inside another expression. Which is not quite correct, because `expr' can contain directly nested references to other constructors, so that (shared ((x (cons 1 (cons 2 x)))) x) => #0=(1 2 . #0#) but not references nested inside other expressions (shared ((x (cons 1 (if #t x x)))) x) => (1 . #) Why the limitation? It seems very unintuitive, and there are useful graphs that can't be represented this way. And if you are going to have this limitation, why is the line drawn at the listed forms? It's not just primitive constructors, because `list' is allowed (which is just a way to generate chains of pairs) but not the related `list*' or `append.' Without `append' you can't even define SRFI-1's `circular-list' in terms of `shared'. -- Alex P.S. Wouldn't `let-shared' have been a more natural name? From eli at barzilay.org Mon Nov 10 03:42:09 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:32:54 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> Message-ID: <18711.62433.900025.556558@arabic.ccs.neu.edu> On Nov 10, Shriram Krishnamurthi wrote: > Fast on the heels of this thread, today I had to insert a bunch of > JavaScript gobbledygook into each of my HTML files. Here's the Scheme > code I wrote: > > ---------- > (define tracker "... gobbledygook goes here ... > ") > > (define (go f) > (let ([txt (with-input-from-file f > (lambda () (read-string (file-size f))))]) > (let ([new-txt > (regexp-replace (regexp "") > txt > (string-append tracker ""))]) > (if (string=? txt new-txt) > (printf "Pattern not found in ~a~n" f) > (with-output-to-file "out" > (lambda () (write-string new-txt))))))) > > (go (vector-ref (current-command-line-arguments) 0)) > ---------- > > [Orthogonal note: writing the gobbledygook was itself a bit painful, > and made me better appreciate Python's quoting.] You mean arbitrary text? Like #< It sure would have been nice to make the above code both shorter and > more robust with FILE->STRING and STRING->FILE... The only question is how many functions to have in that interface. Currently, I see 16 of them: file->string file->strings ; list of strings, read with read-line file->bytes file->bytess ; bad name, and perhaps not needed anyway port->... ; port versions of all of the above string->file ; reverse direction I hope that there's some way to cut all that down somehow... (The file/port cannot be done based on the input value if the two functions come from scheme/port and scheme/file, some keyword argument that makes it return bytes/string, or a list of lines seems ugly.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From esmith at acanac.net Mon Nov 10 07:43:39 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:32:54 2009 Subject: [plt-scheme] Help with unexpected result from foreign.ss (cpointer? ) function Message-ID: <49182C7B.4090103@acanac.net> The following program > (require (lib "foreign.ss")) > (unsafe!) > (define my-cptr (_cpointer 'my-cptr)) > (display (cpointer? my-cptr)) > (newline) gives me this result > Welcome to DrScheme, version 372 [3m]. > Language: Textual (MzScheme, includes R5RS). > #f >> I expected #t Can someone enlighten me please. From robby at cs.uchicago.edu Mon Nov 10 07:53:35 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:54 2009 Subject: [plt-scheme] Whoa... error font MUCH nicer. In-Reply-To: <0CA7DB59-51B9-4184-999E-850436370BE7@brinckerhoff.org> References: <0CA7DB59-51B9-4184-999E-850436370BE7@brinckerhoff.org> Message-ID: <932b2f1f0811100453uec9dd14tbdcd9fdc3b8a5e7d@mail.gmail.com> I didn't do anything! Is it possible you recently changed drscheme's main font? The error font is the italicized version of it. Robby On Mon, Nov 10, 2008 at 1:08 AM, John Clements wrote: > Is it just happenstance, or did DrScheme's error font just get about 500% > more readable under OS X? > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Mon Nov 10 08:21:21 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:54 2009 Subject: [plt-scheme] `shared' syntax confusing In-Reply-To: References: Message-ID: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> At Mon, 10 Nov 2008 16:14:41 +0900, Alex Shinn wrote: > I was somewhat surprised that the expression > > (shared ((x (list* 1 2 3 x))) x) > > did not patch the `x' in the body of the `list*'. > > The manual is not particularly enlightening: > > (shared ([id expr] ...) expr) > > Like letrec, but when an expr next to an id is a cons, > list, vector, quasiquoted expression, or make-structid > from a define-struct, the expr can refer directly to any > id, not just ids defined earlier. Thus, shared can be > used to create cyclic data structures. That's the documentation for the HtDP "Advanced" language. We should improve those docs. The documentation for `scheme/shared' (or `scheme'), however, is considerably more detailed already: http://docs.plt-scheme.org/reference/shared.html > I think it's trying to say that if the binding `expr's are a > list whose car is one of the listed identifiers, then any of > the arguments may directly refer to any `id', but _not_ use > an `id' inside another expression. Which is not quite > correct, because `expr' can contain directly nested > references to other constructors, so that > > (shared ((x (cons 1 (cons 2 x)))) x) > => #0=(1 2 . #0#) > > but not references nested inside other expressions > > (shared ((x (cons 1 (if #t x x)))) x) > => (1 . #) Right. This is more precisely specified in the docs for `scheme/shared'. > Why the limitation? It seems very unintuitive, and there > are useful graphs that can't be represented this way. It was easy to support the second example when `cons' created mutable pairs. Now that it creates immutable pairs, `shared' must be able to predict more of the shape of the resulting data to be able to construct the circular version, and there will obviously be approximations in its analysis of the shape. Not being able to see through `(if #t ...)' is one of the approximations. [In other words, I don't know how to implement it.] > And if you are going to have this limitation, why is the > line drawn at the listed forms? It's not just primitive > constructors, because `list' is allowed (which is just a way > to generate chains of pairs) but not the related `list*' or > `append.' Without `append' you can't even define SRFI-1's > `circular-list' in terms of `shared'. Adding `list*' sounds like a good idea. I don't quite see how it helps you implement `circular-list', though. It seems like you'd need `append' for that, so maybe we can add `append', too. > P.S. Wouldn't `let-shared' have been a more natural name? Yes. Matthew From matthias at ccs.neu.edu Mon Nov 10 09:02:58 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:54 2009 Subject: [plt-scheme] `shared' syntax confusing In-Reply-To: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> References: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> Message-ID: <1088BC16-414D-4E59-81CF-D2EC72B5B3C7@ccs.neu.edu> On Nov 10, 2008, at 8:21 AM, Matthew Flatt wrote: > [In other words, I don't know how to implement it.] What Matthew is trying to say is that he can do this one special case but there is uniform algorithm. >> And if you are going to have this limitation, why is the >> line drawn at the listed forms? > > Adding `list*' sounds like a good idea. I consider it somewhat whimsical to go beyond the list of immediate constructors and to allow functions that we happen to know are uniform in construction. What if someone says (define foo append) (shared ([x (foo (list 1) (list x))]) ...) You can easily imagine generalizations of this. (A type system that specifies "constructorness" the way Sam'e specifies predicate power would help but it's all undecidable anyway.) >> P.S. Wouldn't `let-shared' have been a more natural name? > > Yes. Scheme uses way too many long names. I like 'shared'. -- Matthias From mflatt at cs.utah.edu Mon Nov 10 09:08:26 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:55 2009 Subject: [plt-scheme] Help with unexpected result from foreign.ss (cpointer? ) function In-Reply-To: <49182C7B.4090103@acanac.net> References: <49182C7B.4090103@acanac.net> Message-ID: <20081110140827.8F6366500AD@mail-svr1.cs.utah.edu> At Mon, 10 Nov 2008 07:43:39 -0500, Ernie Smith wrote: > The following program > > (require (lib "foreign.ss")) > > (unsafe!) > > (define my-cptr (_cpointer 'my-cptr)) > > (display (cpointer? my-cptr)) > > (newline) > gives me this result > > Welcome to DrScheme, version 372 [3m]. > > Language: Textual (MzScheme, includes R5RS). > > #f > >> > > I expected #t > Can someone enlighten me please. `(_cpointer 'my-cptr)' creates a cpointer type, not a cpointer instance. So the result is #f in the same way that `(integer? _int)' produces #f. When you use `my-cptr' with `malloc' or `get-ffi-obj', for example, then you'll get an instance of the type: (define p (malloc my-cptr)) (cpointer? p) ; => #t Matthew From ebellani at gmail.com Mon Nov 10 10:26:36 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:32:55 2009 Subject: [plt-scheme] TDD/BDD for plt scheme? Message-ID: <184222e50811100726i6afe615ladc4b38f315a8b6@mail.gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey guys. Being from the ruby gang I'm pretty used to TDD (BDD is a nicer term, but it serves just to get the emphasis out of testing and into design, where it should be anyway), and the community has some standards on how/what to use (kind of murky, but *usually* for rails people use rspec, which is a pretty helpful). I'm wondering if the PLT community has something like that, if not, what do *you* use for it? - -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJGFKsAuLeoteRgJ0RAtHIAJ4xqhP7/KuLAUuNi/fM2KL44YfFpwCeLpkm IlsQbOrrZ1HWdi3ktNTUaQk= =vXrR -----END PGP SIGNATURE----- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081110/2721d3f7/attachment.html From grettke at acm.org Mon Nov 10 10:30:35 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:32:55 2009 Subject: [plt-scheme] TDD/BDD for plt scheme? In-Reply-To: <184222e50811100726i6afe615ladc4b38f315a8b6@mail.gmail.com> References: <184222e50811100726i6afe615ladc4b38f315a8b6@mail.gmail.com> Message-ID: <756daca50811100730ma0f9a72n5f7301074e7c17ba@mail.gmail.com> On Mon, Nov 10, 2008 at 9:26 AM, Eduardo Bellani wrote: > Being from the ruby gang I'm pretty used to TDD > ... > I'm wondering if the PLT community has something like that, if not, http://planet.plt-scheme.org/package-source/schematics/schemeunit.plt/3/3/planet-docs/schemeunit/index.html > what do *you* use for it? For TDD of course! :) From noelwelsh at gmail.com Mon Nov 10 10:31:07 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:32:56 2009 Subject: [plt-scheme] TDD/BDD for plt scheme? In-Reply-To: <184222e50811100726i6afe615ladc4b38f315a8b6@mail.gmail.com> References: <184222e50811100726i6afe615ladc4b38f315a8b6@mail.gmail.com> Message-ID: Try SchemeUnit: http://planet.plt-scheme.org/display.ss?package=schemeunit.plt&owner=schematics N. On Mon, Nov 10, 2008 at 3:26 PM, Eduardo Bellani wrote: > Hey guys. > Being from the ruby gang I'm pretty used to TDD (BDD is a nicer term, > but it serves just to get the emphasis out of > testing and into design, where it should be anyway), and the community > has some standards on > how/what to use (kind of murky, but *usually* for rails people use > rspec, which is a pretty helpful). > > I'm wondering if the PLT community has something like that, if not, > what do *you* use for it? > > - -- > Eduardo Bellani From esmith at acanac.net Mon Nov 10 10:36:58 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:32:56 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> Message-ID: <4918551A.5050208@acanac.net> Shriram Krishnamurthi wrote: > [This is really just a response to Richard, who seemed to be arguing > against such primitives. The "optics" argument is actually stood on > its head here: my hand-written code is the 80...let's call it 60% > solution, because it does no error-checking, probably doesn't handle > Unicode, certainly doesn't care about automicity due to assumptions > about myself, etc. At any rate, given that this is *not* being used > in a compositional manner, the 80% solution of reading the file into > memory, processing it, and writing it back out seems to me just the > right thing. Counter-argument?] I reject the assumption: 'this is not being used in a compositional manner' Your argument can be distilled to: sloppiness is valid sometimes. I prove the point by writing a sloppy program and using it to my advantage immediately after writing it, knowing full well its limitations, ergo the optics argument is disproved. There is an implicit assumption of the optics argument that it applies to cases which *can* be used in a compositional manner. 1- Therefore we can filter out all counter arguments which require the 'non compositional assumption'. So We can consider your argument filtered out. 2- Although sloppiness can be useful, it is never be 're-useful'. 're-useful' programs should be given priority when deciding on the merits of a primitive. From sk at cs.brown.edu Mon Nov 10 10:41:47 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:32:56 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <4918551A.5050208@acanac.net> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> <4918551A.5050208@acanac.net> Message-ID: > 2- Although sloppiness can be useful, it is never be 're-useful'. > 're-useful' programs should be given priority when deciding on > the merits of a primitive. You carefully ignored the part of my message where I pointed out that a good built-in primitive would have made my code *more* robust, and therefore *more* re-useful. But my real response is: Scheme did this for 30 years. The lambda-value calculus is the ultimate in re-utility. And the scripting languages ate our lunch. Shriram From matthias at ccs.neu.edu Mon Nov 10 10:45:20 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:56 2009 Subject: [plt-scheme] TDD/BDD for plt scheme? In-Reply-To: <184222e50811100726i6afe615ladc4b38f315a8b6@mail.gmail.com> References: <184222e50811100726i6afe615ladc4b38f315a8b6@mail.gmail.com> Message-ID: Indeed, students who use DrScheme learn this from the second lecture forward, college, high school, or middle school. See check-expect in teaching languages. On Nov 10, 2008, at 10:26 AM, Eduardo Bellani wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hey guys. > Being from the ruby gang I'm pretty used to TDD (BDD is a nicer term, > but it serves just to get the emphasis out of > testing and into design, where it should be anyway), and the community > has some standards on > how/what to use (kind of murky, but *usually* for rails people use > rspec, which is a pretty helpful). > > I'm wondering if the PLT community has something like that, if not, > what do *you* use for it? > > - -- > Eduardo Bellani > > www.cnxs.com.br > > "What is hateful to you, do not to your fellow men. That is the entire > Law; all the rest is commentary." The Talmud > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFJGFKsAuLeoteRgJ0RAtHIAJ4xqhP7/KuLAUuNi/fM2KL44YfFpwCeLpkm > IlsQbOrrZ1HWdi3ktNTUaQk= > =vXrR > -----END PGP SIGNATURE----- > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From bass at cs.uu.nl Mon Nov 10 11:20:57 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:56 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: References: <4911A727.3060507@cs.uu.nl> <932b2f1f0811050909s2b062c30l9227ff5fb715bb14@mail.gmail.com> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491746F7.10209@cs.uu.nl> Message-ID: <49185F69.7040506@cs.uu.nl> Well it's already easy enough to just write a little batch file that copies the .tex file to the PLT directory, runs SLaTeX there, and then moves the .Z* files back. Create shortcut to batch file, done! <5min work to go from 1% to 100%. ;-) Sorry to skip the cygwin/term sorcery, but I'm getting a bit tired of this whole issue myself now, and this already works like a charm. :-) Bas Shriram Krishnamurthi wrote: > Well, the good news is that you have *something* working. Obviously > it's not a long-term solution, but at least SLaTeX is not 100% off > (only about 99% <-;). > > I actually run SLaTeX under Windows all the time. Over 90% of my > SLaTeXing happens under Windows. But it's all under XP, not Vista or > 2k (which I believe were the two platforms you mentioned), even though > I doubt that makes too much difference. > > Personally, my source .tex files live all over the place -- meaning, > all kinds of sub-directories of My Documents and Desktop, but never in > Program Files/PLT -- and I run SLaTeX from the directory where the > file is. I run it from (until recently) Cygwin or (since the past few > weeks, when Robby pointed me to it) Cygterm, which is a shell inside > PuTTY. My ~/.bashrc has an explicit entry to my current PLT version: > > export PATH=...:/cygdrive/c/Program\ Files/PLT/4.1.1/:... > > I can then run SLaTeX without any path prefix: > > GALIBIER ~/Desktop/T> which slatex > /cygdrive/c/Program Files/PLT/4.1.1/slatex > > This has always done the trick just fine for me (for years and years). > Give that a try. > > Shriram > -- Bas Steunebrink Intelligent Systems Group Utrecht University P.O. Box 80.089 3508TB Utrecht The Netherlands Tel: +31 (30) 253 2993 From robby at cs.uchicago.edu Mon Nov 10 11:34:36 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:32:56 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <49185F69.7040506@cs.uu.nl> References: <4911A727.3060507@cs.uu.nl> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491746F7.10209@cs.uu.nl> <49185F69.7040506@cs.uu.nl> Message-ID: <932b2f1f0811100834v47cbaf39l3d0cf8d83f78d4cf@mail.gmail.com> Easier than that is if you first cd to the directory containing the .tex file and run slatex from that directory, I suspect. Robby On Mon, Nov 10, 2008 at 10:20 AM, Bas Steunebrink wrote: > Well it's already easy enough to just write a little batch file that copies > the .tex file to the PLT directory, runs SLaTeX there, and then moves the > .Z* files back. Create shortcut to batch file, done! <5min work to go from > 1% to 100%. ;-) Sorry to skip the cygwin/term sorcery, but I'm getting a bit > tired of this whole issue myself now, and this already works like a charm. > :-) > > Bas > > > > Shriram Krishnamurthi wrote: >> >> Well, the good news is that you have *something* working. Obviously >> it's not a long-term solution, but at least SLaTeX is not 100% off >> (only about 99% <-;). >> >> I actually run SLaTeX under Windows all the time. Over 90% of my >> SLaTeXing happens under Windows. But it's all under XP, not Vista or >> 2k (which I believe were the two platforms you mentioned), even though >> I doubt that makes too much difference. >> >> Personally, my source .tex files live all over the place -- meaning, >> all kinds of sub-directories of My Documents and Desktop, but never in >> Program Files/PLT -- and I run SLaTeX from the directory where the >> file is. I run it from (until recently) Cygwin or (since the past few >> weeks, when Robby pointed me to it) Cygterm, which is a shell inside >> PuTTY. My ~/.bashrc has an explicit entry to my current PLT version: >> >> export PATH=...:/cygdrive/c/Program\ Files/PLT/4.1.1/:... >> >> I can then run SLaTeX without any path prefix: >> >> GALIBIER ~/Desktop/T> which slatex >> /cygdrive/c/Program Files/PLT/4.1.1/slatex >> >> This has always done the trick just fine for me (for years and years). >> Give that a try. >> >> Shriram >> > > -- > Bas Steunebrink > Intelligent Systems Group > Utrecht University > P.O. Box 80.089 > 3508TB Utrecht > The Netherlands > Tel: +31 (30) 253 2993 > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jvjulien at free.fr Thu Nov 6 10:56:50 2008 From: jvjulien at free.fr (jeeve) Date: Thu Mar 26 02:32:56 2009 Subject: Fwd: [plt-scheme] imperative vs functional In-Reply-To: <91a2ba3e0811051613s150061bbgae21ee48c54e6a8f@mail.gmail.com> References: <91a2ba3e0811051613i3cda93a3r407f6fcabe96d79c@mail.gmail.com> <91a2ba3e0811051613s150061bbgae21ee48c54e6a8f@mail.gmail.com> Message-ID: <0b7b44b6-2f94-4dca-bcb0-736aaa664d0d@b31g2000prb.googlegroups.com> thanks for yours explanations I will meditate there ! From lionht14 at gmail.com Sat Nov 8 17:32:19 2008 From: lionht14 at gmail.com (Cristiano Rocha) Date: Thu Mar 26 02:32:57 2009 Subject: [plt-scheme] Problem with set! Message-ID: Hello. I'm trying to do a procedure called list-set! that receives a list, an element and a position and inserts the element in the position pos of the list. The procedure must be destructive because its purpose is to change an existing list. I'm lists to create a matrix. I have this (define (list-set! lst pos elm) (set! lst (insert elm pos lst))) (define (insert elm pos lst) (if (= pos 0) (cons elm lst) (if (null? lst) (error "out-of-reach") (cons lst (insert elm (- pos 1) lst))))) (define (new-list) ()) I do this: > (define lst (new-list)) > (list-set! lst 0 0) > lst () and it always returns an empty list. But if I do this instead: > (define lst (new-list)) > (set! lst (insert 0 0 lst)) (0) > (set! lst (insert 1 1 lst)) (1 0) I was wondering if anyone could help me out here because I don't know what else to do. From sebastiano.dimartina at gmail.com Mon Nov 10 11:39:19 2008 From: sebastiano.dimartina at gmail.com (sebastiano.dimartina) Date: Thu Mar 26 02:32:57 2009 Subject: [plt-scheme] firebird connection Message-ID: <3c36af4c-70df-4105-87c8-4ef62d98c712@1g2000prd.googlegroups.com> what is the best way to connect to firebird DB? From rcleis at mac.com Mon Nov 10 12:22:52 2008 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:32:57 2009 Subject: [plt-scheme] reading a whole file Message-ID: <76193073576937788150647454152228706049-Webmail@me.com> On Sunday, November 09, 2008, at 09:05PM, "Shriram Krishnamurthi" wrote: >Fast on the heels of this thread, today I had to insert a bunch of >JavaScript gobbledygook into each of my HTML files. Here's the Scheme >code I wrote: > >---------- >(define tracker "... gobbledygook goes here ... >") > >(define (go f) > (let ([txt (with-input-from-file f > (lambda () (read-string (file-size f))))]) > (let ([new-txt > (regexp-replace (regexp "") > txt > (string-append tracker ""))]) > (if (string=? txt new-txt) > (printf "Pattern not found in ~a~n" f) > (with-output-to-file "out" > (lambda () (write-string new-txt))))))) > >(go (vector-ref (current-command-line-arguments) 0)) >---------- > >[Orthogonal note: writing the gobbledygook was itself a bit painful, >and made me better appreciate Python's quoting.] > >I then launched this from a `find' command in the shell that would >locate the .html files, do a quick check relating "out" to the >original, and then mv out to override original. > >I eyeballed the output to make sure there were no instances of >"Pattern not found". There was one, and I was able to cross-check why >and make sure there was no problem. > >It sure would have been nice to make the above code both shorter and >more robust with FILE->STRING and STRING->FILE... > >[This is really just a response to Richard, who seemed to be arguing >against such primitives. The "optics" argument is actually stood on >its head here: my hand-written code is the 80...let's call it 60% >solution, because it does no error-checking, probably doesn't handle >Unicode, certainly doesn't care about automicity due to assumptions >about myself, etc. At any rate, given that this is *not* being used >in a compositional manner, the 80% solution of reading the file into >memory, processing it, and writing it back out seems to me just the >right thing. Counter-argument?] I was replying on a phone beneath a roller coaster in the middle of nowhere, so I didn't type enough to make the claim that the *worst case* in programming would be when so little correlation existed between the 80% cases that 3 of them used together would result in a 50% solution (* 0.8 0.8 0.8)... rather than another 80% solution. Fortunately primitives, modules, etc are organized so that reality could be closer to 80 than 50. The file>string issue is driven by performance, perhaps due to the inability to generalize interfaces between user memory, os memory, disk memory, and disk media. Many uses, such as the JavaScript example above, involve data which entirely fits in the memory on the disk drive; I doubt any modern drive has less than at least several megabytes. Even if a program asks for 1 character, much more relevant data probably ended up in memory yet there aren't enough ways to optimize access to it. The true solution, whatever that means, might need environments that necessarily remove a program's reliance on distinguishing memory from media. But haven't people been making that claim for decades? :) rac > >Shriram >_________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From alexshinn at gmail.com Mon Nov 10 12:24:20 2008 From: alexshinn at gmail.com (Alex Shinn) Date: Thu Mar 26 02:32:57 2009 Subject: [plt-scheme] `shared' syntax confusing In-Reply-To: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> (Matthew Flatt's message of "Mon\, 10 Nov 2008 06\:21\:21 -0700") References: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> Message-ID: Matthew Flatt writes: > The documentation for `scheme/shared' (or `scheme'), however, is > considerably more detailed already: > > http://docs.plt-scheme.org/reference/shared.html Thanks, I had missed that. > It was easy to support the second example when `cons' created mutable > pairs. Now that it creates immutable pairs, `shared' must be able to > predict more of the shape of the resulting data to be able to construct > the circular version, and there will obviously be approximations in its > analysis of the shape. Not being able to see through `(if #t ...)' is > one of the approximations. What about post-processing the values instead of predicting the shape? The following seems to work fine for me: (define-syntax shared (syntax-rules () ((shared ((var expr) ...) body ...) (shared-build () ((var expr) ...) body ...)))) (define-syntax shared-build (syntax-rules () ((shared-build ((var tmp expr) ...) ((var2 expr2) rest ...) body ...) (shared-build ((var tmp expr) ... (var2 tmp2 expr2)) (rest ...) body ...)) ((shared-build ((var tmp expr) ...) () body ...) (let ((tmp (make-placeholder #f)) ...) (let ((var #f) ...) (set! var (let-syntax ((var (make-set!-transformer (lambda (stx) (syntax-case stx (set!) ((set! id val) #'(set! id val)) (id #'tmp))))) ...) expr)) ... (placeholder-set! tmp var) ... (set! var (make-reader-graph var)) ... body ...))))) -- Alex From chust at web.de Mon Nov 10 12:38:16 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:32:57 2009 Subject: [plt-scheme] Problem with set! In-Reply-To: References: Message-ID: <49187188.1050305@web.de> Cristiano Rocha schrieb: > [...] > I'm trying to do a procedure called list-set! that receives a list, an > element and a position and inserts the element in the position pos of > the list. The procedure must be destructive because its purpose is to > change an existing list. I'm lists to create a matrix. > [...] Hello, the destructive behaviour you say you want to achieve is not possible unless you never insert anything at position 0, because the identity of a list is tied to its first cons cell. Even if you never insert at position 0, it can only work with mutable pairs, not with PLT Scheme's default immutable pairs. > I have this > > (define (list-set! lst pos elm) > (set! lst (insert elm pos lst))) > > (define (insert elm pos lst) > (if (= pos 0) > (cons elm lst) > (if (null? lst) > (error "out-of-reach") > (cons lst (insert elm (- pos 1) lst))))) What you implemented here, however, is a purely functional insert procedure, and a list-set! procedure, that is neither destructive nor has any effect but temporarily wasting some memory and burning some CPU cycles ;-) The statement (set! lst ...) assigns a new value to the variable lst that is local to your list-set! procedure. The argument passed to list-set! that was originally stored in that variable is no longer accessible from within list-set! after the set! statement, but it isn't modified in any way by that statement or the call to insert. Therefore, to the caller who doesn't ever see the local variables inside list-set!, the invocation of (list-set! lst 0 0) is equivalent to that of (void lst 0 0) ;-) To solve your problem, you can either turn list-set! into a macro: (define-syntax list-set! (syntax-rules () [(list-set! lst pos elm) (set! lst (insert elm pos lst))])) Or you can pass a box containing the list to list-set! instead of the list itself: (define (list-set! lst pos elm) (set-box! lst (insert elm pos (unbox lst)))) cu, Thomas PS: As a sidenote, to represent matrices I would recommend using SRFI-25 arrays instead of lists. From chust at web.de Mon Nov 10 12:49:54 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:32:57 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <76193073576937788150647454152228706049-Webmail@me.com> References: <76193073576937788150647454152228706049-Webmail@me.com> Message-ID: <49187442.8080003@web.de> Richard Cleis schrieb: > [...] The file>string issue is driven by performance, perhaps due to the > inability to generalize interfaces between user memory, os memory, disk > memory, and disk media. [...] Even if a program asks for 1 character, much > more relevant data probably ended up in memory yet there aren't enough ways > to optimize access to it. [...] Hello, what about adding support for memory mapping to PLT Scheme? This would allow you to turn a whole file into a mutable or immutable byte string without explicitly loading it into memory (the operating system manages the loading and storing of the file's relevant blocks as required). I think this could solve both the convenience and the performance issues discussed in this thread. cu, Thomas From goetter at mazama.net Mon Nov 10 13:04:17 2008 From: goetter at mazama.net (Ben Goetter) Date: Thu Mar 26 02:32:57 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <49187442.8080003@web.de> References: <76193073576937788150647454152228706049-Webmail@me.com> <49187442.8080003@web.de> Message-ID: <491877A1.4070702@mazama.net> Thomas Chust wrote: > what about adding support for memory mapping to PLT Scheme? This would > allow you to turn a whole file into a mutable or immutable byte string > Only helpful for byte files, or for those rare text files whose encoding matches that of PLT Scheme's UCS-4 strings. I agree, would certainly address the performance issues mentioned. Ben From jpc-ml at zenburn.net Mon Nov 10 13:25:34 2008 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:32:58 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <18711.62433.900025.556558@arabic.ccs.neu.edu> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <595b9ab20811040704x7fffefd5ue8696da50203b367@mail.gmail.com> <932b2f1f0811040706m3c4ed28dk639f60c662c96add@mail.gmail.com> <595b9ab20811040721s16988ce9x8e75bac704b361cf@mail.gmail.com> <18704.41572.885844.714150@arabic.ccs.neu.edu> <595b9ab20811041203i431cfe51r74c4ed9c4e143747@mail.gmail.com> <91f48dbf0811041236o757ae08dye0fb3d6c753a7458@mail.gmail.com> <756daca50811041417n30b2c810naa0e6fe3e93dbf43@mail.gmail.com> <18711.62433.900025.556558@arabic.ccs.neu.edu> Message-ID: <49187C9E.8090708@zenburn.net> Eli Barzilay wrote: > The only question is how many functions to have in that interface. > Currently, I see 16 of them: > > file->string > file->strings ; list of strings, read with read-line > file->bytes > file->bytess ; bad name, and perhaps not needed anyway > port->... ; port versions of all of the above > string->file ; reverse direction > > I hope that there's some way to cut all that down somehow... (The > file/port cannot be done based on the input value if the two functions > come from scheme/port and scheme/file, some keyword argument that > makes it return bytes/string, or a list of lines seems ugly.) I think that the line versions are not worth the effort (for/list with line iteration is already available). You could get rid of file-> by using call-with-input-file or with-input-from-file (the argument would default to current-input-port as in read). The same goes for reverse direction (and no line versions, rather lift a good 'join list with strings between' from some SRFI; OTOH we could use a join-strings-to-port since this should be more efficient than list rewriting followed by string-append). -- regards, Jakub Piotr C?apa From chust at web.de Mon Nov 10 13:56:16 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:32:58 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <491877A1.4070702@mazama.net> References: <76193073576937788150647454152228706049-Webmail@me.com> <49187442.8080003@web.de> <491877A1.4070702@mazama.net> Message-ID: <491883D0.3060904@web.de> Ben Goetter schrieb: > Thomas Chust wrote: >> what about adding support for memory mapping to PLT Scheme? This would >> allow you to turn a whole file into a mutable or immutable byte string > Only helpful for byte files, or for those rare text files whose encoding > matches that of PLT Scheme's UCS-4 strings. [...] Hello, if a file contains something else than binary data or text that is encoded in UCS-4, its contents have to be converted to another representation in memory, no matter whether it's mapped or read, that's true. If you don't read all the input but map the file with the initial data representation, you save a lot of memory, though, because you only need to allocate the target representation. I also think that compared to some of the other suggested solutions it would be very concise and elegant to type something like this: (bytes->string/utf-8 (memory-map "some/file")) So I disagree that my proposal would not be useful for such cases. cu, Thomas From bass at cs.uu.nl Mon Nov 10 14:12:13 2008 From: bass at cs.uu.nl (Bas Steunebrink) Date: Thu Mar 26 02:32:58 2009 Subject: [plt-scheme] SLaTeX: getting it to work In-Reply-To: <932b2f1f0811100834v47cbaf39l3d0cf8d83f78d4cf@mail.gmail.com> References: <4911A727.3060507@cs.uu.nl> <49120AC0.2040404@cs.uu.nl> <4912BEE5.2040603@cs.uu.nl> <49130175.2050909@cs.uu.nl> <491746F7.10209@cs.uu.nl> <49185F69.7040506@cs.uu.nl> <932b2f1f0811100834v47cbaf39l3d0cf8d83f78d4cf@mail.gmail.com> Message-ID: <4918878D.209@cs.uu.nl> Yes. I'll put the contents of the batch file here in case anyone else, some time in the future, has the same problem and reads this thread: del .Z* copy mytex.tex "C:\Program Files\PLT" cd "C:\Program Files\PLT" slatex --no-latex mytex.tex del mytex.tex move .Z* C:\Users\Bas\Documents\mydir pause I saved this text as slatex.bat and put it in C:\Users\Bas\Documents\mydir where mytex.tex also resides. I also had to copy C:\Program Files\PLT\collects\slatex\slatex.sty once to C:\Users\Bas\Documents\mydir to be able to run LaTeX on mytex.tex there. Thanks again for all the help! Bas Robby Findler schreef: > Easier than that is if you first cd to the directory containing the > .tex file and run slatex from that directory, I suspect. > > Robby > > On Mon, Nov 10, 2008 at 10:20 AM, Bas Steunebrink wrote: > >> Well it's already easy enough to just write a little batch file that copies >> the .tex file to the PLT directory, runs SLaTeX there, and then moves the >> .Z* files back. Create shortcut to batch file, done! <5min work to go from >> 1% to 100%. ;-) Sorry to skip the cygwin/term sorcery, but I'm getting a bit >> tired of this whole issue myself now, and this already works like a charm. >> :-) >> >> Bas >> From pltscheme at pnkfx.org Mon Nov 10 14:43:55 2008 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Mar 26 02:32:58 2009 Subject: [plt-scheme] Problem with Contracts - HtDP 21.1.3 In-Reply-To: <64025293-3BDD-4C53-828C-5033B70059BC@ccs.neu.edu> References: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> <64025293-3BDD-4C53-828C-5033B70059BC@ccs.neu.edu> Message-ID: <5A8AF7C0-FF12-4B4F-9CA5-98DA88CDF63F@pnkfx.org> David (cc'ing Matthias and the plt-scheme list)- On Nov 7, 2008, at 11:57 AM, Matthias Felleisen wrote: > (X U -> U) W U Nat -> U > > 4. The second argument is used as the first input to f so U = W > > (X U -> U) U U Nat -> U > > 5. No other constraints so we're fine > > And I may have made a mistake so check the calculation -- Matthias Step 4 makes an incorrect deduction. I believe it should be: 4. The second argument is used as the first input to f, so X = W (X U -> U) X U Nat -> U The way I caught this: usually all of the parameters have some sort of relationship with other parts of the contract (on either side of the - > arrow). In Matthias's original proposed solution, X was unconstrained, which raised a red flag in my mind. ---- Also, there are ways to revise the interface to natural-f that completely eliminate the X from the contract, which may make for an interesting design exercise. -Felix Klock From matthias at ccs.neu.edu Mon Nov 10 14:52:20 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:32:58 2009 Subject: [plt-scheme] Problem with Contracts - HtDP 21.1.3 In-Reply-To: <5A8AF7C0-FF12-4B4F-9CA5-98DA88CDF63F@pnkfx.org> References: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> <64025293-3BDD-4C53-828C-5033B70059BC@ccs.neu.edu> <5A8AF7C0-FF12-4B4F-9CA5-98DA88CDF63F@pnkfx.org> Message-ID: <5A5C056B-361D-4C08-9E46-EF1BED84FBD0@ccs.neu.edu> David found my mistake in the pedagogic exercise and share it privately with me. On Nov 10, 2008, at 2:43 PM, Felix Klock's PLT scheme proxy wrote: > David (cc'ing Matthias and the plt-scheme list)- > > On Nov 7, 2008, at 11:57 AM, Matthias Felleisen wrote: > >> (X U -> U) W U Nat -> U >> >> 4. The second argument is used as the first input to f so U = W >> >> (X U -> U) U U Nat -> U >> >> 5. No other constraints so we're fine >> >> And I may have made a mistake so check the calculation -- Matthias > > Step 4 makes an incorrect deduction. > > I believe it should be: > > 4. The second argument is used as the first input to f, so X = W > > (X U -> U) X U Nat -> U > > The way I caught this: usually all of the parameters have some sort > of relationship with other parts of the contract (on either side of > the -> arrow). In Matthias's original proposed solution, X was > unconstrained, which raised a red flag in my mind. > > ---- > > Also, there are ways to revise the interface to natural-f that > completely eliminate the X from the contract, which may make for an > interesting design exercise. > > -Felix Klock > > From mflatt at cs.utah.edu Mon Nov 10 14:58:45 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:32:59 2009 Subject: [plt-scheme] `shared' syntax confusing In-Reply-To: References: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> Message-ID: <20081110195845.803C7650064@mail-svr1.cs.utah.edu> At Tue, 11 Nov 2008 02:24:20 +0900, Alex Shinn wrote: > What about post-processing the values instead of predicting > the shape? The following seems to work fine for me: > > (define-syntax shared > (syntax-rules () > ((shared ((var expr) ...) body ...) > (shared-build () ((var expr) ...) body ...)))) > > (define-syntax shared-build > (syntax-rules () > ((shared-build ((var tmp expr) ...) ((var2 expr2) rest ...) body ...) > (shared-build ((var tmp expr) ... (var2 tmp2 expr2)) (rest ...) body > ...)) > ((shared-build ((var tmp expr) ...) () body ...) > (let ((tmp (make-placeholder #f)) ...) > (let ((var #f) ...) > (set! var (let-syntax > ((var (make-set!-transformer > (lambda (stx) > (syntax-case stx (set!) > ((set! id val) #'(set! id val)) > (id #'tmp))))) > ...) > expr)) ... > (placeholder-set! tmp var) ... > (set! var (make-reader-graph var)) ... > body ...))))) There are trade-offs in what you can express with this approach and the one we're using. Your approach would automatically work with `list*' --- or with any function that does not inspect its arguments and constructs a result using only pairs, vectors, and boxes. But it exposes the intermediate placeholder value, as in (define-struct a (x)) (shared ([a (make-a a)]) (a-x a)) Also, it doesn't take advantage of the ability to mutate some values, such as vectors, as in (shared ([a (vector (make-a a))]) a) or mutable structs, as in (define-struct b (x) #:mutable) (shared ([b (make-b b)]) (b-x b)) I can't say whether either of these drawbacks is actually a significant problem. The `shared' in `scheme/base' is designed to produce `#', though, where it might otherwise have to expose placeholders (to avoid expose implementation details), and it works with examples that exploit mutation (mainly to preserve compatibility with the pre-4.0 `shared', which always used mutation). In any case, I've added `list*' and `append' support to `shared' in `scheme/base'. (For both of our approaches, `append' works only with graph references within its final argument.) Matthew From dyrueta at gmail.com Mon Nov 10 15:10:27 2008 From: dyrueta at gmail.com (David Yrueta) Date: Thu Mar 26 02:32:59 2009 Subject: [plt-scheme] Problem with Contracts - HtDP 21.1.3 In-Reply-To: <5A5C056B-361D-4C08-9E46-EF1BED84FBD0@ccs.neu.edu> References: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> <64025293-3BDD-4C53-828C-5033B70059BC@ccs.neu.edu> <5A8AF7C0-FF12-4B4F-9CA5-98DA88CDF63F@pnkfx.org> <5A5C056B-361D-4C08-9E46-EF1BED84FBD0@ccs.neu.edu> Message-ID: <186df66b0811101210y5742a506ta7b1269a195906e5@mail.gmail.com> and shared it privately with me. It is a bad habit. In the future I'll make my replies public to avoid redundancies. Felix, thank you for your comments. In Matthias's original proposed solution, X was unconstrained... Is there a simple way to define the difference between a constrained and unconstrained variable? Is it the same as the difference between bound and unbound? Judging by your comment, it seems that making the distinction can be useful, but I don't know how to make it; further, I wouldn't appreciate the significance of the distinction even if I could.... Thanks, Dave On Mon, Nov 10, 2008 at 11:52 AM, Matthias Felleisen wrote: > > David found my mistake in the pedagogic exercise and share it privately > with me. > > > > > > On Nov 10, 2008, at 2:43 PM, Felix Klock's PLT scheme proxy wrote: > > David (cc'ing Matthias and the plt-scheme list)- >> >> On Nov 7, 2008, at 11:57 AM, Matthias Felleisen wrote: >> >> (X U -> U) W U Nat -> U >>> >>> 4. The second argument is used as the first input to f so U = W >>> >>> (X U -> U) U U Nat -> U >>> >>> 5. No other constraints so we're fine >>> >>> And I may have made a mistake so check the calculation -- Matthias >>> >> >> Step 4 makes an incorrect deduction. >> >> I believe it should be: >> >> 4. The second argument is used as the first input to f, so X = W >> >> (X U -> U) X U Nat -> U >> >> The way I caught this: usually all of the parameters have some sort of >> relationship with other parts of the contract (on either side of the -> >> arrow). In Matthias's original proposed solution, X was unconstrained, >> which raised a red flag in my mind. >> >> ---- >> >> Also, there are ways to revise the interface to natural-f that completely >> eliminate the X from the contract, which may make for an interesting design >> exercise. >> >> -Felix Klock >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081110/0091cbea/attachment.htm From matthias at ccs.neu.edu Mon Nov 10 15:39:11 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:00 2009 Subject: [plt-scheme] Problem with Contracts - HtDP 21.1.3 In-Reply-To: <186df66b0811101210y5742a506ta7b1269a195906e5@mail.gmail.com> References: <186df66b0811061953o18a0f837x4605c1c64e173a9@mail.gmail.com> <64025293-3BDD-4C53-828C-5033B70059BC@ccs.neu.edu> <5A8AF7C0-FF12-4B4F-9CA5-98DA88CDF63F@pnkfx.org> <5A5C056B-361D-4C08-9E46-EF1BED84FBD0@ccs.neu.edu> <186df66b0811101210y5742a506ta7b1269a195906e5@mail.gmail.com> Message-ID: On Nov 10, 2008, at 3:10 PM, David Yrueta wrote: > and shared it privately with me. private is good in this example, though I doubt exposing the solution to 20.1.3 deep in a thread is much of a problem. > > > It is a bad habit. In the future I'll make my replies public to > avoid redundancies. > > Felix, thank you for your comments. > > In Matthias's original proposed solution, X was unconstrained... > > Is there a simple way to define the difference between a > constrained and unconstrained variable? Is it the same as the > difference between bound and unbound? Judging by your comment, it > seems that making the distinction can be useful, but I don't know > how to make it; further, I wouldn't appreciate the significance of > the distinction even if I could.... > > Thanks, > Dave > > On Mon, Nov 10, 2008 at 11:52 AM, Matthias Felleisen > wrote: > > David found my mistake in the pedagogic exercise and share it > privately with me. > > > > > > On Nov 10, 2008, at 2:43 PM, Felix Klock's PLT scheme proxy wrote: > > David (cc'ing Matthias and the plt-scheme list)- > > On Nov 7, 2008, at 11:57 AM, Matthias Felleisen wrote: > > (X U -> U) W U Nat -> U > > 4. The second argument is used as the first input to f so U = W > > (X U -> U) U U Nat -> U > > 5. No other constraints so we're fine > > And I may have made a mistake so check the calculation -- Matthias > > Step 4 makes an incorrect deduction. > > I believe it should be: > > 4. The second argument is used as the first input to f, so X = W > > (X U -> U) X U Nat -> U > > The way I caught this: usually all of the parameters have some sort > of relationship with other parts of the contract (on either side of > the -> arrow). In Matthias's original proposed solution, X was > unconstrained, which raised a red flag in my mind. > > ---- > > Also, there are ways to revise the interface to natural-f that > completely eliminate the X from the contract, which may make for an > interesting design exercise. > > -Felix Klock > > > > From jay.mccarthy at gmail.com Mon Nov 10 17:43:02 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:00 2009 Subject: [plt-scheme] Stateless Servlets in the PLT Web Server Message-ID: For over a year, the PLT Web Server has supported stateless Web Servlets via the #lang web-server language. This language compiles the servlet in a special way that allows continuations to be used and serializes them to be stored by the client on their Web browser. This greatly improves performance, with relatively few restrictions. Unfortunately, it was a major pain to use this language, because the default Web server configuration did not provide a way to serve them. I have merged the two dispatchers that were responsible for these servlets and traditional servlets. Thus, every Web server configuration that allows any servlets will allow both. This will improve the ease of transition and experimentation for everyone. If you want to try one out: $ svn up $ setup-plt $ plt-web-server -p 8080 & $ open http://localhost:8080/lang-servlets/add06.ss Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From alexshinn at gmail.com Mon Nov 10 20:57:10 2008 From: alexshinn at gmail.com (Alex Shinn) Date: Thu Mar 26 02:33:00 2009 Subject: [plt-scheme] `shared' syntax confusing In-Reply-To: <20081110195845.803C7650064@mail-svr1.cs.utah.edu> (Matthew Flatt's message of "Mon\, 10 Nov 2008 12\:58\:45 -0700") References: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> <20081110195845.803C7650064@mail-svr1.cs.utah.edu> Message-ID: Hi, Matthew Flatt writes: > Your approach would automatically work with `list*' --- or with any > function that does not inspect its arguments and constructs a result > using only pairs, vectors, and boxes. I'm not quite sure what you mean by that. The approach in general allows any computation. The implementation I posted didn't have the letrec* semantics that shared has, but the following simplified version does, and catches some trivial cases of exposed placeholders: (define-syntax shared-build (syntax-rules () ((shared-build ((vars t1s t2s exprs) ...) ((var expr) rest ...) body ...) (shared-build ((vars t1s t2s exprs) ... (var t1 t2 expr)) (rest ...) body ...)) ((shared-build ((var t1 t2 expr) ...) () body ...) (let ((undef (letrec ((x x)) x))) (let ((t1 (make-placeholder undef)) ...) (let ((var t1) ...) (let ((t2 undef) ...) (begin (set! t2 expr) (set! var t2) (placeholder-set! t1 var)) ... (set! var (if (eq? var t1) undef (make-reader-graph var))) ... body ...))))))) It's also portable R[56]RS, given suitable implementations of placeholders and `make-reader-graph'. > But it exposes the intermediate placeholder value [...] > Also, it doesn't take advantage of the ability to mutate some values, > such as vectors [...] > or mutable structs These are limitations in `make-reader-graph' that I was unaware of. One could write a version of that procedure which did traverse and replace all placeholder values, including inside mutable structures. Alternately you could use a post-processor to patch these in. > In any case, I've added `list*' and `append' support to `shared' in > `scheme/base'. (For both of our approaches, `append' works only with > graph references within its final argument.) This is not true. My implementation allows (shared ((a (append (list 1 2 a 3) a))) a) Both implementations give an error for (shared ((a (append a a))) a) which is unavoidable because this has no meaningful semantics. -- Alex From dherman at ccs.neu.edu Mon Nov 10 22:15:25 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:33:00 2009 Subject: [plt-scheme] `planet create` error Message-ID: <27FE3DDC-D017-4F94-80BB-55E21A9D3CD4@ccs.neu.edu> I'm getting this error when I try to build my planet package. It looks pretty deep in the weeds. Who should I talk to about this one? # ---- $ planet create javascript Building: scribblings/javascript.scrbl PLaneT packager: Error generating scribble documentation: car: expects argument of type ; given # === context === /Applications/PLT/collects/syntax/private/modcollapse-noctc.ss:52:2: combine-relative-elements /Applications/PLT/collects/syntax/private/modcollapse-noctc.ss:52:2: combine-relative-elements collapse-module-path-index /Applications/PLT/collects/scribble/basic.ss:130:0: do-module-path- index->taglet /Applications/PLT/collects/scribble/basic.ss:164:0: module-path-index- >taglet /Applications/PLT/collects/scribble/scheme.ss:76:2: make-id-element /Applications/PLT/collects/scribble/scheme.ss:120:2: typeset-atom /Applications/PLT/collects/scribble/private/manual-bind.ss:89:0: definition-site /Applications/PLT/collects/scribble/private/manual-proc.ss:698:6 /Applications/PLT/collects/scribble/private/manual-proc.ss:692:0: *defthing /Applications/PLT/collects/planet/util.ss:269:0: render for-loop /Applications/PLT/collects/planet/util.ss:308:2: make-planet-archive Refusing to continue packaging. === context === /Applications/PLT/collects/planet/util.ss:308:2: make-planet-archive # ---- Thanks, Dave From eli at barzilay.org Tue Nov 11 00:50:14 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:00 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <491877A1.4070702@mazama.net> References: <76193073576937788150647454152228706049-Webmail@me.com> <49187442.8080003@web.de> <491877A1.4070702@mazama.net> Message-ID: <18713.7446.593791.295045@arabic.ccs.neu.edu> On Nov 10, Ben Goetter wrote: > Thomas Chust wrote: > > what about adding support for memory mapping to PLT Scheme? This would > > allow you to turn a whole file into a mutable or immutable byte string > > > Only helpful for byte files, or for those rare text files whose encoding > matches that of PLT Scheme's UCS-4 strings. I agree, would certainly > address the performance issues mentioned. Another problem is that the memory must be out of the GC's hand, which adds another layer of complication. Also, I don't see how this kind of a `mutable' byte string is useful -- it's only in rare cases that you need to edit things in-place. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From spdegabrielle at gmail.com Tue Nov 11 03:45:30 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:01 2009 Subject: [plt-scheme] iteration across cyclic graph Message-ID: <595b9ab20811110045g53a16be0lefd35d1c012b3ef2@mail.gmail.com> Hi, I recently tried to work out how to cycle through a cycle (made with the scheme/shared facilities); (define colours (shared ([a (cons 'red b)] [b (cons 'blue c)] [c (cons 'green d)] [d (cons 'yellow e)] [e (cons 'orange a)]) a)) (define current-colours colours) (define (get-colour) (set! current-colours (cdr current-colours)) (car current-colours)) This does the job, but I'm not happy with either the expression and function. Is there a better way? Cheers, Stephen From mflatt at cs.utah.edu Tue Nov 11 08:41:31 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:01 2009 Subject: [plt-scheme] `shared' syntax confusing In-Reply-To: References: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> <20081110195845.803C7650064@mail-svr1.cs.utah.edu> Message-ID: <20081111134133.512766500B2@mail-svr1.cs.utah.edu> At Tue, 11 Nov 2008 10:57:10 +0900, Alex Shinn wrote: > Hi, > > Matthew Flatt writes: > > > Your approach would automatically work with `list*' --- or with any > > function that does not inspect its arguments and constructs a result > > using only pairs, vectors, and boxes. > > I'm not quite sure what you mean by that. The approach in > general allows any computation. A minor point... I had in mind something like (shared ([a (append b a)] [b (list 1 2)]) a) which is sensible in principle, but doesn't work because `append' inspects its first argument's list structure (unlike it's last argument, which is uses without inspecting). I also had in mind things like (define (thunkify a) (lambda () a)) (shared ([a (thunkify a)]) a) which doesn't return a list, vector, or box. I didn't mean to claim that the current `shared' can handle these cases, only to summarize when your approach would work. > > In any case, I've added `list*' and `append' support to `shared' in > > `scheme/base'. (For both of our approaches, `append' works only with > > graph references within its final argument.) > > This is not true. My implementation allows > > (shared ((a (append (list 1 2 a 3) a))) a) Good point. I was thinking of immediate uses of graph references, as in the `append' example above, but your version does capture more `append' patterns. I'm still reluctant to use a variant of `shared' that has to be defined in terms of placeholders. Also, the existing support for mutable structs is important for the original role of `shared' (in HtDP Advanced as a way to print cyclic structures created via mutation). For now, then, I'll plead laziness, since it would take work to fuse the best parts of what we have on the table. Meanwhile, I'm happy that you can easily get what you want out of `make-reader-graph'. Matthew From alan at alan-watson.org Tue Nov 11 09:38:17 2008 From: alan at alan-watson.org (Alan Watson) Date: Thu Mar 26 02:33:01 2009 Subject: [plt-scheme] Case-sensitive R5RS Message-ID: I want to use R5RS with rebinding and a case-sensitive reader. I'm using "plt-r5rs --no-prim" with the following: (#%require (only-in scheme read-case-sensitive)) (read-case-sensitive #t) However, the compiler complains "only-in: bad module path in: (only-in scheme read-case-sensitive)". This is with 4.1. I'd be very grateful if someone would point out what I'm doing wrong. Regards, Alan -- Alan Watson http://www.alan-watson.org/ From pltscheme at pnkfx.org Tue Nov 11 09:53:06 2008 From: pltscheme at pnkfx.org (Felix Klock's PLT scheme proxy) Date: Thu Mar 26 02:33:01 2009 Subject: [plt-scheme] Case-sensitive R5RS In-Reply-To: References: Message-ID: <0CA5FE60-337E-4B45-8A5A-FE4DC7D1B0FA@pnkfx.org> Alan (cc'ing plt-scheme)- On Nov 11, 2008, at 9:38 AM, Alan Watson wrote: > I want to use R5RS with rebinding and a case-sensitive reader. I'm > using "plt-r5rs --no-prim" with the following: > > (#%require (only-in scheme read-case-sensitive)) > (read-case-sensitive #t) > > However, the compiler complains "only-in: bad module path in: (only- > in scheme read-case-sensitive)". This is with 4.1. > > I'd be very grateful if someone would point out what I'm doing wrong. The #%require syntax is different from the require syntax; there is documentation for it here: http://docs.plt-scheme.org/reference/ require.html#(form._((quote._~23~25kernel)._~23~25require)) It looks like when PLT moved from using the identifier 'only' to the identifier 'only-in', they left it as 'only' within #%require. This should probably work better for you: (#%require (only scheme read-case-sensitive)) -Felix From alan at alan-watson.org Tue Nov 11 10:04:54 2008 From: alan at alan-watson.org (Alan Watson) Date: Thu Mar 26 02:33:01 2009 Subject: [plt-scheme] Case-sensitive R5RS In-Reply-To: <0CA5FE60-337E-4B45-8A5A-FE4DC7D1B0FA@pnkfx.org> References: <0CA5FE60-337E-4B45-8A5A-FE4DC7D1B0FA@pnkfx.org> Message-ID: That works. Thanks very much. Regards, Alan -- Alan Watson http://www.alan-watson.org/ From dherman at ccs.neu.edu Tue Nov 11 10:28:04 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:33:01 2009 Subject: [plt-scheme] `planet create` error In-Reply-To: <27FE3DDC-D017-4F94-80BB-55E21A9D3CD4@ccs.neu.edu> References: <27FE3DDC-D017-4F94-80BB-55E21A9D3CD4@ccs.neu.edu> Message-ID: <4919A484.1080108@ccs.neu.edu> I see Matthias reported this internally this morning, with more information about how to reproduce the bug. Dave Dave Herman wrote: > I'm getting this error when I try to build my planet package. It looks > pretty deep in the weeds. Who should I talk to about this one? > > # ---- > $ planet create javascript > Building: scribblings/javascript.scrbl > PLaneT packager: Error generating scribble documentation: car: expects > argument of type ; given # > > === context === > /Applications/PLT/collects/syntax/private/modcollapse-noctc.ss:52:2: > combine-relative-elements > /Applications/PLT/collects/syntax/private/modcollapse-noctc.ss:52:2: > combine-relative-elements > collapse-module-path-index > /Applications/PLT/collects/scribble/basic.ss:130:0: > do-module-path-index->taglet > /Applications/PLT/collects/scribble/basic.ss:164:0: > module-path-index->taglet > /Applications/PLT/collects/scribble/scheme.ss:76:2: make-id-element > /Applications/PLT/collects/scribble/scheme.ss:120:2: typeset-atom > /Applications/PLT/collects/scribble/private/manual-bind.ss:89:0: > definition-site > /Applications/PLT/collects/scribble/private/manual-proc.ss:698:6 > /Applications/PLT/collects/scribble/private/manual-proc.ss:692:0: *defthing > /Applications/PLT/collects/planet/util.ss:269:0: render > for-loop > /Applications/PLT/collects/planet/util.ss:308:2: make-planet-archive > > > Refusing to continue packaging. > > === context === > /Applications/PLT/collects/planet/util.ss:308:2: make-planet-archive > # ---- > > Thanks, > Dave > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Tue Nov 11 10:31:22 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:01 2009 Subject: [plt-scheme] `planet create` error In-Reply-To: <4919A484.1080108@ccs.neu.edu> References: <27FE3DDC-D017-4F94-80BB-55E21A9D3CD4@ccs.neu.edu> <4919A484.1080108@ccs.neu.edu> Message-ID: <20081111153123.1448F6500AD@mail-svr1.cs.utah.edu> It's now fixed in SVN. At Tue, 11 Nov 2008 10:28:04 -0500, Dave Herman wrote: > I see Matthias reported this internally this morning, with more > information about how to reproduce the bug. > > Dave > > Dave Herman wrote: > > I'm getting this error when I try to build my planet package. It looks > > pretty deep in the weeds. Who should I talk to about this one? > > > > # ---- > > $ planet create javascript > > Building: scribblings/javascript.scrbl > > PLaneT packager: Error generating scribble documentation: car: expects > > argument of type ; given # > > > > === context === > > /Applications/PLT/collects/syntax/private/modcollapse-noctc.ss:52:2: > > combine-relative-elements > > /Applications/PLT/collects/syntax/private/modcollapse-noctc.ss:52:2: > > combine-relative-elements > > collapse-module-path-index > > /Applications/PLT/collects/scribble/basic.ss:130:0: > > do-module-path-index->taglet > > /Applications/PLT/collects/scribble/basic.ss:164:0: > > module-path-index->taglet > > /Applications/PLT/collects/scribble/scheme.ss:76:2: make-id-element > > /Applications/PLT/collects/scribble/scheme.ss:120:2: typeset-atom > > /Applications/PLT/collects/scribble/private/manual-bind.ss:89:0: > > definition-site > > /Applications/PLT/collects/scribble/private/manual-proc.ss:698:6 > > /Applications/PLT/collects/scribble/private/manual-proc.ss:692:0: *defthing > > /Applications/PLT/collects/planet/util.ss:269:0: render > > for-loop > > /Applications/PLT/collects/planet/util.ss:308:2: make-planet-archive > > > > > > Refusing to continue packaging. > > > > === context === > > /Applications/PLT/collects/planet/util.ss:308:2: make-planet-archive > > # ---- > > > > Thanks, > > 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 eli at barzilay.org Tue Nov 11 13:10:58 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:02 2009 Subject: [plt-scheme] `shared' syntax confusing In-Reply-To: <20081111134133.512766500B2@mail-svr1.cs.utah.edu> References: <20081110132124.369E46500A8@mail-svr1.cs.utah.edu> <20081110195845.803C7650064@mail-svr1.cs.utah.edu> <20081111134133.512766500B2@mail-svr1.cs.utah.edu> Message-ID: <18713.51890.875724.996987@arabic.ccs.neu.edu> On Nov 11, Matthew Flatt wrote: > > I'm still reluctant to use a variant of `shared' that has to be > defined in terms of placeholders. [...] Just a quick comment: one reason I prefer this kind of constructs is that they're much easier to explain. (At the cost of exposing a concept that students shouldn't deal with, so probably the current version is better for students anyway.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jay.mccarthy at gmail.com Tue Nov 11 18:39:50 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:02 2009 Subject: [plt-scheme] HTTPS and the PLT Web Server Message-ID: Most of the updates to the PLT Web Server today were internal refactorings to make it easier to make some of the bigger changes down the pipe. However, one change is public, and very nice. It is often desirable to run an HTTPS server with your application. The PLT Web Server has always supported this, because its TCP implementation is parameterized. However, it was not nearly easy enough to actually use that flexibility, unless you were a Scheme warrior, like Eli Barzilay, who used it to implement the handin-server. For that reason I've integrated running the PLT Web Server in HTTPS into the plt-web-server command-line tool: plt-web-server --ssl And you've got yourself an HTTPS server on port 443. You can override that too: plt-web-server --ssl -p 8443 The only thing you need to do is create a private-key.pem and server-cert.pem in the directory you run the PLT Web Server in, and you're good to go. Instructions to create those are included in the FAQ on HTTPS. (Or at least will be when the docs regenerated tonight.) Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From maxigas at anargeek.net Tue Nov 11 18:49:27 2008 From: maxigas at anargeek.net (maxigas) Date: Thu Mar 26 02:33:02 2009 Subject: [plt-scheme] HTTPS and the PLT Web Server In-Reply-To: References: Message-ID: <20081112.004927.249594324.maxigas@anargeek.net> hi! That's really cool, i am totally thrilled about the possibility! Maybe this would change the More.. document also? Because it includes HTTPS instructions at the end, no? Btw, i am almost finished with that one. :) Of course it's also an issue of which version you want to support in the docs, i don't know if there's a policy for that already. maxigas From: "Jay McCarthy" Subject: [plt-scheme] HTTPS and the PLT Web Server Date: Tue, 11 Nov 2008 16:39:50 -0700 > Most of the updates to the PLT Web Server today were internal > refactorings to make it easier to make some of the bigger changes down > the pipe. However, one change is public, and very nice. > > It is often desirable to run an HTTPS server with your application. > The PLT Web Server has always supported this, because its TCP > implementation is parameterized. However, it was not nearly easy > enough to actually use that flexibility, unless you were a Scheme > warrior, like Eli Barzilay, who used it to implement the > handin-server. > > For that reason I've integrated running the PLT Web Server in HTTPS > into the plt-web-server command-line tool: > > plt-web-server --ssl > > And you've got yourself an HTTPS server on port 443. You can override that too: > > plt-web-server --ssl -p 8443 > > The only thing you need to do is create a private-key.pem and > server-cert.pem in the directory you run the PLT Web Server in, and > you're good to go. Instructions to create those are included in the > FAQ on HTTPS. (Or at least will be when the docs regenerated tonight.) > > Jay > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://jay.teammccarthy.org > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jay.mccarthy at gmail.com Tue Nov 11 19:09:05 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:02 2009 Subject: [plt-scheme] HTTPS and the PLT Web Server In-Reply-To: <20081112.004927.249594324.maxigas@anargeek.net> References: <20081112.004927.249594324.maxigas@anargeek.net> Message-ID: On Tue, Nov 11, 2008 at 4:49 PM, maxigas wrote: > Maybe this would change the More.. document also? Because it includes HTTPS instructions at the > end, no? Btw, i am almost finished with that one. :) Of course it's also an issue of which > version you want to support in the docs, i don't know if there's a policy for that already. Yes, the "Continue" document had erudite HTTPS instructions at the end. They've been replaced with this new, more sane, version. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From eli at barzilay.org Tue Nov 11 21:01:26 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:02 2009 Subject: [plt-scheme] HTTPS and the PLT Web Server In-Reply-To: References: Message-ID: <18714.14582.130174.551080@arabic.ccs.neu.edu> On Nov 11, Jay McCarthy wrote: > > However, it was not nearly easy enough to actually use that > flexibility, unless you were a Scheme warrior, like Eli Barzilay, > who used it to implement the handin-server. Just to put things right -- it's Matthew who wrote the initial version of that code, I only maintained it. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at cs.uchicago.edu Tue Nov 11 21:04:39 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:02 2009 Subject: [plt-scheme] HTTPS and the PLT Web Server In-Reply-To: <18714.14582.130174.551080@arabic.ccs.neu.edu> References: <18714.14582.130174.551080@arabic.ccs.neu.edu> Message-ID: <932b2f1f0811111804n16f3455fv6fc21cc7d0760ab3@mail.gmail.com> Warriors all! On Tue, Nov 11, 2008 at 8:01 PM, Eli Barzilay wrote: > On Nov 11, Jay McCarthy wrote: >> >> However, it was not nearly easy enough to actually use that >> flexibility, unless you were a Scheme warrior, like Eli Barzilay, >> who used it to implement the handin-server. > > Just to put things right -- it's Matthew who wrote the initial version > of that code, I only maintained it. > > -- > ((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 dherman at ccs.neu.edu Tue Nov 11 22:22:52 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:33:03 2009 Subject: [plt-scheme] planet server down Message-ID: <2E6D3603-5231-4BC4-B5A8-3058EEE7058E@ccs.neu.edu> Can't download any packages. Dave From robby at cs.uchicago.edu Tue Nov 11 23:29:14 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:03 2009 Subject: [plt-scheme] planet server down In-Reply-To: <2E6D3603-5231-4BC4-B5A8-3058EEE7058E@ccs.neu.edu> References: <2E6D3603-5231-4BC4-B5A8-3058EEE7058E@ccs.neu.edu> Message-ID: <932b2f1f0811112029m233353e1n915172a3e0f75fd9@mail.gmail.com> Thanks, Dave. I think it should be fixed now. Please let me know if you find other problems. Robby On Tue, Nov 11, 2008 at 9:22 PM, Dave Herman wrote: > Can't download any packages. > > Dave > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From vyzo at media.mit.edu Wed Nov 12 01:01:50 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:03 2009 Subject: [plt-scheme] call-with-continuation-barrier and multiple values Message-ID: call/barrier fails miserably if the thunk returns multiple values: > (version) "4.1.2.4" ; svn from a couple of days ago > (call-with-continuation-barrier (lambda () (values 1 2 3))) context expected 1 value, received 3 values: 1 2 3 > -- vyzo From mflatt at cs.utah.edu Wed Nov 12 07:18:03 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:03 2009 Subject: [plt-scheme] call-with-continuation-barrier and multiple values In-Reply-To: References: Message-ID: <20081112121807.373C76500A9@mail-svr1.cs.utah.edu> At Wed, 12 Nov 2008 01:01:50 -0500 (EST), Dimitris Vyzovitis wrote: > call/barrier fails miserably if the thunk returns multiple values: > > > (version) > "4.1.2.4" > ; svn from a couple of days ago > > (call-with-continuation-barrier (lambda () (values 1 2 3))) > context expected 1 value, received 3 values: 1 2 3 Fixed in SVN. Matthew From ecl at pckswarms.ch Wed Nov 12 11:10:33 2008 From: ecl at pckswarms.ch (ecl@pckswarms.ch) Date: Thu Mar 26 02:33:03 2009 Subject: [plt-scheme] NetBSD build and wchar_t Message-ID: <20081112161033.GA27210@jungfrau.pckswarms.ch> Hi, There has to be a simple solution to this... I'm building on NetBSD/macppc and the source in mred/gc2/xsrc keep redefining typedef int wchar_t normally somewhere around line 250-350 or so. This looks like it is generated automagically, but, I don't see the magic here. Thanks very much in advance. My carpal tunnel thanks you! cheers bruce From chust at web.de Wed Nov 12 12:25:59 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:33:04 2009 Subject: [plt-scheme] reading a whole file Message-ID: <554142449@web.de> On Nov 11, Eli Barzilay wrote: > On Nov 10, Ben Goetter wrote: > > Thomas Chust wrote: > > > what about adding support for memory mapping to PLT Scheme? This would > > > allow you to turn a whole file into a mutable or immutable byte string > > > > > Only helpful for byte files, or for those rare text files whose encoding > > matches that of PLT Scheme's UCS-4 strings. I agree, would certainly > > address the performance issues mentioned. > > Another problem is that the memory must be out of the GC's hand, which > adds another layer of complication. Also, I don't see how this kind > of a `mutable' byte string is useful -- it's only in rare cases that > you need to edit things in-place. This may be a small problem, although I doubt it is any problem at all for a precise garbage collector. But it is certainly not a problem that would be newly introduced: The necessary feature already exists in PLT Scheme -- look for make-sized-byte-string in the documentation of scheme/foreign. As for the mutability: I agree that most of the time you would not want to modify the string and even if you wanted to modify the string, you would maybe not want the modifications to be written to disk. But memory mapping offers all these possibilities through combinations of either read or read/write protection and either private copy on write or shared mapping. If memory mapping was implemented, I think it should be implemented right, with all the available features. cu, Thomas ___________________________________________________________________ Kennen Sie schon die Blockbuster-Aktion von WEB.DE? Jeden Monat 2 Freifilme sichern unter http://www.blockbuster.web.de From vyzo at media.mit.edu Wed Nov 12 14:45:35 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:04 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] Message-ID: The struct type identifier contains the expansion time information, but is otherwise sitting unused as a macro. This is a waste of a perfectly good identifier; the macro can be used as a constructor. Similarly, the match syntax can be adapted for symmetry, avoiding the current (overly verbose) struct form. The attached patch (against svn 12407) does this: The (checked-)struct-info info macro acts as a constructor when the constructor identifier is available. Similarly, match is adjusted to symmetrically deconstruct structs by using the type name directly. Example: (define-struct test (x y)) (test 1 2) => # (match (test 1 2) ((test x y) (list x y))) => '(1 2) -- vyzo -------------- next part -------------- Index: collects/scheme/match/parse.ss =================================================================== --- collects/scheme/match/parse.ss (revision 12407) +++ collects/scheme/match/parse.ss (working copy) @@ -152,6 +152,10 @@ [(mcons e1 e2) (make-MPair (parse #'e1) (parse #'e2))] [(struct s pats) (parse-struct stx cert parse #'s #'pats)] + [(type pat ...) + (and (identifier? #'type) + (struct-info? (syntax-local-value (cert #'type) (lambda () #f)))) + (parse-struct stx cert parse #'type #'(pat ...))] [(? p q1 qs ...) (make-And (cons (make-Pred (cert #'p)) (map parse (syntax->list #'(q1 qs ...)))))] Index: collects/scheme/private/define-struct.ss =================================================================== --- collects/scheme/private/define-struct.ss (revision 12407) +++ collects/scheme/private/define-struct.ss (working copy) @@ -26,10 +26,18 @@ 0 0 #f null (current-inspector) (lambda (v stx) - (raise-syntax-error - #f - "identifier for static struct-type information cannot be used as an expression" - stx)) + (let-values (((kons) (cadr (extract-struct-info v)))) + (if kons + (if (list? (syntax-e stx)) + (datum->syntax stx (cons kons (cdr (syntax-e stx))) stx) + (raise-syntax-error + #f + "illegal use of struct-type identifier" + stx)) + (raise-syntax-error + #f + "identifier for static struct-type information cannot be used as an expression" + stx)))) null (lambda (proc info) (if (and (procedure? proc) Index: collects/scheme/private/struct-info.ss =================================================================== --- collects/scheme/private/struct-info.ss (revision 12407) +++ collects/scheme/private/struct-info.ss (working copy) @@ -16,10 +16,18 @@ 1 0 #f null (current-inspector) (lambda (v stx) - (raise-syntax-error - #f - "identifier for static struct-type information cannot be used as an expression" - stx)) + (let-values (((kons) (cadr (extract-struct-info v)))) + (if kons + (if (list? (syntax-e stx)) + (datum->syntax stx (cons kons (cdr (syntax-e stx))) stx) + (raise-syntax-error + #f + "illegal use of struct-type identifier" + stx)) + (raise-syntax-error + #f + "identifier for static struct-type information cannot be used as an expression" + stx)))) null (lambda (proc info) (if (and (procedure? proc) From cwbowron at gmail.com Wed Nov 12 15:26:36 2008 From: cwbowron at gmail.com (Christopher Bowron) Date: Thu Mar 26 02:33:05 2009 Subject: [plt-scheme] Building Distribution Bundle with Framework on Win32 problems Message-ID: <114e756c0811121226ye54ab69v5dba9d3c9fc3d430@mail.gmail.com> I was trying to build my app into a distributable bundle and was getting errors. So I tried simplifying into something that still gets the errors. When I try to build an app that contains Framework, I get the following error: (Scheme->Create Executable: Distribution / MrEd) "collection-path: collection not found: "main.ss" in any of: (# #) === context === C:\Program Files\PLT\collects\compiler\embed-unit.ss:804:60 C:\Program Files\PLT\collects\compiler\embed-unit.ss:703:4: do-write-module-bundle" on Windows XP, using Version 4.1.2 This is the program, and it works if I just run it: ------------------------------------ #lang scheme/gui (require framework) (let ((f (new frame:basic% (label "Hello World") (parent #f) (width 320) (height 200)))) (send f show #t)) -- Christopher W. Bowron [ Nothing is exciting if you know what the outcome will be ] - Joseph Campbell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081112/56d36d2e/attachment.html From mflatt at cs.utah.edu Wed Nov 12 15:32:15 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:05 2009 Subject: [plt-scheme] Building Distribution Bundle with Framework on Win32 problems In-Reply-To: <114e756c0811121226ye54ab69v5dba9d3c9fc3d430@mail.gmail.com> References: <114e756c0811121226ye54ab69v5dba9d3c9fc3d430@mail.gmail.com> Message-ID: <20081112203216.16BFD6500AF@mail-svr1.cs.utah.edu> Sorry --- that's a bug in 4.1.2 that has been fixed for the next release. You may want to try out the nightly build: http://pre.plt-scheme.org/installers/ Matthew At Wed, 12 Nov 2008 15:26:36 -0500, "Christopher Bowron" wrote: > I was trying to build my app into a distributable bundle and was getting > errors. So I tried simplifying into something that still gets the errors. > > When I try to build an app that contains Framework, I get the following > error: (Scheme->Create Executable: Distribution / MrEd) > > "collection-path: collection not found: "main.ss" in any of: > (# Scheme\4.1.2\collects> #) > > === context === > C:\Program Files\PLT\collects\compiler\embed-unit.ss:804:60 > C:\Program Files\PLT\collects\compiler\embed-unit.ss:703:4: > do-write-module-bundle" > > on Windows XP, using Version 4.1.2 > > This is the program, and it works if I just run it: > ------------------------------------ > #lang scheme/gui > > (require framework) > > (let ((f (new frame:basic% (label "Hello World") (parent #f) (width 320) > (height 200)))) > (send f show #t)) > > -- > Christopher W. Bowron > [ Nothing is exciting if you know what the outcome will be ] > - Joseph Campbell > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From morazanm at gmail.com Wed Nov 12 15:38:33 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:33:05 2009 Subject: [plt-scheme] Why is testing not working? Message-ID: <9b1fff280811121238h883ca26se2c241c2ffcffd57@mail.gmail.com> Dear All, I have a student who wrote the following code: ; Oldest Generation (define Petrona (make-child empty empty 'Petrona 1876 'Brown)) (define Petr (make-child empty empty 'Petr 1896 'Brown)) (define Lena (make-child empty empty 'Lena 1896 'Brown)) ; Second Oldest Generation (define Jose (make-child empty Petrona 'Jose 1895 'Brown)) (define Marina (make-child empty empty 'Marina 1910 'Brown)) (define Walter (make-child empty empty 'Walter 1912 'Blue)) (define Helen (make-child Petr Lena 'Helen 1917 'Brown)) ; Third Oldest Generation (define Marco2 (make-child Jose Marina 'Marco 1934 'Brown)) (define Doris (make-child Walter Helen 'Doris 1935 'Brown)) ; Youngest Generation (define Marco (make-child Marco2 Doris 'Marco 1967 'Brown)) ;numanc: at -> num (define (numanc an-at) (cond [(empty? an-at) 0] [else (+ (parents an-at) (numanc (child-mother an-at)) (numanc (child-father an-at)))])) ; parents at -> num (define (parents an-at) (cond [(empty? an-at) 0] [(and (empty? (child-mother an-at))(empty? (child-father an-at))) 0] [(or (empty? (child-mother an-at))(empty? (child-father an-at))) 1] [else 2])) ;examples (check-expect (numanc Petrona) 0) (check-expect (numanc Jose) 1) (check-expect (numanc Marco2) 3) (check-expect (numanc Marco) 9) The output in the interactions window after hitting run is: Welcome to DrScheme, version 4.1.2 [3m]. Language: Beginning Student with List Abbreviations; memory limit: 128 megabytes. > As you can see, no indication of tests passing. Any suggestions? We uninstalled and re-installed DrScheme. We explictily added testing.ss. All to no avail. -- Cheers, Marco From esmith at acanac.net Wed Nov 12 17:18:22 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:33:05 2009 Subject: [plt-scheme] FFI questions: Message-ID: <491B562E.9060304@acanac.net> I feel as though I'm missing key pieces of information which would permit me finally to grasp the FFI documentation. In an effort to discover the missing link I've come up with a few questions, I'd be grateful for answers. More importantly, if in reading these questions it dawns on someone that I am missing a concept please feel free to slap me into consciousness with the necessary point. 1- Given that you create a type using this: (make-ctype ctype ...) How do you create an initialized instance of that type? Something along the lines of: (define my-instance (somehow-make-one-with-this-value 99)) I suppose that applying the (somehow ..) would cause the conversion to C encoding from 99 to occur and the instance would contain the C encoded value? Then evaluating my-instance would trigger the conversion back to a scheme value, 99 presuming our transformation is reversible? If I'm on track, what are the building blocks for implementing (somehow-make-one..) starting from (make-ctype ..)? 2- Given that you create a struct type using this: (make-cstruct-type ctypes) How do you create an initialized instance of that structure? Another way of posing this question would be: What are the steps necessary to implement (_list-struct ) starting from (make-cstruct-type )? 3- Given that you create a pointer type using this: (define-cpointer-type _name ...) How do you instantiate a pointer of that type initialized so that it points to a valid instance of whatever the pointer is intended to point to. (for example how to instantiate a pointer such that it points to a field of the correct type in an existing instance of a structure) 4- There appears to be no way of declaring a vector type, only a vector instance. So when declaring a structure field which *is* a vector, the declaration needs to be made in the form of a substructure declaration with the correct number of repetitions of the single type. Then access to that vector in an instance of the containing structure can be accomplished by applying (make-cvector* ...) to what is returned by the id-field-id accessor for that field. Is that a correct and reasonable approach to dealing with this issue? 5- Since all C vectors are single type like SRFI-4 vectors, it makes sense to always use the SRFI-4 vector for efficiency whenever the type matches. Is it fair to assume that the (make-cvector ..) implementation does this, or is it necessary to hand code the selection of either (make-cvector ..) or the srfi-4 vector constructor depending on type? TIA From mflatt at cs.utah.edu Wed Nov 12 17:24:34 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:05 2009 Subject: [plt-scheme] NetBSD build and wchar_t In-Reply-To: <20081112161033.GA27210@jungfrau.pckswarms.ch> References: <20081112161033.GA27210@jungfrau.pckswarms.ch> Message-ID: <20081112222435.A53256500B7@mail-svr1.cs.utah.edu> At Wed, 12 Nov 2008 17:10:33 +0100, ecl@pckswarms.ch wrote: > I'm building on NetBSD/macppc and the source in mred/gc2/xsrc > keep redefining > > typedef int wchar_t > > normally somewhere around line 250-350 or so. > > This looks like it is generated automagically, but, I don't see the > magic here. See PR 9505: http://bugs.plt-scheme.org/query/?debug=&database=default&cmd=view+audit-trail&cmd=view&pr=9505 I think the right solution is to have xform preserve source-location annotations (so that g++ will ignore the redeclaration), but I haven't yet tried that. Matthew From matthias at ccs.neu.edu Wed Nov 12 17:32:37 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:06 2009 Subject: [plt-scheme] Re: [plt-edu] Why is testing not working? In-Reply-To: <9b1fff280811121238h883ca26se2c241c2ffcffd57@mail.gmail.com> References: <9b1fff280811121238h883ca26se2c241c2ffcffd57@mail.gmail.com> Message-ID: <73BDA063-FDCD-4254-8131-A817EFA5DDB7@ccs.neu.edu> I can't reproduce this result at all. I copied your code into an empty def window and added the define-struct. I get this in the interactions window: > Welcome to DrScheme, version 4.1.2.4-svn11nov2008 [3m]. > Language: Intermediate Student with lambda. > All tests passed! > > (Of course the tests don't cover everything and the code doesn't follow the design recipe. :-) -- Matthias On Nov 12, 2008, at 3:38 PM, Marco Morazan wrote: > Dear All, > > I have a student who wrote the following code: > > ; Oldest Generation > (define Petrona (make-child empty empty 'Petrona 1876 'Brown)) > (define Petr (make-child empty empty 'Petr 1896 'Brown)) > (define Lena (make-child empty empty 'Lena 1896 'Brown)) > ; Second Oldest Generation > (define Jose (make-child empty Petrona 'Jose 1895 'Brown)) > (define Marina (make-child empty empty 'Marina 1910 'Brown)) > (define Walter (make-child empty empty 'Walter 1912 'Blue)) > (define Helen (make-child Petr Lena 'Helen 1917 'Brown)) > ; Third Oldest Generation > (define Marco2 (make-child Jose Marina 'Marco 1934 'Brown)) > (define Doris (make-child Walter Helen 'Doris 1935 'Brown)) > ; Youngest Generation > (define Marco (make-child Marco2 Doris 'Marco 1967 'Brown)) > > ;numanc: at -> num > (define (numanc an-at) > (cond [(empty? an-at) 0] > [else (+ (parents an-at) (numanc (child-mother an-at)) > (numanc (child-father an-at)))])) > > ; parents at -> num > (define (parents an-at) > (cond > [(empty? an-at) 0] > [(and (empty? (child-mother an-at))(empty? (child- > father an-at))) 0] > [(or (empty? (child-mother an-at))(empty? (child-father > an-at))) 1] > [else 2])) > > ;examples > > (check-expect (numanc Petrona) 0) > (check-expect (numanc Jose) 1) > (check-expect (numanc Marco2) 3) > (check-expect (numanc Marco) 9) > > > The output in the interactions window after hitting run is: > > Welcome to DrScheme, version 4.1.2 [3m]. > Language: Beginning Student with List Abbreviations; memory limit: 128 > megabytes. >> > > As you can see, no indication of tests passing. Any suggestions? We > uninstalled and re-installed DrScheme. We explictily added testing.ss. > All to no avail. > > -- > > Cheers, > > Marco > _________________________________________________ > PLT Educators mailing list > plt-edu@list.cs.brown.edu > http://list.cs.brown.edu/mailman/listinfo/plt-edu From mflatt at cs.utah.edu Wed Nov 12 19:33:41 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:06 2009 Subject: [plt-scheme] NetBSD build and wchar_t In-Reply-To: <20081112222435.A53256500B7@mail-svr1.cs.utah.edu> References: <20081112161033.GA27210@jungfrau.pckswarms.ch> <20081112222435.A53256500B7@mail-svr1.cs.utah.edu> Message-ID: <20081113003342.C341D6500D4@mail-svr1.cs.utah.edu> At Wed, 12 Nov 2008 15:24:34 -0700, Matthew Flatt wrote: > I think the right solution is to have xform preserve source-location > annotations (so that g++ will ignore the redeclaration) I've added this support to xform, at least for what seems to be gcc's notation for source locations. It's enabled by `configure' when the compiler is "gcc". If you get a chance to try the current version in SVN (or the source archive created by the next "nightly" build, which will be available at http://pre.plt-scheme.org/installers/), let me know whether the change solves the `wchar_t' problem. Matthew From kominek at gmail.com Wed Nov 12 20:15:05 2008 From: kominek at gmail.com (Jay Kominek) Date: Thu Mar 26 02:33:06 2009 Subject: [plt-scheme] FFI questions: In-Reply-To: <491B562E.9060304@acanac.net> References: <491B562E.9060304@acanac.net> Message-ID: On Wed, Nov 12, 2008 at 3:18 PM, Ernie Smith wrote: > I feel as though I'm missing key pieces of information > which would permit me finally to grasp the FFI documentation. > > In an effort to discover the missing link I've come up with a > few questions, I'd be grateful for answers. More importantly, > if in reading these questions it dawns on someone that I am > missing a concept please feel free to slap me into consciousness > with the necessary point. > > 1- Given that you create a type using this: > > (make-ctype ctype ...) > > How do you create an initialized instance of that type? I think the piece of information you're missing is: you don't have to (and I don't think you can). The C types are conversion routines that get invoked when data has to move from Scheme to C, or vice versa. The ones you provide to make-ctype just go from one sort of Scheme value to another. The built-in ones, _int, _float, etc, are (as near as I can tell), magical, and do the actual conversion to stuff that'll make it to the C functions. > (require scheme/foreign) > (unsafe!) > (get-ffi-obj "roundf" #f (_fun _float -> _float)) # > (define roundf (get-ffi-obj "roundf" #f (_fun _float -> _float))) > (roundf 5.5) 6.0 > (roundf 3.141592) 3.0 > (number? (roundf 3.141592)) #t > (define _silly_float (make-ctype _float (lambda (schemev) (if schemev schemev 0.0)) (lambda (cv) (if (= cv 0.0) #f cv)))) > (define sillyroundf (get-ffi-obj "roundf" #f (_fun _silly_float -> _silly_float))) > (sillyroundf 3.1) 3.0 > (sillyroundf #f) #f > (sillyroundf 0.1) #f So the idea behind _float, for instance, isn't to create a value of some type which doesn't satisfy number? or inexact?, but rather, to tell the FFI layer what conversion to perform on Scheme values so that they're in a form that C expects. I hope I managed to shed some light on things for you. -- Jay Kominek From morazanm at gmail.com Wed Nov 12 20:33:26 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:33:06 2009 Subject: [plt-scheme] Re: [plt-edu] Why is testing not working? In-Reply-To: <73BDA063-FDCD-4254-8131-A817EFA5DDB7@ccs.neu.edu> References: <9b1fff280811121238h883ca26se2c241c2ffcffd57@mail.gmail.com> <73BDA063-FDCD-4254-8131-A817EFA5DDB7@ccs.neu.edu> Message-ID: <9b1fff280811121733n40ec4400hc6d0d8783d51017@mail.gmail.com> This does not look promising. :-( I can not reproduce the behavior on any of my machines. I have worked on the machine of my student and it does not report anything about tests passing or not. It does not complain about now knowing check-expect. It is just weird. I personally unistalled and re-intalled DrScheme and no difference. The student is running Windows Vista (as on one of my machines) on a Sony Vaio. Does any of this matter? If anyone has suggestions, I welcome them. Marco On Wed, Nov 12, 2008 at 5:32 PM, Matthias Felleisen wrote: > > I can't reproduce this result at all. I copied your code into an empty def > window and added the define-struct. I get this in the interactions window: > > >> Welcome to DrScheme, version 4.1.2.4-svn11nov2008 [3m]. >> Language: Intermediate Student with lambda. >> All tests passed! >> > > > (Of course the tests don't cover everything and the code doesn't follow the > design recipe. :-) > > -- Matthias > > > > > > On Nov 12, 2008, at 3:38 PM, Marco Morazan wrote: > >> Dear All, >> >> I have a student who wrote the following code: >> >> ; Oldest Generation >> (define Petrona (make-child empty empty 'Petrona 1876 'Brown)) >> (define Petr (make-child empty empty 'Petr 1896 'Brown)) >> (define Lena (make-child empty empty 'Lena 1896 'Brown)) >> ; Second Oldest Generation >> (define Jose (make-child empty Petrona 'Jose 1895 'Brown)) >> (define Marina (make-child empty empty 'Marina 1910 'Brown)) >> (define Walter (make-child empty empty 'Walter 1912 'Blue)) >> (define Helen (make-child Petr Lena 'Helen 1917 'Brown)) >> ; Third Oldest Generation >> (define Marco2 (make-child Jose Marina 'Marco 1934 'Brown)) >> (define Doris (make-child Walter Helen 'Doris 1935 'Brown)) >> ; Youngest Generation >> (define Marco (make-child Marco2 Doris 'Marco 1967 'Brown)) >> >> ;numanc: at -> num >> (define (numanc an-at) >> (cond [(empty? an-at) 0] >> [else (+ (parents an-at) (numanc (child-mother an-at)) >> (numanc (child-father an-at)))])) >> >> ; parents at -> num >> (define (parents an-at) >> (cond >> [(empty? an-at) 0] >> [(and (empty? (child-mother an-at))(empty? (child-father >> an-at))) 0] >> [(or (empty? (child-mother an-at))(empty? (child-father >> an-at))) 1] >> [else 2])) >> >> ;examples >> >> (check-expect (numanc Petrona) 0) >> (check-expect (numanc Jose) 1) >> (check-expect (numanc Marco2) 3) >> (check-expect (numanc Marco) 9) >> >> >> The output in the interactions window after hitting run is: >> >> Welcome to DrScheme, version 4.1.2 [3m]. >> Language: Beginning Student with List Abbreviations; memory limit: 128 >> megabytes. >>> >> >> As you can see, no indication of tests passing. Any suggestions? We >> uninstalled and re-installed DrScheme. We explictily added testing.ss. >> All to no avail. >> >> -- >> >> Cheers, >> >> Marco >> _________________________________________________ >> PLT Educators mailing list >> plt-edu@list.cs.brown.edu >> http://list.cs.brown.edu/mailman/listinfo/plt-edu > > -- Cheers, Marco From robby at cs.uchicago.edu Wed Nov 12 20:38:43 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:06 2009 Subject: [plt-scheme] Re: [plt-edu] Why is testing not working? In-Reply-To: <9b1fff280811121733n40ec4400hc6d0d8783d51017@mail.gmail.com> References: <9b1fff280811121238h883ca26se2c241c2ffcffd57@mail.gmail.com> <73BDA063-FDCD-4254-8131-A817EFA5DDB7@ccs.neu.edu> <9b1fff280811121733n40ec4400hc6d0d8783d51017@mail.gmail.com> Message-ID: <932b2f1f0811121738u2320829bv2d0e1ff53a5127e1@mail.gmail.com> It would help if you could provide a program (as small as possible!) and series of step-by-step instructions from a newly started DrScheme (presumably just 'paste in this code' and hit Run). Please also include a copy/paste of the entire interactions window. These made shed some light. The architecture of your machine is extremely unlikely to be relevant. Robby On Wed, Nov 12, 2008 at 7:33 PM, Marco Morazan wrote: > This does not look promising. :-( I can not reproduce the behavior on > any of my machines. I have worked on the machine of my student and it > does not report anything about tests passing or not. It does not > complain about now knowing check-expect. It is just weird. I > personally unistalled and re-intalled DrScheme and no difference. > > The student is running Windows Vista (as on one of my machines) on a > Sony Vaio. Does any of this matter? > > If anyone has suggestions, I welcome them. > > Marco > > On Wed, Nov 12, 2008 at 5:32 PM, Matthias Felleisen > wrote: >> >> I can't reproduce this result at all. I copied your code into an empty def >> window and added the define-struct. I get this in the interactions window: >> >> >>> Welcome to DrScheme, version 4.1.2.4-svn11nov2008 [3m]. >>> Language: Intermediate Student with lambda. >>> All tests passed! >>> > >> >> (Of course the tests don't cover everything and the code doesn't follow the >> design recipe. :-) >> >> -- Matthias >> >> >> >> >> >> On Nov 12, 2008, at 3:38 PM, Marco Morazan wrote: >> >>> Dear All, >>> >>> I have a student who wrote the following code: >>> >>> ; Oldest Generation >>> (define Petrona (make-child empty empty 'Petrona 1876 'Brown)) >>> (define Petr (make-child empty empty 'Petr 1896 'Brown)) >>> (define Lena (make-child empty empty 'Lena 1896 'Brown)) >>> ; Second Oldest Generation >>> (define Jose (make-child empty Petrona 'Jose 1895 'Brown)) >>> (define Marina (make-child empty empty 'Marina 1910 'Brown)) >>> (define Walter (make-child empty empty 'Walter 1912 'Blue)) >>> (define Helen (make-child Petr Lena 'Helen 1917 'Brown)) >>> ; Third Oldest Generation >>> (define Marco2 (make-child Jose Marina 'Marco 1934 'Brown)) >>> (define Doris (make-child Walter Helen 'Doris 1935 'Brown)) >>> ; Youngest Generation >>> (define Marco (make-child Marco2 Doris 'Marco 1967 'Brown)) >>> >>> ;numanc: at -> num >>> (define (numanc an-at) >>> (cond [(empty? an-at) 0] >>> [else (+ (parents an-at) (numanc (child-mother an-at)) >>> (numanc (child-father an-at)))])) >>> >>> ; parents at -> num >>> (define (parents an-at) >>> (cond >>> [(empty? an-at) 0] >>> [(and (empty? (child-mother an-at))(empty? (child-father >>> an-at))) 0] >>> [(or (empty? (child-mother an-at))(empty? (child-father >>> an-at))) 1] >>> [else 2])) >>> >>> ;examples >>> >>> (check-expect (numanc Petrona) 0) >>> (check-expect (numanc Jose) 1) >>> (check-expect (numanc Marco2) 3) >>> (check-expect (numanc Marco) 9) >>> >>> >>> The output in the interactions window after hitting run is: >>> >>> Welcome to DrScheme, version 4.1.2 [3m]. >>> Language: Beginning Student with List Abbreviations; memory limit: 128 >>> megabytes. >>>> >>> >>> As you can see, no indication of tests passing. Any suggestions? We >>> uninstalled and re-installed DrScheme. We explictily added testing.ss. >>> All to no avail. >>> >>> -- >>> >>> Cheers, >>> >>> Marco >>> _________________________________________________ >>> PLT Educators mailing list >>> plt-edu@list.cs.brown.edu >>> http://list.cs.brown.edu/mailman/listinfo/plt-edu >> >> > > > > -- > > Cheers, > > Marco > _________________________________________________ > PLT Educators mailing list > plt-edu@list.cs.brown.edu > http://list.cs.brown.edu/mailman/listinfo/plt-edu > > From mvanier at cs.caltech.edu Wed Nov 12 20:45:08 2008 From: mvanier at cs.caltech.edu (Michael Vanier) Date: Thu Mar 26 02:33:07 2009 Subject: [plt-scheme] Re: [plt-edu] Why is testing not working? In-Reply-To: <9b1fff280811121733n40ec4400hc6d0d8783d51017@mail.gmail.com> References: <9b1fff280811121238h883ca26se2c241c2ffcffd57@mail.gmail.com> <73BDA063-FDCD-4254-8131-A817EFA5DDB7@ccs.neu.edu> <9b1fff280811121733n40ec4400hc6d0d8783d51017@mail.gmail.com> Message-ID: <491B86A4.6080203@cs.caltech.edu> Marco, Does DrScheme allow you to evaluate anything in the interactions window at all? I.e. if you do (+ 2 2) in the interactions window, does it report "4"? Similarly, does it allow you to define a simple function in the defintions window and evaluate it in the interactions window? I'm just wondering if something more fundamental than testing is wrong here. Mike Marco Morazan wrote: > This does not look promising. :-( I can not reproduce the behavior on > any of my machines. I have worked on the machine of my student and it > does not report anything about tests passing or not. It does not > complain about now knowing check-expect. It is just weird. I > personally unistalled and re-intalled DrScheme and no difference. > > The student is running Windows Vista (as on one of my machines) on a > Sony Vaio. Does any of this matter? > > If anyone has suggestions, I welcome them. > > Marco > > On Wed, Nov 12, 2008 at 5:32 PM, Matthias Felleisen > wrote: > >> I can't reproduce this result at all. I copied your code into an empty def >> window and added the define-struct. I get this in the interactions window: >> >> >> >>> Welcome to DrScheme, version 4.1.2.4-svn11nov2008 [3m]. >>> Language: Intermediate Student with lambda. >>> All tests passed! >>> >> (Of course the tests don't cover everything and the code doesn't follow the >> design recipe. :-) >> >> -- Matthias >> >> >> >> >> >> On Nov 12, 2008, at 3:38 PM, Marco Morazan wrote: >> >> >>> Dear All, >>> >>> I have a student who wrote the following code: >>> >>> ; Oldest Generation >>> (define Petrona (make-child empty empty 'Petrona 1876 'Brown)) >>> (define Petr (make-child empty empty 'Petr 1896 'Brown)) >>> (define Lena (make-child empty empty 'Lena 1896 'Brown)) >>> ; Second Oldest Generation >>> (define Jose (make-child empty Petrona 'Jose 1895 'Brown)) >>> (define Marina (make-child empty empty 'Marina 1910 'Brown)) >>> (define Walter (make-child empty empty 'Walter 1912 'Blue)) >>> (define Helen (make-child Petr Lena 'Helen 1917 'Brown)) >>> ; Third Oldest Generation >>> (define Marco2 (make-child Jose Marina 'Marco 1934 'Brown)) >>> (define Doris (make-child Walter Helen 'Doris 1935 'Brown)) >>> ; Youngest Generation >>> (define Marco (make-child Marco2 Doris 'Marco 1967 'Brown)) >>> >>> ;numanc: at -> num >>> (define (numanc an-at) >>> (cond [(empty? an-at) 0] >>> [else (+ (parents an-at) (numanc (child-mother an-at)) >>> (numanc (child-father an-at)))])) >>> >>> ; parents at -> num >>> (define (parents an-at) >>> (cond >>> [(empty? an-at) 0] >>> [(and (empty? (child-mother an-at))(empty? (child-father >>> an-at))) 0] >>> [(or (empty? (child-mother an-at))(empty? (child-father >>> an-at))) 1] >>> [else 2])) >>> >>> ;examples >>> >>> (check-expect (numanc Petrona) 0) >>> (check-expect (numanc Jose) 1) >>> (check-expect (numanc Marco2) 3) >>> (check-expect (numanc Marco) 9) >>> >>> >>> The output in the interactions window after hitting run is: >>> >>> Welcome to DrScheme, version 4.1.2 [3m]. >>> Language: Beginning Student with List Abbreviations; memory limit: 128 >>> megabytes. >>> >>> As you can see, no indication of tests passing. Any suggestions? We >>> uninstalled and re-installed DrScheme. We explictily added testing.ss. >>> All to no avail. >>> >>> -- >>> >>> Cheers, >>> >>> Marco >>> _________________________________________________ >>> PLT Educators mailing list >>> plt-edu@list.cs.brown.edu >>> http://list.cs.brown.edu/mailman/listinfo/plt-edu >>> >> > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081112/23ab18ee/attachment.htm From eli at barzilay.org Wed Nov 12 22:00:38 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:07 2009 Subject: [plt-scheme] FFI questions: In-Reply-To: <491B562E.9060304@acanac.net> References: <491B562E.9060304@acanac.net> Message-ID: <18715.38998.952708.623910@arabic.ccs.neu.edu> On Nov 12, Ernie Smith wrote: > I feel as though I'm missing key pieces of information which would > permit me finally to grasp the FFI documentation. > > In an effort to discover the missing link I've come up with a few > questions, I'd be grateful for answers. More importantly, if in > reading these questions it dawns on someone that I am missing a > concept please feel free to slap me into consciousness with the > necessary point. > > 1- Given that you create a type using this: > > (make-ctype ctype ...) > > How do you create an initialized instance of that type? Jay gave a good answer on this. The idea is that the primitive ctypes are ones that can translate Scheme values to C values -- there is no way for you to directly see these C values in the Scheme world. When you create a new ctype with (make-ctype _foo s->c c->s) the resulting type knows how to translate Scheme values to C by applying the `s->c' function and then doing the conversion that `_foo' is doing -- which itself can be a user-defined ctype -- and the result of going through these chain of conversions is always some value at the C side. `c->s' is used when going the other way, from a C value to a Scheme value. But you can see these values indirectly, by using one of the facilities that deal with C values in Scheme. For example: > (define _singleton-int (make-ctype _int car list)) > (define a (malloc _singleton-int)) ;; note that `malloc' allocates space for the base C type here, an ;; _int in this case > (ptr-set! a _singleton-int (list 1)) > (ptr-ref a _singleton-int) (1) The `ptr-set!' and `ptr-ref' functions expect a type to be used, which allows you to treat the value as a different type, for example: > (ptr-ref a _int) 1 > (ptr-ref a _byte) 1 ; <- exposes the fact that my machine is little-endian There is a `tag' field for pointers which is not used as much as it should. In the future I hope to make the above `malloc' save the ctype on the cpointer value, and have it be used by default in `ptr-set!', `ptr-ref' and others. (But this is going to be a substantial change that will require some careful design.) > Something along the lines of: > (define my-instance (somehow-make-one-with-this-value 99)) > > I suppose that applying the (somehow ..) would cause the conversion > to C encoding from 99 to occur and the instance would contain the C > encoded value? I hope that the above further clarifies the issue. There are two accessor functions that can give you the relevant conversion functions, which you may want to use for debugging; they're not exposed in the scheme/foreign interface because I didn't see any need for them so far, and I think that they're not even useful for debugging -- if you have some substantial conversion code, you'd probably have a separate function that does it (and that you can test). Here's an example of using this: > (ctype-scheme->c _singleton-int) # > ((ctype-scheme->c _singleton-int) (list 1)) 1 but if you try to do this over the primitive types you get: > (ctype-scheme->c _int) #f because there is nothing that you can get here and actually use. (This is related to the fact that the code that implements these primitive conversions *must* be C code.) > 2- Given that you create a struct type using this: > (make-cstruct-type ctypes) > > How do you create an initialized instance of that structure? There are several ways, like `malloc', or like refering to a pointer that holds an instance of that cstruc, but if you just want to create a value, then you get the usual `make-foo' constructor. For example: > (define-cstruct _foo ([x _int] [y _int])) > (make-foo 1 2) # The result is a Scheme pointer object that points at the malloced block of memory holding your struct. (`make-foo' is implemented using `malloc'.) > Another way of posing this question would be: > What are the steps necessary to implement (_list-struct ) starting > from (make-cstruct-type )? You can see the implementation of both in "collects/mzlib/foreign.ss". The function that actually creates the libffi representation of a struct is `make-cstruct-type', and both of the above use it. > 3- Given that you create a pointer type using this: > (define-cpointer-type _name ...) > How do you instantiate a pointer of that type initialized > so that it points to a valid instance of whatever the pointer > is intended to point to. cpointers have that tag field, and `define-cpointer-type' is the way to create a type (based on _cpointer) that checks that the pointer is valid using this tag value. > (for example how to instantiate a pointer such that it points to > a field of the correct type in an existing instance of a structure) You can get an "offset pointer" with `ptr-add', but that's useful only in rare situations. > 4- There appears to be no way of declaring a vector type, Right -- that's a limitation of libffi. (If anyone knows of a way to do it, then feel free to enlighten me...) > only a vector instance. > So when declaring a structure field which *is* a vector, > the declaration needs to be made in the form of a substructure > declaration with the correct number of repetitions of the single > type. Then access to that vector in an instance of the containing > structure can be accomplished by applying > (make-cvector* ...) to what is returned by the > id-field-id accessor for that field. > Is that a correct and reasonable approach to dealing with this issue? Yes, it's as good as anything... It might be more convenient to use `_list-struct', for such cases -- or perhaps build some abstraction on top of that which is simpler for the N*type case. (Actually, now tat I think about it, perhaps it can be used to get a good fake representation of c vectors that will work in structs too.) > 5- Since all C vectors are single type like SRFI-4 vectors, it > makes sense to always use the SRFI-4 vector for efficiency > whenever the type matches. If you mean for random Scheme code, then Scheme vectors are still better, because accessing cvectors will create the Scheme object over and over again (when you're using boxed values, like floating point numbers). > Is it fair to assume that the (make-cvector ..) implementation > does this, or is it necessary to hand code the selection of > either (make-cvector ..) or the srfi-4 vector constructor > depending on type? `srfi-4' structs are implemented using the same facility that does cvectors. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From goetter at mazama.net Wed Nov 12 22:51:52 2008 From: goetter at mazama.net (Ben Goetter) Date: Thu Mar 26 02:33:07 2009 Subject: [plt-scheme] DrScheme/OLPC sans Sugar Message-ID: <491BA458.4060105@mazama.net> I am successfully running the vanilla Fedora 9 build of 4.1.2 on an XO-1 running build 767 (the recent G1G1 refresh). Memory is of course an issue. I am not running DrScheme on top of Sugar, but rather the smaller XFCE wm. I have disabled every tool other than Browser, Check Syntax, Graphical Debugger, Macro Stepper, and Version. Even with these changes, the system would not host the full DrScheme debugger until I configured it with some swap space (by default, the XO-1 has no swap partition). It now swaps to a file on a SD card: slow, and hard on the card, but effective. The DrScheme interface was unusable, with giant menus and giant fonts and a Preferences dialog that stretched far off the bottom of the screen, until I configured XFCE to scale its fonts to 150 DPI. I am not a savvy enough X user to hack in the /etc/X11 directory, and DrScheme was not using the window manager's font preferences. The vanilla build requires GL, so I have Mesa installed, allowing MrEd to load. However, the SGL samples appear to be dlopening the wrong library name (libGL.so instead of libGL.so.1). From grettke at acm.org Wed Nov 12 23:24:49 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:07 2009 Subject: [plt-scheme] DrScheme/OLPC sans Sugar In-Reply-To: <491BA458.4060105@mazama.net> References: <491BA458.4060105@mazama.net> Message-ID: <756daca50811122024r25b8f879o307628a4442e1b7@mail.gmail.com> Hi Ben, On Wed, Nov 12, 2008 at 9:51 PM, Ben Goetter wrote: > I am successfully running the vanilla Fedora 9 build of 4.1.2 on an XO-1 > running build 767 (the recent G1G1 refresh). 3.x works fine on top of Sugar, so no messing around with alternative window managers or sd swap if one so desires: http://www.wisdomandwonder.com/article/28/scheme-lisp-on-the-olpc-xo > Memory is of course an issue. Tell me about it: http://www.wisdomandwonder.com/article/275/the-xo-has-got-too-much-sugar > The DrScheme interface was unusable, with giant menus and giant fonts and a > Preferences dialog that stretched far off the bottom of the screen, until I > configured XFCE to scale its fonts to 150 DPI. I am not a savvy enough X > user to hack in the /etc/X11 directory, and DrScheme was not using the > window manager's font preferences. I didn't run into that on pre 4.x builds. > The vanilla build requires GL, so I have Mesa installed, allowing MrEd to > load. However, the SGL samples appear to be dlopening the wrong library > name (libGL.so instead of libGL.so.1). I disabled OpenGL rather than use Mesa. From morazanm at gmail.com Wed Nov 12 23:52:16 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:33:07 2009 Subject: [plt-scheme] Re: [plt-edu] Why is testing not working? In-Reply-To: <932b2f1f0811121738u2320829bv2d0e1ff53a5127e1@mail.gmail.com> References: <9b1fff280811121238h883ca26se2c241c2ffcffd57@mail.gmail.com> <73BDA063-FDCD-4254-8131-A817EFA5DDB7@ccs.neu.edu> <9b1fff280811121733n40ec4400hc6d0d8783d51017@mail.gmail.com> <932b2f1f0811121738u2320829bv2d0e1ff53a5127e1@mail.gmail.com> Message-ID: <9b1fff280811122052t148b6d34rab7a0bc1fe23403c@mail.gmail.com> 1. Pasted into the definitions window: (define (f x) 0) (check-expect (f 5) 0) (check-expect (f 10) 1) 2. Press Run 3. Result in interactions window: Welcome to DrScheme, version 4.1.2 [3m]. Language: Beginning Student with List Abbreviations; memory limit: 128 megabytes. > No failed test reported. On Wed, Nov 12, 2008 at 8:38 PM, Robby Findler wrote: > It would help if you could provide a program (as small as possible!) > and series of step-by-step instructions from a newly started DrScheme > (presumably just 'paste in this code' and hit Run). Please also > include a copy/paste of the entire interactions window. These made > shed some light. > > The architecture of your machine is extremely unlikely to be relevant. > > Robby > > On Wed, Nov 12, 2008 at 7:33 PM, Marco Morazan wrote: >> This does not look promising. :-( I can not reproduce the behavior on >> any of my machines. I have worked on the machine of my student and it >> does not report anything about tests passing or not. It does not >> complain about now knowing check-expect. It is just weird. I >> personally unistalled and re-intalled DrScheme and no difference. >> >> The student is running Windows Vista (as on one of my machines) on a >> Sony Vaio. Does any of this matter? >> >> If anyone has suggestions, I welcome them. >> >> Marco >> >> On Wed, Nov 12, 2008 at 5:32 PM, Matthias Felleisen >> wrote: >>> >>> I can't reproduce this result at all. I copied your code into an empty def >>> window and added the define-struct. I get this in the interactions window: >>> >>> >>>> Welcome to DrScheme, version 4.1.2.4-svn11nov2008 [3m]. >>>> Language: Intermediate Student with lambda. >>>> All tests passed! >>>> > >>> >>> (Of course the tests don't cover everything and the code doesn't follow the >>> design recipe. :-) >>> >>> -- Matthias >>> >>> >>> >>> >>> >>> On Nov 12, 2008, at 3:38 PM, Marco Morazan wrote: >>> >>>> Dear All, >>>> >>>> I have a student who wrote the following code: >>>> >>>> ; Oldest Generation >>>> (define Petrona (make-child empty empty 'Petrona 1876 'Brown)) >>>> (define Petr (make-child empty empty 'Petr 1896 'Brown)) >>>> (define Lena (make-child empty empty 'Lena 1896 'Brown)) >>>> ; Second Oldest Generation >>>> (define Jose (make-child empty Petrona 'Jose 1895 'Brown)) >>>> (define Marina (make-child empty empty 'Marina 1910 'Brown)) >>>> (define Walter (make-child empty empty 'Walter 1912 'Blue)) >>>> (define Helen (make-child Petr Lena 'Helen 1917 'Brown)) >>>> ; Third Oldest Generation >>>> (define Marco2 (make-child Jose Marina 'Marco 1934 'Brown)) >>>> (define Doris (make-child Walter Helen 'Doris 1935 'Brown)) >>>> ; Youngest Generation >>>> (define Marco (make-child Marco2 Doris 'Marco 1967 'Brown)) >>>> >>>> ;numanc: at -> num >>>> (define (numanc an-at) >>>> (cond [(empty? an-at) 0] >>>> [else (+ (parents an-at) (numanc (child-mother an-at)) >>>> (numanc (child-father an-at)))])) >>>> >>>> ; parents at -> num >>>> (define (parents an-at) >>>> (cond >>>> [(empty? an-at) 0] >>>> [(and (empty? (child-mother an-at))(empty? (child-father >>>> an-at))) 0] >>>> [(or (empty? (child-mother an-at))(empty? (child-father >>>> an-at))) 1] >>>> [else 2])) >>>> >>>> ;examples >>>> >>>> (check-expect (numanc Petrona) 0) >>>> (check-expect (numanc Jose) 1) >>>> (check-expect (numanc Marco2) 3) >>>> (check-expect (numanc Marco) 9) >>>> >>>> >>>> The output in the interactions window after hitting run is: >>>> >>>> Welcome to DrScheme, version 4.1.2 [3m]. >>>> Language: Beginning Student with List Abbreviations; memory limit: 128 >>>> megabytes. >>>>> >>>> >>>> As you can see, no indication of tests passing. Any suggestions? We >>>> uninstalled and re-installed DrScheme. We explictily added testing.ss. >>>> All to no avail. >>>> >>>> -- >>>> >>>> Cheers, >>>> >>>> Marco >>>> _________________________________________________ >>>> PLT Educators mailing list >>>> plt-edu@list.cs.brown.edu >>>> http://list.cs.brown.edu/mailman/listinfo/plt-edu >>> >>> >> >> >> >> -- >> >> Cheers, >> >> Marco >> _________________________________________________ >> PLT Educators mailing list >> plt-edu@list.cs.brown.edu >> http://list.cs.brown.edu/mailman/listinfo/plt-edu >> >> > -- Cheers, Marco From s.degabrielle at cs.ucl.ac.uk Thu Nov 13 06:00:59 2008 From: s.degabrielle at cs.ucl.ac.uk (Stephen De Gabrielle) Date: Thu Mar 26 02:33:08 2009 Subject: [plt-scheme] DrScheme/OLPC sans Sugar In-Reply-To: <756daca50811122024r25b8f879o307628a4442e1b7@mail.gmail.com> References: <491BA458.4060105@mazama.net> <756daca50811122024r25b8f879o307628a4442e1b7@mail.gmail.com> Message-ID: <595b9ab20811130300l670d52q31e2f5455e01fd50@mail.gmail.com> you could always use mzscheme, as there is not much that can be done about Sugar. (I'm guessing that the ffi could be used to talk to sugar?) Stephen On Thu, Nov 13, 2008 at 4:24 AM, Grant Rettke wrote: > Hi Ben, > > On Wed, Nov 12, 2008 at 9:51 PM, Ben Goetter wrote: >> I am successfully running the vanilla Fedora 9 build of 4.1.2 on an XO-1 >> running build 767 (the recent G1G1 refresh). > > 3.x works fine on top of Sugar, so no messing around with alternative > window managers or sd swap if one so desires: > > http://www.wisdomandwonder.com/article/28/scheme-lisp-on-the-olpc-xo > >> Memory is of course an issue. > > Tell me about it: > http://www.wisdomandwonder.com/article/275/the-xo-has-got-too-much-sugar > >> The DrScheme interface was unusable, with giant menus and giant fonts and a >> Preferences dialog that stretched far off the bottom of the screen, until I >> configured XFCE to scale its fonts to 150 DPI. I am not a savvy enough X >> user to hack in the /etc/X11 directory, and DrScheme was not using the >> window manager's font preferences. > > I didn't run into that on pre 4.x builds. > >> The vanilla build requires GL, so I have Mesa installed, allowing MrEd to >> load. However, the SGL samples appear to be dlopening the wrong library >> name (libGL.so instead of libGL.so.1). > > I disabled OpenGL rather than use Mesa. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From d.j.gurnell at gmail.com Thu Nov 13 08:08:06 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:33:08 2009 Subject: [plt-scheme] dynamic-require with no "provided" argument Message-ID: Hi all, I have a module called main.ss that runs an application from the command line: Trillian:~/my-application$ mzscheme main.ss Application started. I'm trying to write another module, build.ss, to use as a make-file (using Noel's sake.plt package). build.ss is going to do various things, including but not limited to compiling and running main.ss. I don't want any static compilation dependencies from build.ss to main.ss, so I thought I might try using dynamic-require for the running part (another option is to use the system procedure to run mzscheme in a separate process). I tried writing this: (dynamic-require (build-path "main.ss") (void)) but nothing happened. I then tried refactoring main.ss and bundling the code into a "run-application" procedure: (let ([run-application (dynamic-require (build-path "main.ss") 'run-application)]) (run-application)) Doing this makes the application run twice. The docs say that dynamic- require "visits" and "instantiates" a module when a variable name is specified, but only "instantiates" the module if void is specified. I'm guessing that the instantiation part is what actually runs the code in the module, so both main.ss and build.ss must be calling run- application. Two questions then: 1. Is there a way of visiting and instantiating a module without requiring a particular variable? The obvious quick hack of removing the call to (run-application) above seems a bit daft. 2. Is this all dubious and wrong and should I be using (system "main.ss") instead? Many thanks, -- Dave From d.j.gurnell at gmail.com Thu Nov 13 08:10:48 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:33:08 2009 Subject: [plt-scheme] Re: dynamic-require with no "provided" argument In-Reply-To: References: Message-ID: <62E9D27B-4203-44C2-9361-503A3380433C@gmail.com> PS - I should have said - the application is a web-server instance and I want to be able to kill it from inside the build script. That's why I tried the dynamic-require approach rather than the system approach to begin with. Cheers! From grettke at acm.org Thu Nov 13 08:47:47 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:08 2009 Subject: [plt-scheme] DrScheme/OLPC sans Sugar In-Reply-To: <595b9ab20811130300l670d52q31e2f5455e01fd50@mail.gmail.com> References: <491BA458.4060105@mazama.net> <756daca50811122024r25b8f879o307628a4442e1b7@mail.gmail.com> <595b9ab20811130300l670d52q31e2f5455e01fd50@mail.gmail.com> Message-ID: <756daca50811130547x36123a3ct6108a66812901363@mail.gmail.com> On Thu, Nov 13, 2008 at 5:00 AM, Stephen De Gabrielle wrote: > you could always use mzscheme, as there is not much that can be done > about Sugar. XO + HtDP is really special though :). From mflatt at cs.utah.edu Thu Nov 13 09:03:24 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:08 2009 Subject: [plt-scheme] dynamic-require with no "provided" argument In-Reply-To: References: Message-ID: <20081113140325.DBD156500CB@mail-svr1.cs.utah.edu> At Thu, 13 Nov 2008 13:08:06 +0000, Dave Gurnell wrote: > I tried writing this: > > (dynamic-require (build-path "main.ss") (void)) > > but nothing happened. I then tried refactoring main.ss and bundling > the code into a "run-application" procedure: > > (let ([run-application (dynamic-require (build-path "main.ss") > 'run-application)]) > (run-application)) > > Doing this makes the application run twice. The docs say that dynamic- > require "visits" and "instantiates" a module when a variable name is > specified, but only "instantiates" the module if void is specified. Actually, it only visits (i.e., runs the compile-time part of) a module if `(void)' is given as the second argument. Supplying `(void)' doesn't run the run-time part. That's probably the opposite of what you want. > 1. Is there a way of visiting and instantiating a module without > requiring a particular variable? I think you probably want `(dynamic-require ... #f)', which instantiates the module (i.e., runs the run-time part) but doesn't bother to visit it (i.e., run the compile-time part). In your `run-application' variant, did the module body already contain a `(run-application)' call? That would explain why it ran twice: once when instantiating the module, and again when the `dynamic-require' result was called. Not calling `(run-application)' after `dynamic-require' is essentially the same as supplying #f to `dynamic-require'. Matthew From vyzo at media.mit.edu Thu Nov 13 10:59:58 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:08 2009 Subject: [plt-scheme] make/setup-extension broken: missing xform keyword-argument Message-ID: compiler/xform/xform obtained a new required keyword argument (keep-lines?), which breaks make/setup-extension (which does not know such argument and doesn't supply it) -- vyzo From mflatt at cs.utah.edu Thu Nov 13 11:03:39 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:08 2009 Subject: [plt-scheme] make/setup-extension broken: missing xform keyword-argument In-Reply-To: References: Message-ID: <20081113160340.2777B6500AE@mail-svr1.cs.utah.edu> At Thu, 13 Nov 2008 10:59:58 -0500 (EST), Dimitris Vyzovitis wrote: > compiler/xform/xform obtained a new required keyword argument > (keep-lines?), which breaks make/setup-extension (which does not know such > argument and doesn't supply it) That was supposed to be an optional argument --- now fixed in SVN. Matthew From vyzo at media.mit.edu Thu Nov 13 11:05:47 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:09 2009 Subject: [plt-scheme] make/setup-extension broken: missing xform keyword-argument In-Reply-To: References: Message-ID: On Thu, 13 Nov 2008, Dimitris Vyzovitis wrote: > compiler/xform/xform obtained a new required keyword argument (keep-lines?), > which breaks make/setup-extension (which does not know such argument and > doesn't supply it) trivial patch (makes the keyword argument in xform optional) -- vyzo -------------- next part -------------- Index: collects/compiler/xform.ss =================================================================== --- collects/compiler/xform.ss (revision 12422) +++ collects/compiler/xform.ss (working copy) @@ -5,7 +5,7 @@ (provide xform) -(define (xform quiet? src dest header-dirs #:keep-lines? keep-lines?) +(define (xform quiet? src dest header-dirs #:keep-lines? (keep-lines? #f)) (let ([exe (current-extension-compiler)] [flags (expand-for-compile-variant (current-extension-preprocess-flags))] From d.j.gurnell at gmail.com Thu Nov 13 11:13:24 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:33:09 2009 Subject: [plt-scheme] dynamic-require with no "provided" argument In-Reply-To: <20081113140325.DBD156500CB@mail-svr1.cs.utah.edu> References: <20081113140325.DBD156500CB@mail-svr1.cs.utah.edu> Message-ID: > I think you probably want `(dynamic-require ... #f)', which > instantiates the module (i.e., runs the run-time part) but doesn't > bother to visit it (i.e., run the compile-time part). Ah. I seeeeeeeeee. I misunderstood the docs there. I thought #f was something else. > In your `run-application' variant, did the module body already contain > a `(run-application)' call? That would explain why it ran twice: once > when instantiating the module, and again when the `dynamic-require' > result was called. Not calling `(run-application)' after > `dynamic-require' is essentially the same as supplying #f to > `dynamic-require'. Yes. My email wasn't clear but that's definitely what was happening. Thanks! -- Dave From dvanhorn at ccs.neu.edu Thu Nov 13 15:59:03 2008 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:33:09 2009 Subject: [plt-scheme] Screen capture on Mac OS X Message-ID: <491C9517.8040408@ccs.neu.edu> How can I capture a DrScheme screen shot under Mac OS X? The usual route, DrScheme > Services > Grab > Screen, is not available (at least under 4.1.2.4-svn12nov2008). Thanks, David From jensaxel at soegaard.net Thu Nov 13 16:05:24 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:09 2009 Subject: [plt-scheme] Screen capture on Mac OS X In-Reply-To: <491C9517.8040408@ccs.neu.edu> References: <491C9517.8040408@ccs.neu.edu> Message-ID: <491C9694.2010400@soegaard.net> David Van Horn wrote: > How can I capture a DrScheme screen shot under Mac OS X? The standard OS X keybindinds are as follows: Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard In Leopard, the following keys can be held down while selecting an area (via Command-Shift-4 or Command-Control-Shift-4): Space, to lock the size of the selected region and instead move it when the mouse moves Shift, to resize only one edge of the selected region Option, to resize the selected region with its center as the anchor point -- Jens Axel S?gaard From mflatt at cs.utah.edu Thu Nov 13 16:25:38 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:09 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> Message-ID: <20081113212538.C6B426500B9@mail-svr1.cs.utah.edu> At Tue, 4 Nov 2008 14:20:13 +0000, "Stephen De Gabrielle" wrote: > Is there a function to read a whole file into memory (as a string) > > (lambda (i) (read-string 80000 i)) > or is there something better? As of 4.1.2.5, we've added many convenience functions to `scheme/file' and `scheme/port'. Also, `scheme' now re-exports `scheme/port'. Added to `scheme/file': file->string file->bytes file->value ; composes `call-with-input-file*' and `read' file->lines file->bytes-lines display-lines-to-file ; complements both file->lines and file->bytes-lines write-to-file display-to-file Added to `scheme/port': call-with-input-string call-with-input-bytes with-input-from-string with-input-from-bytes call-with-output-string call-with-output-bytes with-output-to-string with-output-to-bytes port->string port->bytes port->lines port->bytes-lines display-lines Matthew From jay.mccarthy at gmail.com Thu Nov 13 16:26:18 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:09 2009 Subject: [plt-scheme] web-server struct binding:file - content-type ? In-Reply-To: <779bf2730811061557n14682213ufecee347631098c0@mail.gmail.com> References: <779bf2730811051713s3bd6c9f9wc851bc0b7ad7a4d4@mail.gmail.com> <779bf2730811052343w660c9b26uade7008099fcb3c5@mail.gmail.com> <779bf2730811061557n14682213ufecee347631098c0@mail.gmail.com> Message-ID: I've added support for this to the server. The MIME headers are now part of the binding:file structure. Attached is a sample servlet that demonstrates. Jay #lang scheme (require web-server/servlet) (provide (all-defined-out)) (define interface-version 'v1) (define timeout +inf.0) (define (start initial-request) (define req (send/suspend (lambda (k-url) `(html (body (form ([action ,k-url] [method "post"] [enctype "multipart/form-data"]) (input ([type "file"] [name "somename"])) (input ([type "submit"])))))))) (define (header->xexpr h) (match h [(struct header (field value)) `(li (ul (li "Field: " ,(bytes->string/utf-8 field)) (li "Value: " ,(bytes->string/utf-8 value))))])) (define (binding->xexpr b) (match b [(struct binding:form (field value)) `(li (ul (li "Field: " ,(bytes->string/utf-8 field)) (li "Value: " ,(bytes->string/utf-8 value))))] [(struct binding:file (field filename headers content)) `(li (ul (li "Field: " ,(bytes->string/utf-8 field)) (li "Name: " ,(bytes->string/utf-8 filename)) (li "Headers: " (ul ,@(map header->xexpr headers))) (li "Contents: " (pre ,(bytes->string/utf-8 content)))))])) `(html (body ([bgcolor "white"]) (p "Uploaded:" (ul ,@(map binding->xexpr (request-bindings/raw req))))))) On Thu, Nov 6, 2008 at 4:57 PM, YC wrote: > I've tested on Firefox, Lynx, and IE. I suspect other browsers will also > send it. > > Content-Type generally sits right below the Content-Disposition line in the > MIME parts. > > Thanks, > yc > > On Thu, Nov 6, 2008 at 3:41 PM, Jay McCarthy wrote: >> >> I'll add it. Do you know if I need to use any particular browser to get it >> sent? >> >> Jay >> > > -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From hag at linnaean.org Thu Nov 13 19:07:54 2008 From: hag at linnaean.org (Daniel Hagerty) Date: Thu Mar 26 02:33:09 2009 Subject: [plt-scheme] NetBSD build and wchar_t In-Reply-To: Matthew Flatt's message of "Wed, 12 Nov 2008 17:33:41 -0700" References: <20081112161033.GA27210@jungfrau.pckswarms.ch> <20081112222435.A53256500B7@mail-svr1.cs.utah.edu> <20081113003342.C341D6500D4@mail-svr1.cs.utah.edu> Message-ID: Matthew Flatt writes: > I've added this support to xform, at least for what seems to be gcc's > notation for source locations. It's enabled by `configure' when the > compiler is "gcc". I tried SVN 12429, and that's a no go. The source-location annotations that are emitted have lost the flag information; for example # 39 "/usr/include/stddef.h" 2 3 4 comes out as # 39 "/usr/include/stddef.h" The "3" flag is the critical one for a wchar_t typedef being ignored. From mflatt at cs.utah.edu Thu Nov 13 23:09:10 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:10 2009 Subject: [plt-scheme] NetBSD build and wchar_t In-Reply-To: References: <20081112161033.GA27210@jungfrau.pckswarms.ch> <20081112222435.A53256500B7@mail-svr1.cs.utah.edu> <20081113003342.C341D6500D4@mail-svr1.cs.utah.edu> Message-ID: <20081114040913.09D086500AE@mail-svr1.cs.utah.edu> At 13 Nov 2008 19:07:54 -0500, Daniel Hagerty wrote: > The source-location annotations that are emitted have lost the flag > information; for example > > # 39 "/usr/include/stddef.h" 2 3 4 > > comes out as > # 39 "/usr/include/stddef.h" > > The "3" flag is the critical one for a wchar_t typedef being ignored. The current version in SVN now detects and preserves the "3" flag. Thanks for your help in testing the changes, Matthew From deriddersteve at hotmail.com Fri Nov 14 05:04:37 2008 From: deriddersteve at hotmail.com (Steve De Ridder) Date: Thu Mar 26 02:33:10 2009 Subject: [plt-scheme] rotate bmp onclick In-Reply-To: <20081114040913.09D086500AE@mail-svr1.cs.utah.edu> References: <20081112161033.GA27210@jungfrau.pckswarms.ch> <20081112222435.A53256500B7@mail-svr1.cs.utah.edu> <20081113003342.C341D6500D4@mail-svr1.cs.utah.edu> <20081114040913.09D086500AE@mail-svr1.cs.utah.edu> Message-ID: dear newslist-members, i'm pretty new in the scheme / mred language. for the moment, i'm writing a "magic the gathering" application in scheme. therefore, i have to be able to tap / rotate my own defined card (a simple bitmap) when i click it. i read about this on http://osdir.com/ml/lisp.scheme.plt/2003-05/msg00117.html but didn't find the solution (or is this due to my poor english -english is only my third language)can anyone please point this out for me? thank you in advance! sincerely, steve de ridderassistent mathematics and statisticsroyal military academybrusselsbelgium _________________________________________________________________ Windows Live Hotmail now works up to 70% faster. http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081114/5627b3db/attachment.html From spdegabrielle at gmail.com Fri Nov 14 05:09:48 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:10 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <20081113212538.C6B426500B9@mail-svr1.cs.utah.edu> References: <595b9ab20811040620m544f717doeda06c540131133d@mail.gmail.com> <20081113212538.C6B426500B9@mail-svr1.cs.utah.edu> Message-ID: <595b9ab20811140209y10d3cd34ge314bb904dd585f5@mail.gmail.com> Thank you, Cheers, Stephen On Thu, Nov 13, 2008 at 9:25 PM, Matthew Flatt wrote: > At Tue, 4 Nov 2008 14:20:13 +0000, "Stephen De Gabrielle" wrote: >> Is there a function to read a whole file into memory (as a string) >> >> (lambda (i) (read-string 80000 i)) >> or is there something better? > > As of 4.1.2.5, we've added many convenience functions to `scheme/file' > and `scheme/port'. Also, `scheme' now re-exports `scheme/port'. > > > Added to `scheme/file': > > file->string > file->bytes > file->value ; composes `call-with-input-file*' and `read' > file->lines > file->bytes-lines > display-lines-to-file ; complements both file->lines and file->bytes-lines > write-to-file > display-to-file > > Added to `scheme/port': > > call-with-input-string > call-with-input-bytes > with-input-from-string > with-input-from-bytes > call-with-output-string > call-with-output-bytes > with-output-to-string > with-output-to-bytes > port->string > port->bytes > port->lines > port->bytes-lines > display-lines > > > Matthew > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From d.j.gurnell at gmail.com Fri Nov 14 05:23:28 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:33:11 2009 Subject: [plt-scheme] Screen capture on Mac OS X In-Reply-To: <491C9694.2010400@soegaard.net> References: <491C9517.8040408@ccs.neu.edu> <491C9694.2010400@soegaard.net> Message-ID: It might be worth adding that these keys can be enabled/disabled in the "Keyboard & Mouse" preference pane. -- Dave > David Van Horn wrote: >> How can I capture a DrScheme screen shot under Mac OS X? > The standard OS X keybindinds are as follows: > > Command-Shift-3: Take a screenshot of the screen, and save it as a > file on the desktop > Command-Shift-4, then select an area: Take a screenshot of an area > and save it as a file on the desktop > Command-Shift-4, then space, then click a window: Take a screenshot > of a window and save it as a file on the desktop > Command-Control-Shift-3: Take a screenshot of the screen, and save > it to the clipboard > Command-Control-Shift-4, then select an area: Take a screenshot of > an area and save it to the clipboard > Command-Control-Shift-4, then space, then click a window: Take a > screenshot of a window and save it to the clipboard > > In Leopard, the following keys can be held down while selecting an > area (via Command-Shift-4 or Command-Control-Shift-4): > > Space, to lock the size of the selected region and instead move it > when the mouse moves > Shift, to resize only one edge of the selected region > Option, to resize the selected region with its center as the anchor > point > > > -- > Jens Axel S?gaard From spdegabrielle at gmail.com Fri Nov 14 05:49:40 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:11 2009 Subject: [plt-scheme] pretty html source Message-ID: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> Is there a way to prettify the html generated by DrScheme It currently comes out as a single line, and inserting some line-breaks would help readability in view-source. Cheers, Stephen From spdegabrielle at gmail.com Fri Nov 14 06:15:23 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:11 2009 Subject: [plt-scheme] Re: pretty html source In-Reply-To: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> References: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> Message-ID: <595b9ab20811140315s18e5b3d5k28b7acfddb2703ff@mail.gmail.com> Sorry, worked it out I just need to include "\r"'s whenever I need a new line being careful not to put the new line inside a tag: '(form "\r" ((action ' causes an error. Cheers, Stephen On Fri, Nov 14, 2008 at 10:49 AM, Stephen De Gabrielle wrote: > Is there a way to prettify the html generated by DrScheme > > It currently comes out as a single line, and inserting some > line-breaks would help readability in view-source. > > Cheers, > > Stephen > From d.j.gurnell at gmail.com Fri Nov 14 06:24:50 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:33:11 2009 Subject: [plt-scheme] Re: pretty html source In-Reply-To: <595b9ab20811140315s18e5b3d5k28b7acfddb2703ff@mail.gmail.com> References: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> <595b9ab20811140315s18e5b3d5k28b7acfddb2703ff@mail.gmail.com> Message-ID: <86AAA77A-DF83-4B21-9511-049D1498D30F@gmail.com> Dave Herman's PPrint package would be good for this sort of thing. It should only take 30 mins or so to knock up a first version using that and scheme/match. I'm definitely considering building this into Mirrors. Code contributions and Trac feature requests welcome :) Cheers, -- Dave > Sorry, worked it out > I just need to include "\r"'s whenever I need a new line > being careful not to put the new line inside a tag: '(form "\r" > ((action ' causes an error. > > Cheers, > > Stephen From eli at barzilay.org Fri Nov 14 06:24:27 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:11 2009 Subject: [plt-scheme] Bug report / request for comment concerning foreign.ss In-Reply-To: <49106ACC.20108@acanac.net> References: <49106ACC.20108@acanac.net> Message-ID: <18717.24555.768251.278839@arabic.ccs.neu.edu> On Nov 4, Ernie Smith wrote: > (module ffi-bug mzscheme > (require (lib "foreign.ss" )) ;; (unsafe!) > ;; > ;; BUG / FEATURE > ;; > ;; When declaring a c structure using define-cstruct > ;; ctype-sizeof reports more bytes than was asked for > ;; in the declaration. > ;; > ;; This bug is illustrated by the code and results below. > ;; > ;; The response I expect to this bug report is that it is in fact > ;; a feature as opposed to a bug. > ;; > ;; To save an iteration on the Q & A loop. > ;; I'm going to anticipate that response and reply to it: > ;; > ;; Whether or not a structure is implicitly padded may not be in the > ;; control of the programmer developing the scheme interface to a C > ;; library. Some structures will be padded others won't be so the > ;; marshalling infrastructure has to expose control of padding and > ;; alignment to the programmer defining an interface. > ;; > ;; In my opinion it is generally a mistake to hide such > ;; behaviour because the programmer needs to be thinking about > ;; the issue. Hiding it leads to mistakes. > ;; It is desirable to leave the padding/alignment issue in the open. > ;; > ;; To be clear, individual interfaces can vary on the same O.S. on > ;; the same hardware. C compiler features permit individual structures > ;; to be padded or not as and when required. Yes, that's all true, but there are certain rules about how to lay out C data in structs which libffi uses -- and the foreign interface basically exposes that at the Scheme level. Even more than that, there is Scheme code that need to figure out the same numbers because (AFAICT) libffi provides an interface to make new C struct types, but no way to know their offsets -- so "collects/mzlib/foreign.ss" has a function called `compute-offsets' which computes the offsets so it can initialize such structs. So the only thing that is needed for things to be as flexible as you want is for libffi to have a more generic interface that allows me to create a new type where I specify its size and alignment. But this would only matter when you have structs that are substructs or that are passed by value -- if the only way to move these things around is by reference, then you can easily do so -- use an explicit number of bytes to malloc, and set/ref things from the right offsets. It won't be convenient, but it's possible. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Fri Nov 14 06:41:37 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:11 2009 Subject: [plt-scheme] reading a whole file In-Reply-To: <554142449@web.de> References: <554142449@web.de> Message-ID: <18717.25585.96002.645167@arabic.ccs.neu.edu> On Nov 12, Thomas Chust wrote: > On Nov 11, Eli Barzilay wrote: > > On Nov 10, Ben Goetter wrote: > > > Only helpful for byte files, or for those rare text files whose > > > encoding matches that of PLT Scheme's UCS-4 strings. I agree, > > > would certainly address the performance issues mentioned. > > > > Another problem is that the memory must be out of the GC's hand, > > which adds another layer of complication. Also, I don't see how > > this kind of a `mutable' byte string is useful -- it's only in > > rare cases that you need to edit things in-place. > > This may be a small problem, although I doubt it is any problem at > all for a precise garbage collector. But it is certainly not a > problem that would be newly introduced: The necessary feature > already exists in PLT Scheme -- look for make-sized-byte-string in > the documentation of scheme/foreign. Yeah, I know about it... The point is that doing this at the core means that bytes are a little uniform which can make things a little more complicated and in this case there's little gain. But these problems are not too serious -- which is exactly why it should be easy to do this at the Scheme level, using the foreign interface. > As for the mutability: I agree that most of the time you would not > want to modify the string and even if you wanted to modify the > string, you would maybe not want the modifications to be written to > disk. But memory mapping offers all these possibilities through > combinations of either read or read/write protection and either > private copy on write or shared mapping. If memory mapping was > implemented, I think it should be implemented right, with all the > available features. Sounds like a nice project... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Fri Nov 14 06:56:26 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:11 2009 Subject: [plt-scheme] Re: pretty html source In-Reply-To: <86AAA77A-DF83-4B21-9511-049D1498D30F@gmail.com> References: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> <595b9ab20811140315s18e5b3d5k28b7acfddb2703ff@mail.gmail.com> <86AAA77A-DF83-4B21-9511-049D1498D30F@gmail.com> Message-ID: <18717.26474.91336.823439@arabic.ccs.neu.edu> On Nov 14, Dave Gurnell wrote: > Dave Herman's PPrint package would be good for this sort of > thing. It should only take 30 mins or so to knock up a first version > using that and scheme/match. > > I'm definitely considering building this into Mirrors. Code > contributions and Trac feature requests welcome :) That's much more difficult than it sounds... It's easy to do something simple -- actually, the xml collection *can* print stuff with indentation: (display-xml/content (xexpr->xml '(p (ul (li "foo") (li "bar"))))) but it doesn't take into account places where you shouldn't add whitespaces (like after "
  • " and before "
  • " in that example). I have some code that prints things indented and does not mess things up, but it was difficult write. My excuse for that was that I'll be writing scripts that will output htmls that people will later edit, but in retrospect it's really not worth the effort (the indentation doesn't look like it makes sense when it's correct). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From d.j.gurnell at gmail.com Fri Nov 14 08:00:22 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:33:12 2009 Subject: [plt-scheme] Re: pretty html source In-Reply-To: <18717.26474.91336.823439@arabic.ccs.neu.edu> References: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> <595b9ab20811140315s18e5b3d5k28b7acfddb2703ff@mail.gmail.com> <86AAA77A-DF83-4B21-9511-049D1498D30F@gmail.com> <18717.26474.91336.823439@arabic.ccs.neu.edu> Message-ID: <84219886-6395-448F-B698-C255BA3808F0@gmail.com> Eli wrote: > Dave wrote: >> I'm definitely considering building [HTML pretty printing] into >> Mirrors. [...] > > That's much more difficult than it sounds... It's easy to do > something simple -- actually, the xml collection *can* print stuff > with indentation: > > (display-xml/content (xexpr->xml '(p (ul (li "foo") (li "bar"))))) > > but it doesn't take into account places where you shouldn't add > whitespaces (like after "
  • " and before "
  • " in that example) > [...] Oh absolutely. The "simple" version I was referring to was a naive one you suggested above. I was previously content to rely on pretty-printing plugins for Firefox to do my formatting for me (the "View Source Chart" extension is quite good). I'm really impressed with PPrint, though, so now I'm now tempted to give some full-featured Scheme code a try. Come to think of it (and as an aside), there *is* a reason I haven't put pretty printing into Mirrors yet... the compile-time rendering features make it difficult to do. By default, something like: (xml (p "Hi " (b ,name))) is macro-transformed to the equivalent of: (xml (!raw "

    Hi ") ,name (!raw "

    ")) This feature can be turned off but !raw blocks are always available to the programmer and it's not obvious now to handle them in pretty printed output. Suggestions welcome. -- Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081114/e27a8bb8/attachment.htm From spdegabrielle at gmail.com Fri Nov 14 08:10:26 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:12 2009 Subject: [plt-scheme] HTML templating Message-ID: <595b9ab20811140510w6f3e8eebs97a969788393fb02@mail.gmail.com> Hi, What do people use for html templating? (when designing pages in Dreamweaver etc.) Cheers, Stephen From jay.mccarthy at gmail.com Fri Nov 14 08:12:38 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:12 2009 Subject: [plt-scheme] HTML templating In-Reply-To: <595b9ab20811140510w6f3e8eebs97a969788393fb02@mail.gmail.com> References: <595b9ab20811140510w6f3e8eebs97a969788393fb02@mail.gmail.com> Message-ID: Probably nothing. =) I'm working on something. Expect documentation and examples in the near future. Jay On Fri, Nov 14, 2008 at 6:10 AM, Stephen De Gabrielle wrote: > Hi, > > What do people use for html templating? (when designing pages in > Dreamweaver etc.) > > > Cheers, > > Stephen > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From jay.mccarthy at gmail.com Fri Nov 14 08:44:58 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:12 2009 Subject: [plt-scheme] Web Server Documentation Reorganization Message-ID: The PLT Web Server manual was organized too much like a reference manual with little guide to a user to understand how some modules fits in to the big picture. I've reorganized the documentation with the following paradigm: --- Running the Web Server --- Writing Servlets --- Extending the Web Server Other improvement related to this: I've added examples to almost every servlet function. I have integrated the stateless and non-stateless servlet documentation to put stateless servlets on a more secure footing and make it clear that they are usable in real applications. I've created an HTTP sub-module that encapsulates most of the HTTP handling. (This will limit the need to use what used to be considered internal Web Server functions.) Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From pocmatos at gmail.com Fri Nov 14 08:47:30 2008 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:33:13 2009 Subject: [plt-scheme] OT: Missing Rhys Price Jones Video Message-ID: <11b141710811140547j51e946e0p5b92811a0900d4b@mail.gmail.com> Hi all, Sorry for the off-topic, but does anyone know where I can watch the presentation Rhys Price Jones: DNA analysis from: http://www.cs.indiana.edu/dfried_celebration.html whose link doesn't work anymore? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From eli at barzilay.org Fri Nov 14 10:05:56 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:13 2009 Subject: [plt-scheme] Re: pretty html source In-Reply-To: <84219886-6395-448F-B698-C255BA3808F0@gmail.com> References: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> <595b9ab20811140315s18e5b3d5k28b7acfddb2703ff@mail.gmail.com> <86AAA77A-DF83-4B21-9511-049D1498D30F@gmail.com> <18717.26474.91336.823439@arabic.ccs.neu.edu> <84219886-6395-448F-B698-C255BA3808F0@gmail.com> Message-ID: <18717.37844.328207.205430@arabic.ccs.neu.edu> On Nov 14, Dave Gurnell wrote: > > Oh absolutely. The "simple" version I was referring to was a naive > one you suggested above. FWIW, the code that I used would do something like this with the previous example:

      ; no space after the

      , but the next line

    • blah
    • ; has four spaces because it's two levels
    • blah
    • ; in

    This means that for each html tag I need to keep information about whether whitespace being ignored (for example,
      ), not ignored (
    • and

      ), or "very not ignored" as in

      .  It was a mess, and
      definitely too much work for too little profit.
      
      
      > I was previously content to rely on pretty-printing plugins for
      > Firefox to do my formatting for me (the "View Source Chart"
      > extension is quite good). I'm really impressed with PPrint, though,
      > so now I'm now tempted to give some full-featured Scheme code a try.
      > 
      > Come to think of it (and as an aside), there *is* a reason I haven't
      > put pretty printing into Mirrors yet... the compile-time rendering
      > features make it difficult to do. By default, something like:
      > 
      >    (xml (p "Hi " (b ,name)))
      > 
      > is macro-transformed to the equivalent of:
      > 
      >    (xml (!raw "

      Hi ") ,name (!raw "

      ")) > > This feature can be turned off but !raw blocks are always available > to the programmer and it's not obvious now to handle them in pretty > printed output. Suggestions welcome. Looks like you'll have to translate that to raw strings that will appear one line, with a `break' tokens that carry the indentation level that they must go in. That's for the "simple approach"; for the real pprint way you'll probably need to add soft and hard breaks, and probably even breaks at different levels of soft/hard. So my opinion is that this is even more work for an even less gain (since it's even less likely that someone will take generated pages and edit them). The only utility I can see in this is debugging -- and things like browser view of the xml tree or a dom inspector are much better at doing these things anyway. (And that's really pointing at the ridiculousness of the xml syntax with its "human readable" redundancy -- it's only a question of time until no manually-written html pages exist.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From d.j.gurnell at gmail.com Fri Nov 14 10:32:44 2008 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:33:13 2009 Subject: [plt-scheme] Re: pretty html source In-Reply-To: <18717.37844.328207.205430@arabic.ccs.neu.edu> References: <595b9ab20811140249l462cf8cakbfa2b817de80be72@mail.gmail.com> <595b9ab20811140315s18e5b3d5k28b7acfddb2703ff@mail.gmail.com> <86AAA77A-DF83-4B21-9511-049D1498D30F@gmail.com> <18717.26474.91336.823439@arabic.ccs.neu.edu> <84219886-6395-448F-B698-C255BA3808F0@gmail.com> <18717.37844.328207.205430@arabic.ccs.neu.edu> Message-ID: Eli wrote: > [...] (And that's really pointing at the ridiculousness of the xml > syntax > with its "human readable" redundancy -- it's only a question of time > until no manually-written html pages exist.) Heh. Good point well made! -- Dave From jay.mccarthy at gmail.com Fri Nov 14 16:59:41 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:13 2009 Subject: [plt-scheme] Re: Web Server Documentation Reorganization In-Reply-To: References: Message-ID: Just realized the copy from the blog didn't get the links. Docs: http://docs.plt-scheme.org/web-server/index.html Writing Servlets: http://docs.plt-scheme.org/web-server/Writing_Servlets.html Stateless: http://docs.plt-scheme.org/web-server/stateless-servlets.html HTTP module: http://docs.plt-scheme.org/web-server/http.html On Fri, Nov 14, 2008 at 6:44 AM, Jay McCarthy wrote: > The PLT Web Server manual was organized too much like a reference > manual with little guide to a user to understand how some modules fits > in to the big picture. I've reorganized the documentation with the > following paradigm: > > --- Running the Web Server > --- Writing Servlets > --- Extending the Web Server > > Other improvement related to this: I've added examples to almost every > servlet function. I have integrated the stateless and non-stateless > servlet documentation to put stateless servlets on a more secure > footing and make it clear that they are usable in real applications. > I've created an HTTP sub-module that encapsulates most of the HTTP > handling. (This will limit the need to use what used to be considered > internal Web Server functions.) > > Jay > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://jay.teammccarthy.org > > "The glory of God is Intelligence" - D&C 93 > -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From jvjulien at free.fr Fri Nov 14 05:27:40 2008 From: jvjulien at free.fr (jeeve) Date: Thu Mar 26 02:33:13 2009 Subject: [plt-scheme] Re: world.ss - combination of keys In-Reply-To: References: Message-ID: <4937bec9-5a58-470b-880e-267029eb9f90@w39g2000prb.googlegroups.com> Thanks a lot for your explanation. I'm going to try to test the universe ! On 31 oct, 15:35, Matthias Felleisen wrote: > Voil?, but you may also want to look at the experimental universe.ss ? > teachpack and its documentation: > > ? ?http://www.ccs.neu.edu/home/matthias/107-f08/Universe/universe2.ss > ? ?http://www.ccs.neu.edu/home/matthias/107-f08/Universe/universe/ > index.html > > This will allow you to have two computers for two players (and soon N ? > for N). > > Also, the use of state/assignment is superfluous. The world/universe ? > is entirely functional. If you insist on using state, try use (void) ? > as the first and only world -- Matthias > > (define-struct jeu-mobile (gauche droit turn)) > ;; JeuMobile is (make-jeu-mobile Posn Posn GD) > ;; GD is one of: 'gauche ou 'droit > > (define (changer-direction j key) > ? ?(let* ((jmg (jeu-mobile-gauche j)) > ? ? ? ? ? (jmd (jeu-mobile-droit j)) > ? ? ? ? ? (y1 (posn-y jmg)) > ? ? ? ? ? (y2 (posn-y jmd))) > ? ? ?(begin > ? ? ? ?(cond > ? ? ? ? ?((key=? key #\a) (set-jeu-mobile-turn! j 'gauche)) > ? ? ? ? ?((key=? key #\q) (set-jeu-mobile-turn! j 'droit)) > ? ? ? ? ?((key=? key 'up) > ? ? ? ? ? (if (symbol=? (jeu-mobile-turn j) 'droit) > ? ? ? ? ? ? ? (set-posn-y! jmd (- y2 10)) > ? ? ? ? ? ? ? (set-posn-y! jmg (- y1 10)))) > ? ? ? ? ?((key=? key 'down) > ? ? ? ? ? (if (symbol=? (jeu-mobile-turn j) 'droit) > ? ? ? ? ? ? ? (set-posn-y! jmd (+ y2 10)) > ? ? ? ? ? ? ? (set-posn-y! jmg (+ y1 10))))) > ? ? ? ?j))) > > (check-expect > ? (let ([j (make-jeu-mobile (make-posn 10 20) (make-posn 30 40) ? > 'gauche)]) > ? ? (begin > ? ? ? (changer-direction j #\a) > ? ? ? (changer-direction j 'up))) > ? (make-jeu-mobile (make-posn 10 10) (make-posn 30 40) 'gauche)) > > (check-expect > ? (let ([j (make-jeu-mobile (make-posn 10 20) (make-posn 30 40) ? > 'droite)]) > ? ? (begin > ? ? ? (changer-direction j #\a) > ? ? ? (changer-direction j 'down))) > ? (make-jeu-mobile (make-posn 10 30) (make-posn 30 40) 'gauche)) > > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From vyzo at media.mit.edu Sat Nov 15 08:49:14 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:14 2009 Subject: [plt-scheme] annoying cookies and doc search box Message-ID: The search box has started leaving cookies in the browser, which is *extremely* annoying when searching the docs in local installation with firefox 3. Specifically, when the browser option for asking before setting cookies is enabled the damn thing will keep asking every time (even when you accept the first time and ask it to stop asking!), presumably because there is no site. The cookie disalog is presented as "the site file:// wants to set a cookie blah blah blah". I don't know whether this is a bug in firefox or a bug in the generated docs, but why is the search box setting cookies in the first place? At the very least, when browsing locally from the file system it should not. firefox 3.0.3, GNU, plt-4.1.2.5 if you want to reproduce -- vyzo From vyzo at media.mit.edu Sat Nov 15 08:51:24 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:14 2009 Subject: [plt-scheme] annoying cookies and doc search box In-Reply-To: References: Message-ID: On Sat, 15 Nov 2008, Dimitris Vyzovitis wrote: > The search box has started leaving cookies in the browser, which is > *extremely* annoying when searching the docs in local installation with > firefox 3. > > Specifically, when the browser option for asking before setting cookies is > enabled the damn thing will keep asking every time (even when you accept the > first time and ask it to stop asking!), presumably because there is no site. > The cookie disalog is presented as "the site file:// wants to set a cookie > blah blah blah". > > I don't know whether this is a bug in firefox or a bug in the generated docs, > but why is the search box setting cookies in the first place? At the very > least, when browsing locally from the file system it should not. > > firefox 3.0.3, GNU, plt-4.1.2.5 if you want to reproduce Firefox bug apparently: https://bugzilla.mozilla.org/show_bug.cgi?id=430045 -- vyzo From jensaxel at soegaard.net Sat Nov 15 09:01:57 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:14 2009 Subject: [plt-scheme] annoying cookies and doc search box In-Reply-To: References: Message-ID: <491ED655.7080608@soegaard.net> Dimitris Vyzovitis wrote: > Firefox bug apparently: > https://bugzilla.mozilla.org/show_bug.cgi?id=430045 I am not sure whether it makes a difference or not, but I created an account and voted for the bug ('s removal). Maybe this will get fixed faster, if we vote for it. /Jens Axel From vladimir at ok2home.net Sat Nov 15 08:38:27 2008 From: vladimir at ok2home.net (Vladimir Konrad) Date: Thu Mar 26 02:33:14 2009 Subject: [plt-scheme] custodian - how to exit program when memory limit is exceeded Message-ID: <20081115133827.3f3f6f39@svr0.h.dearm.co.uk> Hello, I am trying to make the main program exit if it exceeds memory limit. The following (test) code does not do it: #lang scheme (custodian-limit-memory (current-custodian) 1) (define x '(1 2 3 4 5 6 7)) (write "got here")(newline) I tried to search but did not find much... Or is it that sub-custodian cannot change the level above? Vlad From mflatt at cs.utah.edu Sat Nov 15 09:21:44 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:15 2009 Subject: [plt-scheme] custodian - how to exit program when memory limit is exceeded In-Reply-To: <20081115133827.3f3f6f39@svr0.h.dearm.co.uk> References: <20081115133827.3f3f6f39@svr0.h.dearm.co.uk> Message-ID: <20081115142146.1E7E76500A8@mail-svr1.cs.utah.edu> At Sat, 15 Nov 2008 13:38:27 +0000, Vladimir Konrad wrote: > I am trying to make the main program exit if it exceeds memory limit. > > The following (test) code does not do it: > > > #lang scheme > > (custodian-limit-memory (current-custodian) 1) > (define x '(1 2 3 4 5 6 7)) > (write "got here")(newline) If you add (collect-garbage) before the last line, then it will exit. Memory limits are checked only after a GC --- though in useful applications it's an automatic GC that detects the excessive memory use, instead of an explicit call to `collect-garbage'. Matthew From vladimir at ok2home.net Sat Nov 15 09:33:34 2008 From: vladimir at ok2home.net (Vladimir Konrad) Date: Thu Mar 26 02:33:15 2009 Subject: [plt-scheme] memory leak (program attached) Message-ID: <20081115143334.440cda26@svr0.h.dearm.co.uk> Hello, I am trying to trace memory leak in program, which loads images and samples the pixels (the file attached works but leaks memory). I am not sure what I am doing wrong... The "culprit" lines seem to be: (send bitmap-dc get-pixel x y colour) (list (send colour red) (send colour green) (send colour blue)) If I remove the do (x,y) loops from load-image, the program does not leak the memory. Is there a better way to do this? Kind regards, Vlad -------------- next part -------------- A non-text attachment was scrubbed... Name: read-images.ss Type: application/octet-stream Size: 1819 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081115/618687ec/read-images.obj From vyzo at media.mit.edu Sat Nov 15 09:37:43 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:16 2009 Subject: [plt-scheme] annoying cookies and doc search box In-Reply-To: <491ED655.7080608@soegaard.net> References: <491ED655.7080608@soegaard.net> Message-ID: On Sat, 15 Nov 2008, Jens Axel Soegaard wrote: > Dimitris Vyzovitis wrote: >> Firefox bug apparently: >> https://bugzilla.mozilla.org/show_bug.cgi?id=430045 > I am not sure whether it makes a difference or not, but > I created an account and voted for the bug ('s removal). > Maybe this will get fixed faster, if we vote for it. Good point, I'll do the same. -- vyzo From chust at web.de Fri Nov 14 14:47:11 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:33:16 2009 Subject: [plt-scheme] Bug in pattern matching with failure procedures and multiple return values Message-ID: <491DD5BF.3080107@web.de> Hello, I ran into a problem when using failure procedures in a match expression that was intended to return multiple values. Here is a simplified example: % mzscheme Welcome to MzScheme v4.1.2 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. > (match 'foo [_ (=> skip) (skip)] [_ (values 1 2)]) context expected 1 value, received 2 values: 1 2 The error only occurs if the declared failure procedure has actually been called, which feels very much like a bug :-( cu, Thomas From vladimir at ok2home.net Sat Nov 15 10:59:50 2008 From: vladimir at ok2home.net (Vladimir Konrad) Date: Thu Mar 26 02:33:16 2009 Subject: [plt-scheme] custodian - how to exit program when memory limit is exceeded In-Reply-To: <20081115142146.1E7E76500A8@mail-svr1.cs.utah.edu> References: <20081115133827.3f3f6f39@svr0.h.dearm.co.uk> <20081115142146.1E7E76500A8@mail-svr1.cs.utah.edu> Message-ID: <20081115155950.30e052a3@svr0.h.dearm.co.uk> > > The following (test) code does not do it: > > #lang scheme > > > > (custodian-limit-memory (current-custodian) 1) > > (define x '(1 2 3 4 5 6 7)) > > (write "got here")(newline) > > If you add > > (collect-garbage) > > before the last line, then it will exit. > > Memory limits are checked only after a GC --- though in useful > applications it's an automatic GC that detects the excessive memory > use, instead of an explicit call to `collect-garbage'. Thank you, it makes sense... The above code was a mock-up to see if it works, and with your addition it does... Vlad From vladimir at ok2home.net Sat Nov 15 11:32:22 2008 From: vladimir at ok2home.net (Vladimir Konrad) Date: Thu Mar 26 02:33:16 2009 Subject: [plt-scheme] memory leak (program attached) In-Reply-To: <20081115143334.440cda26@svr0.h.dearm.co.uk> References: <20081115143334.440cda26@svr0.h.dearm.co.uk> Message-ID: <20081115163222.5a286137@svr0.h.dearm.co.uk> > I am trying to trace memory leak in program, which loads images and > samples the pixels (the file attached works but leaks memory). > Is there a better way to do this? Seems that a simpler approach (without going through bitmap-dc) using bitmap object directly (to get the pixels) works without memory leak... Vlad From mflatt at cs.utah.edu Sat Nov 15 11:50:34 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:16 2009 Subject: [plt-scheme] memory leak (program attached) In-Reply-To: <20081115163222.5a286137@svr0.h.dearm.co.uk> References: <20081115143334.440cda26@svr0.h.dearm.co.uk> <20081115163222.5a286137@svr0.h.dearm.co.uk> Message-ID: <20081115165035.5ED456500A8@mail-svr1.cs.utah.edu> At Sat, 15 Nov 2008 16:32:22 +0000, Vladimir Konrad wrote: > > I am trying to trace memory leak in program, which loads images and > > samples the pixels (the file attached works but leaks memory). > > > Is there a better way to do this? > > Seems that a simpler approach (without going through bitmap-dc) using > bitmap object directly (to get the pixels) works without memory leak... I think you're seeing a bad interaction between generational collection and finalization of graphics objects. If I remove the `list' call from the inner loop in your code, then memory use seems to be bounded better. I think it's because the `list' calls trigger GCs that make the bitmap and its DC survive into the older generation. Then, due to the link from the DC to the bitmap and the ordering of finalizations, it takes two major collections to purge the bitmap. If that's correct, you'd also get better results by adding `(send bitmap-dc set-bitmap #f)' after the bitmap is used. There's a check in the system that triggers extra major collections when the number of bitmaps grows (because bitmaps and finalization interact badly in many ways). So, the system will eventually reach a steady state for your program --- but at much higher memory use than if the link is broken explicitly. Matthew From vladimir at ok2home.net Sat Nov 15 12:09:39 2008 From: vladimir at ok2home.net (Vladimir Konrad) Date: Thu Mar 26 02:33:17 2009 Subject: [plt-scheme] memory leak (program attached) In-Reply-To: <20081115165035.5ED456500A8@mail-svr1.cs.utah.edu> References: <20081115143334.440cda26@svr0.h.dearm.co.uk> <20081115163222.5a286137@svr0.h.dearm.co.uk> <20081115165035.5ED456500A8@mail-svr1.cs.utah.edu> Message-ID: <20081115170939.013448e0@svr0.h.dearm.co.uk> > At Sat, 15 Nov 2008 16:32:22 +0000, Vladimir Konrad wrote: > > > I am trying to trace memory leak in program, which loads images > > > and samples the pixels (the file attached works but leaks memory). > If that's correct, you'd also get better results by adding `(send > bitmap-dc set-bitmap #f)' after the bitmap is used. The "set-bitmap #f" does the trick, the memory usage stays constant while reading ~1000 of images. This is great and I do not have to re-write the program to use the bitmap% object directly :-). > There's a check in the system that triggers extra major collections > when the number of bitmaps grows (because bitmaps and finalization > interact badly in many ways). So, the system will eventually reach a > steady state for your program --- but at much higher memory use than > if the link is broken explicitly. Thank you very much for your help and explanations. Vlad From yinso.chen at gmail.com Sat Nov 15 20:20:19 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:33:17 2009 Subject: [plt-scheme] web-server: response/basic vs. response/full Message-ID: <779bf2730811151720j5956fa57r3bc4d5636687cdfb@mail.gmail.com> Hi - I've been tripping up trying to return a 304 Not Modified, until I found that if I return response/basic, the status is always 200. It seems that reduce potential usage for response/basic. Is there a significance for such a limitation? (I haven't upgraded to latest, so not sure if the behavior has changed). Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081115/ad69da76/attachment.htm From knubee at gmail.com Sat Nov 15 21:07:49 2008 From: knubee at gmail.com (knubee) Date: Thu Mar 26 02:33:18 2009 Subject: [plt-scheme] plt documentation source/tools? Message-ID: the plt documentation looks very nice in both html and pdf format. i'm wonder what was used as source -- and how the two formats were generated. if the original source is tex/latex, would it be possible to see the source for, say, the "quick introduction with pictures" http://download.plt-scheme.org/doc/4.1.1/html/quick/index.html http://download.plt-scheme.org/doc/pdf/quick.pdf this would help me see the details of which packages were used (slatex? etc.) and if tex/latex is the source, how was the html generated (tex4ht? or ?) thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081116/a0428d3d/attachment.html From robby at cs.uchicago.edu Sat Nov 15 21:14:14 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:18 2009 Subject: [plt-scheme] plt documentation source/tools? In-Reply-To: References: Message-ID: <932b2f1f0811151814x730185f8i74c5e56ccc0025f2@mail.gmail.com> That's funny you should ask! We built a whole new document building infrastructure (and when I say "we" I mostly mean "Matthew" and some "Eli" :). It's called Scribble and you can read about it in the docs themselves. Robby On Sat, Nov 15, 2008 at 8:07 PM, knubee wrote: > the plt documentation looks very nice in both html and pdf format. i'm > wonder what was used as source -- and how the two formats were generated. if > the original source is tex/latex, would it be possible to see the source > for, say, the "quick introduction with pictures" > > http://download.plt-scheme.org/doc/4.1.1/html/quick/index.html > > http://download.plt-scheme.org/doc/pdf/quick.pdf > > this would help me see the details of which packages were used (slatex? > etc.) > > and if tex/latex is the source, how was the html generated (tex4ht? or ?) > > thanks. > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From samth at ccs.neu.edu Sat Nov 15 21:22:29 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:33:18 2009 Subject: [plt-scheme] Bug in pattern matching with failure procedures and multiple return values In-Reply-To: <491DD5BF.3080107@web.de> References: <491DD5BF.3080107@web.de> Message-ID: <63bb19ae0811151822y1bcceab1v32f1bc9694238c32@mail.gmail.com> Yeah, that definitely looks like a bug. Can you file it in the bug tracker? Thanks, sam th On Fri, Nov 14, 2008 at 2:47 PM, Thomas Chust wrote: > Hello, > > I ran into a problem when using failure procedures in a match expression > that was intended to return multiple values. Here is a simplified example: > > % mzscheme > Welcome to MzScheme v4.1.2 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. >> (match 'foo [_ (=> skip) (skip)] [_ (values 1 2)]) > context expected 1 value, received 2 values: 1 2 > > The error only occurs if the declared failure procedure has actually > been called, which feels very much like a bug :-( > > cu, > Thomas > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From hdg at cox.net Sun Nov 16 00:36:54 2008 From: hdg at cox.net (H David Goering) Date: Thu Mar 26 02:33:18 2009 Subject: [plt-scheme] migrating non-modular mzscheme programs to PLT version 4 Message-ID: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> Unlike MzScheme of version 3, Module seems to require that the top- level file of a multi=file program contain a module. Adding '(require mzscheme)' is not sufficient. Converting the top-level file to a module is no hardship, but 'load' and 'load/use-compiled' now seem to require that arguments refer to modules rather than mere files. If the reference is not a module the error message "compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound" is seen. Adding '#lang mzscheme' fixes that problem but fragments the namespace in a regrettable way. Will Module accept a multi-file mzscheme program that is not modularized? Or one that is treated as a single module? Thanks, David From jay.mccarthy at gmail.com Sun Nov 16 02:01:03 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:19 2009 Subject: [plt-scheme] web-server: response/basic vs. response/full In-Reply-To: <779bf2730811151720j5956fa57r3bc4d5636687cdfb@mail.gmail.com> References: <779bf2730811151720j5956fa57r3bc4d5636687cdfb@mail.gmail.com> Message-ID: The documentation for response/basic [1] says that there is a 'code' field. You can make the code 304. For example: (make-response/basic 302 "Not Modified" (current-seconds) #"text/plain" empty) You can also use a response/full with the additional field if you need some content too. Are you saying you didn't realize you could do this, or that there is a bug when you try to? Jay 1. http://docs.plt-scheme.org/web-server/response-structs_ss.html On Sat, Nov 15, 2008 at 6:20 PM, YC wrote: > Hi - > > I've been tripping up trying to return a 304 Not Modified, until I found > that if I return response/basic, the status is always 200. It seems that > reduce potential usage for response/basic. Is there a significance for such > a limitation? (I haven't upgraded to latest, so not sure if the behavior > has changed). > > Thanks, > yc > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From noelwelsh at gmail.com Sun Nov 16 05:49:15 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:19 2009 Subject: [plt-scheme] migrating non-modular mzscheme programs to PLT version 4 In-Reply-To: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> References: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> Message-ID: If you add #lang scheme (provide (all-defined-out)) to all your leaf modules, and #lang scheme (require "dependencies.ss") (provide (all-defined-out)) to all non-leaf modules (replacing "dependencies.ss" with the appropriate file names, you'll essentially be in a world where all bindings exist in the same namespace. Perhaps that will do what you want? N. On Sun, Nov 16, 2008 at 5:36 AM, H David Goering wrote: > Unlike MzScheme of version 3, Module seems to require that the top-level > file of a multi=file program contain a module. Adding '(require mzscheme)' > is not sufficient. > > Converting the top-level file to a module is no hardship, but 'load' and > 'load/use-compiled' now seem to require that arguments refer to modules > rather than mere files. If the reference is not a module the error message > "compile: bad syntax; function application is not allowed, because no #%app > syntax transformer is bound" is seen. Adding '#lang mzscheme' fixes that > problem but fragments the namespace in a regrettable way. > > Will Module accept a multi-file mzscheme program that is not modularized? > Or one that is treated as a single module? > > Thanks, > > David From cce at ccs.neu.edu Sun Nov 16 12:14:24 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:33:19 2009 Subject: [plt-scheme] migrating non-modular mzscheme programs to PLT version 4 In-Reply-To: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> References: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> Message-ID: <990e0c030811160914u7e057f5cg5d27a4cf9784502c@mail.gmail.com> If you put "#lang scheme/load" at the top of your main file, I believe it should run properly in the Module language and load the other files without changing them. --Carl On Sun, Nov 16, 2008 at 12:36 AM, H David Goering wrote: > Unlike MzScheme of version 3, Module seems to require that the top-level > file of a multi=file program contain a module. Adding '(require mzscheme)' > is not sufficient. > > Converting the top-level file to a module is no hardship, but 'load' and > 'load/use-compiled' now seem to require that arguments refer to modules > rather than mere files. If the reference is not a module the error message > "compile: bad syntax; function application is not allowed, because no #%app > syntax transformer is bound" is seen. Adding '#lang mzscheme' fixes that > problem but fragments the namespace in a regrettable way. > > Will Module accept a multi-file mzscheme program that is not modularized? > Or one that is treated as a single module? > > Thanks, > > David From mflatt at cs.utah.edu Sun Nov 16 12:28:32 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:19 2009 Subject: [plt-scheme] rotate bmp onclick In-Reply-To: References: <20081112161033.GA27210@jungfrau.pckswarms.ch> <20081112222435.A53256500B7@mail-svr1.cs.utah.edu> <20081113003342.C341D6500D4@mail-svr1.cs.utah.edu> <20081114040913.09D086500AE@mail-svr1.cs.utah.edu> Message-ID: <20081116172834.3704465008C@mail-svr1.cs.utah.edu> At Fri, 14 Nov 2008 10:04:37 +0000, Steve De Ridder wrote: > > dear newslist-members, i'm pretty new in the scheme / mred language. for the > moment, i'm writing a "magic the gathering" application in scheme. therefore, > i have to be able to tap / rotate my own defined card (a simple bitmap) when i > click it. i read about this on http://osdir.com/ml/lisp.scheme.plt/2003- > 05/msg00117.html but didn't find the solution (or is this due to my poor > english -english is only my third language)can anyone please point this out > for me? The `games/cards' library in the current release still doesn't support rotation. I've added rotation support in the current development version; it's now available via SVN, and it will be available in the next nightly build. (It probably won't be included in a regular release until early next year.) If you can't or don't want to use the latest version, you could create cards that use rotated images, and then "rotate" a card by swapping the original card with one using a rotated image. Here's a function that rotates a bitmap (either clockwise or counter-clockwise): (define (rotate-bm bm cw?) (let ([w (send bm get-width)] [h (send bm get-height)]) (let ([bm2 (make-object mred:bitmap% h w)] [s (make-bytes (* w h 4))] [s2 (make-bytes (* h w 4))]) (send bm get-argb-pixels 0 0 w h s) (for ([i (in-range w)]) (for ([j (in-range h)]) (let ([src-pos (* (+ i (* j w)) 4)]) (bytes-copy! s2 (if cw? (* (+ (- (- h j) 1) (* i h)) 4) (* (+ j (* (- (- w i) 1) h)) 4)) s src-pos (+ src-pos 4))))) (let ([dc (make-object mred:bitmap-dc% bm2)]) (send dc set-argb-pixels 0 0 h w s2) (send dc set-bitmap #f)) bm2))) The documentation for the cards library says that all cards need to have size 71x96, so creating rotated cards wouldn't work according to the docs. Actually, though, only some table methods assume a 71x96 card, such as the method that arranges cards with a region. I've generalized the card-arranging methods to merely assume that all cards have the same shape. Matthew From dherman at ccs.neu.edu Sun Nov 16 15:03:53 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:33:19 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: Message-ID: +1 On Nov 12, 2008, at 11:45 AM, Dimitris Vyzovitis wrote: > The struct type identifier contains the expansion time information, > but is otherwise sitting unused as a macro. This is a waste of a > perfectly good identifier; the macro can be used as a > constructor. Similarly, the match syntax can be adapted for symmetry, > avoiding the current (overly verbose) struct form. > > The attached patch (against svn 12407) does this: The > (checked-)struct-info info macro acts as a constructor when the > constructor identifier is available. Similarly, match is adjusted to > symmetrically deconstruct structs by using the type name directly. > > Example: > (define-struct test (x y)) > (test 1 2) => # > (match (test 1 2) ((test x y) (list x y))) => '(1 2) > > > -- vyzo_________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From dherman at ccs.neu.edu Sun Nov 16 15:15:56 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:33:19 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: Message-ID: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> Does your patch also bind the struct name as an identifier macro so it can be used in a higher-order fashion? E.g.: (define-struct thing (symbol) #:prefab) (map (compose thing string->symbol) '("a" "b" "c")) ; => (#s(thing a) #s(thing b) #s(thing c)) Dave On Nov 16, 2008, at 12:03 PM, Dave Herman wrote: > +1 > > On Nov 12, 2008, at 11:45 AM, Dimitris Vyzovitis wrote: > >> The struct type identifier contains the expansion time information, >> but is otherwise sitting unused as a macro. This is a waste of a >> perfectly good identifier; the macro can be used as a >> constructor. Similarly, the match syntax can be adapted for symmetry, >> avoiding the current (overly verbose) struct form. >> >> The attached patch (against svn 12407) does this: The >> (checked-)struct-info info macro acts as a constructor when the >> constructor identifier is available. Similarly, match is adjusted to >> symmetrically deconstruct structs by using the type name directly. >> >> Example: >> (define-struct test (x y)) >> (test 1 2) => # >> (match (test 1 2) ((test x y) (list x y))) => '(1 2) >> >> >> -- >> vyzo_________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jensaxel at soegaard.net Sun Nov 16 15:15:46 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:20 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: Message-ID: <49207F72.20704@soegaard.net> Agree. I wish for (define-struct foo (yada yada2)) the struct type identifier were called instead of foo. However it is a pretty invasive change. /Jens Axel Dave Herman wrote: > +1 > > On Nov 12, 2008, at 11:45 AM, Dimitris Vyzovitis wrote: > >> The struct type identifier contains the expansion time information, >> but is otherwise sitting unused as a macro. This is a waste of a >> perfectly good identifier; the macro can be used as a >> constructor. Similarly, the match syntax can be adapted for symmetry, >> avoiding the current (overly verbose) struct form. >> >> The attached patch (against svn 12407) does this: The >> (checked-)struct-info info macro acts as a constructor when the >> constructor identifier is available. Similarly, match is adjusted to >> symmetrically deconstruct structs by using the type name directly. >> >> Example: >> (define-struct test (x y)) >> (test 1 2) => # >> (match (test 1 2) ((test x y) (list x y))) => '(1 2) >> >> >> -- vyzo_________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yinso.chen at gmail.com Sun Nov 16 15:38:02 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:33:20 2009 Subject: [plt-scheme] web-server: response/basic vs. response/full In-Reply-To: References: <779bf2730811151720j5956fa57r3bc4d5636687cdfb@mail.gmail.com> Message-ID: <779bf2730811161238r2c0323e8s9eb65526963df4be@mail.gmail.com> Hi Jay - On Sat, Nov 15, 2008 at 11:01 PM, Jay McCarthy wrote: > Are you saying you didn't realize you could do this, or that there is > a bug when you try to? > I am saying that there might be a bug - when I use (make-response/basic 304 ...) the result is a 200 instead of 304. I glanced at web-server/private/response.ss and it seems to convert a response/basic into a response/full at response->response/basic. But the conversion doesn't retain the original status code. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081116/7ae991e6/attachment.htm From vyzo at media.mit.edu Mon Nov 17 03:14:15 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:20 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> Message-ID: On Sun, 16 Nov 2008, Dave Herman wrote: > Does your patch also bind the struct name as an identifier macro so it can be > used in a higher-order fashion? E.g.: > > (define-struct thing (symbol) #:prefab) > (map (compose thing string->symbol) '("a" "b" "c")) > ; => > (#s(thing a) #s(thing b) #s(thing c)) > > Dave Not currently, but this is straightforward; I can add it. -- vyzo From vyzo at media.mit.edu Mon Nov 17 04:03:41 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:21 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> Message-ID: On Mon, 17 Nov 2008, Dimitris Vyzovitis wrote: > On Sun, 16 Nov 2008, Dave Herman wrote: > >> Does your patch also bind the struct name as an identifier macro so it can >> be used in a higher-order fashion? E.g.: > > Not currently, but this is straightforward; I can add it. Updated patch attached (svn12467, aka 4.1.3.1, but the affected files are the same in 4.1.2 so it should apply there as well) -- vyzo PS: damn, make install takes ages... -------------- next part -------------- Index: collects/scheme/match/parse.ss =================================================================== --- collects/scheme/match/parse.ss (revision 12467) +++ collects/scheme/match/parse.ss (working copy) @@ -152,6 +152,10 @@ [(mcons e1 e2) (make-MPair (parse #'e1) (parse #'e2))] [(struct s pats) (parse-struct stx cert parse #'s #'pats)] + [(type pat ...) + (and (identifier? #'type) + (struct-info? (syntax-local-value (cert #'type) (lambda () #f)))) + (parse-struct stx cert parse #'type #'(pat ...))] [(? p q1 qs ...) (make-And (cons (make-Pred (cert #'p)) (map parse (syntax->list #'(q1 qs ...)))))] Index: collects/scheme/private/define-struct.ss =================================================================== --- collects/scheme/private/define-struct.ss (revision 12467) +++ collects/scheme/private/define-struct.ss (working copy) @@ -26,10 +26,20 @@ 0 0 #f null (current-inspector) (lambda (v stx) - (raise-syntax-error - #f - "identifier for static struct-type information cannot be used as an expression" - stx)) + (let-values (((kons) (cadr (extract-struct-info v)))) + (if kons + (if (list? (syntax-e stx)) + (datum->syntax stx (cons kons (cdr (syntax-e stx))) stx) + (if (symbol? (syntax-e stx)) + kons + (raise-syntax-error + #f + "illegal use of struct-type identifier" + stx))) + (raise-syntax-error + #f + "identifier for static struct-type information cannot be used as an expression" + stx)))) null (lambda (proc info) (if (and (procedure? proc) Index: collects/scheme/private/struct-info.ss =================================================================== --- collects/scheme/private/struct-info.ss (revision 12467) +++ collects/scheme/private/struct-info.ss (working copy) @@ -16,10 +16,20 @@ 1 0 #f null (current-inspector) (lambda (v stx) - (raise-syntax-error - #f - "identifier for static struct-type information cannot be used as an expression" - stx)) + (let-values (((kons) (cadr (extract-struct-info v)))) + (if kons + (if (list? (syntax-e stx)) + (datum->syntax stx (cons kons (cdr (syntax-e stx))) stx) + (if (symbol? (syntax-e stx)) + kons + (raise-syntax-error + #f + "illegal use of struct-type identifier" + stx))) + (raise-syntax-error + #f + "identifier for static struct-type information cannot be used as an expression" + stx)))) null (lambda (proc info) (if (and (procedure? proc) From andrew-scheme at areilly.bpc-users.org Mon Nov 17 01:12:52 2008 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Thu Mar 26 02:33:21 2009 Subject: Google Android (Was: [plt-scheme] ARM support) In-Reply-To: <48F368FA.6020808@neilvandyke.org> References: <18666.46354.169623.133665@arabic.ccs.neu.edu> <18666.47837.753204.562748@arabic.ccs.neu.edu> <595b9ab20810062259m18e311dv24449dc61b314ac0@mail.gmail.com> <48EAFC37.8040300@neilvandyke.org> <48F21083.8000005@neilvandyke.org> <48F368FA.6020808@neilvandyke.org> Message-ID: <20081117061252.GC63213@duncan.reilly.home> On Mon, Oct 13, 2008 at 11:27:54AM -0400, Neil Van Dyke wrote: > For me to move to a Scheme-like language that can't reuse our Scheme > library investment would seem masochistic. > > I'd be fine with a Scheme that had all of R5RS except for "call/cc" and > mutability of strings. Not wanting to take anything away from PLT 2jvm efforts (go PLT!), doesn't the bigloo scheme still have a java byte-code back-end? I've never used it (and the only time I've ever used bigloo was for the skribe text processor, so ymmv). BTW, it looks like Manuel Serano is doing interesting things with scheme->javascript now: see Hop. Cheers, Andrew From jensaxel at soegaard.net Mon Nov 17 11:50:35 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:21 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> Message-ID: <4921A0DB.20809@soegaard.net> Dimitris Vyzovitis wrote: > On Mon, 17 Nov 2008, Dimitris Vyzovitis wrote: >> On Sun, 16 Nov 2008, Dave Herman wrote: >>> Does your patch also bind the struct name as an identifier macro so >>> it can be used in a higher-order fashion? E.g.: >> >> Not currently, but this is straightforward; I can add it. > > Updated patch attached (svn12467, aka 4.1.3.1, but the affected files > are the same in 4.1.2 so it should apply there as well) I am curious, how many tests in the test suite fails after this patch? http://svn.plt-scheme.org/plt/trunk/collects/tests/ -- Jens Axel S?gaard From jay.mccarthy at gmail.com Mon Nov 17 12:07:30 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:21 2009 Subject: [plt-scheme] web-server: response/basic vs. response/full In-Reply-To: <779bf2730811161238r2c0323e8s9eb65526963df4be@mail.gmail.com> References: <779bf2730811151720j5956fa57r3bc4d5636687cdfb@mail.gmail.com> <779bf2730811161238r2c0323e8s9eb65526963df4be@mail.gmail.com> Message-ID: This was a bug. I've fixed it in SVN. Jay On Sun, Nov 16, 2008 at 1:38 PM, YC wrote: > Hi Jay - > > On Sat, Nov 15, 2008 at 11:01 PM, Jay McCarthy > wrote: >> >> Are you saying you didn't realize you could do this, or that there is >> a bug when you try to? > > I am saying that there might be a bug - when I use (make-response/basic 304 > ...) the result is a 200 instead of 304. > > I glanced at web-server/private/response.ss and it seems to convert a > response/basic into a response/full at response->response/basic. But the > conversion doesn't retain the original status code. > > Thanks, > yc > > > > -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From vyzo at media.mit.edu Mon Nov 17 12:07:42 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:21 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: <4921A0DB.20809@soegaard.net> References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> <4921A0DB.20809@soegaard.net> Message-ID: On Mon, 17 Nov 2008, Jens Axel Soegaard wrote: > Dimitris Vyzovitis wrote: >> On Mon, 17 Nov 2008, Dimitris Vyzovitis wrote: >>> On Sun, 16 Nov 2008, Dave Herman wrote: >>>> Does your patch also bind the struct name as an identifier macro so it >>>> can be used in a higher-order fashion? E.g.: >>> >>> Not currently, but this is straightforward; I can add it. >> >> Updated patch attached (svn12467, aka 4.1.3.1, but the affected files are >> the same in 4.1.2 so it should apply there as well) > I am curious, how many tests in the test suite fails after this patch? > > http://svn.plt-scheme.org/plt/trunk/collects/tests/ The patch is non-invasive: it modifies the default macro of the meta struct to expand when there is a constructor identifier in the metadata instead of barfing. So, unless there is a test that forcibly looks for a syntax error when using the struct type identifier, it shouldn't fail any. For the match part, the struct type identifier is bound to syntax anyway and hence not a match-expander. So, unless you name a struct in a way that shadows a builtin match rule there shouldn't be a problem there either. Did you run into a problem? (No, I haven't run the testsuite yet) -- vyzo From jensaxel at soegaard.net Mon Nov 17 12:19:04 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:22 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> <4921A0DB.20809@soegaard.net> Message-ID: <4921A788.2010401@soegaard.net> Dimitris Vyzovitis wrote: > The patch is non-invasive: it modifies the default macro of the meta > struct to expand when there is a constructor identifier in the > metadata instead of barfing. So, unless there is a test that forcibly > looks for a syntax error when using the struct type identifier, it > shouldn't fail any. > Did you run into a problem? (No, I haven't run the testsuite yet) No, I didn't read the patch closely, so I didn't get how it worked. Your solution is quite elegant. Still, it might be worth running the test suite nonetheless - just in case ;-) -- Jens Axel S?gaard From vyzo at media.mit.edu Mon Nov 17 12:20:39 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:22 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> <4921A0DB.20809@soegaard.net> Message-ID: On Mon, 17 Nov 2008, Dimitris Vyzovitis wrote: > On Mon, 17 Nov 2008, Jens Axel Soegaard wrote: > >> I am curious, how many tests in the test suite fails after this patch? Passes clean in 4.1.3.1 > (version) "4.1.3.1" > (load "/usr/local/src/plt-svn/plt/collects/tests/mzscheme/quiet.ss") ... Performed 443266 expression tests (432378 value expressions, 10888 exn expressions) and 23382 exception field tests. Passed all tests. -- vyzo From jensaxel at soegaard.net Mon Nov 17 12:22:42 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:22 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> <4921A0DB.20809@soegaard.net> Message-ID: <4921A862.20906@soegaard.net> Dimitris Vyzovitis wrote: > On Mon, 17 Nov 2008, Dimitris Vyzovitis wrote: >> On Mon, 17 Nov 2008, Jens Axel Soegaard wrote: >>> I am curious, how many tests in the test suite fails after this patch? > Passes clean in 4.1.3.1 >> (version) > "4.1.3.1" >> (load "/usr/local/src/plt-svn/plt/collects/tests/mzscheme/quiet.ss") > ... > Performed 443266 expression tests (432378 value expressions, 10888 exn > expressions) > and 23382 exception field tests. > > Passed all tests. Great. /Jens Axel From samth at ccs.neu.edu Mon Nov 17 12:56:56 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:33:22 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> <4921A0DB.20809@soegaard.net> Message-ID: <63bb19ae0811170956n7f3fe5bbt3c1bd88e00f6503e@mail.gmail.com> Can you run the test suite for `match' like this: % cd collects/tests/match % mzscheme plt-match-tests.ss as well as add some tests for your new feature? Probably it would be easiest to add them to collects/tests/match/examples.ss . Thanks, sam th On Mon, Nov 17, 2008 at 12:20 PM, Dimitris Vyzovitis wrote: > On Mon, 17 Nov 2008, Dimitris Vyzovitis wrote: > >> On Mon, 17 Nov 2008, Jens Axel Soegaard wrote: >> >>> I am curious, how many tests in the test suite fails after this patch? > > Passes clean in 4.1.3.1 > >> (version) > > "4.1.3.1" >> >> (load "/usr/local/src/plt-svn/plt/collects/tests/mzscheme/quiet.ss") > > ... > Performed 443266 expression tests (432378 value expressions, 10888 exn > expressions) > and 23382 exception field tests. > > Passed all tests. > > -- vyzo > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- sam th samth@ccs.neu.edu From vyzo at media.mit.edu Mon Nov 17 13:07:43 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:22 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: <63bb19ae0811170956n7f3fe5bbt3c1bd88e00f6503e@mail.gmail.com> References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> <4921A0DB.20809@soegaard.net> <63bb19ae0811170956n7f3fe5bbt3c1bd88e00f6503e@mail.gmail.com> Message-ID: On Mon, 17 Nov 2008, Sam TH wrote: > Can you run the test suite for `match' like this: > > % cd collects/tests/match > % mzscheme plt-match-tests.ss yes, that passes too: 321 success(es) 0 failure(s) 0 error(s) 321 test(s) run > > as well as add some tests for your new feature? Probably it would be > easiest to add them to collects/tests/match/examples.ss . Well, there are really just a couple of tests that make sense: correct expansion and the arity syntax error. For the former one, will something like this do? (define-struct test1 (x y)) (define-struct (test2 test1) (z)) (match (test1 1 2) ((test1 x y) (list x y))) => (1 2) (match (test2 1 2 3) ((test1 x y) (list x y))) => (1 2) (match (test2 1 2 3) ((test2 x y z) (list x y z))) => (1 2 3) (match (test1 1 2) ((test2 x y z) #t) (else #f)) => #f Now, the syntax error is harder to autotest. Is there any facility for catching syntax errors? Something like this: (match 'foo ((test1 x) #t)) stdin::268: match: wrong number for fields for structure test1: expected 2 but got 1 at: (x) in: (test1 x) I can also add a couple of tests in the tests/mzscheme/struct.ss suite. -- vyzo From vyzo at media.mit.edu Mon Nov 17 13:28:57 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:22 2009 Subject: [plt-scheme] Using the struct type identifier as a macro [PATCH] In-Reply-To: <63bb19ae0811170956n7f3fe5bbt3c1bd88e00f6503e@mail.gmail.com> References: <47DD5AE3-0DE1-4B78-9841-DD8B70C4CC5D@ccs.neu.edu> <4921A0DB.20809@soegaard.net> <63bb19ae0811170956n7f3fe5bbt3c1bd88e00f6503e@mail.gmail.com> Message-ID: On Mon, 17 Nov 2008, Sam TH wrote: > as well as add some tests for your new feature? Probably it would be > easiest to add them to collects/tests/match/examples.ss . Added tests in collects/tests/match/example.ss and collects/tests/mzscheme/struct.ss -- vyzo -------------- next part -------------- Index: collects/scheme/match/parse.ss =================================================================== --- collects/scheme/match/parse.ss (revision 12479) +++ collects/scheme/match/parse.ss (working copy) @@ -152,6 +152,10 @@ [(mcons e1 e2) (make-MPair (parse #'e1) (parse #'e2))] [(struct s pats) (parse-struct stx cert parse #'s #'pats)] + [(type pat ...) + (and (identifier? #'type) + (struct-info? (syntax-local-value (cert #'type) (lambda () #f)))) + (parse-struct stx cert parse #'type #'(pat ...))] [(? p q1 qs ...) (make-And (cons (make-Pred (cert #'p)) (map parse (syntax->list #'(q1 qs ...)))))] Index: collects/scheme/private/define-struct.ss =================================================================== --- collects/scheme/private/define-struct.ss (revision 12479) +++ collects/scheme/private/define-struct.ss (working copy) @@ -26,10 +26,20 @@ 0 0 #f null (current-inspector) (lambda (v stx) - (raise-syntax-error - #f - "identifier for static struct-type information cannot be used as an expression" - stx)) + (let-values (((kons) (cadr (extract-struct-info v)))) + (if kons + (if (list? (syntax-e stx)) + (datum->syntax stx (cons kons (cdr (syntax-e stx))) stx) + (if (symbol? (syntax-e stx)) + kons + (raise-syntax-error + #f + "illegal use of struct-type identifier" + stx))) + (raise-syntax-error + #f + "identifier for static struct-type information cannot be used as an expression" + stx)))) null (lambda (proc info) (if (and (procedure? proc) Index: collects/scheme/private/struct-info.ss =================================================================== --- collects/scheme/private/struct-info.ss (revision 12479) +++ collects/scheme/private/struct-info.ss (working copy) @@ -16,10 +16,20 @@ 1 0 #f null (current-inspector) (lambda (v stx) - (raise-syntax-error - #f - "identifier for static struct-type information cannot be used as an expression" - stx)) + (let-values (((kons) (cadr (extract-struct-info v)))) + (if kons + (if (list? (syntax-e stx)) + (datum->syntax stx (cons kons (cdr (syntax-e stx))) stx) + (if (symbol? (syntax-e stx)) + kons + (raise-syntax-error + #f + "illegal use of struct-type identifier" + stx))) + (raise-syntax-error + #f + "identifier for static struct-type information cannot be used as an expression" + stx)))) null (lambda (proc info) (if (and (procedure? proc) Index: collects/tests/match/examples.ss =================================================================== --- collects/tests/match/examples.ss (revision 12479) +++ collects/tests/match/examples.ss (working copy) @@ -51,6 +51,8 @@ (define-struct empt ()) +(define-struct T1 (x y)) +(define-struct (T2 T1) (z)) (provide new-tests) @@ -577,5 +579,30 @@ [(vector a b) a] [else 'bad])) + + ;; direct struct expanders + (comp 3 + (match (make-T1 1 2) + ((T1 x y) (+ x y)) + (else #f))) + + (comp 3 + (match (make-T2 1 2 3) + ((T1 x y) (+ x y)) + (else #f))) + + (comp 6 + (match (make-T2 1 2 3) + ((T2 x y z) (+ x y z)) + (else #f))) + + (comp 'yes + (match 'foo + ((T1 x y) (+ x y)) + (else 'yes))) + + (comp 'yes (with-handlers ((exn:fail:syntax? (lambda _ 'yes))) + (expand (quote-syntax (match 'foo ((T1 x) x)))))) + )) Index: collects/tests/mzscheme/struct.ss =================================================================== --- collects/tests/mzscheme/struct.ss (revision 12479) +++ collects/tests/mzscheme/struct.ss (working copy) @@ -430,6 +430,8 @@ (test #f struct? ai) (test 1 a-b ai) (test 2 a-c ai) +(test #t procedure? a) +(test #t a? (a 1 2)) (define ai2 (make-a 1 2)) (set-a-b! ai2 3) (set-a-c! ai2 4) From diggerrrrr at gmail.com Tue Nov 18 05:45:27 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:33:22 2009 Subject: [plt-scheme] list-box's maximum size of string? Message-ID: Hello , When i use following code: (send msg-lst set lines) where msg-lst is a instance of list-box% and lines is a (listof strings) it complains with following error/message : "set in list-box%: expected argument of type ; ... .." Some of my lines are indeed more than 200 characters long. So how do i overcome this restriction also , out of curiosity why such restriction is needed? Thanks From mflatt at cs.utah.edu Tue Nov 18 07:28:45 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:23 2009 Subject: [plt-scheme] list-box's maximum size of string? In-Reply-To: References: Message-ID: <20081118122848.B0EC86500C2@mail-svr1.cs.utah.edu> At Tue, 18 Nov 2008 16:15:27 +0530, Veer wrote: > When i use following code: > > (send msg-lst set lines) > > where msg-lst is a instance of list-box% and lines is a (listof strings) > it complains with following error/message : > > "set in list-box%: expected argument of type 200 characters)>; ... .." > > Some of my lines are indeed more than 200 characters long. > > So how do i overcome this restriction You can use `hierarchical-list%' from `mrlib/hierlist'. Unfortunately, the methods on `hierarchical-list%' are different. Also, it can be tricky to get a `hiearchical-list%' to look like a `list-box%', if that is a concern. Some example code is below. > also , out of curiosity why such > restriction is needed? It's a result of using old GUI toolbox layers, such as an Xt-based widget layer under X11 and Carbon APIs under Mac OS X, which have limits in various places. This particular limit may not have to do with list boxes; at some point, we chose a consistent 200-character limit for all GUI labels. Matthew ---------------------------------------------------------------------- A simple list box: ---------------------------------------------------------------------- #lang scheme/gui (define f (new frame% [label "List"] [width 200] [height 200])) (define l (new list-box% [label #f] [choices '()] [parent f])) (send l set (for/list ([in (in-range 100)]) (make-string 200 #\z))) (send f show #t) ------------------------------------------------------------------------- hierlist simulating a list box, but without the label-width limit: ---------------------------------------------------------------------- #lang scheme/gui (require mrlib/hierlist) (define f (new frame% [label "List"] [width 200] [height 200])) (define l (new hierarchical-list% [label #f] [parent f] [style '(control-border no-hscroll)])) (send l set-no-sublists #t) (send l horiz-margin 2) (send l vert-margin 2) (send l horizontal-inset 0) (send l vertical-inset 0) (define items (for/list ([i (in-range 100)]) (make-string 201 #\z))) (for ([i (in-list items)]) (send (send (send l new-item) get-editor) insert i)) (send f show #t) From kbohdan at mail.ru Tue Nov 18 09:12:38 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:23 2009 Subject: [plt-scheme] Is R6RS useless for PLT? Message-ID: Hi, I know that PLT has r6rs implementation, but it doesn't look like PLT community cares much about it. Isn't it more logical to encourage writing new modules/libraries using r6rs ? PLT has a lot of specific extensions which can be added on the top of r6rs and at the same time *serve* as new standard proposals. IMHO, this strategy can have good effect on scheme evolution and language learning threshold. Is it just matter of the huge legacy codebase or am I missing something? -- Bohdan From robby at cs.uchicago.edu Tue Nov 18 09:23:52 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:23 2009 Subject: [plt-scheme] Is R6RS useless for PLT? In-Reply-To: References: Message-ID: <932b2f1f0811180623p2b414cfelb101bcfbc3636579@mail.gmail.com> I, for one, certainly care to the extent that people who want to develop libraries for R6RS will also be developing libraries for PLT Scheme. Robby On Tue, Nov 18, 2008 at 8:12 AM, wrote: > Hi, > > I know that PLT has r6rs implementation, but it doesn't look > like PLT community cares much about it. > Isn't it more logical to encourage writing new modules/libraries > using r6rs ? PLT has a lot of specific extensions which can be > added on the top of r6rs and at the same time *serve* as new standard > proposals. IMHO, this strategy can have good effect on scheme > evolution and language learning threshold. > > Is it just matter of the huge legacy codebase > or am I missing something? > > -- > Bohdan > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From matthias at ccs.neu.edu Tue Nov 18 09:34:14 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:23 2009 Subject: [plt-scheme] Is R6RS useless for PLT? In-Reply-To: References: Message-ID: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> As the naming conventions in DrScheme suggest, we consider our Module language the primary development vehicle. R6RS, like R5RS, is supported and available. Bug reports and feature requests are taken seriously. As Robby indicates, R6RS is our bridge to other Scheme implementations and we would like libraries to flow into our world. -- Matthias On Nov 18, 2008, at 9:12 AM, kbohdan@mail.ru wrote: > Hi, > > I know that PLT has r6rs implementation, but it doesn't look > like PLT community cares much about it. > Isn't it more logical to encourage writing new modules/libraries > using r6rs ? PLT has a lot of specific extensions which can be > added on the top of r6rs and at the same time *serve* as new standard > proposals. IMHO, this strategy can have good effect on scheme > evolution and language learning threshold. > > Is it just matter of the huge legacy codebase > or am I missing something? > > -- > Bohdan > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From kbohdan at mail.ru Tue Nov 18 09:40:47 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:23 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> Message-ID: The only problem is that I'm forced to choose between power and portability. -- Bohdan Matthias Felleisen wrote: > > > As the naming conventions in DrScheme suggest, we consider > our Module language the primary development vehicle. R6RS, > like R5RS, is supported and available. Bug reports and > feature requests are taken seriously. As Robby indicates, > R6RS is our bridge to other Scheme implementations and we > would like libraries to flow into our world. -- Matthias > From sk at cs.brown.edu Tue Nov 18 09:48:09 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:33:23 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> Message-ID: Out of curiosity, how many Perl implementations do you routinely port between? Or Ruby implementations? Or Tcl implementations? On Tue, Nov 18, 2008 at 9:40 AM, wrote: > The only problem is that I'm forced to choose between power and portability. > > -- > Bohdan > > Matthias Felleisen wrote: >> >> >> As the naming conventions in DrScheme suggest, we consider >> our Module language the primary development vehicle. R6RS, >> like R5RS, is supported and available. Bug reports and >> feature requests are taken seriously. As Robby indicates, >> R6RS is our bridge to other Scheme implementations and we >> would like libraries to flow into our world. -- Matthias >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From robby at cs.uchicago.edu Tue Nov 18 10:03:19 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:24 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> Message-ID: <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> Unfortunately, that is a tradeoff we do not yet know how to do better on. There has been substantial effort from the PLT world towards R6RS, however, so do not think we don't care! Robby On Tue, Nov 18, 2008 at 8:40 AM, wrote: > The only problem is that I'm forced to choose between power and portability. > > -- > Bohdan > > Matthias Felleisen wrote: >> >> >> As the naming conventions in DrScheme suggest, we consider >> our Module language the primary development vehicle. R6RS, >> like R5RS, is supported and available. Bug reports and >> feature requests are taken seriously. As Robby indicates, >> R6RS is our bridge to other Scheme implementations and we >> would like libraries to flow into our world. -- Matthias >> > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From feeley at iro.umontreal.ca Tue Nov 18 10:09:59 2008 From: feeley at iro.umontreal.ca (Marc Feeley) Date: Thu Mar 26 02:33:24 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> Message-ID: <1DD14038-100D-4120-B834-70E7F5AA2FDA@iro.umontreal.ca> On 18-Nov-08, at 9:48 AM, Shriram Krishnamurthi wrote: > Out of curiosity, how many Perl implementations do you routinely port > between? Or Ruby implementations? Or Tcl implementations? Shriram, you are neglecting the fact that there are many (as in *many*) implementations of Scheme. This diversity is not gratuitous. Each implementation covers some niche of the programming spectrum. Some Schemes are well suited for teaching programming, some are geared towards fast compilation, some towards fast execution, some target embedded systems, some interoperate well with other languages (C, Java, .NET, ...), some are easily ported to new platforms, some have nice debugging environments, some have nice documentation, etc. No single implementation does it all. The thing is that a piece of software is constantly in evolution. It may start small with a single objective, but subsequently grow with a change of focus, and thus a change of requirements from the Scheme system. That is why portability of the source code is important. It allows the developer to switch between Scheme implementations as the requirements of the software evolve, or as the developer discovers bugs and weaknesses in the Scheme he initially chose. The diversity of Scheme implementations should be viewed as one of the strengths of Scheme, not a weakness. Marc From gregory.woodhouse at gmail.com Tue Nov 18 10:22:57 2008 From: gregory.woodhouse at gmail.com (Woodhouse Gregory) Date: Thu Mar 26 02:33:24 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> Message-ID: <7AB50A9F-C24A-4CD6-9A1C-8A7753D783AE@gmail.com> What would you suggest as a primer on R6RS libraries, ideally for someone with some knowledge of PLT modules? Sent from my iPhone On Nov 18, 2008, at 7:03 AM, "Robby Findler" wrote: > Unfortunately, that is a tradeoff we do not yet know how to do better > on. There has been substantial effort from the PLT world towards R6RS, > however, so do not think we don't care! > > Robby > > On Tue, Nov 18, 2008 at 8:40 AM, wrote: >> The only problem is that I'm forced to choose between power and >> portability. >> >> -- >> Bohdan >> >> Matthias Felleisen wrote: >>> >>> >>> As the naming conventions in DrScheme suggest, we consider >>> our Module language the primary development vehicle. R6RS, >>> like R5RS, is supported and available. Bug reports and >>> feature requests are taken seriously. As Robby indicates, >>> R6RS is our bridge to other Scheme implementations and we >>> would like libraries to flow into our world. -- Matthias >>> >> >> _________________________________________________ >> 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 Tue Nov 18 10:22:39 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:24 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <1DD14038-100D-4120-B834-70E7F5AA2FDA@iro.umontreal.ca> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <1DD14038-100D-4120-B834-70E7F5AA2FDA@iro.umontreal.ca> Message-ID: <575AC480-C930-4920-8A3A-27FE9C8C0B3D@ccs.neu.edu> On Nov 18, 2008, at 10:09 AM, Marc Feeley wrote: > The diversity of Scheme implementations should be viewed as one of > the strengths of Scheme, not a weakness. Marc, we agree with this statement very much as far as the idea of Scheme is concerned. Because there are so many implementations around, I am hopeful that Scheme will survive me in some for or other and that no matter how it survives some of the ideas we developed for Scheme will survive in this form. For a working programmer, though, Scheme is an idea -- a specification of a family of languages -- and for most working programmers, the contexts and constraints are pretty clear. So it usually suffices to pick a particular Scheme programming language, say Gambit or PLT, and to work with it. The porting programmers are few. From this perspective, an R6RS implementation serves as a bridge between distinct Scheme implementations. If you have chosen a specific language for its power (one of my scripts for submitting NSF proposals is 10 lines of code; in R5RS it's 120) and you do discover the need for a port, you first move from PLT to its R6RS specification -- in an interoperating manner -- and then you move it to Gambit's R6RS, possibly incorporating Gambit-specific features as you re-deploy your product. We should not expect more from a 'common standard' and not less. -- Matthias From kbohdan at mail.ru Tue Nov 18 10:22:12 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:24 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> Message-ID: Shriram Krishnamurthi wrote: > Out of curiosity, how many Perl implementations do you routinely port > between? Or Ruby implementations? Or Tcl implementations? Probably if you count amount of Perl, Ruby, Tcl, Python etc. communities having its own language version and compare this with count of Scheme clans, the scornful context of your questions will disappear. I hope so. OTOH, portability of scheme code is not very important problem just because scheme is rarely used in serious commercial projects. And vice versa, Scheme is rarely used in serious commercial projects because it doesn't have time-proven standard and real-world libraries based this standard. As Marc said, diversity is the strength of Scheme, but IMHO lack of common denominator is a weakness. -- Bohdan From diggerrrrr at gmail.com Tue Nov 18 10:28:33 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:33:24 2009 Subject: [plt-scheme] list-box's maximum size of string? In-Reply-To: <20081118122848.B0EC86500C2@mail-svr1.cs.utah.edu> References: <20081118122848.B0EC86500C2@mail-svr1.cs.utah.edu> Message-ID: Thanks for the explanation and the code. On Tue, Nov 18, 2008 at 5:58 PM, Matthew Flatt wrote: > At Tue, 18 Nov 2008 16:15:27 +0530, Veer wrote: >> When i use following code: >> >> (send msg-lst set lines) >> >> where msg-lst is a instance of list-box% and lines is a (listof strings) >> it complains with following error/message : >> >> "set in list-box%: expected argument of type > 200 characters)>; ... .." >> >> Some of my lines are indeed more than 200 characters long. >> >> So how do i overcome this restriction > > You can use `hierarchical-list%' from `mrlib/hierlist'. > > Unfortunately, the methods on `hierarchical-list%' are different. Also, > it can be tricky to get a `hiearchical-list%' to look like a > `list-box%', if that is a concern. Some example code is below. > >> also , out of curiosity why such >> restriction is needed? > > It's a result of using old GUI toolbox layers, such as an Xt-based > widget layer under X11 and Carbon APIs under Mac OS X, which have > limits in various places. This particular limit may not have to do with > list boxes; at some point, we chose a consistent 200-character limit > for all GUI labels. > > Matthew > > ---------------------------------------------------------------------- > A simple list box: > ---------------------------------------------------------------------- > #lang scheme/gui > > (define f (new frame% [label "List"] > [width 200] > [height 200])) > > (define l (new list-box% > [label #f] > [choices '()] > [parent f])) > > (send l set (for/list ([in (in-range 100)]) > (make-string 200 #\z))) > > (send f show #t) > > ------------------------------------------------------------------------- > hierlist simulating a list box, but without the label-width limit: > ---------------------------------------------------------------------- > #lang scheme/gui > (require mrlib/hierlist) > > (define f (new frame% [label "List"] > [width 200] > [height 200])) > > (define l (new hierarchical-list% > [label #f] > [parent f] > [style '(control-border no-hscroll)])) > (send l set-no-sublists #t) > (send l horiz-margin 2) > (send l vert-margin 2) > (send l horizontal-inset 0) > (send l vertical-inset 0) > > (define items (for/list ([i (in-range 100)]) > (make-string 201 #\z))) > > (for ([i (in-list items)]) > (send (send (send l new-item) get-editor) insert i)) > > (send f show #t) > > From kbohdan at mail.ru Tue Nov 18 10:51:59 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:25 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> Message-ID: Robby Findler wrote: > Unfortunately, that is a tradeoff we do not yet know how to do better > on. There has been substantial effort from the PLT world towards R6RS, > however, so do not think we don't care! > > Robby We know about this effort! Thanks! Just waiting for continuation return :) -- Bohdan From samth at ccs.neu.edu Tue Nov 18 11:23:36 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:33:25 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> Message-ID: <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> On Tue, Nov 18, 2008 at 9:48 AM, Shriram Krishnamurthi wrote: > Out of curiosity, how many Perl implementations do you routinely port > between? Or Ruby implementations? Or Tcl implementations? Perl and Tcl both seem to have only one implementation. There is an alternative Ruby implementation, called JRuby, which describes itself as compatible. There are at least two alternative Python implementations, PyPy and Jython, but I don't think their compatibility is perfect. All of these were developed, however, after the original language became well-established. Thanks, -- sam th samth@ccs.neu.edu From matthias at ccs.neu.edu Tue Nov 18 11:32:35 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:25 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> Message-ID: On Nov 18, 2008, at 10:51 AM, kbohdan@mail.ru wrote: > Just waiting for continuation return :) Hey, their return type is empty, meaning they never, ever return. I hope you're not holding your breath. From cce at ccs.neu.edu Tue Nov 18 11:45:16 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:33:25 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> Message-ID: <990e0c030811180845i699a618dq316b8d4ae9871588@mail.gmail.com> On Tue, Nov 18, 2008 at 11:32 AM, Matthias Felleisen wrote: > > On Nov 18, 2008, at 10:51 AM, kbohdan@mail.ru wrote: > >> Just waiting for continuation return :) > > Hey, their return type is empty, meaning they never, ever return. I hope > you're not holding your > breath. Perhaps he is waiting for control to return into a continuation, rather than out of one. -- Carl Eastlund From kbohdan at mail.ru Tue Nov 18 11:42:00 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:25 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> Message-ID: Matthias Felleisen wrote: > > On Nov 18, 2008, at 10:51 AM, kbohdan@mail.ru wrote: > >> Just waiting for continuation return :) > > > > Hey, their return type is empty, meaning they never, ever return. I hope > you're not holding your breath. You can't be sure about this unless you put #!r6rs above. -- Bohdan From matthias at ccs.neu.edu Tue Nov 18 11:55:56 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:25 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <932b2f1f0811180703m5ceea038l7d5f8ae982af5140@mail.gmail.com> Message-ID: <2CA7D791-01DD-40B3-8F96-575B5807CA5E@ccs.neu.edu> See Typed Scheme. It's typed therefore it's correct '-] On Nov 18, 2008, at 11:42 AM, kbohdan@mail.ru wrote: > Matthias Felleisen wrote: >> On Nov 18, 2008, at 10:51 AM, kbohdan@mail.ru wrote: >>> Just waiting for continuation return :) >> Hey, their return type is empty, meaning they never, ever return. >> I hope you're not holding your breath. > > You can't be sure about this unless you put #!r6rs above. > > -- > Bohdan > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From esmith at acanac.net Tue Nov 18 12:18:08 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:33:26 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> Message-ID: <4922F8D0.4060107@acanac.net> Shriram Krishnamurthi wrote: > Out of curiosity, how many Perl implementations do you routinely port > between? Or Ruby implementations? Or Tcl implementations? I'm taking the above as a rhetorical question. As such I think your point is not addressing the spirit of his question. PLT scheme offers features one is tempted to take advantage of. BUT the number of people maintaining PLT scheme is so small one has to view them as an endangered species. Willy-nilly use of extensions is detrimental to portability, and when environment has a risk of extinction, portability equates to re-usability. A helpful answer to his question would be to suggest a strategy to keep control over the 'willy-nilly' and thus minimize risk and maximize recourse in the possible event of extinction. Interestingly, giving him a good answer will reduce the risk of extinction by promoting population growth. Simply sticking to RnRs merely makes PLT extensions esoteric. In the event that PLT scheme is no more, what is my emigration strategy for my body of work? What can I do now to minimize that problem without also ruling out all the extended features? I think that is more the spirit of his question. I'm interested in that answer myself. From matthias at ccs.neu.edu Tue Nov 18 12:41:52 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:26 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <4922F8D0.4060107@acanac.net> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <4922F8D0.4060107@acanac.net> Message-ID: <4DA0FDC1-4185-4CCF-96E5-3A7DC223DF88@ccs.neu.edu> On Nov 18, 2008, at 12:18 PM, Ernie Smith wrote: > Simply sticking to RnRs merely makes PLT extensions esoteric. > In the event that PLT scheme is no more, what is my emigration > strategy > for my body of work? What can I do now to minimize that problem > without also ruling out all the extended features? > I think that is more the spirit of his question. > > I'm interested in that answer myself. Please read my reply. I address this point specifically and we are actively working on a strategy. -- Matthias From gherson at snet.net Tue Nov 18 12:48:41 2008 From: gherson at snet.net (George Herson) Date: Thu Mar 26 02:33:27 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? (newbie) Message-ID: <785341.12684.qm@web81301.mail.mud.yahoo.com> What would be the issues involved in implementing the PLT extensions as SRFIs on top of R6RS? thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081118/da2b4904/attachment.html From matthias at ccs.neu.edu Tue Nov 18 12:53:19 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:27 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? (newbie) In-Reply-To: <785341.12684.qm@web81301.mail.mud.yahoo.com> References: <785341.12684.qm@web81301.mail.mud.yahoo.com> Message-ID: <0870ACF5-ACD3-4B89-B54C-E52AB9A61F66@ccs.neu.edu> No, these extensions go to the core of the engine. -- Matthias On Nov 18, 2008, at 12:48 PM, George Herson wrote: > What would be the issues involved in implementing the PLT > extensions as SRFIs on top of R6RS? > > thank you. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ebellani at gmail.com Tue Nov 18 13:20:30 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:33:27 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> Message-ID: <184222e50811181020p27a7a6a3gcfa3f1eacaebaff6@mail.gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 About the ruby implementations, I'll throw in my 2 cents, as it is a subject I'm more familiar with. The ruby mri (Matz's Ruby Interpreter) implementaion *IS* the de facto reference, as there is no specification of the language. What that means is that that for a long time it dominated the ruby landscape. That fact forces every single new implementation (JRuby, Rubinious, IronRuby) into a compatibility submission :P That, IMHO, is extremely healthy for a language, at least initially, since it kind of creates a safe assumption that any libraries and code produced in that language will run across implementations. Hugs -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJIwdtTGtma8x8sd4RAprOAJ46R0ZPtzcSqvShWeZDVq4Jr35cHACgwRUq 4WQhwqLtd7M2HspdEYFJ6Yk= =TffQ -----END PGP SIGNATURE----- On Tue, Nov 18, 2008 at 2:23 PM, Sam TH wrote: > On Tue, Nov 18, 2008 at 9:48 AM, Shriram Krishnamurthi wrote: >> Out of curiosity, how many Perl implementations do you routinely port >> between? Or Ruby implementations? Or Tcl implementations? > > Perl and Tcl both seem to have only one implementation. There is an > alternative Ruby implementation, called JRuby, which describes itself > as compatible. There are at least two alternative Python > implementations, PyPy and Jython, but I don't think their > compatibility is perfect. > > All of these were developed, however, after the original language > became well-established. > > Thanks, > -- > sam th > samth@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud From vyzo at media.mit.edu Tue Nov 18 13:23:58 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:27 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <4922F8D0.4060107@acanac.net> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <4922F8D0.4060107@acanac.net> Message-ID: On Tue, 18 Nov 2008, Ernie Smith wrote: > Shriram Krishnamurthi wrote: >> Out of curiosity, how many Perl implementations do you routinely port >> between? Or Ruby implementations? Or Tcl implementations? > I'm taking the above as a rhetorical question. > As such I think your point is not addressing the spirit of his question. > > PLT scheme offers features one is tempted to take advantage of. > BUT the number of people maintaining PLT scheme is so small one has > to view them as an endangered species. > > Willy-nilly use of extensions is detrimental to portability, > and when environment has a risk of extinction, > portability equates to re-usability. > > A helpful answer to his question would be to suggest a strategy > to keep control over the 'willy-nilly' and thus minimize > risk and maximize recourse in the possible event of extinction. > > Interestingly, giving him a good answer will reduce the risk of > extinction by promoting population growth. > > Simply sticking to RnRs merely makes PLT extensions esoteric. > In the event that PLT scheme is no more, what is my emigration strategy > for my body of work? What can I do now to minimize that problem without > also ruling out all the extended features? > I think that is more the spirit of his question. Well, macros... that's why we use scheme after all! When the implementation offers compelling enough features (plt does) to use them, by all means do. If it goes extinct, it is not the end of the world. Most schemes are sufficiently close in the core, so that porting from a dead scheme to another is doable by writing a sufficient macro set. It is not trivial if you go too deep in featureland, but it is not impossible either. Also, another aspect that is important: plt (and most schemes out there) are free software, so the code will live even if the core team disappears from the face of the world. -- vyzo From aghuloum at cs.indiana.edu Tue Nov 18 13:23:50 2008 From: aghuloum at cs.indiana.edu (Abdulaziz Ghuloum) Date: Thu Mar 26 02:33:27 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <4922F8D0.4060107@acanac.net> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <4922F8D0.4060107@acanac.net> Message-ID: <4CA041B5-F479-4BB2-8E87-5EDB4E0DD2EB@cs.indiana.edu> On Nov 18, 2008, at 12:18 PM, Ernie Smith wrote: > A helpful answer to his question would be to suggest a strategy > to keep control over the 'willy-nilly' and thus minimize > risk and maximize recourse in the possible event of extinction. I agree with the sentiment of your post. Relying on a single implementation with one or a handful of developers does pose a risk. There are many possible strategies: 1. Hope for the best: Stick with your implementation of choice and hope that it outlives your project. Given the momentum of PLT, this may not be too bad an idea. The situation is radically different in (all?) other implementations that have exactly one developer. 2. Expect the worst: Refrain from using any nonstandard feature that your implementation provides. If it's not in the report it's not in your code. This is extreme and unrealistic. It's equally unrealistic to expect that all of one implementation's features will become standard. 3. Eat your cake and have it too: Isolate the parts of your code that use implementation-specific extensions from the rest of your code, and keep your main code base platform independent. Now the implementations (not the standard) of R6RS all provide a uniform mechanism for you to take strategy 3---it's up to you to utilize it. All implementations allow you to restrict your code to the standard features (if so you choose), and they all allow you to incorporate common but nonstandard features into your program without this 'willy-nilly' use of such features. This works by writing the majority of your code in the form of R6RS libraries, and when it comes to common but nonstandard features, you supply an implementation-specific compatibility library for each implementation you intend to use. For example, suppose your program uses "process" to run an external shell command. Now process, being nonstandard feature comes with different flavors under the different implementations. Instead of depending on say PLT's process, you provide a (process) library "process.mzscheme.sls" that reexports mzscheme's process procedure. Want to run your program under Ikarus? Provide a "process.ikarus.sls" file and you're done. Try to run it under Ypsilon? It will complain that it cannot find the (process) library and you know what to do then. Common features like process should eventually end up being SRFIs so that you won't have to port them and write compatibility libraries yourself, but until then, it's usually a few lines per implementation depending on the feature. This strategy works for most features and I've used it to port large libraries (e.g., OpenGL, GLUT, etc.) from Ypsilon to Ikarus (by providing an ypsilon compatibility library) and I've seen people using it for even more ambitious situations (e.g., a portable GTK over the pipe interface). It's doable and it's not that hard; it just takes some discipline. Aziz,,, From robby at cs.uchicago.edu Tue Nov 18 13:35:11 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:28 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <4922F8D0.4060107@acanac.net> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <4922F8D0.4060107@acanac.net> Message-ID: <932b2f1f0811181035g17756382n8e81ac65e8380219@mail.gmail.com> I believe this reasoning rules out lots of languages (those listed below included). Robby On Tue, Nov 18, 2008 at 11:18 AM, Ernie Smith wrote: > Shriram Krishnamurthi wrote: >> >> Out of curiosity, how many Perl implementations do you routinely port >> between? Or Ruby implementations? Or Tcl implementations? > > I'm taking the above as a rhetorical question. > As such I think your point is not addressing the spirit of his question. > > PLT scheme offers features one is tempted to take advantage of. > BUT the number of people maintaining PLT scheme is so small one has > to view them as an endangered species. > > Willy-nilly use of extensions is detrimental to portability, > and when environment has a risk of extinction, > portability equates to re-usability. > > A helpful answer to his question would be to suggest a strategy > to keep control over the 'willy-nilly' and thus minimize > risk and maximize recourse in the possible event of extinction. > > Interestingly, giving him a good answer will reduce the risk of > extinction by promoting population growth. > > Simply sticking to RnRs merely makes PLT extensions esoteric. > In the event that PLT scheme is no more, what is my emigration strategy > for my body of work? What can I do now to minimize that problem without > also ruling out all the extended features? > I think that is more the spirit of his question. > > I'm interested in that answer myself. > > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From diggerrrrr at gmail.com Tue Nov 18 13:38:33 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:33:28 2009 Subject: [plt-scheme] Need more class examples? Message-ID: Hello, This code : (define my-area% (class* object% (area<%>) (init min-width) (define mini-width min-width) (define/public (get-top-level-window) this) (define/public (get-parent) #f) (define/public (stretchable-height) #f) (define/public (stretchable-width) #f) (define/public (get-graphical-min-size) 0) (define/public (min-width) 0) (define/public (min-height) 0) (super-new))) complains : "class*: duplicate declared identifier in: min-width " My question is how you implement class method and init variable with same name? I tried to read the class reference manual , but its too complex for me at the moment, so some examples will be of great help. Thanks From marek at xivilization.net Tue Nov 18 13:43:31 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:33:28 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> Message-ID: <20081118194331.7661c766@halmanfloyd.lan.local> On Tue, 18 Nov 2008 11:23:36 -0500 "Sam TH" wrote: > On Tue, Nov 18, 2008 at 9:48 AM, Shriram Krishnamurthi > wrote: > > Out of curiosity, how many Perl implementations do you routinely > > port between? Or Ruby implementations? Or Tcl implementations? > > Perl and Tcl both seem to have only one implementation. There is an > alternative Ruby implementation, called JRuby, which describes itself > as compatible. There are at least two alternative Python > implementations, PyPy and Jython, but I don't think their > compatibility is perfect. There is also IronPython but that's actually not what I wanted to say. In Python-land there is Python aka CPython which basically defines the standard and is it's own reference implementation. All new features are introduced there first and may or may not be adapted soon in other implementations. Currently, CPython is what actually matters, the other implementations are currently rather exotic and neither Jython nor IronPython will ever replace CPython. Maybe PyPy will do that in the long run, but PyPy is focused a bit more on research about dynamic languages and how to get them running fast than on replacing CPython. regards, Marek From kbohdan at mail.ru Tue Nov 18 13:54:16 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:28 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081118194331.7661c766@halmanfloyd.lan.local> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> <20081118194331.7661c766@halmanfloyd.lan.local> Message-ID: AFAIK, All mentioned languages, including python, have the only implementation or have *dominating implementation*. For many reasons I believe that www.python.org will stay dominating community with multiple portable implementations on board. I haven't seen nobody using anything but CPython for real life scripting. I can be wrong but not so much. As a good example of the language without single dominating implementation but with excellent dominating community i recommend to look at: c++ & www.boost.org. To put your library inside one must satisfy a lot of requirements. The most useful libraries from *boost* project will become a part of a new standard. When/If PLT switched to r6rs, wouldn't it be perfect to have similar library adoption process for r6rs PLT libs ? Note the difference between boost and SRFIs is that boost libraries have real-life quality and are released all together allowing modifications, enhancements, bug fixes and tighter reuse of other boost libraries. -- Bohdan Marek Kubica wrote: > On Tue, 18 Nov 2008 11:23:36 -0500 > "Sam TH" wrote: > >> On Tue, Nov 18, 2008 at 9:48 AM, Shriram Krishnamurthi >> wrote: >>> Out of curiosity, how many Perl implementations do you routinely >>> port between? Or Ruby implementations? Or Tcl implementations? >> Perl and Tcl both seem to have only one implementation. There is an >> alternative Ruby implementation, called JRuby, which describes itself >> as compatible. There are at least two alternative Python >> implementations, PyPy and Jython, but I don't think their >> compatibility is perfect. > > There is also IronPython but that's actually not what I wanted to say. > > In Python-land there is Python aka CPython which basically defines the > standard and is it's own reference implementation. All new features are > introduced there first and may or may not be adapted soon in other > implementations. Currently, CPython is what actually matters, the other > implementations are currently rather exotic and neither Jython nor > IronPython will ever replace CPython. Maybe PyPy will do that in the > long run, but PyPy is focused a bit more on research about dynamic > languages and how to get them running fast than on replacing CPython. > > regards, > Marek > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From marek at xivilization.net Tue Nov 18 14:08:56 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:33:28 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> <20081118194331.7661c766@halmanfloyd.lan.local> Message-ID: <20081118200856.648cf7a8@halmanfloyd.lan.local> Hi, On Tue, 18 Nov 2008 20:54:16 +0200 kbohdan@mail.ru wrote: > As a good example of the language without single dominating > implementation but with excellent dominating community i recommend to > look at: c++ & www.boost.org. To put your library inside one must > satisfy a lot of requirements. The most useful libraries from *boost* > project will become a part of a new standard. When/If PLT switched to > r6rs, wouldn't it be perfect to have similar library adoption process > for r6rs PLT libs ? I don't think that taking extensions from PLT or other implementations and declaring them a standard will work. C++ is not a language known for its elegance but Scheme (at least R5RS-Scheme) is. Sure, I'm all for making Scheme a more practical language but then, I wouldn't want Scheme to become an cleaned-up clone of Common Lisp. CL has its use, Scheme does too and shouldn't be a Lisp-1 version of CL. A bit of history: Macros are maybe the most dominant, well-known feature of Lisp and therefore Scheme. You might be surprised, like me, to hear that macros weren't standardized in the RnRS until macros became mandatory in some version (I don't remember the exact version, but when "Scheme and the Art of programming" was printed in the nineties, it wasn't). regards, Marek From cce at ccs.neu.edu Tue Nov 18 14:09:52 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:33:28 2009 Subject: [plt-scheme] Need more class examples? In-Reply-To: References: Message-ID: <990e0c030811181109i6d8ff79bi5e3451587f22c17c@mail.gmail.com> The code below ought to work. I set up the min-width initialization argument to have the internal name my-width so it doesn't clash with the min-width method. (define my-area% (class* object% (area<%>) (init [(my-width min-width) #| default value would go here |#]) (define mini-width my-width) (define/public (get-top-level-window) this) (define/public (get-parent) #f) (define/public (stretchable-height) #f) (define/public (stretchable-width) #f) (define/public (get-graphical-min-size) 0) (define/public (min-width) 0) (define/public (min-height) 0) (super-new))) Note that this takes two levels of parenthesis, so that internal names can be distinguished from default values. The various ways to declare initialization arguments look like this: (init name) (init [name default-expression]) (init [(internal-name external-name)]) (init [(internal-name external-name) default-expression]) --Carl On Tue, Nov 18, 2008 at 1:38 PM, Veer wrote: > Hello, > > This code : > > (define my-area% (class* object% (area<%>) > (init min-width) > (define mini-width min-width) > > (define/public (get-top-level-window) > this) > (define/public (get-parent) > #f) > (define/public (stretchable-height) > #f) > (define/public (stretchable-width) > #f) > (define/public (get-graphical-min-size) > 0) > (define/public (min-width) > 0) > (define/public (min-height) > 0) > (super-new))) > > complains : > "class*: duplicate declared identifier in: min-width " > > My question is how you implement class method and init variable with same name? > I tried to read the class reference manual , but its too complex for > me at the moment, so some examples > will be of great help. > > Thanks From ryanc at ccs.neu.edu Tue Nov 18 14:10:39 2008 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:33:29 2009 Subject: [plt-scheme] Need more class examples? In-Reply-To: References: Message-ID: <4CBCE214-FBE4-412F-9505-046F8D4B1896@ccs.neu.edu> On Nov 18, 2008, at 1:38 PM, Veer wrote: > Hello, > > This code : > > (define my-area% (class* object% (area<%>) > (init min-width) > (define mini-width min-width) > > (define/public (get-top-level-window) > this) > (define/public (get-parent) > #f) > (define/public (stretchable-height) > #f) > (define/public (stretchable-width) > #f) > (define/public (get-graphical-min-size) > 0) > (define/public (min-width) > 0) > (define/public (min-height) > 0) > (super-new))) > > complains : > "class*: duplicate declared identifier in: min-width " > > My question is how you implement class method and init variable with > same name? > I tried to read the class reference manual , but its too complex for > me at the moment, so some examples > will be of great help. If you make it a (public) field, you can use the "renamed" version of the 'init-field' syntax: (class* object% (area<%>) (init-field ((mini-width min-width))) ...) That declares two things: - an initialization argument with an "external name" of 'min-width' - a field named 'mini-width', whose initial value comes from the initialization argument If you don't want to make it a public field, then you can do this: (class* object% (area<%>) (init ((-min-width min-width))) (define mini-width -min-width) ...) Then you'd have three names instead of just two: - 'min-width' is the external name of the initialization argument - '-min-width' is the internal name of the initialization argument - 'mini-width' is the name of the private instance variable Ryan > > > Thanks > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From blake at mcbride.name Tue Nov 18 14:30:55 2008 From: blake at mcbride.name (Blake McBride) Date: Thu Mar 26 02:33:29 2009 Subject: [plt-scheme] Thread documentation Message-ID: <610cb0830811181130j77dc0657gb73eaab3d657aa00@mail.gmail.com> It would be great if you could add one of the following two paragraphs to the PLT Scheme Reference section 1.1.13. 1. PLT Scheme supports true native / OS threads meaning that multiple core CPU's are fully taken advantage of. -or- 2. PLT Scheme simulates threads within scheme in an OS portable way. All scheme threads run within one (or a small or limited number) of OS threads. Multi-core CPU's are therefore not fully utilized. Many Scheme's and Lisp's out there say they support threads but how they do this (cooperative/pre-emptive, native/simulated) makes all the difference in the world. Sadly, virtually no one's documentation makes it clear what you are dealing with. Adding the above text would clarify the matter. Thanks. Blake McBride -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081118/1ab6f34d/attachment.htm From robby at cs.uchicago.edu Tue Nov 18 14:34:43 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:29 2009 Subject: [plt-scheme] Thread documentation In-Reply-To: <610cb0830811181130j77dc0657gb73eaab3d657aa00@mail.gmail.com> References: <610cb0830811181130j77dc0657gb73eaab3d657aa00@mail.gmail.com> Message-ID: <932b2f1f0811181134y48e6491x51a761d89a33e14b@mail.gmail.com> Just in case you didn't already know the answer, we're in world 2, but moving into world 1 (thanks to work at Utah). Robby On Tue, Nov 18, 2008 at 1:30 PM, Blake McBride wrote: > > It would be great if you could add one of the following two paragraphs to > the PLT Scheme Reference section 1.1.13. > > 1. PLT Scheme supports true native / OS threads meaning that multiple core > CPU's are fully taken advantage of. > > -or- > > 2. PLT Scheme simulates threads within scheme in an OS portable way. All > scheme threads run within one (or a small or limited number) of OS threads. > Multi-core CPU's are therefore not fully utilized. > > > Many Scheme's and Lisp's out there say they support threads but how they do > this (cooperative/pre-emptive, native/simulated) makes all the difference in > the world. Sadly, virtually no one's documentation makes it clear what you > are dealing with. Adding the above text would clarify the matter. > > Thanks. > > Blake McBride > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From kbohdan at mail.ru Tue Nov 18 14:37:50 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:29 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081118200856.648cf7a8@halmanfloyd.lan.local> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> <20081118194331.7661c766@halmanfloyd.lan.local> <20081118200856.648cf7a8@halmanfloyd.lan.local> Message-ID: Marek Kubica wrote: > Hi, > > On Tue, 18 Nov 2008 20:54:16 +0200 > kbohdan@mail.ru wrote: > >> As a good example of the language without single dominating >> implementation but with excellent dominating community i recommend to >> look at: c++ & www.boost.org. To put your library inside one must >> satisfy a lot of requirements. The most useful libraries from *boost* >> project will become a part of a new standard. When/If PLT switched to >> r6rs, wouldn't it be perfect to have similar library adoption process >> for r6rs PLT libs ? > > I don't think that taking extensions from PLT or other implementations > and declaring them a standard will work. Sorry, wasn't clear. I mean that some boost libraries can become proposals/drafts for the next c++ standard. From this point of view, boost libs are similar to scheme SRFIs and python PEPs. Boost libraries should pass aggressive adoption process which is comparable to Scheme evolution process but takes less time. Anyway the only relation of boost libs to standard is a good quality of libraries which is tempting for a c++ standard committee. > C++ is not a language known > for its elegance but Scheme (at least R5RS-Scheme) is. C++ elegance doesn't matter here, right ? >Sure, I'm all > for making Scheme a more practical language but then, I wouldn't want > Scheme to become an cleaned-up clone of Common Lisp. Is there any reason for your "wouldn't want" ? What is wrong with CL? What is wrong from cleaning up and reusing CL experience ? Why you think that i'm trying to make Scheme CL clone? > CL has its use, > Scheme does too and shouldn't be a Lisp-1 version of CL. The main problem is that Scheme is used mainly for research & study. I don't like this. I can see a lot of practical real-life unique applications for Scheme. This forces me to hope that the diversity of Scheme implementations will be somehow centralized around r6rs. -- Bohdan From diggerrrrr at gmail.com Tue Nov 18 14:41:29 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:33:30 2009 Subject: [plt-scheme] Need more class examples? In-Reply-To: <4CBCE214-FBE4-412F-9505-046F8D4B1896@ccs.neu.edu> References: <4CBCE214-FBE4-412F-9505-046F8D4B1896@ccs.neu.edu> Message-ID: Thanks a lot! , it's very clear now , thanks Carl and Ryan . On Wed, Nov 19, 2008 at 12:40 AM, Ryan Culpepper wrote: > On Nov 18, 2008, at 1:38 PM, Veer wrote: > >> Hello, >> >> This code : >> >> (define my-area% (class* object% (area<%>) >> (init min-width) >> (define mini-width min-width) >> >> (define/public (get-top-level-window) >> this) >> (define/public (get-parent) >> #f) >> (define/public (stretchable-height) >> #f) >> (define/public (stretchable-width) >> #f) >> (define/public (get-graphical-min-size) >> 0) >> (define/public (min-width) >> 0) >> (define/public (min-height) >> 0) >> (super-new))) >> >> complains : >> "class*: duplicate declared identifier in: min-width " >> >> My question is how you implement class method and init variable with same >> name? >> I tried to read the class reference manual , but its too complex for >> me at the moment, so some examples >> will be of great help. > > > If you make it a (public) field, you can use the "renamed" version of the > 'init-field' syntax: > > (class* object% (area<%>) > (init-field ((mini-width min-width))) > ...) > > That declares two things: > - an initialization argument with an "external name" of 'min-width' > - a field named 'mini-width', whose initial value comes from the > initialization argument > > If you don't want to make it a public field, then you can do this: > > (class* object% (area<%>) > (init ((-min-width min-width))) > (define mini-width -min-width) > ...) > > Then you'd have three names instead of just two: > - 'min-width' is the external name of the initialization argument > - '-min-width' is the internal name of the initialization argument > - 'mini-width' is the name of the private instance variable > > Ryan > > > >> >> >> Thanks >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From pivanyi at freemail.hu Tue Nov 18 14:43:04 2008 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:33:30 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <4CA041B5-F479-4BB2-8E87-5EDB4E0DD2EB@cs.indiana.edu> Message-ID: Hi, Just to "chip" in. I have this problem for a long time. I have ported my graphical application from Guile to Bigloo and now to PLT. Well, now is already a couple of years ago, but I am still very happy with PLT. Thanks for all the great work. :-) I also wanted to mention that I use Scheme for industry, so this is also possible, of course not in the scale of Java or other languages. Abdulaziz Ghuloum ?rta: > 3. Eat your cake and have it too: Isolate the parts of your > code that use implementation-specific extensions from the rest > of your code, and keep your main code base platform > independent. That is also what I do, but ... > (e.g., a portable GTK over the pipe interface). It's doable > and it's not that hard; it just takes some discipline. yes, you need strong discipline :-) and sometimes to give up certain features. Best regards, Peter Ivanyi ______________________________________ BE?P?THET? SZETTEK AKCI?S ?RON ITT! AEG-ELECTROLUX mosogat?g?pek – mos?g?pek – t?zhelyek - h?t?k ak?r 5 ?V kiterjesztett GARANCI?VAL! T?bb sz?z VIDE? term?kbemutat? – ORSZ?GOS h?zhozsz?ll?t?s – RENDELJ online az AEGshop.hu-t?l! http://ad.adverticum.net/b/cl,1,6022,299294,366112/click.prm From yinso.chen at gmail.com Tue Nov 18 16:35:24 2008 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:33:30 2009 Subject: [plt-scheme] Thread documentation In-Reply-To: <932b2f1f0811181134y48e6491x51a761d89a33e14b@mail.gmail.com> References: <610cb0830811181130j77dc0657gb73eaab3d657aa00@mail.gmail.com> <932b2f1f0811181134y48e6491x51a761d89a33e14b@mail.gmail.com> Message-ID: <779bf2730811181335s81dd54bib542c5e7284ee396@mail.gmail.com> That's big news! Is there some timeframe/detail for this? I imagine it would be world 2 + 1, where the microthreads are still retained, but multicore capable, FFI can be non-blocking, and works with both 3m/cgc... correct? Thanks, yc On Tue, Nov 18, 2008 at 11:34 AM, Robby Findler wrote: > Just in case you didn't already know the answer, we're in world 2, but > moving into world 1 (thanks to work at Utah). > > Robby > > On Tue, Nov 18, 2008 at 1:30 PM, Blake McBride wrote: > > > > It would be great if you could add one of the following two paragraphs to > > the PLT Scheme Reference section 1.1.13. > > > > 1. PLT Scheme supports true native / OS threads meaning that multiple > core > > CPU's are fully taken advantage of. > > > > -or- > > > > 2. PLT Scheme simulates threads within scheme in an OS portable way. > All > > scheme threads run within one (or a small or limited number) of OS > threads. > > Multi-core CPU's are therefore not fully utilized. > > > > > > Many Scheme's and Lisp's out there say they support threads but how they > do > > this (cooperative/pre-emptive, native/simulated) makes all the difference > in > > the world. Sadly, virtually no one's documentation makes it clear what > you > > are dealing with. Adding the above text would clarify the matter. > > > > Thanks. > > > > Blake McBride > > > > > > > > > > _________________________________________________ > > 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/20081118/0dd6c8eb/attachment.html From robby at cs.uchicago.edu Tue Nov 18 16:37:30 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:31 2009 Subject: [plt-scheme] Thread documentation In-Reply-To: <779bf2730811181335s81dd54bib542c5e7284ee396@mail.gmail.com> References: <610cb0830811181130j77dc0657gb73eaab3d657aa00@mail.gmail.com> <932b2f1f0811181134y48e6491x51a761d89a33e14b@mail.gmail.com> <779bf2730811181335s81dd54bib542c5e7284ee396@mail.gmail.com> Message-ID: <932b2f1f0811181337m47594c6cye00d6981a47c6e5e@mail.gmail.com> I probably shouldn't have opened my mouth, but I guess they're still a ways away. I'll let them speak now. Robby On Tue, Nov 18, 2008 at 3:35 PM, YC wrote: > That's big news! > > Is there some timeframe/detail for this? > > I imagine it would be world 2 + 1, where the microthreads are still > retained, but multicore capable, FFI can be non-blocking, and works with > both 3m/cgc... correct? > > Thanks, > yc > > On Tue, Nov 18, 2008 at 11:34 AM, Robby Findler > wrote: >> >> Just in case you didn't already know the answer, we're in world 2, but >> moving into world 1 (thanks to work at Utah). >> >> Robby >> >> On Tue, Nov 18, 2008 at 1:30 PM, Blake McBride wrote: >> > >> > It would be great if you could add one of the following two paragraphs >> > to >> > the PLT Scheme Reference section 1.1.13. >> > >> > 1. PLT Scheme supports true native / OS threads meaning that multiple >> > core >> > CPU's are fully taken advantage of. >> > >> > -or- >> > >> > 2. PLT Scheme simulates threads within scheme in an OS portable way. >> > All >> > scheme threads run within one (or a small or limited number) of OS >> > threads. >> > Multi-core CPU's are therefore not fully utilized. >> > >> > >> > Many Scheme's and Lisp's out there say they support threads but how they >> > do >> > this (cooperative/pre-emptive, native/simulated) makes all the >> > difference in >> > the world. Sadly, virtually no one's documentation makes it clear what >> > you >> > are dealing with. Adding the above text would clarify the matter. >> > >> > Thanks. >> > >> > Blake McBride >> > >> > >> > >> > >> > _________________________________________________ >> > 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 marek at xivilization.net Tue Nov 18 17:13:55 2008 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:33:31 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> <20081118194331.7661c766@halmanfloyd.lan.local> <20081118200856.648cf7a8@halmanfloyd.lan.local> Message-ID: <20081118231355.36e01bc6@halmanfloyd.lan.local> Hi, On Tue, 18 Nov 2008 21:37:50 +0200 kbohdan@mail.ru wrote: > > C++ is not a language known > > for its elegance but Scheme (at least R5RS-Scheme) is. > > C++ elegance doesn't matter here, right ? I haven't heard anybody who said C++ was elegant. Fast, yes, portable - sometimes. Elegant, no. And to be honest, I'm used to elegant solutions in dynamically typed languages, so probably any kind of 'elegance' in C++ won't convince me anyway. > Is there any reason for your "wouldn't want" ? What is wrong with CL? > What is wrong from cleaning up and reusing CL experience ? > Why you think that i'm trying to make Scheme CL clone? Whats wrong with CL: nothing. It is already there, ready to be used. No need to clone it. This is not some Sun-Microsoft competition where we try to design languages like Java and C# and try to get as many programmers on our side because we offer features that the other language will only provide in the next version. So if you want a CL-like language, with a comprehensive standard and compatible implementations just go for CL. History has shown that CL is not perfect, it is a compromise that people working on Real Applications(TM) agreed on, mostly MacLisp and Interlisp folks who wanted to push as many of their ideas in the new standard. You're proposing similar things - pushing implementation specific extensions into a standard. Actually, what I'm currently missing in CL word is some kind of progress. Sure, there are already quite some libraries published and there are some high quality implementations, but it doesn't make me excited, the way that each new release of a even-more-R6RS-conformant Scheme does. Maybe it's just me or maybe CL is really mature; I'm not taht much into CL to judge. > The main problem is that Scheme is used mainly for research & study. > I don't like this. I can see a lot of practical real-life unique > applications for Scheme. This forces me to hope that the diversity of > Scheme implementations will be somehow centralized around r6rs. No, but I have to repeat a lesson that Kenny Tilton taught me: shut up and write code. And honestly, this really *is* the right way. A perfect implementation of R6RS buys you exactly nothing, an good implementation of a library lets you start with your problem instead of first having to write the library to use to solve your problem. Lisp is suffering very much of the time that is spent on discussing about it, time that could be used better to write program in it. Or write documentation. This is maybe why I signed up for this list: PLT is an implementation for people who want to use Scheme, rather than stand by and admire it's beauty. At least this is my perception of PLT, due to the comprehensive documentation and the functionality that is provided. I want to get my work done. I don't want to wait until a deus ex machina eppears and saves the day by providing a mysterious way of making all implementations compatible. But even if they were, someone still needs to write the libs. And actually, writing stuff in Scheme and seeing it work has so far been much more fun than discussing some details of R6RS for half a week :) Of course, I appreciate unification, this is also the point where I hope that R6RS will provide a bigger common ground than previous versions. regards, Marek From matthias at ccs.neu.edu Tue Nov 18 17:21:51 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:31 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081118231355.36e01bc6@halmanfloyd.lan.local> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> <20081118194331.7661c766@halmanfloyd.lan.local> <20081118200856.648cf7a8@halmanfloyd.lan.local> <20081118231355.36e01bc6@halmanfloyd.lan.local> Message-ID: On Nov 18, 2008, at 5:13 PM, Marek Kubica wrote: > PLT is an implementation for people who want to use Scheme, rather > than stand by and admire it's beauty. Amen! May I propose that we rest this thread now? (I must admit that I saw this phrase only by accident anyway.) Building code is more fun than discussing reports. -- Matthias From esmith at acanac.net Tue Nov 18 17:27:38 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:33:31 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <4DA0FDC1-4185-4CCF-96E5-3A7DC223DF88@ccs.neu.edu> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <4922F8D0.4060107@acanac.net> <4DA0FDC1-4185-4CCF-96E5-3A7DC223DF88@ccs.neu.edu> Message-ID: <4923415A.9010109@acanac.net> Matthias Felleisen wrote: > > > Please read my reply. I address this point specifically > and we are actively working on a strategy. -- Matthias > > I could find no reply which made any reference to a strategy actively being worked on. I did find a reply which I'll summarize as follows: Use R6Rs as a bridge. Port from PLT to R6Rs, then from R6Rs to other (e.g. Gambit) But don't worry about that bridge until you come to it. It sounds a bit scary to me. And I challenge the notion that most working programmers aren't porting programmers. I think we all are, ipso facto. By virtue of continuing to work, we port. I'm more inclined towards something along the lines of the reply Aziz posted. Thanks Aziz. I think with PLT the module language is the addiction that is worrisome, RnRs won't be helping much there. I would surely like to learn more about that strategy actively being worked on you mention. From kbohdan at mail.ru Tue Nov 18 17:56:59 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:31 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081118231355.36e01bc6@halmanfloyd.lan.local> References: <38E4D4F5-FAF7-4AE7-B804-12D66E6E90A8@ccs.neu.edu> <63bb19ae0811180823y29cba0aay15d3b96f9e85eeeb@mail.gmail.com> <20081118194331.7661c766@halmanfloyd.lan.local> <20081118200856.648cf7a8@halmanfloyd.lan.local> <20081118231355.36e01bc6@halmanfloyd.lan.local> Message-ID: Marek Kubica wrote: > Of course, I appreciate unification, this is also the point where I > hope that R6RS will provide a bigger common ground than previous > versions. It was a major issue. -- Bohdan From mflatt at cs.utah.edu Tue Nov 18 18:22:57 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:32 2009 Subject: [plt-scheme] Thread documentation In-Reply-To: <610cb0830811181130j77dc0657gb73eaab3d657aa00@mail.gmail.com> References: <610cb0830811181130j77dc0657gb73eaab3d657aa00@mail.gmail.com> Message-ID: <20081118232258.630846500BD@mail-svr1.cs.utah.edu> At Tue, 18 Nov 2008 13:30:55 -0600, "Blake McBride" wrote: > Many Scheme's and Lisp's out there say they support threads but how they do > this (cooperative/pre-emptive, native/simulated) makes all the difference in > the world. Sadly, virtually no one's documentation makes it clear what you > are dealing with. Adding the above text would clarify the matter. It's actually documented in the beginning of Chapter 10, but I agree that the information belongs in 1.1.13, so I've moved it. Matthew From harsha.v.r at gmail.com Tue Nov 18 22:49:08 2008 From: harsha.v.r at gmail.com (harsha) Date: Thu Mar 26 02:33:32 2009 Subject: [plt-scheme] fred doesn't respond to text-field changes Message-ID: <18030623-320f-468a-89d2-bf0051ae5fc9@d36g2000prf.googlegroups.com> hi, the mred binding to gui doesn't seem to be responding to text-field changes, is this a work in progress or am i missing something in my program? #lang frtime (require frtime/gui/fred ) (define a (new ft-frame% (label "hello") (width 600) (height 500) (shown #t))) (define b (new ft-text-field% (label "hello") (parent a))) (define k (send b get-value-b)) (define c (new ft-button% (label k) (parent a))) (value-now k) indicates that k changes with text-field changes but the button c doesn't update to reflect this, (replacing k with a behaviour like (number->string seconds) works fine.) harsha From grettke at acm.org Tue Nov 18 23:34:09 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:32 2009 Subject: [plt-scheme] R6RS is useful for PLT, and, PLT is useful for R6RS Message-ID: <756daca50811182034g754c35b6j9493fe50e826eff5@mail.gmail.com> PLaneT has a lot of code. How much of it could be backported to R6RS? Would it be interesting? Using DrScheme to write and run the same code that you run in any other R6RS compliant Scheme distribution is pretty neat. It leverages their investment in the tool and the runtime. From hdg at cox.net Tue Nov 18 23:41:55 2008 From: hdg at cox.net (H David Goering) Date: Thu Mar 26 02:33:32 2009 Subject: [plt-scheme] migrating non-modular mzscheme programs to PLT version 4 In-Reply-To: <990e0c030811160914u7e057f5cg5d27a4cf9784502c@mail.gmail.com> References: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> <990e0c030811160914u7e057f5cg5d27a4cf9784502c@mail.gmail.com> Message-ID: <9F6074D7-4D4E-45AC-B619-12F7C82990AB@cox.net> Carl, Which Scheme is scheme/load? It's not MzScheme. The program loaded after adding "(require mzscheme)" and making a few small changes, but it doesn't run. Thanks, David On Nov 16, 2008, at 11:14 AM, Carl Eastlund wrote: > If you put "#lang scheme/load" at the top of your main file, I believe > it should run properly in the Module language and load the other files > without changing them. > > --Carl > > On Sun, Nov 16, 2008 at 12:36 AM, H David Goering wrote: >> Unlike MzScheme of version 3, Module seems to require that the top- >> level >> file of a multi=file program contain a module. Adding '(require >> mzscheme)' >> is not sufficient. >> >> Converting the top-level file to a module is no hardship, but >> 'load' and >> 'load/use-compiled' now seem to require that arguments refer to >> modules >> rather than mere files. If the reference is not a module the error >> message >> "compile: bad syntax; function application is not allowed, because >> no #%app >> syntax transformer is bound" is seen. Adding '#lang mzscheme' >> fixes that >> problem but fragments the namespace in a regrettable way. >> >> Will Module accept a multi-file mzscheme program that is not >> modularized? >> Or one that is treated as a single module? >> >> Thanks, >> >> David From cce at ccs.neu.edu Wed Nov 19 00:40:12 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:33:32 2009 Subject: [plt-scheme] migrating non-modular mzscheme programs to PLT version 4 In-Reply-To: <9F6074D7-4D4E-45AC-B619-12F7C82990AB@cox.net> References: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> <990e0c030811160914u7e057f5cg5d27a4cf9784502c@mail.gmail.com> <9F6074D7-4D4E-45AC-B619-12F7C82990AB@cox.net> Message-ID: <990e0c030811182140n3723d600g4f232cecdeefcd36@mail.gmail.com> The scheme/load language is PLT 4.0, like the scheme and scheme/base languages, but it behaves like the top level (i.e. the REPL) rather than like a module. I forgot it wouldn't save you the trouble of porting to the new language features. --Carl On Tue, Nov 18, 2008 at 11:41 PM, H David Goering wrote: > Carl, > > Which Scheme is scheme/load? It's not MzScheme. The program loaded after > adding "(require mzscheme)" and making a few small changes, but it doesn't > run. > > Thanks, > > David > > On Nov 16, 2008, at 11:14 AM, Carl Eastlund wrote: > >> If you put "#lang scheme/load" at the top of your main file, I believe >> it should run properly in the Module language and load the other files >> without changing them. >> >> --Carl >> >> On Sun, Nov 16, 2008 at 12:36 AM, H David Goering wrote: >>> >>> Unlike MzScheme of version 3, Module seems to require that the top-level >>> file of a multi=file program contain a module. Adding '(require >>> mzscheme)' >>> is not sufficient. >>> >>> Converting the top-level file to a module is no hardship, but 'load' and >>> 'load/use-compiled' now seem to require that arguments refer to modules >>> rather than mere files. If the reference is not a module the error >>> message >>> "compile: bad syntax; function application is not allowed, because no >>> #%app >>> syntax transformer is bound" is seen. Adding '#lang mzscheme' fixes that >>> problem but fragments the namespace in a regrettable way. >>> >>> Will Module accept a multi-file mzscheme program that is not modularized? >>> Or one that is treated as a single module? >>> >>> Thanks, >>> >>> David From thomas.gordon at fokus.fraunhofer.de Wed Nov 19 00:54:49 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:33:32 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? Message-ID: On Nov 18, 2008, at 3:34 PM, Matthias Felleisen wrote: > As the naming conventions in DrScheme suggest, we consider > our Module language the primary development vehicle. R6RS, > like R5RS, is supported and available. Bug reports and > feature requests are taken seriously. As Robby indicates, > R6RS is our bridge to other Scheme implementations and we > would like libraries to flow into our world. -- Matthias The problem is that the PLT tools, libraries, environment and documentation in effect, if not intention, encourage people to write modules using the PLT Scheme dialect, rather than portable R6RS libraries, since the PLT dialect is better supported. Anything which discourages people from making the effort to port libraries to R6RS, or write new libraries in R6RS, serves to undermine R6RS. Now, I can understand that the status quo may be in the best interest of the PLT team and community and that you don't have much incentive to encourage people to write code which is not dependent on the PLT system. I'll also appreciate that the PLT team does research on programming languages and needs to experiment with new ideas. Presumably what needs to happen for R6RS to succeed is for one or more R6RS implementations to become competive with PLT and begin to attract users away from PLT, on their own merits. I don't suppose we can expect the PLT team to take the lead on this. Tom Gordon From hendrik at topoi.pooq.com Thu Nov 20 00:56:12 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:33:32 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: Message-ID: <20081120055612.GA9676@topoi.pooq.com> On Wed, Nov 19, 2008 at 06:54:49AM +0100, Tom Gordon wrote: > On Nov 18, 2008, at 3:34 PM, Matthias Felleisen wrote: > > >As the naming conventions in DrScheme suggest, we consider > >our Module language the primary development vehicle. R6RS, > >like R5RS, is supported and available. Bug reports and > >feature requests are taken seriously. As Robby indicates, > >R6RS is our bridge to other Scheme implementations and we > >would like libraries to flow into our world. -- Matthias > > The problem is that the PLT tools, libraries, environment and > documentation in effect, if not intention, encourage people to write > modules using the PLT Scheme dialect, rather than portable R6RS > libraries, since the PLT dialect is better supported. > > Anything which discourages people from making the effort to port > libraries to R6RS, or write new libraries in R6RS, serves to undermine > R6RS. > > Now, I can understand that the status quo may be in the best interest > of the PLT team and community and that you don't have much incentive > to encourage people to write code which is not dependent on the PLT > system. I'll also appreciate that the PLT team does research on > programming languages and needs to experiment with new ideas. > > Presumably what needs to happen for R6RS to succeed is for one or more > R6RS implementations to become competive with PLT and begin to attract > users away from PLT, on their own merits. I don't suppose we can > expect the PLT team to take the lead on this. The problem, as I see it, is not a question of unwillingness, but a matter of limited resources. PLT Scheme is more successful than other systems primarily because it has defined and implemented enough libraries to make PLT useful for a lot of real-world applications. This is not a trivial task. and is an important contribution. Without this, Scheme would not even be in teh running as a serious application programming language. R6RS has made moves in this direction, providing more necessary tools, but moving slowly, with a lot of second thought, a lot of trying-to-be-certain-it-is-being-done-right, a lot of consensus-making. THis inevitably slows its development down, and the "standard" is only slowly becoming a widely-applicable system. THis is nte nature of standards, especially good ones. What needs doing is to bend PLT Schene in the direction of R6RS, gradually removing incompatibilities, and gradually creating bridges for old code. There is a substantial base of old code. And yes, the librries are going to have to be rewritten to make them portable. To some extent this can probably be automated, with suitable name-spaces and macros. To a greater extent is will probably have to be done by hand. And some are just going to have to remain unportable because they use and provide features that do not exist in R^RS. It will take work, and I don't see any signs the PLT scheme team is unwilling to take on this effort. What I do see is limited resources. I presume any assistance will be welcome, and that the role of the PLT scheme in this is to provide the coordination and common toolset that make this work. -- hendrik From jev at mac.com Wed Nov 19 10:08:33 2008 From: jev at mac.com (Jaime Vargas) Date: Thu Mar 26 02:33:33 2009 Subject: [plt-scheme] Graphics artifacts Message-ID: <56952723494591501042989109429590979430-Webmail@me.com> When running the code below in OSX 10.4.11 and 10.5.4 using DrScheme 4.1.2.4-svn12nov2008, I see white bands defects. Is this normal for rendering pixel by pixel or a bug? #lang scheme/gui ; Make a 300 x 300 frame (define frame (new frame% [label "Drawing Example"] [width 300] [height 300])) ; Make the drawing area (define canvas (new canvas% [parent frame])) ; Get the canvas's drawing context (define dc (send canvas get-dc)) ; Make some pens and brushes (define black-pen (make-object pen% "BLACK" 1 'solid)) (define red-pen (make-object pen% "RED" 1 'solid)) ; Show the frame (send frame show #t) ; Wait a second to let the window get ready (sleep/yield 1) ; Draw 1-pixel checkerboard pattern (for* ([x (in-range 300)] [y (in-range 300)]) (if (odd? (+ x y)) (send dc set-pen red-pen) (send dc set-pen black-pen)) (send dc draw-point x y)) Thanks, Jaime From jensaxel at soegaard.net Wed Nov 19 10:44:37 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:33 2009 Subject: [plt-scheme] Graphics artifacts In-Reply-To: <56952723494591501042989109429590979430-Webmail@me.com> References: <56952723494591501042989109429590979430-Webmail@me.com> Message-ID: <49243465.9030409@soegaard.net> Jaime Vargas wrote: > When running the code below in OSX 10.4.11 and 10.5.4 using DrScheme 4.1.2.4-svn12nov2008, I see white bands defects. Is this normal for rendering pixel by pixel or a bug? > > That is indeed strange. Even stranger is the fact, that I got different white stripes, when I ran the snippet several times. -- Jens Axel S?gaard From diggerrrrr at gmail.com Wed Nov 19 10:02:59 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:33:33 2009 Subject: [plt-scheme] get-graphical-min-size error? Message-ID: Hello, When i query frame for get-graphical-min-size like this : (send frame get-graphical-min-size) it complains with following message : "send: no such method: get-hard-minimum-size for class: ...red/private/wxtop.ss:584:4" I am running 4.1 on linux. From mflatt at cs.utah.edu Wed Nov 19 11:16:18 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:33 2009 Subject: [plt-scheme] Graphics artifacts In-Reply-To: <56952723494591501042989109429590979430-Webmail@me.com> References: <56952723494591501042989109429590979430-Webmail@me.com> Message-ID: <20081119161618.5C1766500C6@mail-svr1.cs.utah.edu> At Wed, 19 Nov 2008 10:08:33 -0500, Jaime Vargas wrote: > When running the code below in OSX 10.4.11 and 10.5.4 using DrScheme > 4.1.2.4- svn12nov2008, I see white bands defects. Is this normal for > rendering pixel by pixel or a bug? It's a bug --- and, so far, an especially puzzling one. I will continue to investigate. Matthew From esmith at acanac.net Wed Nov 19 11:54:29 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:33:33 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081120055612.GA9676@topoi.pooq.com> References: <20081120055612.GA9676@topoi.pooq.com> Message-ID: <492444C5.8050403@acanac.net> A slide I read at the end of a tutorial by Matthew Flatt indicates a key focal point. This is the tutorial: http://www.cs.utah.edu/classes/cs6520-mflatt/s04/macro-tutorial.pdf The slide read: There is no one scheme. or Scheme is a language for defining practical languages. Standardized language declaration syntax may be the way to tame implementation differences. amen to that. From gregory.woodhouse at gmail.com Wed Nov 19 12:37:28 2008 From: gregory.woodhouse at gmail.com (Greg Woodhouse) Date: Thu Mar 26 02:33:34 2009 Subject: [plt-scheme] Look at it differently: Why PLT? Message-ID: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> There is a lot of discussion going on here about how many PLT users wish it would conform more closely to R6RS. As someone working in two arenas where standards are especially important (healthcare and government), I can't help but be sympathetic. Indeed, I'd like to be able to use PLT Scheme for production work, and not conforming with existing standards is a major impediment there. That being said, everyone on this list is using, or at least interested in using, PLT Scheme. Why? I suspect everyone will have their own answers, but here are some of mine: 1. I like the DrScheme development enivornment. Though I could certainly use command line tools, I find it easier to use an integrated environment. There's nothing wrong with that. I don't know a Java developer in this office that Doesn't use Eclipse (I used to use NetBeans, but have since switched to Eclipse). Okay, to be fair Java has idiosynrasies making it even more awkward not to use an IDE, but the point remains. 2. PLT Scheme provides many (unfortunately, not all) of the capabilities I'm most interested in. Support for both web applications and low level socket programming is a must. I frequently make use of patterns and pattern matching (perhaps making my programming style a bit more ML or Haskell-like than Scheme-like?) Though I haven't really made extensive use of it yet, the unit system seems to provide a very powerful mechanism for abstraction, and is something that I believe to be crucial for large scale applications. The contract system is a big one. I recently received my copy of the OOPSLA 2008 procedings in the mail, and there is a paper (Dino Distefano, "jStar: Towards Practical Verification for Java") that demonstrates how a research prototype (jStar) is able to handle (albit awkwardly in some ways) four common design patterns in Java. I didn't pick it up with Scheme in mind, but I couldn't help but think about how much simpler, more elegant, and powerful contracts in PLT Scheme are. Two additional areas with rich support are XML and GUI development (including graphics). For me, these are both close to being a must. 4. PLT Scheme is vital. I've argued in other forums that when a language or framework is no longer being actively developed (and no, I don't mean just maintenance), it is already on the road to obsolescence. There is a tension here between the desire for standardization and stability on the one hand, and innovation and intellectual vigor on the other. But insisting too quickly on standardization can easily lead to a kind of "analysis paralysis". 5. PLT Scheme is portable. It supports Windows, OS X (Macintosh), and Linux equally, and code developed on one platform is generally portable to the others. Time and again, we run into situations where a tool is only available on one platform or, even if it is available on multiple platforms, one or more of them is a "second class citizen". Either the newest versions of the product will not be available, or technical support will be much more limited, or both. I really appreciate the fact that this isn't the case with PLT Scheme. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081119/da87b55a/attachment.htm From martindemello at gmail.com Wed Nov 19 13:45:32 2008 From: martindemello at gmail.com (Martin DeMello) Date: Thu Mar 26 02:33:34 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: On Wed, Nov 19, 2008 at 9:37 AM, Greg Woodhouse wrote: > > That being said, everyone on this list is using, or at least interested in > using, PLT Scheme. Why? I suspect everyone will have their own answers, but > here are some of mine: I like how it combines clean, powerful, rich and pragmatic. Thus far, the only other languages I've found in that sweet spot are Ruby, Clojure and Python. I daresay I'll find Haskell pragmatic, and OCaml clean, once I am better at them, but I liked how I could just pick up PLT Scheme and start using it, and feel that I was getting some advantage in doing so. Plus, too few people care about more expressive ways to write GUI desktop applications. I really like that the PLT GUI framework is well integrated and not just a thin wrapper over some C or Java toolkit. martin From vyzo at media.mit.edu Wed Nov 19 14:01:03 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:34 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: On Wed, 19 Nov 2008, Greg Woodhouse wrote: > That being said, everyone on this list is using, or at least interested in > using, PLT Scheme. Why? I suspect everyone will have their own answers, but > here are some of mine: For me macros and the module system is the real killer feature of plt. The module system, apart from the nice abstraction facilities, makes it is trivial to change the language to better suite your needs. The macro system, especially with the excellent expansion time primitives makes it easy to write little languages. The two combine to give plt great expressive power. I wish r6rs had a feature like #lang and some better expansion time support (syntax-local-value anyone?); it would be a lot easier to port code. -- vyzo From jadudm at gmail.com Wed Nov 19 14:21:42 2008 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:33:34 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: On Wed, Nov 19, 2008 at 12:37 PM, Greg Woodhouse wrote: > That being said, everyone on this list is using, or at least interested in > using, PLT Scheme. Why? I suspect everyone will have their own answers, but > here are some of mine: Hi Greg, I wanted to say that I agree with every point on your list. While taking courses at IUB, I switched to PLT Scheme simply because it was the only Scheme I could easily use on my Mac. (This was just before OS X.) Since then, everything you say reflects why I continue to use PLT Scheme instead of exploring across implementations. In terms of full disclosure, I should also say that I find most of the PLT team very intimidating, and am afraid someone wielding a mighty lambda or mean-wicked leflef paren will stop by and pay my family a visit if I ever switch to another Scheme implementation... ;) Cheers, Matt From matthias at ccs.neu.edu Wed Nov 19 14:30:12 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:35 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: <509BEE2C-CABB-47BB-95FD-7070F8399AB3@ccs.neu.edu> On Nov 19, 2008, at 2:21 PM, Matt Jadud wrote: > In terms of full disclosure, I should also say that I find most of the > PLT team very intimidating, and am afraid someone wielding a mighty > lambda or mean-wicked leflef paren will stop by and pay my family a > visit if I ever switch to another Scheme implementation... That's the way we like it, ah-hu. And I use right parens. From ebellani at gmail.com Wed Nov 19 14:43:14 2008 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:33:35 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: <184222e50811191143w27b445b5y595d069e4bef6cd7@mail.gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - From the point of view of this noob, what attracted me to PLT instead of other schemes/lisps was your point 4 (or is it 3? :P ). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFJJGxRTGtma8x8sd4RAuYiAJ4ztQAukmRIEaDP50uRsh5FXDAm7QCfSTAm +xDdwHdxlrqa5sCC6tzHHjI= =aMf8 -----END PGP SIGNATURE----- > 4. PLT Scheme is vital. The community looks (at least from the outside) interested in building stuff, not just preserving what they see as sacred pillars, there are up to date documentation and people seem nicer to outsiders. For example, I took a look at comp.lang.lisp and saw a lot of people getting consciously hostile to other people who are obviously beginners, but were asking perfectly valid questions, which frankly drove me away very fast. Here I've yet to see that, and I think that is very much related to do with your point. My 2 cents. Hugs -- Eduardo Bellani www.cnxs.com.br "What is hateful to you, do not to your fellow men. That is the entire Law; all the rest is commentary." The Talmud From gregory.woodhouse at gmail.com Wed Nov 19 15:07:15 2008 From: gregory.woodhouse at gmail.com (Greg Woodhouse) Date: Thu Mar 26 02:33:35 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: <509BEE2C-CABB-47BB-95FD-7070F8399AB3@ccs.neu.edu> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> <509BEE2C-CABB-47BB-95FD-7070F8399AB3@ccs.neu.edu> Message-ID: <5f07325f0811191207h42b4a4e2q95b8e2b80a9946e0@mail.gmail.com> Oh, I find the PLT team very intimidating, too (but in a good way). I could have added that as another bullet point. I have a huge amount of respect for the PLT team, and know they are people I can rely on to produce a good product. On the other hand, I've been impressaed by all of your willingness to answer questions and point people like me in the right direction. On Wed, Nov 19, 2008 at 11:30 AM, Matthias Felleisen wrote: > > > On Nov 19, 2008, at 2:21 PM, Matt Jadud wrote: > > In terms of full disclosure, I should also say that I find most of the >> PLT team very intimidating, and am afraid someone wielding a mighty >> lambda or mean-wicked leflef paren will stop by and pay my family a >> visit if I ever switch to another Scheme implementation... >> > > That's the way we like it, ah-hu. And I use right parens. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081119/0f503854/attachment.html From grettke at acm.org Wed Nov 19 15:33:11 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:35 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: Message-ID: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> On Tue, Nov 18, 2008 at 11:54 PM, Tom Gordon wrote: > Anything which discourages people from making the effort to port libraries > to R6RS, or write new libraries in R6RS, serves to undermine R6RS. By that rationale the PLT group also discourages the use of the HtDP languages, and Typed Scheme for example! :) > Presumably what needs to happen for R6RS to succeed is for one or more R6RS > implementations to become competive with PLT and begin to attract users away > from PLT, on their own merits. Please elaborate. From grettke at acm.org Wed Nov 19 16:03:51 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:36 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081120055612.GA9676@topoi.pooq.com> References: <20081120055612.GA9676@topoi.pooq.com> Message-ID: <756daca50811191303n6ca44219lee547f23c7c2cd0a@mail.gmail.com> On Wed, Nov 19, 2008 at 11:56 PM, wrote: > R6RS has made moves in this direction, providing more necessary tools, I think of R6RS as being important for its API definition; people want to have a chance at portability. > What needs doing is to bend PLT Schene in the direction of R6RS, > gradually removing incompatibilities, and gradually creating bridges for > old code. You can call into and out of R6RS from the #scheme language, it is already in place. Back-porting functionality to R6RS is the harder part. > the role of the PLT scheme in this is to provide the > coordination and common toolset that make this work. Definitely. From mflatt at cs.utah.edu Wed Nov 19 16:21:39 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:36 2009 Subject: [plt-scheme] Graphics artifacts In-Reply-To: <20081119161618.5C1766500C6@mail-svr1.cs.utah.edu> References: <56952723494591501042989109429590979430-Webmail@me.com> <20081119161618.5C1766500C6@mail-svr1.cs.utah.edu> Message-ID: <20081119212139.A66206500E1@mail-svr1.cs.utah.edu> At Wed, 19 Nov 2008 09:16:18 -0700, Matthew Flatt wrote: > At Wed, 19 Nov 2008 10:08:33 -0500, Jaime Vargas wrote: > > When running the code below in OSX 10.4.11 and 10.5.4 using DrScheme > > 4.1.2.4- svn12nov2008, I see white bands defects. Is this normal for > > rendering pixel by pixel or a bug? > > It's a bug --- and, so far, an especially puzzling one. I will continue > to investigate. It seems to be a QuickDraw problem, specifically related to moving an image from a window's offscreen image onto the screen. If you have a window with white bands, try dragging it off the screen or under the dock, and I think you'll see that it updates correctly. That's not a PLT Scheme update --- not even at the level of C++ glue to the OS's drawing libraries. It's entirely in the OS, which means that the OS didn't copy the offscreen image to the screen correctly in the first place. It's possible that PLT Scheme is somehow misusing QuickDraw, or maybe it's actually a bug in QuickDraw (which is now deprecated). I haven't found any change in our use of QuickDraw that solves the problem, and it looks like the long-term solution will be to switch PLT Scheme away from QuickDraw. Meanwhile, a workaround is to * Turn on "smoothing" in the window using `(send dc set-smoothing 'aligned)', which has the effect of using Quartz instead of QuickDraw for many operations. * Draw the point using `(send dc draw-line x y x y)', since `draw-point' isn't one of the operations that uses Quartz. Another solution is to build the image in a bitmap%, and then `draw-bitmap' it into the canvas. Matthew From billclem at gmail.com Wed Nov 19 19:11:17 2008 From: billclem at gmail.com (Bill Clementson) Date: Thu Mar 26 02:33:36 2009 Subject: [plt-scheme] Vancouver Lisp Users Group meeting for November 2008 - 0x20 Years of Lisp Systems, a Personal Journey Message-ID: <8757cb490811191611l5bebc277te179b12883f9954@mail.gmail.com> Hi all, Norman Jaffe has been using Lisp and Lisp Machines for more years than most lispvan members have been alive! Working on such a broad range of Lisp systems has given him a fairly unique perspective on Lisp as a language and Lisp Machines as a working environment (Norm gave an earlier presentation on "Wearing Lisp" at the April 2006 lispvan meeting). During this presentation, Norm will be showing off some actual Lisp Machines and Lisp Environments and talking about his experiences with them. We will have the meeting at a new location, The Hackery, (with a projector and a special meeting room!), so make certain you take note of the new location. Here's the "official" meeting notice: Topic: 0x20 Years of Lisp Systems, a Personal Journey Presenter: Norman Jaffe Date: Thursday, November 27th, 2008 Time: 7pm - 10pm (or whenever) Venue: The Hackery, 304 Victoria Dr (entrance off Franklin), Vancouver Summary: While at the University of Washington and Simon Fraser University in the early '70s, I was exposed to a wide variety of computer languages and systems. Most have 'fallen by the wayside', but four have influenced my travels through the computing landscape - Lisp, Smalltalk, Snobol and APL. Tonight I'll talk about where LISP has taken me, from informal 'Greenspun' code to dedicated hardware. I hope to show the breadth of Lisp systems and the exciting new directions that I see. Join us for a beer (bring your own - there's a fridge) and/or coffee and a chance to see some old and new lisp machines and lisp environments and to discuss what was, what is, and what could be! For updates (and additional links), see my blog posting: http://bc.tech.coop/blog/081119.html -- Bill Clementson From mike at sharedlogic.ca Wed Nov 19 20:41:04 2008 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:33:36 2009 Subject: [plt-scheme] Some rough PLT web app figures Message-ID: Hi, Given some of the recent blog posts on use of the PLT web server, I thought I would share some of our deployment figures. Sorry that it's little more than a quick laundry list; time and customer permitting, perhaps I'll write a more thorough summary later. We've written 5 PLT-based web apps for one of our clients. One provides core personnel scheduling, work order, billing, and payroll operations; the other four provide remote data entry for various business processes built around the core (e.g. employee time-keeping). Together, the apps weigh in at 24286 LOC of Scheme code, of which 6340 LOC is shared as libraries. The business rules and data are modeled exclusively and stored using PostgreSQL. The 'view' layer is written in Scheme as is a custom date/time library required for multiple time-zone business logic. We run each app under a separate mzscheme instance, all behind an Apache reverse proxy to provide SSL. The core app hovers around 300M memory usage, of which about 250M is resident. The others consume between 60 and 160M each. Here's the hardware and software: Dell PE 2970 2GHz Quad Core AMD Opteron 8G RAM FreeBSD 7.0-RELEASE amd64 PostgreSQL 8.2 mz-4.1 spgsql instaservlet custom servlet-shim.ss: LRU memory manager 1G memory threshold 5 second check 24 life points 30 minute period for life point deduction Hope of that's of use to someone. Cheers! Mike From fahree at gmail.com Tue Nov 18 09:15:35 2008 From: fahree at gmail.com (=?ISO-8859-1?Q?Far=E9?=) Date: Thu Mar 26 02:33:36 2009 Subject: [plt-scheme] Next Boston Lisp Meeting: Monday November 24th 2008 at 1800 at MIT 34-401B Message-ID: <653bea160811180615y417de6cu1c31f967ad6aff51@mail.gmail.com> Next Boston Lisp Meeting: Monday November 24th 2008 at 1800 at MIT 34-401B Gregory Marton will give a talk about the meanings of English words as programs. http://fare.livejournal.com/136992.html Gregory will introduce a way of thinking about the meanings of English words as programs (c.f. SHRDLU), cast the problem of language learning as a search through the space of possible programs, and show first steps in learning. Gregory has created a system called Sepia that makes it relatively easy to write small lexicons that implement some semantic theory for a domain. Applications that Gregory and several colleagues have had fun with include: * understanding dates and times and other measures: "next Wednesday" * finding and linking names of people, organizations, places * telling a robot what to do with stuff on a table: "touch the red one" * asking about spatial paths in video: "show people entering the kitchen" * a toy gossip world: "John loves Mary" "Who does not hate Mary?" * a little number theory: "18 is twice the sum of its digits" These applications are inherently brittle, and manual construction gets harder as the application grows. The research goal is to construct new meaning programs with little human input, or with input from non-programmers. Given a problem phrase, Sepia uses standard ways to find similar words that it knows. Its current approach is to take the meanings of those words and makes small changes, looking for a combination that produces the target meaning. Both the system as a whole and the language of semantics are implemented in the GNU/Guile flavor of Scheme. Gregory Marton is a PhD student in computer science at MIT, and this is his dissertation topic. His first language is Hungarian, and since meeting English at age eight, he has wondered about meanings and how to learn language. He has a B.S. in Computer Science with a minor in Linguistics from the University of Maryland, College Park, 1999. * The Lisp Meeting will take place on Monday November 24th 2008 at 1800 (6pm) at MIT, Room 34-401B. As the numbers indicate, this is in Building 34, on the 4th floor. This is the usual location, on 50 Vassar Street, Cambridge. MIT map: http://whereis.mit.edu/bin/map?selection=34 Google map: http://maps.google.com/maps?q=50+Vassar+St,+Cambridge,+MA+02139,+USA Many thanks go to Alexey Radul for arranging for the room, and to MIT for welcoming us. * * Buffet: ITA Software, a fine employer of Lisp hackers (disclosure: I work there), is kindly purchasing a buffet to accompany our Monthly Boston Lisp Meeting. Anyone who attends is welcome to partake. We appreciate it if you let us know you're coming, and what food taboos you have, so that we can order the right amount of food. Tell us by sending email to boston-lisp-meeting-register at common-lisp.net. We won't send any acknowledgment unless requested; importantly, we'll keep your identity and address confidential and won't communicate any such information to anyone, not even to our sponsors. * * * The previous Boston Lisp Meeting on October 27th had over 30 participants. Tim McNerney gave copious background on the Thinking Machines Corporation and its line of massively parallel computer as an introduction to his work on automated verification of a compiler optimization pass through abstract interpretation. Both the presentation and the following discussion were very lively. We're always looking for more speakers. The call for speakers and all the other details are at http://fare.livejournal.com/120393.html For more information, see our new web site boston-lisp.org. For posts related to the Boston Lisp meetings in general, follow this link: http://fare.livejournal.com/tag/boston-lisp-meeting or subscribe to our RSS feed: http://fare.livejournal.com/data/rss?tag=boston-lisp-meeting Please forward this information to people you think would be interested. Please accept my apologies for your receiving this message multiple times. My apologies if this announce gets posted to a list where it shouldn't, or fails to get posted to a list where it should. Feedback welcome by private email reply to fare@tunes.org. [ Fran?ois-Ren? ?VB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] When all lawful citizens are disarmed, will we have an omnipresent police state to protect us from armed criminals? From derk22 at gmail.com Tue Nov 18 11:16:49 2008 From: derk22 at gmail.com (Derk) Date: Thu Mar 26 02:33:36 2009 Subject: [plt-scheme] Binary tree traversal, infix breadth first order Message-ID: <449177bb-824f-4685-bc68-8c7e9e63d7d8@d36g2000prf.googlegroups.com> hi, I want to make a function that walks through a tree in infix order and in breath first order. I have made a function that uses depth first order, but breadth first is more difficult I think. The tree is represented in the following way: ?( (b) a ( ((f) d (g)) c (() e (h)) ) ). The function should then return ?(a b c d e f g h) my code, not very much: (define (leaf? node) (not (list? node)) ) (define (treewalk tree) (cond ((leaf? tree) tree) ..... ) ) thanks, From 84jkdl202 at sneakemail.com Wed Nov 19 08:40:26 2008 From: 84jkdl202 at sneakemail.com (///) Date: Thu Mar 26 02:33:37 2009 Subject: [plt-scheme] R5RS is totally useless for PLT, and I presume that R6RS is, also. Message-ID: PLT Scheme 4.1 has totally scuttled my project, which was started under PLT version 360, in which R5RS programs could interact freely with PLT Scheme code, and PLT code could be (and was) written as if it was R5RS with a few extensions. Today, I discovered that my ISP has upgraded to PLT 4.1.2, where they have introduced a feature (among many) they claimed wouldn't affect "most code:" Immutable lists. The HTML-parsing library my program uses is heavily infused with set-car! and set-cdr!. All kinds of functions are dependent on it, and their callers are in turn dependent on the mutating behavior. In short, to get rid of list mutation, you'd have to rewrite the entire library from scratch (PLT's html module sucks, BTW). PLT Scheme still supports mutable lists, but they're a separate data type, which means that I can't pass the lists that come out of the HTML-parsing library to any function that uses any PLT Scheme library call to work with lists. All the code I wrote to accept the output of this library is suddenly completely useless. While trying to come up with a workaround (a KLUDGE), I was delighted to discover that PLT Scheme 4.1.2 doesn't support nested (define) forms, either. Useless. From sk at cs.brown.edu Wed Nov 19 20:55:08 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:33:37 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: Awesome; thanks for that information! Do we infer from this that you're just writing CGI-like programs, or are you actually using the PLT Scheme Web server itself (lurking behind your Apache front-end)? Shriram From eli at barzilay.org Wed Nov 19 20:56:23 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:37 2009 Subject: [plt-scheme] R5RS is totally useless for PLT, and I presume that R6RS is, also. In-Reply-To: References: Message-ID: <18724.50119.297873.760784@arabic.ccs.neu.edu> On Nov 19, /// wrote: > PLT Scheme still supports mutable lists, but they're a separate data > type, which means that I can't pass the lists that come out of the > HTML-parsing library to any function that uses any PLT Scheme > library call to work with lists. All the code I wrote to accept the > output of this library is suddenly completely useless. Converting mutable pairs to immutable ones is easy: (define (mtree-map x f) (let loop ([x x]) (if (mpair? x) (f (loop (mcar x)) (loop (mcdr x))) x))) (define (tree-mutable->immutable t) (mtree-map t cons)) > While trying to come up with a workaround (a KLUDGE), I was > delighted to discover that PLT Scheme 4.1.2 doesn't support nested > (define) forms, either. Huh? > (define (foo x) (define (square x) (* x x)) (+ 1 (square x))) > (foo 5) 26 -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at cs.uchicago.edu Wed Nov 19 21:03:54 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:37 2009 Subject: [plt-scheme] R5RS is totally useless for PLT, and I presume that R6RS is, also. In-Reply-To: References: Message-ID: <932b2f1f0811191803p2f3d540el9ea4038caffd0f6c@mail.gmail.com> In case you missed it, Matthew Flatt wrote a blog post about his experience converting out (approx) 500,000 lines of Scheme code from using mutable pairs to immutable pairs. (It was easy.) I don't know if your code follows ours, but if it doesn't, I'm sure we'd all be interested to get a boiled down version of the problem so we can learn more about it. http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html But Eli's solution might be the right thing in the short term -- if you have a clearly marked boundary where pairs are mutated, then it is pretty easy to just put some copying layers around it -- this at least lets you get started so that you can figure out where you stand and if eliminating the mutation is worth the effort. In the meantime, you might consider directing some of your anger at your ISP for changing your deployment environment without adequate warning. (Altho if you pay attention around here, you were well warned.) Robby On Wed, Nov 19, 2008 at 7:40 AM, /// <84jkdl202@sneakemail.com> wrote: > PLT Scheme 4.1 has totally scuttled my project, which was started > under PLT version 360, in which R5RS programs could interact freely > with PLT Scheme code, and PLT code could be (and was) written as if > it was R5RS with a few extensions. > > Today, I discovered that my ISP has upgraded to PLT 4.1.2, where they > have introduced a feature (among many) they claimed wouldn't affect > "most code:" Immutable lists. The HTML-parsing library my program uses > is heavily infused with set-car! and set-cdr!. All kinds of functions > are > dependent on it, and their callers are in turn dependent on the > mutating > behavior. In short, to get rid of list mutation, you'd have to rewrite > the entire library from scratch (PLT's html module sucks, BTW). > > PLT Scheme still supports mutable lists, but they're a separate data > type, which means that I can't pass the lists that come out of the > HTML-parsing library to any function that uses any PLT Scheme library > call to work with lists. All the code I wrote to accept the output of > this > library is suddenly completely useless. > > While trying to come up with a workaround (a KLUDGE), I was delighted > to discover that PLT Scheme 4.1.2 doesn't support nested (define) > forms, > either. > > Useless. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mike at sharedlogic.ca Wed Nov 19 21:07:06 2008 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:33:37 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: On Wed, Nov 19, 2008 at 7:55 PM, Shriram Krishnamurthi wrote: > Awesome; thanks for that information! > > Do we infer from this that you're just writing CGI-like programs, or > are you actually using the PLT Scheme Web server itself (lurking > behind your Apache front-end)? > > Shriram Your welcome! We are using the web server itself, abusing the poor LRU manager with our wanton use send/suspend and send/suspend/dispatch. Not a manually-concocted URL in site. Of course, we'll blame that on you, having written those various papers on the Continue server and send/suspend/dispatch, in particular :-) -Mike From matthias at ccs.neu.edu Wed Nov 19 21:09:49 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:37 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: This really neat! We should send you to DC to tell NSF about the success of our web and scheme stuff in general. -- Matthias On Nov 19, 2008, at 8:41 PM, Michael Forster wrote: > Hi, > > Given some of the recent blog posts on use of the PLT web server, > I thought I would share some of our deployment figures. Sorry that > it's little more than a quick laundry list; time and customer > permitting, > perhaps I'll write a more thorough summary later. > > We've written 5 PLT-based web apps for one of our clients. One > provides core personnel scheduling, work order, billing, and payroll > operations; the other four provide remote data entry for various > business processes built around the core (e.g. employee time-keeping). > > Together, the apps weigh in at 24286 LOC of Scheme code, of which > 6340 LOC is shared as libraries. The business rules and data are > modeled exclusively and stored using PostgreSQL. The 'view' layer > is written in Scheme as is a custom date/time library required for > multiple time-zone business logic. > > We run each app under a separate mzscheme instance, all behind > an Apache reverse proxy to provide SSL. The core app hovers > around 300M memory usage, of which about 250M is resident. The > others consume between 60 and 160M each. > > Here's the hardware and software: > > Dell PE 2970 > 2GHz Quad Core AMD Opteron > 8G RAM > > FreeBSD 7.0-RELEASE amd64 > PostgreSQL 8.2 > mz-4.1 > spgsql > instaservlet > > custom servlet-shim.ss: > LRU memory manager > 1G memory threshold > 5 second check > 24 life points > 30 minute period for life point deduction > > Hope of that's of use to someone. > > Cheers! > > Mike > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From matthias at ccs.neu.edu Wed Nov 19 21:15:48 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:37 2009 Subject: [plt-scheme] Binary tree traversal, infix breadth first order In-Reply-To: <449177bb-824f-4685-bc68-8c7e9e63d7d8@d36g2000prf.googlegroups.com> References: <449177bb-824f-4685-bc68-8c7e9e63d7d8@d36g2000prf.googlegroups.com> Message-ID: <7432E8C8-9876-4F62-8986-CC0FEEE470FB@ccs.neu.edu> Let's see On Nov 18, 2008, at 11:16 AM, Derk wrote: > hi, > I want to make a function that walks through a tree in infix order and > in breath first order. I have made a function that uses depth first > order, but breadth first is more difficult I think. > > The tree is represented in the following way: ?( (b) a ( ((f) d (g)) c > (() e (h)) ) ). The function should then return ?(a b c d e f g h) Let's see. From what you have told us so far, there is a straightforward solution: ;; Tree -> [Listof Symbol] ;; return elements of tree in infix order (define (infix t) (cond [(equal? '((b) a ( ((f) d (g)) c (() e (h)))) t) '(a b c d e f g h)] [else (error 'infix "tree expected, given ~e\n" t)])) As you can see, I have added documentation and quasi-header like you'd do in other languages. Is this enough? > > my code, not very much: > > (define (leaf? node) > (not (list? node)) > ) > > (define (treewalk tree) > (cond > ((leaf? tree) tree) > ..... > ) > ) > > thanks, > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Wed Nov 19 21:16:22 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:33:38 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: No, no, the blame is all Jay's -- I insist. (-: Shriram On Wed, Nov 19, 2008 at 9:07 PM, Michael Forster wrote: > On Wed, Nov 19, 2008 at 7:55 PM, Shriram Krishnamurthi wrote: >> Awesome; thanks for that information! >> >> Do we infer from this that you're just writing CGI-like programs, or >> are you actually using the PLT Scheme Web server itself (lurking >> behind your Apache front-end)? >> >> Shriram > > Your welcome! > > We are using the web server itself, abusing the poor LRU > manager with our wanton use send/suspend and > send/suspend/dispatch. Not a manually-concocted URL > in site. Of course, we'll blame that on you, having written > those various papers on the Continue server and > send/suspend/dispatch, in particular :-) > > -Mike > From mike at sharedlogic.ca Wed Nov 19 21:33:28 2008 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:33:38 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: On Wed, Nov 19, 2008 at 8:09 PM, Matthias Felleisen wrote: > > This really neat! We should send you to DC to tell NSF about the success of > our web and scheme stuff in general. -- Matthias > Just don't tell 'em we're Canucks ;-) Seriously though, PLT Scheme was the deciding factor in our being able to deploy these as web apps rather than fat-client apps. (The thought of deploying on over 200 Windows boxes across the country still gives me the shakes.) Previous versions were web-based and written in Common Lisp. CL was an excellent platform, but as customer demand for interactivity escalated, and with AJAX representing a significant security concern (our client is in the security and event management business), fat-client looked like the only option. Happily, with PLT's send/suspend[/dispatch], we were able to deliver more than enough interactivity, and in a much better (in our opinion) programming style than required by sessions or AJAX. -Mike From grettke at acm.org Wed Nov 19 21:50:04 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:38 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: <756daca50811191850o291c8b83vb4a421c3d6bb2087@mail.gmail.com> On Wed, Nov 19, 2008 at 11:37 AM, Greg Woodhouse wrote: > That being said, everyone on this list is using, or at least interested in > using, PLT Scheme. Why? 1. Great documentation. 2. Vibrant community (its members are all "dialed in", and many of them are world class developers). 3. DrScheme 4. Language 5. Libraries 6. PLaneT 7. Runs "out of the box" with "batteries included" on nearly every OS. From clements at brinckerhoff.org Wed Nov 19 21:55:27 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:33:39 2009 Subject: [plt-scheme] Binary tree traversal, infix breadth first order In-Reply-To: <449177bb-824f-4685-bc68-8c7e9e63d7d8@d36g2000prf.googlegroups.com> References: <449177bb-824f-4685-bc68-8c7e9e63d7d8@d36g2000prf.googlegroups.com> Message-ID: On Nov 18, 2008, at 8:16 AM, Derk wrote: > hi, > I want to make a function that walks through a tree in infix order and > in breath first order. I have made a function that uses depth first > order, but breadth first is more difficult I think. > > The tree is represented in the following way: ?( (b) a ( ((f) d (g)) c > (() e (h)) ) ). The function should then return ?(a b c d e f g h) > > my code, not very much: > > (define (leaf? node) > (not (list? node)) > ) > > (define (treewalk tree) > (cond > ((leaf? tree) tree) > ..... > ) > ) What step of the Design Recipe are you on? (www.htdp.org) 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/20081119/a440558a/smime.bin From hendrik at topoi.pooq.com Thu Nov 20 15:56:09 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:33:39 2009 Subject: [plt-scheme] Nokia N800 Message-ID: <20081120205609.GD12664@topoi.pooq.com> Has anyone considered or done porting PLT Scheme to the Nokia N800? Was/would it be worth doing? The machine runs a Linux system with 128 megabytes of RAM, swapped to a 256 megabyte flash memory. It has an ARM processor (specifically, an OMAP2420 microprocessor) -- hendrik From gregory.woodhouse at gmail.com Wed Nov 19 21:56:56 2008 From: gregory.woodhouse at gmail.com (Woodhouse Gregory) Date: Thu Mar 26 02:33:40 2009 Subject: [plt-scheme] Look at it differently: Why PLT? In-Reply-To: <756daca50811191850o291c8b83vb4a421c3d6bb2087@mail.gmail.com> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> <756daca50811191850o291c8b83vb4a421c3d6bb2087@mail.gmail.com> Message-ID: Oh, yes, the documentation! It is superb. How could I have forgotten that? There's a fine line between optimization and not being stupid. -- R. Kent Dybvig http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com On Nov 19, 2008, at 6:50 PM, Grant Rettke wrote: > On Wed, Nov 19, 2008 at 11:37 AM, Greg Woodhouse > wrote: >> That being said, everyone on this list is using, or at least >> interested in >> using, PLT Scheme. Why? > > 1. Great documentation. > 2. Vibrant community (its members are all "dialed in", and many of > them are world class developers). > 3. DrScheme > 4. Language > 5. Libraries > 6. PLaneT > 7. Runs "out of the box" with "batteries included" on nearly every OS. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081119/3fd505d5/attachment.html From eli at barzilay.org Wed Nov 19 22:06:31 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:40 2009 Subject: [plt-scheme] PLT Scheme v4.1.1 In-Reply-To: <20081120030204.GA15657@duncan.reilly.home> References: <200810052014.m95KEFQ0009396@winooski.ccs.neu.edu> <20081120030204.GA15657@duncan.reilly.home> Message-ID: <18724.54327.628916.87637@arabic.ccs.neu.edu> On Nov 20, Andrew Reilly wrote: > > OK: feedback. Is it possible to unwire the #lang line, even if > only as a configuration option? I'd choose an extra line of > real source code, if I had a choice. I looked in the "choose > language..." dialog, but couldn't see an obvious switch. Preferences -> Editing -> General -> "Always show #lang line". -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From andrew-scheme at areilly.bpc-users.org Wed Nov 19 22:18:34 2008 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Thu Mar 26 02:33:40 2009 Subject: [plt-scheme] PLT Scheme v4.1.1 In-Reply-To: <18724.54327.628916.87637@arabic.ccs.neu.edu> References: <200810052014.m95KEFQ0009396@winooski.ccs.neu.edu> <20081120030204.GA15657@duncan.reilly.home> <18724.54327.628916.87637@arabic.ccs.neu.edu> Message-ID: <20081120031834.GB15657@duncan.reilly.home> On Wed, Nov 19, 2008 at 10:06:31PM -0500, Eli Barzilay wrote: > On Nov 20, Andrew Reilly wrote: > > > > OK: feedback. Is it possible to unwire the #lang line, even if > > only as a configuration option? I'd choose an extra line of > > real source code, if I had a choice. I looked in the "choose > > language..." dialog, but couldn't see an obvious switch. > > Preferences -> Editing -> General -> "Always show #lang line". Ah-ha! I knew there'd be a knob in there somewhere. Thanks! I had actually forgotten about the main preferences dialog altogether. Why is the Choose Language not a child of that, instead of a menu item on its own? Emphasis? Cheers, Andrew From morazanm at gmail.com Wed Nov 19 22:20:13 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:33:40 2009 Subject: [plt-scheme] Binary tree traversal, infix breadth first order In-Reply-To: <449177bb-824f-4685-bc68-8c7e9e63d7d8@d36g2000prf.googlegroups.com> References: <449177bb-824f-4685-bc68-8c7e9e63d7d8@d36g2000prf.googlegroups.com> Message-ID: <9b1fff280811191920h759f3882o6a6dea3f1c15ccdc@mail.gmail.com> Derk, Start by defining what a tree is. I am sure that '( (b) a ( ((f) d (g)) c (() e (h)) ) ) is not what you want the representation for trees to be. After you have defined what a tree is, then you can start thinking about how to solve your problems. On Tue, Nov 18, 2008 at 11:16 AM, Derk wrote: > hi, > I want to make a function that walks through a tree in infix order and > in breath first order. I have made a function that uses depth first > order, but breadth first is more difficult I think. > > The tree is represented in the following way: '( (b) a ( ((f) d (g)) c > (() e (h)) ) ). The function should then return '(a b c d e f g h) > > my code, not very much: > > (define (leaf? node) > (not (list? node)) > ) > > (define (treewalk tree) > (cond > ((leaf? tree) tree) > ..... > ) > ) > > thanks, > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Cheers, Marco From morazanm at gmail.com Wed Nov 19 22:31:33 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:33:40 2009 Subject: [plt-scheme] Is the value of teaching abstraction catching on? Message-ID: <9b1fff280811191931y259dc5e2x2cbf322c7c37a033@mail.gmail.com> I just read this note that came out in April: http://www.sciencedaily.com/releases/2008/04/080424140410.htm I had to wonder if any of the students in the study were CS students that had gone through HtDP/C. Probably not, because such students would likely have learned all the lessons well and would have been able to apply them to problems in a different context. Interestingly enough, the authors did not test teaching abstractly first followed by concrete examples. -- Cheers, Marco From andrew-scheme at areilly.bpc-users.org Wed Nov 19 22:02:04 2008 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Thu Mar 26 02:33:40 2009 Subject: [plt-scheme] PLT Scheme v4.1.1 In-Reply-To: <200810052014.m95KEFQ0009396@winooski.ccs.neu.edu> References: <200810052014.m95KEFQ0009396@winooski.ccs.neu.edu> Message-ID: <20081120030204.GA15657@duncan.reilly.home> I just got around to catching up with the latest news (4.1.2 actually, but this announcement pertains.) On Sun, Oct 05, 2008 at 04:14:16PM -0400, Eli Barzilay wrote: > PLT Scheme version 4.1.1 is now available from > > http://plt-scheme.org/ > > This is mostly a bug-fix release. > > Notable changes: > * `#lang' lines wired to the top of DrScheme's definition window > > Feedback Welcome, OK: feedback. Is it possible to unwire the #lang line, even if only as a configuration option? I'd choose an extra line of real source code, if I had a choice. I looked in the "choose language..." dialog, but couldn't see an obvious switch. Cheers, -- Andrew From spdegabrielle at gmail.com Thu Nov 20 04:27:22 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:40 2009 Subject: [plt-scheme] handin-server message(bug?) on first 'check-syntax' of the day Message-ID: <595b9ab20811200127w3c23c017g3f291db48f0734dd@mail.gmail.com> HI, I get this on my first invocation of 'check-syntax'; WARNING: open-input-file: cannot open input file: "/Users/stephen/Library/PLT Scheme/4.1.2.4/doc/handin-server/out.sxref" (No such file or directory; errno=2) Is it just me - or do others get this? Cheers, Stephen -- Stephen De Gabrielle From mvanier42 at gmail.com Thu Nov 20 06:23:34 2008 From: mvanier42 at gmail.com (Michael Vanier) Date: Thu Mar 26 02:33:41 2009 Subject: [plt-scheme] divascheme in mac os x? Message-ID: <492548B6.3080006@cs.caltech.edu> Hi, I was wondering if it's possible to run the DivaScheme package in Mac OS X. I've installed it, but I can't activate it -- hitting F4, which is supposed to toggle the DivaScheme environment, does nothing. Any suggestions? Thanks, Mike From s.degabrielle at cs.ucl.ac.uk Thu Nov 20 07:01:33 2008 From: s.degabrielle at cs.ucl.ac.uk (Stephen De Gabrielle) Date: Thu Mar 26 02:33:41 2009 Subject: [plt-scheme] divascheme in mac os x? In-Reply-To: <492548B6.3080006@cs.caltech.edu> References: <492548B6.3080006@cs.caltech.edu> Message-ID: <595b9ab20811200401g504aec5chb667b3b680e303ad@mail.gmail.com> I just tried it - it seems to work fine on intel/10.4 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 On Thu, Nov 20, 2008 at 11:23 AM, Michael Vanier wrote: > Hi, > > I was wondering if it's possible to run the DivaScheme package in Mac OS X. > I've installed it, but I can't activate it -- hitting F4, which is supposed > to toggle the DivaScheme environment, does nothing. Any suggestions? > > Thanks, > > Mike > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From vyzo at media.mit.edu Thu Nov 20 07:41:16 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:33:41 2009 Subject: [plt-scheme] R5RS is totally useless for PLT, and I presume that R6RS is, also. In-Reply-To: References: Message-ID: On Wed, 19 Nov 2008, /// wrote: > While trying to come up with a workaround (a KLUDGE), The proper kludge here is to write a little native module that provides set-car!/set-cdr!. See attached file (completely unsafe, use at your own risk) Use like this: Now, where is my flame shield? -- vyzo -------------- next part -------------- // hack for providing set-car!/set-cdr! in mz4 // author: vyzo // USE AT YOUR OWN RISK #include "escheme.h" #define SYMBOL scheme_intern_symbol #define DEFUN(name, p, mina, maxa) \ scheme_add_global (name, \ scheme_make_prim_w_arity (p, name, mina, maxa), module) START_XFORM_SKIP; Scheme_Object *set_car (int argc, Scheme_Object **argv) { SCHEME_CAR (argv[0]) = argv[1]; return scheme_void; } Scheme_Object *set_cdr (int argc, Scheme_Object **argv) { SCHEME_CDR (argv[0]) = argv[1]; return scheme_void; } END_XFORM_SKIP; Scheme_Object *scheme_reload (Scheme_Env *env) { Scheme_Env* module; module = scheme_primitive_module (SYMBOL ("_unsafe" ), env); DEFUN ("set-car!", set_car, 2, 2); DEFUN ("set-cdr!", set_cdr, 2, 2); scheme_finish_primitive_module( module ); return scheme_void; } Scheme_Object *scheme_initialize (Scheme_Env *env) { return scheme_reload (env); } Scheme_Object *scheme_module_name() { return SYMBOL ("nasty"); } From robby at cs.uchicago.edu Thu Nov 20 08:07:48 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:41 2009 Subject: [plt-scheme] PLT Scheme v4.1.1 In-Reply-To: <20081120031834.GB15657@duncan.reilly.home> References: <200810052014.m95KEFQ0009396@winooski.ccs.neu.edu> <20081120030204.GA15657@duncan.reilly.home> <18724.54327.628916.87637@arabic.ccs.neu.edu> <20081120031834.GB15657@duncan.reilly.home> Message-ID: <932b2f1f0811200507i4b00c5e3je8328f442e632411@mail.gmail.com> I suppose emphasis is a fair reason why, but also because it isn't just a preference (although some of the state is indeed saved in the preferences). Robby On Wed, Nov 19, 2008 at 9:18 PM, Andrew Reilly wrote: > On Wed, Nov 19, 2008 at 10:06:31PM -0500, Eli Barzilay wrote: >> On Nov 20, Andrew Reilly wrote: >> > >> > OK: feedback. Is it possible to unwire the #lang line, even if >> > only as a configuration option? I'd choose an extra line of >> > real source code, if I had a choice. I looked in the "choose >> > language..." dialog, but couldn't see an obvious switch. >> >> Preferences -> Editing -> General -> "Always show #lang line". > > Ah-ha! I knew there'd be a knob in there somewhere. Thanks! > > I had actually forgotten about the main preferences dialog > altogether. Why is the Choose Language not a child of that, > instead of a menu item on its own? Emphasis? > > Cheers, > > Andrew > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at cs.uchicago.edu Thu Nov 20 08:22:39 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:41 2009 Subject: [plt-scheme] PLT Scheme v4.1.1 In-Reply-To: <20081120030204.GA15657@duncan.reilly.home> References: <200810052014.m95KEFQ0009396@winooski.ccs.neu.edu> <20081120030204.GA15657@duncan.reilly.home> Message-ID: <932b2f1f0811200522t65be64c2o515847b21fcc4d85@mail.gmail.com> On Wed, Nov 19, 2008 at 9:02 PM, Andrew Reilly wrote: > OK: feedback. Is it possible to unwire the #lang line, even if > only as a configuration option? I'd choose an extra line of > real source code, if I had a choice. I looked in the "choose > language..." dialog, but couldn't see an obvious switch. In that case, you might also be interested in moving the toolbar to the left or right and maybe hiding the status bar that appears along the bottom of the window. This is either in the view menu or, on a mac, you can click on the wide bubble thingy on the top-right of the window. Robby From hendrik at topoi.pooq.com Fri Nov 21 02:24:58 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:33:41 2009 Subject: [plt-scheme] Nokia N800 In-Reply-To: <595b9ab20811192358u76fd8774s2a16b5abb505ec28@mail.gmail.com> References: <20081120205609.GD12664@topoi.pooq.com> <595b9ab20811192358u76fd8774s2a16b5abb505ec28@mail.gmail.com> Message-ID: <20081121072458.GA16049@topoi.pooq.com> On Thu, Nov 20, 2008 at 07:58:08AM +0000, Stephen De Gabrielle wrote: > I once built mzscheme for the 770. I don't think drscheme will fit/run. Does that mean mzscheme programs would probably run, but that you'd be better off developing them elsewhere? Would programs that actually need a windows-and-stylus interface be hopeless to use? Or does the bulk of drscheme lie elsewhere? -- hendrik > > On 11/20/08, hendrik@topoi.pooq.com wrote: > > Has anyone considered or done porting PLT Scheme to the Nokia N800? > > Was/would it be worth doing? The machine runs a Linux system with 128 > > megabytes of RAM, swapped to a 256 megabyte flash memory. It has an ARM > > processor (specifically, an OMAP2420 microprocessor) > > > > -- 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 morazanm at gmail.com Thu Nov 20 08:52:11 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:33:41 2009 Subject: [plt-scheme] Why would the order of functions matter? Message-ID: <9b1fff280811200552w34d2cdddy4f14dbb5f310d2d4@mail.gmail.com> Dear All, I have a student getting the following error: Welcome to DrScheme, version 4.1.1 [3m]. Language: Beginning Student with List Abbreviations; memory limit: 128 megabytes. reference to an identifier before its definition: insert-everywhere-in-a-word > The questioned identifier is defined as a function after its first reference. When I re-arrange the function definitions DrScheme no longer complains. What can be causing this? -- Cheers, Marco From morazanm at gmail.com Thu Nov 20 09:20:07 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:33:42 2009 Subject: [plt-scheme] Re: Why would the order of functions matter? In-Reply-To: <9b1fff280811200552w34d2cdddy4f14dbb5f310d2d4@mail.gmail.com> References: <9b1fff280811200552w34d2cdddy4f14dbb5f310d2d4@mail.gmail.com> Message-ID: <9b1fff280811200620k20892c7fpa6623f33b144f79b@mail.gmail.com> Here's little more of the puzzle after some more investigating: Student's file: ... ;;; insert-everywhere/in-all-words: symbol a-low -> low ;;; to insert a symbol (s) between all letters and at the beginning ;;; and the end of all words of a-low (define (insert-everywhere/in-all-words s a-low) ;;; (s) is a symbol representing the letter to be inserted in a-low ;;; (empty? a-low) is true if a-low is empty ;;; otherwise, ;;; (cons? a-low) is true if a-low is a cons ;;; (first a-low) is the first word in a-low ;;; (rest a-low) is the list containing the a-low without (first a-low) ;;; (insert-everywhere/in-all-words s (rest a-low)) is the low ;;; with s inserted in (rest a-low) according to the contract (cond [(empty? a-low) (list s empty)] [else (append (insert-everywhere-in-a-word s (first a-low)) (insert-everywhere/in-all-words s (rest a-low)))])) ;;; EXAMPLE (= (insert-everywhere/in-all-words 'd (list (list 'l 'i 'k 'e) (list 'p 'o) (list 'a 'n))) (list (list 'd 'l 'i 'k 'e) (list 'l 'd 'i 'k 'e) (list 'l 'i 'd 'k 'e) (list 'l 'i 'k 'd 'e) (list 'l 'i 'k 'e 'd) (list 'd 'p 'o) (list 'p 'd 'o) (list 'p 'o 'd) (list 'd 'a 'n) (list 'a 'd 'n) (list 'a 'n 'd))true) ... Produces this error: Welcome to DrScheme, version 4.1.1 [3m]. Language: Beginning Student with List Abbreviations; memory limit: 128 megabytes. reference to an identifier before its definition: insert-everywhere-in-a-word > If the following is commented out: ;;; EXAMPLE (= (insert-everywhere/in-all-words 'd (list (list 'l 'i 'k 'e) (list 'p 'o) (list 'a 'n))) (list (list 'd 'l 'i 'k 'e) (list 'l 'd 'i 'k 'e) (list 'l 'i 'd 'k 'e) (list 'l 'i 'k 'd 'e) (list 'l 'i 'k 'e 'd) (list 'd 'p 'o) (list 'p 'd 'o) (list 'p 'o 'd) (list 'd 'a 'n) (list 'a 'd 'n) (list 'a 'n 'd))true) The error disappears. Should the above example (that does not use check-expect and that makes improper use of =) cause such an error to appear? I can see that insert-everywhere/in-all-words is being called before insert-everywhere-in-a-word has been defined in the file. Is that the expected/wanted behavior for a student language? It may be useful to collect all definitions before evaluating any application expressions in the student languages. Is something to think about or is there a reason this would be undesirable? -- Cheers, Marco From jos.koot at telefonica.net Thu Nov 20 09:25:39 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:33:42 2009 Subject: [plt-scheme] Why would the order of functions matter? References: <9b1fff280811200552w34d2cdddy4f14dbb5f310d2d4@mail.gmail.com> Message-ID: <14136141DDBC42748DBE1C373AA43CBA@uw2b2dff239c4d> ----- Original Message ----- From: "Marco Morazan" To: "plt edu" Cc: "Scheme PLT" Sent: Thursday, November 20, 2008 2:52 PM Subject: [plt-scheme] Why would the order of functions matter? > Dear All, > > I have a student getting the following error: > > Welcome to DrScheme, version 4.1.1 [3m]. > Language: Beginning Student with List Abbreviations; memory limit: 128 > megabytes. > reference to an identifier before its definition: > insert-everywhere-in-a-word >> > > The questioned identifier is defined as a function after its first > reference. When I re-arrange the function definitions DrScheme no > longer complains. What can be causing this? Exactly what the error message says, I think. (define (foo x) (bar x)) ; ok, for the value of bar is not yet required (only its (top level) binding) (define (bar x) (+ x 1)) ; ok, now variable `bar' has its value. (foo 3) --> 4 However: (define (foo x) (bar x)) (foo 3) --> reference to an identifier before its definition: bar Variable `bar' has no value yet. (define (bar x) (+ x 1)) Jos > > -- > > Cheers, > > Marco > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From 84jkdl202 at sneakemail.com Wed Nov 19 21:47:51 2008 From: 84jkdl202 at sneakemail.com (///) Date: Thu Mar 26 02:33:42 2009 Subject: [plt-scheme] Re: Look at it differently: Why PLT? In-Reply-To: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: On Nov 19, 12:37 pm, "Greg Woodhouse" wrote: > There is a lot of discussion going on here about how many PLT users wish it > would conform more closely to R6RS. As someone working in two arenas where > standards are especially important (healthcare and government), I can't help > but be sympathetic. Indeed, I'd like to be able to use PLT Scheme for > production work, and not conforming with existing standards is a major > impediment there. > > That being said, everyone on this list is using, or at least interested in > using, PLT Scheme. Why? There are several reasons I use PLT Scheme: PLT Scheme is a Lisp. Many of the reasons that Lisp is a great programming language are shared with PLT Scheme. PLT Scheme has a very useful, big set of libraries not found in other Scheme implementations, and that can't be ported to other Scheme implementations because of PLT's module architecture and other features. These libraries implement important features that allow me to express ideas with simpler code. I find PLT's interactive environment to be more useful than the static environments provided by Chicken, Stalin, et al. The other interactive Schemes tend to be interpreters with no C function interface (Guile, MIT Scheme, Scheme 48), making things like database support nearly impossible. Even though "phase levels" cripple PLT Scheme's macro system in frustrating ways (forcing unwanted complexity into my code), many other Schemes are even more crippled when it comes to macros, having no support at all for syntax-case macros. Even though PLT Scheme provides an interactive development environment, programs written with it can be compiled to regular executables that load quickly. This is so important to my project, that the fact that SBCL is better than PLT Scheme in every other way doesn't matter enough to make me switch to it. Even with all the power offered by PLT Scheme, it's still dead simple, as long as you don't try to do anything too fancy with macros, and as long as you don't think you should be able to use libraries that use set-car! and set-cdr!. The module system is far easier to figure out (when it comes to non-macro code) than Common Lisp's ASDF. There is good online documentation, even for older versions of PLT Scheme. From hdg at cox.net Thu Nov 20 10:25:44 2008 From: hdg at cox.net (H David Goering) Date: Thu Mar 26 02:33:42 2009 Subject: [plt-scheme] migrating non-modular mzscheme programs to PLT version 4 In-Reply-To: <990e0c030811182140n3723d600g4f232cecdeefcd36@mail.gmail.com> References: <9588BA54-28D7-454D-A0DC-DD3152F6F19D@cox.net> <990e0c030811160914u7e057f5cg5d27a4cf9784502c@mail.gmail.com> <9F6074D7-4D4E-45AC-B619-12F7C82990AB@cox.net> <990e0c030811182140n3723d600g4f232cecdeefcd36@mail.gmail.com> Message-ID: <188BB5FB-733C-4A0F-9EE8-8F852C1F4CFF@cox.net> Noel & carl, Thank you for your advice. I implemented Carl's solution. The differences between MzScheme v. 372 and #lang scheme/load + (require mzscheme) were in my case trivial. David On Nov 18, 2008, at 11:40 PM, Carl Eastlund wrote: > The scheme/load language is PLT 4.0, like the scheme and scheme/base > languages, but it behaves like the top level (i.e. the REPL) rather > than like a module. I forgot it wouldn't save you the trouble of > porting to the new language features. > > --Carl > > On Tue, Nov 18, 2008 at 11:41 PM, H David Goering wrote: >> Carl, >> >> Which Scheme is scheme/load? It's not MzScheme. The program >> loaded after >> adding "(require mzscheme)" and making a few small changes, but it >> doesn't >> run. >> >> Thanks, >> >> David >> >> On Nov 16, 2008, at 11:14 AM, Carl Eastlund wrote: >> >>> If you put "#lang scheme/load" at the top of your main file, I >>> believe >>> it should run properly in the Module language and load the other >>> files >>> without changing them. >>> >>> --Carl >>> >>> On Sun, Nov 16, 2008 at 12:36 AM, H David Goering >>> wrote: >>>> >>>> Unlike MzScheme of version 3, Module seems to require that the >>>> top-level >>>> file of a multi=file program contain a module. Adding '(require >>>> mzscheme)' >>>> is not sufficient. >>>> >>>> Converting the top-level file to a module is no hardship, but >>>> 'load' and >>>> 'load/use-compiled' now seem to require that arguments refer to >>>> modules >>>> rather than mere files. If the reference is not a module the error >>>> message >>>> "compile: bad syntax; function application is not allowed, >>>> because no >>>> #%app >>>> syntax transformer is bound" is seen. Adding '#lang mzscheme' >>>> fixes that >>>> problem but fragments the namespace in a regrettable way. >>>> >>>> Will Module accept a multi-file mzscheme program that is not >>>> modularized? >>>> Or one that is treated as a single module? >>>> >>>> Thanks, >>>> >>>> David From spdegabrielle at gmail.com Thu Nov 20 11:03:35 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:43 2009 Subject: [plt-scheme] hash table implementation? Message-ID: <595b9ab20811200803u391ec549xb8172db2a8e0cfe7@mail.gmail.com> Hi, I'm looking a b-trees at the moment and wondered how hash tables are implemented in PLT scheme? Cheers, Stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081120/d36f0e62/attachment.htm From noelwelsh at gmail.com Thu Nov 20 11:19:49 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:43 2009 Subject: [plt-scheme] hash table implementation? In-Reply-To: <595b9ab20811200803u391ec549xb8172db2a8e0cfe7@mail.gmail.com> References: <595b9ab20811200803u391ec549xb8172db2a8e0cfe7@mail.gmail.com> Message-ID: I just skimmed the source code and it seems like a standard hash table implemented using an array. No evidence of fancy stuff in the code I looked at. N. On Thu, Nov 20, 2008 at 4:03 PM, Stephen De Gabrielle wrote: > Hi, > > I'm looking a b-trees at the moment and wondered how hash tables are > implemented in PLT scheme? > > Cheers, > > Stephen From mflatt at cs.utah.edu Thu Nov 20 11:26:37 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:43 2009 Subject: [plt-scheme] hash table implementation? In-Reply-To: References: <595b9ab20811200803u391ec549xb8172db2a8e0cfe7@mail.gmail.com> Message-ID: <20081120162637.D86176500B2@mail-svr1.cs.utah.edu> That's correct for mutable hash tables. Immutable hash tables (with functional updated) are implemented using a red--black tree. Matthew At Thu, 20 Nov 2008 16:19:49 +0000, "Noel Welsh" wrote: > I just skimmed the source code and it seems like a standard hash table > implemented using an array. No evidence of fancy stuff in the code I > looked at. > > N. > > On Thu, Nov 20, 2008 at 4:03 PM, Stephen De Gabrielle > wrote: > > Hi, > > > > I'm looking a b-trees at the moment and wondered how hash tables are > > implemented in PLT scheme? > > > > Cheers, > > > > Stephen > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jay.mccarthy at gmail.com Thu Nov 20 11:33:17 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:43 2009 Subject: [plt-scheme] Templates in the PLT Web Server Message-ID: Almost all Web application frameworks have a templating system to allow the dynamic portion of a site to modify some semi-static content before displaying it. These frameworks are primarily useful because they allow the contributions of non-programmers to be more easily integrated into an application and remove a barrier to using traditional HTML design tools, like Amaya and Dreamweaver. The PLT Web Server now provides a templating system of its own. It uses the syntax of Scribble to provide access to all features of PLT Scheme to template authors. Furthermore, it requires zero run-time parsing of templates?the templates your servlet uses are loaded and compiled when your servlet is compiled. The documentation [1] has all the details about using templates in your applications. But here's a short example: template.html: @in[c clients]{ }
      @(car c), @(cdr c)
      servlet.ss: (let ([clients (list (cons "Young" "Brigham") (cons "Smith" "Joseph"))]) (include-template "template.html")) Evaluates to:
      Young, Brigham
      Smith, Joseph
      1. http://docs.plt-scheme.org/web-server/templates.html -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From s.degabrielle at cs.ucl.ac.uk Thu Nov 20 11:42:06 2008 From: s.degabrielle at cs.ucl.ac.uk (Stephen De Gabrielle) Date: Thu Mar 26 02:33:44 2009 Subject: [plt-scheme] Re: hash table implementation? In-Reply-To: <20081120162637.D86176500B2@mail-svr1.cs.utah.edu> References: <595b9ab20811200803u391ec549xb8172db2a8e0cfe7@mail.gmail.com> <20081120162637.D86176500B2@mail-svr1.cs.utah.edu> Message-ID: <595b9ab20811200842s4e376f2j31bd8fc791c5b925@mail.gmail.com> Thanks. On 11/20/08, Matthew Flatt wrote: > That's correct for mutable hash tables. Immutable hash tables (with > functional updated) are implemented using a red--black tree. > > Matthew > > At Thu, 20 Nov 2008 16:19:49 +0000, "Noel Welsh" wrote: >> I just skimmed the source code and it seems like a standard hash table >> implemented using an array. No evidence of fancy stuff in the code I >> looked at. >> >> N. >> >> On Thu, Nov 20, 2008 at 4:03 PM, Stephen De Gabrielle >> wrote: >> > Hi, >> > >> > I'm looking a b-trees at the moment and wondered how hash tables are >> > implemented in PLT scheme? >> > >> > Cheers, >> > >> > Stephen >> _________________________________________________ >> 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 jay.mccarthy at gmail.com Thu Nov 20 11:37:47 2008 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:33:44 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: Awesome! We're very happy to hear it! Be sure to let me know if you're having any problems or annoyances. Jay On Wed, Nov 19, 2008 at 7:33 PM, Michael Forster wrote: > On Wed, Nov 19, 2008 at 8:09 PM, Matthias Felleisen > wrote: >> >> This really neat! We should send you to DC to tell NSF about the success of >> our web and scheme stuff in general. -- Matthias >> > > Just don't tell 'em we're Canucks ;-) > > Seriously though, PLT Scheme was the deciding factor > in our being able to deploy these as web apps rather > than fat-client apps. (The thought of deploying on over > 200 Windows boxes across the country still gives me the > shakes.) > > Previous versions were web-based and written in Common > Lisp. CL was an excellent platform, but as customer demand > for interactivity escalated, and with AJAX representing a > significant security concern (our client is in the security and > event management business), fat-client looked like the only > option. > > Happily, with PLT's send/suspend[/dispatch], we were able > to deliver more than enough interactivity, and in a much > better (in our opinion) programming style than required by > sessions or AJAX. > > -Mike > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From noelwelsh at gmail.com Thu Nov 20 11:46:00 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:44 2009 Subject: [plt-scheme] Templates in the PLT Web Server In-Reply-To: References: Message-ID: Good to see. Although we currently don't make use of templates at Untyped, no doubt we will have use in the future. I can see these templates being useful for, e.g. blog engines, which require customisation by non-experts. The implementation is interesting. It's not what I would expect (breaking lexical scope, display via side-effects?) but it'll take more use for me to judge it. N. On Thu, Nov 20, 2008 at 4:33 PM, Jay McCarthy wrote: > Almost all Web application frameworks have a templating system to > allow the dynamic portion of a site to modify some semi-static content > before displaying it. These frameworks are primarily useful because > they allow the contributions of non-programmers to be more easily > integrated into an application and remove a barrier to using > traditional HTML design tools, like Amaya and Dreamweaver. ... From noelwelsh at gmail.com Thu Nov 20 11:51:38 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:44 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: Interesting to see. Our stats are very similar. Probably more LOC, a bit less RAM, approx. same memory consumption. On Thu, Nov 20, 2008 at 1:41 AM, Michael Forster wrote: > > custom servlet-shim.ss: > LRU memory manager The serve/servlet procedure in recent versions of the web server does everything Instaservlet does, so we don't intent to maintain instaservlet in the future (but I'm pleased to see you got some use out of it). If you use any other Untyped/Schematics libraries that you've had to extend we're open to patches/feature requests/etc. N. From sk at cs.brown.edu Thu Nov 20 11:57:41 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:33:44 2009 Subject: [plt-scheme] Templates in the PLT Web Server In-Reply-To: References: Message-ID: Agreed, but that's just how templating works. For years I resisted adding templating precisely for these reasons, and never got around to designing a proper and scope-respecting "functional" template mechanism. Jay did the right thing to say screw it, let's move ahead. I'm not the biggest fan of how @-reader syntax plays out here, but again Jay was smart to peg his choices to it rather than invent a new syntax. So, very cool. Shriram On Thu, Nov 20, 2008 at 11:46 AM, Noel Welsh wrote: > Good to see. Although we currently don't make use of templates at > Untyped, no doubt we will have use in the future. I can see these > templates being useful for, e.g. blog engines, which require > customisation by non-experts. The implementation is interesting. > It's not what I would expect (breaking lexical scope, display via > side-effects?) but it'll take more use for me to judge it. > > N. > > On Thu, Nov 20, 2008 at 4:33 PM, Jay McCarthy wrote: >> Almost all Web application frameworks have a templating system to >> allow the dynamic portion of a site to modify some semi-static content >> before displaying it. These frameworks are primarily useful because >> they allow the contributions of non-programmers to be more easily >> integrated into an application and remove a barrier to using >> traditional HTML design tools, like Amaya and Dreamweaver. > ... > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From noelwelsh at gmail.com Thu Nov 20 11:58:18 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:44 2009 Subject: [plt-scheme] Templates in the PLT Web Server In-Reply-To: References: Message-ID: On Thu, Nov 20, 2008 at 4:46 PM, Noel Welsh wrote: > ... The implementation is interesting. > It's not what I would expect (breaking lexical scope, display via > side-effects?) but it'll take more use for me to judge it. Just to clarify, this isn't meant to be taken as a negative comment. I had given a little thought to templates and my immediate design was to model a template as a function. Jay's design is quite different, and probably much more usable by both programmers and others. N. From mike at sharedlogic.ca Thu Nov 20 12:18:40 2008 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:33:44 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: On Thu, Nov 20, 2008 at 10:37 AM, Jay McCarthy wrote: > Awesome! We're very happy to hear it! > > Be sure to let me know if you're having any problems or annoyances. > > Jay Thanks! Will do. -Mike From dyoo at cs.wpi.edu Thu Nov 20 12:19:28 2008 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Thu Mar 26 02:33:45 2009 Subject: [plt-scheme] divascheme in mac os x? In-Reply-To: <492548B6.3080006@cs.caltech.edu> References: <492548B6.3080006@cs.caltech.edu> Message-ID: On Thu, Nov 20, 2008 at 6:23 AM, Michael Vanier wrote: > Hi, > > I was wondering if it's possible to run the DivaScheme package in Mac OS X. > I've installed it, but I can't activate it -- hitting F4, which is supposed > to toggle the DivaScheme environment, does nothing. Any suggestions? Uh oh. Ok, I will investigate this when I get home. Just as a sanity check: when you restart DrScheme, do you see a menu item under the File menu that says "Enable DivaScheme"? From mike at sharedlogic.ca Thu Nov 20 12:24:05 2008 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:33:45 2009 Subject: [plt-scheme] Some rough PLT web app figures In-Reply-To: References: Message-ID: On Thu, Nov 20, 2008 at 10:51 AM, Noel Welsh wrote: > Interesting to see. Our stats are very similar. Probably more LOC, a > bit less RAM, approx. same memory consumption. > > On Thu, Nov 20, 2008 at 1:41 AM, Michael Forster wrote: >> >> custom servlet-shim.ss: >> LRU memory manager > > The serve/servlet procedure in recent versions of the web server does > everything Instaservlet does, so we don't intent to maintain > instaservlet in the future (but I'm pleased to see you got some use > out of it). If you use any other Untyped/Schematics libraries that > you've had to extend we're open to patches/feature requests/etc. > > N. Thanks for the heads-up. I haven't followed any of the web server and documentation updates since we deployed the apps early last summer. At that time, we preferred to run the apps under separate mzscheme/web-server instances, so I'll have to read about how to do that with serve/servlet. -Mike From eli at barzilay.org Thu Nov 20 13:41:56 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:45 2009 Subject: [plt-scheme] Templates in the PLT Web Server In-Reply-To: References: Message-ID: <18725.44916.834896.846684@arabic.ccs.neu.edu> On Nov 20, Shriram Krishnamurthi wrote: > Agreed, but that's just how templating works. For years I resisted > adding templating precisely for these reasons, and never got around > to designing a proper and scope-respecting "functional" template > mechanism. Can you be more specific about the problems that you've seen/anticipated? FWIW, the biggest possible confusion is that you'd often do, for example, (begin ...) when you mean (list ...). That's exactly why I added `begin/collect' which is sort of a hybrid of the two. (Jay doesn't use it currently, but it will probably be needed at some point.) > Jay did the right thing to say screw it, let's move ahead. I'm not > the biggest fan of how @-reader syntax plays out here, [...] Any reasons? -- I'm not trying to start any kind of a flamewar, I just spent a *REALLY* long time designing that thing and I think that the result is almost completely satisfying. So any complaints, including ones that are very technical and ones that are high level enough to not worth spending work on, any of these would be very interesting to hear. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Thu Nov 20 14:11:54 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:33:45 2009 Subject: [plt-scheme] Re: Why would the order of functions matter? References: <9b1fff280811200552w34d2cdddy4f14dbb5f310d2d4@mail.gmail.com> <9b1fff280811200620k20892c7fpa6623f33b144f79b@mail.gmail.com> Message-ID: <1E61587049134F3FAC3D47E6EFBA08DE@uw2b2dff239c4d> Ok that's a clearer question. Pro your suggestion: A student can program top down and include tests immediately after each definition. Contra your suggestion: Why develop a habit that will not work in non-teaching-languages? I don't know the starting level of your students nor the precise goals of your course, but if possible I would prefer to make the following distinction right from the beginning: between collecting the value of a variable and a (possibly forward) reference to a binding without needing the value yet. There would also a difference between a complete program in the definitions window and definitions entered in the interactions window, a difference that might disturb the student. Even without allowing side effects (read set!), the student should be made aware of the evaluation process. Mho. Jos ----- Original Message ----- From: "Marco Morazan" To: "plt edu" Cc: "Scheme PLT" Sent: Thursday, November 20, 2008 3:20 PM Subject: [plt-scheme] Re: Why would the order of functions matter? > Here's little more of the puzzle after some more investigating: > > Student's file: > > > ... > ;;; insert-everywhere/in-all-words: symbol a-low -> low > ;;; to insert a symbol (s) between all letters and at the beginning > ;;; and the end of all words of a-low > (define (insert-everywhere/in-all-words s a-low) > ;;; (s) is a symbol representing the letter to be inserted in a-low > ;;; (empty? a-low) is true if a-low is empty > ;;; otherwise, > ;;; (cons? a-low) is true if a-low is a cons > ;;; (first a-low) is the first word in a-low > ;;; (rest a-low) is the list containing the a-low without (first a-low) > ;;; (insert-everywhere/in-all-words s (rest a-low)) is the low > ;;; with s inserted in (rest a-low) according to the contract > (cond > [(empty? a-low) (list s empty)] > [else (append (insert-everywhere-in-a-word s (first a-low)) > (insert-everywhere/in-all-words s (rest a-low)))])) > > ;;; EXAMPLE > (= (insert-everywhere/in-all-words 'd (list (list 'l 'i 'k 'e) > (list 'p 'o) > (list 'a 'n))) > (list (list 'd 'l 'i 'k 'e) > (list 'l 'd 'i 'k 'e) > (list 'l 'i 'd 'k 'e) > (list 'l 'i 'k 'd 'e) > (list 'l 'i 'k 'e 'd) > (list 'd 'p 'o) > (list 'p 'd 'o) > (list 'p 'o 'd) > (list 'd 'a 'n) > (list 'a 'd 'n) > (list 'a 'n 'd))true) > ... > > > Produces this error: > > Welcome to DrScheme, version 4.1.1 [3m]. > Language: Beginning Student with List Abbreviations; memory limit: 128 > megabytes. > reference to an identifier before its definition: > insert-everywhere-in-a-word >> > > If the following is commented out: > > ;;; EXAMPLE > (= (insert-everywhere/in-all-words 'd (list (list 'l 'i 'k 'e) > (list 'p 'o) > (list 'a 'n))) > (list (list 'd 'l 'i 'k 'e) > (list 'l 'd 'i 'k 'e) > (list 'l 'i 'd 'k 'e) > (list 'l 'i 'k 'd 'e) > (list 'l 'i 'k 'e 'd) > (list 'd 'p 'o) > (list 'p 'd 'o) > (list 'p 'o 'd) > (list 'd 'a 'n) > (list 'a 'd 'n) > (list 'a 'n 'd))true) > > The error disappears. Should the above example (that does not use > check-expect and that makes improper use of =) cause such an error to > appear? I can see that insert-everywhere/in-all-words is being called > before insert-everywhere-in-a-word has been defined in the file. Is > that the expected/wanted behavior for a student language? > > It may be useful to collect all definitions before evaluating any > application expressions in the student languages. Is something to > think about or is there a reason this would be undesirable? > > -- > > Cheers, > > Marco > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mvanier at cs.caltech.edu Thu Nov 20 16:27:08 2008 From: mvanier at cs.caltech.edu (Michael Vanier) Date: Thu Mar 26 02:33:46 2009 Subject: [plt-scheme] Re: Look at it differently: Why PLT? In-Reply-To: References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> Message-ID: <4925D62C.3040008@cs.caltech.edu> I can't speak for Scheme48 or MIT Scheme, but I know for a fact that guile has a C interface. Not that I use it (I'm very partial to PLT Scheme), but let's give credit where credit is due. Mike /// wrote: > On Nov 19, 12:37 pm, "Greg Woodhouse" > wrote: > >> There is a lot of discussion going on here about how many PLT users wish it >> would conform more closely to R6RS. As someone working in two arenas where >> standards are especially important (healthcare and government), I can't help >> but be sympathetic. Indeed, I'd like to be able to use PLT Scheme for >> production work, and not conforming with existing standards is a major >> impediment there. >> >> That being said, everyone on this list is using, or at least interested in >> using, PLT Scheme. Why? >> > > There are several reasons I use PLT Scheme: > > PLT Scheme is a Lisp. Many of the reasons that Lisp is a great > programming language are shared with PLT Scheme. > > PLT Scheme has a very useful, big set of libraries not found in other > Scheme implementations, and that can't be ported to other Scheme > implementations because of PLT's module architecture and other > features. These libraries implement important features that allow > me to express ideas with simpler code. > > I find PLT's interactive environment to be more useful than the > static environments provided by Chicken, Stalin, et al. > The other interactive Schemes tend to be interpreters with no C > function interface (Guile, MIT Scheme, Scheme 48), making things like > database support nearly impossible. > > Even though "phase levels" cripple PLT Scheme's macro system in > frustrating > ways (forcing unwanted complexity into my code), many other Schemes > are even > more crippled when it comes to macros, having no support at all for > syntax-case macros. > > Even though PLT Scheme provides an interactive development > environment, > programs written with it can be compiled to regular executables that > load quickly. This is so important to my project, that the fact that > SBCL is better than PLT Scheme in every other way doesn't matter > enough > to make me switch to it. > > Even with all the power offered by PLT Scheme, it's still dead simple, > as long as you don't try to do anything too fancy with macros, and > as long as you don't think you should be able to use libraries that > use set-car! and set-cdr!. The module system is far easier to figure > out (when it comes to non-macro code) than Common Lisp's ASDF. There > is good online documentation, even for older versions of 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/20081120/d465807e/attachment.html From apgwoz at gmail.com Thu Nov 20 16:50:02 2008 From: apgwoz at gmail.com (Andrew Gwozdziewycz) Date: Thu Mar 26 02:33:46 2009 Subject: [plt-scheme] Re: Look at it differently: Why PLT? In-Reply-To: <4925D62C.3040008@cs.caltech.edu> References: <5f07325f0811190937s5751db88t9eb6ebda69796704@mail.gmail.com> <4925D62C.3040008@cs.caltech.edu> Message-ID: <8ba244fb0811201350q1013f615l5b69fd083d08d757@mail.gmail.com> On Thu, Nov 20, 2008 at 4:27 PM, Michael Vanier wrote: > I can't speak for Scheme48 or MIT Scheme, but I know for a fact that guile > has a C interface. > As does Scheme 48 > /// wrote > > On Nov 19, 12:37 pm, "Greg Woodhouse" > wrote: > > > There is a lot of discussion going on here about how many PLT users wish it > would conform more closely to R6RS. As someone working in two arenas where > standards are especially important (healthcare and government), I can't help > but be sympathetic. Indeed, I'd like to be able to use PLT Scheme for > production work, and not conforming with existing standards is a major > impediment there. > > That being said, everyone on this list is using, or at least interested in > using, PLT Scheme. Why? > > > There are several reasons I use PLT Scheme: > > PLT Scheme is a Lisp. Many of the reasons that Lisp is a great > programming language are shared with PLT Scheme. > > PLT Scheme has a very useful, big set of libraries not found in other > Scheme implementations, and that can't be ported to other Scheme > implementations because of PLT's module architecture and other > features. These libraries implement important features that allow > me to express ideas with simpler code. > > I find PLT's interactive environment to be more useful than the > static environments provided by Chicken, Stalin, et al. > The other interactive Schemes tend to be interpreters with no C > function interface (Guile, MIT Scheme, Scheme 48), making things like > database support nearly impossible. > > Even though "phase levels" cripple PLT Scheme's macro system in > frustrating > ways (forcing unwanted complexity into my code), many other Schemes > are even > more crippled when it comes to macros, having no support at all for > syntax-case macros. > > Even though PLT Scheme provides an interactive development > environment, > programs written with it can be compiled to regular executables that > load quickly. This is so important to my project, that the fact that > SBCL is better than PLT Scheme in every other way doesn't matter > enough > to make me switch to it. > > Even with all the power offered by PLT Scheme, it's still dead simple, > as long as you don't try to do anything too fancy with macros, and > as long as you don't think you should be able to use libraries that > use set-car! and set-cdr!. The module system is far easier to figure > out (when it comes to non-macro code) than Common Lisp's ASDF. There > is good online documentation, even for older versions of 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 > > -- Andrew Gwozdziewycz apgwoz@gmail.com http://www.apgwoz.com | http://www.photub.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081120/b5022649/attachment.htm From dherman at ccs.neu.edu Thu Nov 20 17:26:14 2008 From: dherman at ccs.neu.edu (David Herman) Date: Thu Mar 26 02:33:46 2009 Subject: [plt-scheme] handin-server message(bug?) on first 'check-syntax' of the day In-Reply-To: <595b9ab20811200127w3c23c017g3f291db48f0734dd@mail.gmail.com> Message-ID: <11672594.114701227219974088.JavaMail.root@zimbra> Yes, I see this all the time. Dave ----- Original Message ----- From: Stephen De Gabrielle To: PLT Scheme Mailing List Sent: Thu, 20 Nov 2008 04:27:22 -0500 (EST) Subject: [plt-scheme] handin-server message(bug?) on first 'check-syntax' of the day HI, I get this on my first invocation of 'check-syntax'; WARNING: open-input-file: cannot open input file: "/Users/stephen/Library/PLT Scheme/4.1.2.4/doc/handin-server/out.sxref" (No such file or directory; errno=2) Is it just me - or do others get this? Cheers, Stephen -- Stephen De Gabrielle _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme From balaban at cs.nyu.edu Thu Nov 20 20:57:51 2008 From: balaban at cs.nyu.edu (Ittai Balaban) Date: Thu Mar 26 02:33:47 2009 Subject: [plt-scheme] Why Modules? Message-ID: I've been looking into units, specifically the '99 "Cool Units..." paper. Apologies for reopening old threads, but I did not see this answered: In many respects (syntax bindings not included), units provide a much richer framework than modules - the latter cannot be assembled compositionally, prohibit cyclic dependencies, and do not allow multiple instantiations. Thus, my question is, since you make such a convincing case for units in the '99 paper, why did PLT find it necessary to introduce a new abstraction in the form of modules? Did you run into some intrinsic limitations of units? This is interesting, btw, because in the so called mainstream world of enterprise java, people are looking outside of the language to unit-like frameworks like OSGi to get around the limitations shared by Java packages and PLT modules. Thanks for any effort in helping me understand this. -- Ittai From samth at ccs.neu.edu Thu Nov 20 21:04:30 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:33:47 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: References: Message-ID: <63bb19ae0811201804p7b2a6f92we0c65e8aa210f106@mail.gmail.com> On Thu, Nov 20, 2008 at 8:57 PM, Ittai Balaban wrote: > I've been looking into units, specifically the '99 "Cool Units..." paper. > Apologies for reopening old threads, but I did not see this answered: > > In many respects (syntax bindings not included) You've hit on the answer right here. For the purposes of handling syntax, modules are essential. For more information on this, see "Composable and Compilable Macros", by Flatt, ICFP 02. >, units provide a much richer > framework than modules - the latter cannot be assembled compositionally, > prohibit cyclic dependencies, and do not allow multiple instantiations. > Thus, my question is, since you make such a convincing case for units in the > '99 paper, why did PLT find it necessary to introduce a new abstraction in > the form of modules? Did you run into some intrinsic limitations of units? > > This is interesting, btw, because in the so called mainstream world of > enterprise java, people are looking outside of the language to unit-like > frameworks like OSGi to get around the limitations shared by Java packages > and PLT modules. -- sam th samth@ccs.neu.edu From robby at cs.uchicago.edu Thu Nov 20 21:09:27 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:47 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: <63bb19ae0811201804p7b2a6f92we0c65e8aa210f106@mail.gmail.com> References: <63bb19ae0811201804p7b2a6f92we0c65e8aa210f106@mail.gmail.com> Message-ID: <932b2f1f0811201809o4564839dt97ad785c63e97257@mail.gmail.com> And where "syntax" here includes all manner of compile-time information, including type information. Robby On Thu, Nov 20, 2008 at 8:04 PM, Sam TH wrote: > On Thu, Nov 20, 2008 at 8:57 PM, Ittai Balaban wrote: >> I've been looking into units, specifically the '99 "Cool Units..." paper. >> Apologies for reopening old threads, but I did not see this answered: >> >> In many respects (syntax bindings not included) > > You've hit on the answer right here. For the purposes of handling > syntax, modules are essential. For more information on this, see > "Composable and Compilable Macros", by Flatt, ICFP 02. > >>, units provide a much richer >> framework than modules - the latter cannot be assembled compositionally, >> prohibit cyclic dependencies, and do not allow multiple instantiations. >> Thus, my question is, since you make such a convincing case for units in the >> '99 paper, why did PLT find it necessary to introduce a new abstraction in >> the form of modules? Did you run into some intrinsic limitations of units? >> >> This is interesting, btw, because in the so called mainstream world of >> enterprise java, people are looking outside of the language to unit-like >> frameworks like OSGi to get around the limitations shared by Java packages >> and PLT modules. > > -- > sam th > samth@ccs.neu.edu > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From grettke at acm.org Thu Nov 20 22:14:18 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:47 2009 Subject: [plt-scheme] Templates in the PLT Web Server In-Reply-To: References: Message-ID: <756daca50811201914m7bac3d9ax5c8a0722f6564de9@mail.gmail.com> On Thu, Nov 20, 2008 at 10:33 AM, Jay McCarthy wrote: > The PLT Web Server now provides a templating system of its own. Very nice Jay! From lunarc.lists at gmail.com Thu Nov 20 22:33:10 2008 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:33:47 2009 Subject: [plt-scheme] hash table implementation? In-Reply-To: <20081120162637.D86176500B2@mail-svr1.cs.utah.edu> References: <595b9ab20811200803u391ec549xb8172db2a8e0cfe7@mail.gmail.com> <20081120162637.D86176500B2@mail-svr1.cs.utah.edu> Message-ID: 2008/11/20 Matthew Flatt : > That's correct for mutable hash tables. Immutable hash tables (with > functional updated) are implemented using a red--black tree. Does this mean that if I am not planning to modify a hash table after construction, that it is preferable to use mutable hash tables for lookup speed? I've been using immutable ones simply because they have a ready-made constructor from alists. Henk From mvanier42 at gmail.com Fri Nov 21 01:54:04 2008 From: mvanier42 at gmail.com (Michael Vanier) Date: Thu Mar 26 02:33:47 2009 Subject: [plt-scheme] divascheme in mac os x? In-Reply-To: References: <492548B6.3080006@cs.caltech.edu> Message-ID: <49265B0C.5040304@cs.caltech.edu> Danny Yoo wrote: > On Thu, Nov 20, 2008 at 6:23 AM, Michael Vanier wrote: > >> Hi, >> >> I was wondering if it's possible to run the DivaScheme package in Mac OS X. >> I've installed it, but I can't activate it -- hitting F4, which is supposed >> to toggle the DivaScheme environment, does nothing. Any suggestions? >> > > Uh oh. Ok, I will investigate this when I get home. > > Just as a sanity check: when you restart DrScheme, do you see a menu > item under the File menu that says "Enable DivaScheme"? > Never mind, it works now. I had to delete my old DrScheme files under ~/Library/PLT Scheme and start over. Something from a previous install was presumably confusing the program. Mike From noelwelsh at gmail.com Fri Nov 21 02:42:00 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:48 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: References: Message-ID: Modules are much simpler to use than units. This doesn't directly address your question, but is, I think, an important consideration. N. On Fri, Nov 21, 2008 at 1:57 AM, Ittai Balaban wrote: ... > In many respects (syntax bindings not included), units provide a much richer > framework than modules - the latter cannot be assembled compositionally, > prohibit cyclic dependencies, and do not allow multiple instantiations. > Thus, my question is, since you make such a convincing case for units in the > '99 paper, why did PLT find it necessary to introduce a new abstraction in > the form of modules? Did you run into some intrinsic limitations of units? ... From spdegabrielle at gmail.com Fri Nov 21 07:07:52 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:48 2009 Subject: [plt-scheme] lambda-apply-values Message-ID: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> Hi, something I seem to often do is use list as structures, (and have lists of these) eg #lang scheme (define people '(("Guy" 40 man) ("Maddona" 50 woman))) I am often doing something like; (map (? (person) (let ((name (car person)) (age (car person)) (gender (car person))) (blah-fn name age gender) ) people) I could, but don't often, do (map (? (name age gender) (blah-fn name age gender) ) (map car people) (map cadr people) (map caddr people)) I realise this is a bit rubbish and have thought of a better way; (map (? (person) (let-values ([(name age gender) (apply values person)]) (blah-fn name age gender) )) people) I sort of suspect that a macro might be the ticket - like; (define-syntax-rule (lambda-apply-values-person1 values-list blah-fn x y z) (? (values-list) (let-values ([(x y z) (apply values values-list)]) (blah-fn x y z) ))) (map (lambda-apply-values-person1 person (lambda args (display args)) x y z) people) which works but doesn't handle multiple identifiers; (define-syntax lambda-apply-values-person2 (syntax-rules () (lambda-apply-values-person2 values-list ...) (? (values-list) (let-values ([(...) (apply values values-list)]) (list ...) )))) of course this doesn't work. I suspect I can't do this with syntax-rules and need to look at syntax-case and the syntax form. Because I do this all the time I'm sure that others have a better way. What do you do? Cheers, Stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081121/52c4c18b/attachment.html From noelwelsh at gmail.com Fri Nov 21 07:15:46 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:49 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> Message-ID: Use structures and/or pattern matching (see match-lambda in particular). Using lists as structures is, I think, quite bad practice. You can get away with it for limited cases but it will bite you in the arse if you change the data format. In statically typed languages you can get away it (using tuples though, not lists) a bit more. N. On Fri, Nov 21, 2008 at 12:07 PM, Stephen De Gabrielle wrote: ... > something I seem to often do is use list as structures, (and have lists of > these) ... From spdegabrielle at gmail.com Fri Nov 21 07:22:37 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:49 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> Message-ID: <595b9ab20811210422k5293352ei7b92acda7df93bed@mail.gmail.com> thanks for the good advice. On Fri, Nov 21, 2008 at 12:15 PM, Noel Welsh wrote: > Use structures and/or pattern matching (see match-lambda in > particular). Using lists as structures is, I think, quite bad > practice. You can get away with it for limited cases but it will bite > you in the arse if you change the data format tell me about it! > N. > > On Fri, Nov 21, 2008 at 12:07 PM, Stephen De Gabrielle > wrote: > ... > > something I seem to often do is use list as structures, (and have lists > of > > these) > ... > -- Cheers, Stephen -- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081121/000e51f6/attachment.htm From jos.koot at telefonica.net Fri Nov 21 07:30:20 2008 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:33:50 2009 Subject: [plt-scheme] lambda-apply-values References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> Message-ID: <6C58F4978AD244928CCFBEE9CE797F06@uw2b2dff239c4d> ----- Original Message ----- From: Stephen De Gabrielle To: PLT List Sent: Friday, November 21, 2008 1:07 PM Subject: [plt-scheme] lambda-apply-values Hi, something I seem to often do is use list as structures, (and have lists of these) eg #lang scheme (define people '(("Guy" 40 man) ("Maddona" 50 woman))) I am often doing something like; (map (? (person) (let ((name (car person)) (age (car person)) (gender (car person))) (blah-fn name age gender) ) people) I could, but don't often, do (map (? (name age gender) (blah-fn name age gender) ) (map car people) (map cadr people) (map caddr people)) I realise this is a bit rubbish and have thought of a better way; (map (? (person) (let-values ([(name age gender) (apply values person)]) (blah-fn name age gender) )) people) I sort of suspect that a macro might be the ticket - like; (define-syntax-rule (lambda-apply-values-person1 values-list blah-fn x y z) (? (values-list) (let-values ([(x y z) (apply values values-list)]) (blah-fn x y z) ))) (map (lambda-apply-values-person1 person (lambda args (display args)) x y z) people) which works but doesn't handle multiple identifiers; (define-syntax lambda-apply-values-person2 (syntax-rules () (lambda-apply-values-person2 values-list (x y z)) (? (values-list) (let-values ([(...) (apply values values-list)]) <=== (list ...) )))) of course this doesn't work. I suspect I can't do this with syntax-rules and need to look at syntax-case and the syntax form. May be (define-syntax lambda-apply-values-person2 (syntax-rules () ((_ ((values-list (e ...)) ...) . body) (? (values-list ...) (let-values ([(e ...) (apply values values-list)] ...) . body))))) (map (lambda-apply-values-person2 ((lsta (a b c)) (lstx (x y))) (list a b c x y)) '((a0 b0 c0) (a1 b1 b2)) '((x0 y0) (x1 y1))) ;--> ((a0 b0 c0 x0 y0) (b0 b1 b2 x1 y1)) Jos Because I do this all the time I'm sure that others have a better way. What do you do? Cheers, Stephen ------------------------------------------------------------------------------ _________________________________________________ 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/20081121/935ed63e/attachment.html From kbohdan at mail.ru Fri Nov 21 07:32:09 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:33:50 2009 Subject: [plt-scheme] Re: lambda-apply-values In-Reply-To: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> Message-ID: What about (map (lambda (p) (apply blah-fn p)) people) ? -- Bohdan Stephen De Gabrielle wrote: > Hi, > > something I seem to often do is use list as structures, (and have lists > of these) > > eg > > #lang scheme > (define people '(("Guy" 40 man) ("Maddona" 50 woman))) > > I am often doing something like; > > (map (? (person) > (let ((name (car person)) > (age (car person)) > (gender (car person))) > (blah-fn name age gender) > ) people) > > I could, but don't often, do (map (? (name age gender) (blah-fn name age > gender) ) (map car people) (map cadr people) (map caddr people)) > > I realise this is a bit rubbish and have thought of a better way; > > (map (? (person) > (let-values ([(name age gender) (apply values person)]) > (blah-fn name age gender) > )) people) > > I sort of suspect that a macro might be the ticket - like; > > > (define-syntax-rule (lambda-apply-values-person1 values-list blah-fn x y z) > (? (values-list) > (let-values ([(x y z) (apply values values-list)]) > (blah-fn x y z) > ))) > > (map (lambda-apply-values-person1 person (lambda args (display args)) x > y z) people) > > which works but doesn't handle multiple identifiers; > > (define-syntax lambda-apply-values-person2 > (syntax-rules () > (lambda-apply-values-person2 values-list ...) > (? (values-list) > (let-values ([(...) (apply values values-list)]) > (list ...) > )))) > of course this doesn't work. I suspect I can't do this with syntax-rules > and need to look at syntax-case and the syntax form. > > Because I do this all the time I'm sure that others have a better way. > What do you do? > > Cheers, > > Stephen > > > > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Fri Nov 21 08:08:23 2008 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:33:51 2009 Subject: [plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison? Message-ID: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> Hi all, I would be interested in seeing some comparison between the performance (time / memory) of modules created with Scheme (untyped, no contracts), contracts in module frontiers and typed scheme. Anyone did any experiments or have any useful insights regarding this? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From robby at cs.uchicago.edu Fri Nov 21 08:29:17 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:51 2009 Subject: [plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison? In-Reply-To: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> References: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> Message-ID: <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> PLT's contract system encourages cheap contracts, mostly because contracts live on module boundaries and tight loops tend not to be across module boundaries. While I have not done anything close to a careful study, I did carefully measure the effect of dropping contracts from drscheme and the impact was negligible. Robby On 11/21/08, Paulo J. Matos wrote: > Hi all, > > I would be interested in seeing some comparison between the > performance (time / memory) of modules created with Scheme (untyped, > no contracts), contracts in module frontiers and typed scheme. > > Anyone did any experiments or have any useful insights regarding 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 erich at snafu.de Fri Nov 21 08:17:23 2008 From: erich at snafu.de (Erich Rast) Date: Thu Mar 26 02:33:51 2009 Subject: [plt-scheme] Howto regexp-split string but keep delimiters Message-ID: <1227273443.11000.5.camel@darkstar> Hello all, I need to split a large string into separate words using a regexp, but need to keep non-whitespace delimiters: "Ab, c, dd,hello." ==> ("Ab" "," "c" "," "dd" "," "hello" ".") Can this be done using regexp-split? How? Best regards, Erich From matthias at ccs.neu.edu Fri Nov 21 08:39:46 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:51 2009 Subject: [plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison? In-Reply-To: <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> References: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> Message-ID: <02A20885-E7CD-42E0-99DF-4B359E5F19BF@ccs.neu.edu> On Nov 21, 2008, at 8:29 AM, Robby Findler wrote: > PLT's contract system encourages cheap contracts, mostly because > contracts live on module boundaries and tight loops tend not to be > across module boundaries. > > While I have not done anything close to a careful study, I did > carefully measure the effect of dropping contracts from drscheme and > the impact was negligible. In this day and age, 'negligible' is a questionabe statement :) One of my students is working on parallelizing contracts. He is relying on Kevin's work on 'places'. General statement: it doesn't pay off in general, but only when the contract is about as intensive as the procedure's computations. That's all we know for now. -- Matthias > > Robby > > On 11/21/08, Paulo J. Matos wrote: >> Hi all, >> >> I would be interested in seeing some comparison between the >> performance (time / memory) of modules created with Scheme (untyped, >> no contracts), contracts in module frontiers and typed scheme. >> >> Anyone did any experiments or have any useful insights regarding >> 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 >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pocmatos at gmail.com Fri Nov 21 08:47:29 2008 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:33:51 2009 Subject: [plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison? In-Reply-To: <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> References: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> Message-ID: <11b141710811210547l303f66cvcf05bb92b4016b3d@mail.gmail.com> On Fri, Nov 21, 2008 at 1:29 PM, Robby Findler wrote: > PLT's contract system encourages cheap contracts, mostly because > contracts live on module boundaries and tight loops tend not to be > across module boundaries. > > While I have not done anything close to a careful study, I did > carefully measure the effect of dropping contracts from drscheme and > the impact was negligible. > Thanks for the reply. What does your intuition say about the performance of using typed-scheme instead of contracts? Would the difference also be negligible? Regarding this question, I would even hope that by using typed scheme, the compiler could use this annotations to improve compiled code, but as far as i know this as not been done yet, right? On the other hand, then, typed-scheme shouldn't have any performance degradation when comparing to normal scheme as it is not a runtime feature, like contracts, or am I wrong? > Robby > > On 11/21/08, Paulo J. Matos wrote: >> Hi all, >> >> I would be interested in seeing some comparison between the >> performance (time / memory) of modules created with Scheme (untyped, >> no contracts), contracts in module frontiers and typed scheme. >> >> Anyone did any experiments or have any useful insights regarding 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 >> >> > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From robby at cs.uchicago.edu Fri Nov 21 08:48:06 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:51 2009 Subject: [plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison? In-Reply-To: <02A20885-E7CD-42E0-99DF-4B359E5F19BF@ccs.neu.edu> References: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> <02A20885-E7CD-42E0-99DF-4B359E5F19BF@ccs.neu.edu> Message-ID: <932b2f1f0811210548g7110c7d1sd2a4cf2fc4f2dfe7@mail.gmail.com> On Fri, Nov 21, 2008 at 7:39 AM, Matthias Felleisen wrote: > > On Nov 21, 2008, at 8:29 AM, Robby Findler wrote: > >> PLT's contract system encourages cheap contracts, mostly because >> contracts live on module boundaries and tight loops tend not to be >> across module boundaries. >> >> While I have not done anything close to a careful study, I did >> carefully measure the effect of dropping contracts from drscheme and >> the impact was negligible. > > > In this day and age, 'negligible' is a questionable statement :) I don't think there is a day and age for which this should be considered the be all and end all, but this was in a paper you are a co-author on. Below is the relevant passage. That's truly all I know. >From http://www.cs.uchicago.edu/~robby/pubs/papers/ecoop2004-fff.pdf: "We have studied the performance impact of contracts in DrScheme. An instru- mented version of DrScheme counts the number of functions and function contracts. After starting up DrScheme and opening a few windows and Help Desk, there are 27962 reachable functions and only 507 wrappers, i.e., slightly less than 2% of the functions are wrapped. With a different accounting annotation, DrScheme can also determine the number of function calls and calls to contract functions; for basically the same start-up action, the program performs 2,142,000 calls to user-defined functions, of which 1425 are calls to contract wrappers. That is, 0.06% of the calls to user-defined functions are calls to wrappers. Unfortunately, it is difficult to generalize these experiments, because it is a major undertaking to write contracts for a large system of components. Still, the experiment with DrScheme suggests that well-chosen contracts have little performance impact on a large program. Based on our experience, the number of contracts in a com- ponent rarely exceeds 10% of the number of functions proper. Yet, even if our system were to contain that many wrapper functions, our experiments suggest that only .3% of the function calls would be calls to wrapper functions. " Robby From grettke at acm.org Fri Nov 21 08:49:00 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:51 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: References: Message-ID: <756daca50811210549s16887168w671bcc7d7fe0745@mail.gmail.com> On Fri, Nov 21, 2008 at 1:42 AM, Noel Welsh wrote: > Modules are much simpler to use than units. This doesn't directly > address your question, but is, I think, an important consideration. It would be interesting for the documentation to include an example of how one particular problem is addressed using modules, units, and classes. There are probably some idioms particular to each construct; and it would be helpful to compare them. I'm thinking about this myself because I wrote a program with classes rather than units because they were simpler; but now I am thinking that I ought to learn units and also investigate how to solve the problem using the module system alone. From robby at cs.uchicago.edu Fri Nov 21 08:51:29 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:52 2009 Subject: [plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison? In-Reply-To: <11b141710811210547l303f66cvcf05bb92b4016b3d@mail.gmail.com> References: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> <11b141710811210547l303f66cvcf05bb92b4016b3d@mail.gmail.com> Message-ID: <932b2f1f0811210551q68c52f58x813084485fd43946@mail.gmail.com> On Fri, Nov 21, 2008 at 7:47 AM, Paulo J. Matos wrote: > On Fri, Nov 21, 2008 at 1:29 PM, Robby Findler wrote: >> PLT's contract system encourages cheap contracts, mostly because >> contracts live on module boundaries and tight loops tend not to be >> across module boundaries. >> >> While I have not done anything close to a careful study, I did >> carefully measure the effect of dropping contracts from drscheme and >> the impact was negligible. >> > > Thanks for the reply. What does your intuition say about the > performance of using typed-scheme instead of contracts? Would the > difference also be negligible? There is the obvious 'remove the checks' optimization that can be done, but is not yet being done. After that, there are a few large research programs aimed at pushing type information all the way thru the compiler and they have shown that you can do better if you do that, but I'm not enough of an expert to know if it is worth the energy required (my guess: no). > Regarding this question, I would even hope that by using typed scheme, > the compiler could use this annotations to improve compiled code, but > as far as i know this as not been done yet, right? On the other hand, > then, typed-scheme shouldn't have any performance degradation when > comparing to normal scheme as it is not a runtime feature, like > contracts, or am I wrong? Typed scheme does use contracts for interop, so it isn't completely clear. Also, typed scheme does (cough) type checking and that takes time. For some programs, compilation is a significant part of the running time. So, I guess the answer is "it depends" :) Robby From samth at ccs.neu.edu Fri Nov 21 08:52:02 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:33:52 2009 Subject: [plt-scheme] Typed, Contracts, and Normal Scheme Performance Comparison? In-Reply-To: <11b141710811210547l303f66cvcf05bb92b4016b3d@mail.gmail.com> References: <11b141710811210508o4f5495bcwadf658a42a3e9934@mail.gmail.com> <932b2f1f0811210529rf83386csfddc62b46f4fde75@mail.gmail.com> <11b141710811210547l303f66cvcf05bb92b4016b3d@mail.gmail.com> Message-ID: <63bb19ae0811210552v12626f00n41c2e39cce182a85@mail.gmail.com> On Fri, Nov 21, 2008 at 8:47 AM, Paulo J. Matos wrote: > On Fri, Nov 21, 2008 at 1:29 PM, Robby Findler wrote: >> PLT's contract system encourages cheap contracts, mostly because >> contracts live on module boundaries and tight loops tend not to be >> across module boundaries. >> >> While I have not done anything close to a careful study, I did >> carefully measure the effect of dropping contracts from drscheme and >> the impact was negligible. >> > > Thanks for the reply. What does your intuition say about the > performance of using typed-scheme instead of contracts? Would the > difference also be negligible? > > Regarding this question, I would even hope that by using typed scheme, > the compiler could use this annotations to improve compiled code, but > as far as i know this as not been done yet, right? On the other hand, > then, typed-scheme shouldn't have any performance degradation when > comparing to normal scheme as it is not a runtime feature, like > contracts, or am I wrong? At the border between typed and untyped code, contracts are automatically synthesized, so if you have one module that uses types, it will have performance comparable to using contracts. If you convert multiple modules, there's no overhead for communication between them, and thus the performance is potentially better than contracts. However, as Robby said, depending on your code organization, all of this overhead may well be small. Thanks, -- sam th samth@ccs.neu.edu From spdegabrielle at gmail.com Fri Nov 21 08:54:58 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:52 2009 Subject: [plt-scheme] Nokia N800 In-Reply-To: <20081121072458.GA16049@topoi.pooq.com> References: <20081120205609.GD12664@topoi.pooq.com> <595b9ab20811192358u76fd8774s2a16b5abb505ec28@mail.gmail.com> <20081121072458.GA16049@topoi.pooq.com> Message-ID: <595b9ab20811210554i33e2e54fjd35a9ad1c23e83d0@mail.gmail.com> I don't really know.... On Fri, Nov 21, 2008 at 7:24 AM, wrote: > On Thu, Nov 20, 2008 at 07:58:08AM +0000, Stephen De Gabrielle wrote: > > I once built mzscheme for the 770. I don't think drscheme will fit/run. > > Does that mean mzscheme programs would probably run, but that you'd be > better off developing them elsewhere? Would programs that actually need yes > Would programs that actually need > a windows-and-stylus interface be hopeless to use? Other people have ported stuff - but I understand their are significant differences in interacting that you have to cope with I don't know if you could port mred (the GUI libraries) Or does the bulk of > drscheme lie elsewhere? > I don't know what that means. HTH s. > > -- hendrik > > > > > On 11/20/08, hendrik@topoi.pooq.com wrote: > > > Has anyone considered or done porting PLT Scheme to the Nokia N800? > > > Was/would it be worth doing? The machine runs a Linux system with 128 > > > megabytes of RAM, swapped to a 256 megabyte flash memory. It has an > ARM > > > processor (specifically, an OMAP2420 microprocessor) > > > > > > -- hendrik > > > > > > _________________________________________________ > > > 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/20081121/de518efd/attachment.htm From matthias at ccs.neu.edu Fri Nov 21 10:41:52 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:52 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: References: Message-ID: On Nov 20, 2008, at 8:57 PM, Ittai Balaban wrote: > I've been looking into units, specifically the '99 "Cool Units..." > paper. Apologies for reopening old threads, but I did not see this > answered: > > In many respects (syntax bindings not included), units provide a > much richer framework than modules - the latter cannot be assembled > compositionally, prohibit cyclic dependencies, and do not allow > multiple instantiations. Thus, my question is, since you make such > a convincing case for units in the '99 paper, why did PLT find it > necessary to introduce a new abstraction in the form of modules? > Did you run into some intrinsic limitations of units? > > This is interesting, btw, because in the so called mainstream world > of enterprise java, people are looking outside of the language to > unit-like frameworks like OSGi to get around the limitations shared > by Java packages and PLT modules. > > Thanks for any effort in helping me understand this. 1. Units, as proposed, were overkill for many tasks. 2. Shriram Krishnamurthi's dissertation generalized units to languages, appropriately dubbed unit/lang. 3. These unit/langs never made it beyond prototype stage and Matthew found a pragmatic way to do a lot with modules and syntax. 4. Ryan Culpepper et al provided a way to do some syntax with units back in 2005. 5. Scott Owens, supervised by Matthew, implemented a syntactically simpler unit system that provides a somewhat gentler learning curve, starting from modules, than our original system. 6. On some occasions, I dig out these units and use them but most of the time I get away with plain modules. We should at some point make an effort to tease this out in the docs. -- Matthias From mflatt at cs.utah.edu Fri Nov 21 10:47:49 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:53 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: References: Message-ID: <20081121154751.6FA256500AE@mail-svr1.cs.utah.edu> At Thu, 20 Nov 2008 20:57:51 -0500, "Ittai Balaban" wrote: > In many respects (syntax bindings not included), units provide a much > richer framework than modules - the latter cannot be assembled > compositionally, prohibit cyclic dependencies, and do not allow multiple > instantiations. Thus, my question is, since you make such a convincing > case for units in the '99 paper, why did PLT find it necessary to > introduce a new abstraction in the form of modules? Did you run into some > intrinsic limitations of units? The continuation of that work is Scott Owens's dissertation http://www.cs.utah.edu/plt/publications/owens-phd.pdf and related papers From Structures and Functors to Modules and Units ICFP 2006 Owens and Flatt http://www.cs.utah.edu/plt/publications/icfp06-of.pdf Syntactic Abstraction in Component Interfaces GPCE 2005 Culpepper, Owens, and Flatt. http://www.cs.utah.edu/plt/publications/gpce05-cof.pdf about the interplay of modules and units. As you and others noted, we introduced `module' to deal with syntactic extension. Another explanation is that you need some sort of module system to host a unit system: to create a unit that uses AN implementation of an interface, you need some way to refer to THE specification of the interface, as well as a way to refer to specific implementations to link them together. At the same time, the module system is weaker than a unit system for composing systems, and we really should be putting our libraries into units (i.e., I still believe most of the original `unit' motivation). The reason we don't, though, is the same reason that ML programmers don't write "fully functorized" code: it's a bit of a pain to split implementation from interface and to explicitly link implementations, and the resulting extra flexibility is needed so rarely that the pain doesn't seem worthwhile --- unless we really need the flexibility, in which case we do use units. We've attacked the "bit of a pain" problem using syntactic extension. With `#lang unit' and `define-compound-unit/infer', we've removed some tedious syntax and bookkeeping for using units. It will take more work in that direction, though, to make it as easy as throwing a module together. Possibly we just need to be more disciplined. Also, it would take more compiler work to get back the current level of performance for cross-module calls (e.g., if `+' were imported through a unit, then "just in time" would have to be later than it is currently). Matthew From matthias at ccs.neu.edu Fri Nov 21 10:53:59 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:53 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: <20081121154751.6FA256500AE@mail-svr1.cs.utah.edu> References: <20081121154751.6FA256500AE@mail-svr1.cs.utah.edu> Message-ID: P.S. One other point to note is that people often ask for contracts for unit boundaries because the module boundaries come with it. Stevie Strickland has just started working on the proper integration of units and contracts, as a step toward typed units. -- Matthias On Nov 21, 2008, at 10:47 AM, Matthew Flatt wrote: > At Thu, 20 Nov 2008 20:57:51 -0500, "Ittai Balaban" wrote: >> In many respects (syntax bindings not included), units provide a much >> richer framework than modules - the latter cannot be assembled >> compositionally, prohibit cyclic dependencies, and do not allow >> multiple >> instantiations. Thus, my question is, since you make such a >> convincing >> case for units in the '99 paper, why did PLT find it necessary to >> introduce a new abstraction in the form of modules? Did you run >> into some >> intrinsic limitations of units? > > The continuation of that work is Scott Owens's dissertation > > http://www.cs.utah.edu/plt/publications/owens-phd.pdf > > and related papers > > From Structures and Functors to Modules and Units > ICFP 2006 Owens and Flatt > http://www.cs.utah.edu/plt/publications/icfp06-of.pdf > > > Syntactic Abstraction in Component Interfaces > GPCE 2005 Culpepper, Owens, and Flatt. > http://www.cs.utah.edu/plt/publications/gpce05-cof.pdf > > about the interplay of modules and units. > > > As you and others noted, we introduced `module' to deal with syntactic > extension. Another explanation is that you need some sort of module > system to host a unit system: to create a unit that uses AN > implementation of an interface, you need some way to refer to THE > specification of the interface, as well as a way to refer to specific > implementations to link them together. > > At the same time, the module system is weaker than a unit system for > composing systems, and we really should be putting our libraries into > units (i.e., I still believe most of the original `unit' motivation). > The reason we don't, though, is the same reason that ML programmers > don't write "fully functorized" code: it's a bit of a pain to split > implementation from interface and to explicitly link implementations, > and the resulting extra flexibility is needed so rarely that the pain > doesn't seem worthwhile --- unless we really need the flexibility, in > which case we do use units. > > We've attacked the "bit of a pain" problem using syntactic extension. > With `#lang unit' and `define-compound-unit/infer', we've removed some > tedious syntax and bookkeeping for using units. It will take more work > in that direction, though, to make it as easy as throwing a module > together. Possibly we just need to be more disciplined. Also, it would > take more compiler work to get back the current level of performance > for cross-module calls (e.g., if `+' were imported through a unit, > then > "just in time" would have to be later than it is currently). > > > Matthew > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From eli at barzilay.org Fri Nov 21 10:54:10 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:53 2009 Subject: [plt-scheme] PLT Scheme v4.1.3 Message-ID: <200811211554.mALFsASw005702@winooski.ccs.neu.edu> PLT Scheme version 4.1.3 is now available from http://plt-scheme.org/ This is mostly a bug-fix release. Notable changes: * Web Server: - Documentation rewritten to separate servlet APIs and server extension APIs - HTTPS supported on the "plt-web-server" command-line with "--ssl" option - Stateless servlets supported in default configuration through 'stateless interface-version - `web-server/servlet-env' supports top-level servlets through #:servlet-path - Servlets are served from anywhere in the htdocs directory by default - A template system based on the Scribble syntax has been added, see web-server/templates in the documentation And many other internal modifications to make extension easier! [Note that mirror sites can take a while to catch up with the new downloads.] Feedback Welcome, -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From areilly at bigpond.net.au Fri Nov 21 08:14:02 2008 From: areilly at bigpond.net.au (Andrew Reilly) Date: Thu Mar 26 02:33:53 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> Message-ID: <81885C39-B76D-4751-A127-52671E541391@bigpond.net.au> On 21/11/2008, at 23:07, Stephen De Gabrielle wrote: > Hi, > > something I seem to often do is use list as structures, (and have > lists of these) > > eg > > #lang scheme > (define people '(("Guy" 40 man) ("Maddona" 50 woman))) > > I am often doing something like; > > (map (? (person) > (let ((name (car person)) > (age (car person)) > (gender (car person))) > (blah-fn name age gender) > ) people) (map (match-lambda (((list name age gender) (blah-fn name age gender))) people) or there-abouts. Match is, imo, grand. Per some of the other comments, I try not to use lists as structures per-se, but when pulling information out of XML files I find that that's just how it is, and match is just brilliant for turning them back into structs or function arguments. Cheers, Andrew From mflatt at cs.utah.edu Fri Nov 21 11:18:38 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:53 2009 Subject: [plt-scheme] hash table implementation? In-Reply-To: References: <595b9ab20811200803u391ec549xb8172db2a8e0cfe7@mail.gmail.com> <20081120162637.D86176500B2@mail-svr1.cs.utah.edu> Message-ID: <20081121161839.3DF8265008D@mail-svr1.cs.utah.edu> At Thu, 20 Nov 2008 22:33:10 -0500, "Henk Boom" wrote: > 2008/11/20 Matthew Flatt : > > That's correct for mutable hash tables. Immutable hash tables (with > > functional updated) are implemented using a red--black tree. > > Does this mean that if I am not planning to modify a hash table after > construction, that it is preferable to use mutable hash tables for > lookup speed? I've been using immutable ones simply because they have > a ready-made constructor from alists. No, I think immutable hash tables tend to be about as fast as immutable ones for lookup. But my impression is that immutable hash tables can be significantly slower to build. [The difference, I think, is that the constant on rb-tree traversal is low, while the constant on rb-tree rotation and intermediate-node construction is much larger.] I used the program below to check. If you make `sz' larger, then construction of the immutable table takes proportionally more time. If you make `sz' large enough (100000 on my machine) then lookup can be faster with the mutable table, but not by much. The usual caveat on a benchmark applies: a real program might differ from the test below in many ways that affect performance. Matthew ---------------------------------------- #lang scheme (define sz 100) (define iters 1000000) (define ht1 (for/hash ([i (in-range sz)]) (values i (list i)))) (define ht2 (hash-copy ht1)) (define (t ht) (time (for ([i (in-range iters)]) (hash-ref ht (modulo i sz))))) 'lookup-immutable (t ht1) 'lookup-mutable (t ht2) 'make-immutable (time (void (for/fold ([ht #hasheq()]) ([i (in-range iters)]) (hash-set ht (modulo i sz) i)))) 'make-mutable (time (void (let ([ht (make-hasheq)]) (for ([i (in-range iters)]) (hash-set! ht (modulo i sz) i))))) From eli at barzilay.org Fri Nov 21 11:19:25 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:33:53 2009 Subject: [plt-scheme] Howto regexp-split string but keep delimiters In-Reply-To: <1227273443.11000.5.camel@darkstar> References: <1227273443.11000.5.camel@darkstar> Message-ID: <18726.57229.525435.352362@arabic.ccs.neu.edu> On Nov 21, Erich Rast wrote: > Hello all, > > I need to split a large string into separate words using a regexp, but > need to keep non-whitespace delimiters: > > "Ab, c, dd,hello." ==> ("Ab" "," "c" "," "dd" "," "hello" ".") > > Can this be done using regexp-split? How? It's easier to do with regexp-match: > (regexp-match* #px"[\\w]+|[^\\s\\w]" "Ab, c, dd,hello.") ("Ab" "," "c" "," "dd" "," "hello" ".") -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From droy at mit.edu Fri Nov 21 13:42:24 2008 From: droy at mit.edu (Daniel Roy) Date: Thu Mar 26 02:33:54 2009 Subject: [plt-scheme] a single module split across several files Message-ID: I have a question about using modules/units and physical code organization. Simply put: can I split a single module across several files so its easier to work with? More details: We had been using the Pretty Big language and (load ...) commands to piece together a number of files totaling roughly 14,000 lines. I've recently moved the code into the modules framework (which seems to be necessary in order to get debugging across multiple files and other more advanced functionality to work in DrScheme). However, in the process, I had to (naively) concatenate a number of files together as they referenced each other. If they were separate modules, they would have had cyclic dependencies. That said, they aren't really cyclic -- they really are a single module. Unfortunately it's also 6000 lines of code. Using (load ...) doesn't work (at least my naive attempts at using load didn't work). Now, undoubtedly there is some re-factoring that could be done to identify reusable and generic components that I could separate out as other modules and reduce this file to a manageable size. But this is a research project not a software development one and the form and structure of the code is subject to radical changes. Can I get the benefit of modules (better optimization? debugging? etc?) without being forced to move dependent code into the same physical file? thanks, dan -- Daniel Roy CSAIL/MIT http://web.mit.edu/droy/www (mobile) +1 617 872 3267 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081121/8b5f7d2d/attachment.html From robby at cs.uchicago.edu Fri Nov 21 14:02:58 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:54 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: Message-ID: <932b2f1f0811211102u2507b9b1ye1088f1aedffc135@mail.gmail.com> You might try 'include' but compilation won't track dependencies for those files (so it is probably a bad idea). If I were too lazy to refactor, I would probably just live with a 6000 line file (but ... that's me :). Check Syntax could make this job much easier. You might also try units, but it might end up being more work than refactoring. Robby On Fri, Nov 21, 2008 at 12:42 PM, Daniel Roy wrote: > I have a question about using modules/units and physical code organization. > > Simply put: can I split a single module across several files so its easier > to work with? > > More details: We had been using the Pretty Big language and (load ...) > commands to piece together a number of files totaling roughly 14,000 lines. > I've recently moved the code into the modules framework (which seems to be > necessary in order to get debugging across multiple files and other more > advanced functionality to work in DrScheme). However, in the process, I had > to (naively) concatenate a number of files together as they referenced each > other. If they were separate modules, they would have had cyclic > dependencies. That said, they aren't really cyclic -- they really are a > single module. Unfortunately it's also 6000 lines of code. Using (load > ...) doesn't work (at least my naive attempts at using load didn't work). > > Now, undoubtedly there is some re-factoring that could be done to identify > reusable and generic components that I could separate out as other modules > and reduce this file to a manageable size. But this is a research project > not a software development one and the form and structure of the code is > subject to radical changes. Can I get the benefit of modules (better > optimization? debugging? etc?) without being forced to move dependent code > into the same physical file? > > thanks, > dan > > > -- > Daniel Roy > CSAIL/MIT > http://web.mit.edu/droy/www > (mobile) +1 617 872 3267 > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jensaxel at soegaard.net Fri Nov 21 14:02:16 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:33:54 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: Message-ID: <492705B8.4010502@soegaard.net> Daniel Roy skrev: > I have a question about using modules/units and physical code > organization. > > Simply put: can I split a single module across several files so its > easier to work with? > More details: We had been using the Pretty Big language and (load ...) > commands to piece together a number of files totaling roughly 14,000 > lines. I've recently moved the code into the modules framework (which > seems to be necessary in order to get debugging across multiple files > and other more advanced functionality to work in DrScheme). However, > in the process, I had to (naively) concatenate a number of files > together as they referenced each other. If they were separate > modules, they would have had cyclic dependencies. That said, they > aren't really cyclic -- they really are a single module. > Unfortunately it's also 6000 lines of code. Using (load ...) doesn't > work (at least my naive attempts at using load didn't work). > > Now, undoubtedly there is some re-factoring that could be done to > identify reusable and generic components that I could separate out as > other modules and reduce this file to a manageable size. But this is > a research project not a software development one and the form and > structure of the code is subject to radical changes. Can I get the > benefit of modules (better optimization? debugging? etc?) without > being forced to move dependent code into the same physical file? Yes, use include: http://docs.plt-scheme.org/reference/include.html#(form._((lib._scheme/include..ss)._include)) But most likely your files already contain closely related functions that ought to be in their own module (if nothing else, to make the code clearer). -- Jens Axel S?gaard From m.douglas.williams at gmail.com Fri Nov 21 14:05:17 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:33:55 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: Message-ID: I'm curious about what the pros answer this one. Faced with the same situation, I factored the code into manageable units and use the incude function. I don't think it's very elegant, but it works. Doug On Fri, Nov 21, 2008 at 11:42 AM, Daniel Roy wrote: > I have a question about using modules/units and physical code organization. > > Simply put: can I split a single module across several files so its easier > to work with? > > More details: We had been using the Pretty Big language and (load ...) > commands to piece together a number of files totaling roughly 14,000 lines. > I've recently moved the code into the modules framework (which seems to be > necessary in order to get debugging across multiple files and other more > advanced functionality to work in DrScheme). However, in the process, I had > to (naively) concatenate a number of files together as they referenced each > other. If they were separate modules, they would have had cyclic > dependencies. That said, they aren't really cyclic -- they really are a > single module. Unfortunately it's also 6000 lines of code. Using (load > ...) doesn't work (at least my naive attempts at using load didn't work). > > > Now, undoubtedly there is some re-factoring that could be done to identify > reusable and generic components that I could separate out as other modules > and reduce this file to a manageable size. But this is a research project > not a software development one and the form and structure of the code is > subject to radical changes. Can I get the benefit of modules (better > optimization? debugging? etc?) without being forced to move dependent code > into the same physical file? > > thanks, > dan > > > -- > Daniel Roy > CSAIL/MIT > http://web.mit.edu/droy/www > (mobile) +1 617 872 3267 > > _________________________________________________ > 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/20081121/d38836ca/attachment.htm From mflatt at cs.utah.edu Fri Nov 21 14:09:24 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:33:55 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: <932b2f1f0811211102u2507b9b1ye1088f1aedffc135@mail.gmail.com> References: <932b2f1f0811211102u2507b9b1ye1088f1aedffc135@mail.gmail.com> Message-ID: <20081121190924.BA3276500A3@mail-svr1.cs.utah.edu> At Fri, 21 Nov 2008 13:02:58 -0600, "Robby Findler" wrote: > You might try 'include' but compilation won't track dependencies for > those files `mzc' and `setup-plt' do track `include' dependencies. Matthew From matthias at ccs.neu.edu Fri Nov 21 14:12:49 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:55 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: Message-ID: <5F1F15C4-D9CD-4C58-9102-F60CD148FEF1@ccs.neu.edu> I urge you to break large modules into reasonably small modules and link them. You're better off that way, for designing, debugging, and maintenance. There is no hard limit of course but I tend to think of my modules as somewhere between 20 and 2000 lines, with the latter being on the very large side for me. -- Matthias On Nov 21, 2008, at 2:05 PM, Doug Williams wrote: > I'm curious about what the pros answer this one. Faced with the > same situation, I factored the code into manageable units and use > the incude function. I don't think it's very elegant, but it works. > > Doug > > On Fri, Nov 21, 2008 at 11:42 AM, Daniel Roy wrote: > I have a question about using modules/units and physical code > organization. > > Simply put: can I split a single module across several files so > its easier to work with? > > More details: We had been using the Pretty Big language and > (load ...) commands to piece together a number of files totaling > roughly 14,000 lines. I've recently moved the code into the > modules framework (which seems to be necessary in order to get > debugging across multiple files and other more advanced > functionality to work in DrScheme). However, in the process, I had > to (naively) concatenate a number of files together as they > referenced each other. If they were separate modules, they would > have had cyclic dependencies. That said, they aren't really cyclic > -- they really are a single module. Unfortunately it's also 6000 > lines of code. Using (load ...) doesn't work (at least my naive > attempts at using load didn't work). > > Now, undoubtedly there is some re-factoring that could be done to > identify reusable and generic components that I could separate out > as other modules and reduce this file to a manageable size. But > this is a research project not a software development one and the > form and structure of the code is subject to radical changes. Can > I get the benefit of modules (better optimization? debugging? etc?) > without being forced to move dependent code into the same physical > file? > > thanks, > dan > > > -- > Daniel Roy > CSAIL/MIT > http://web.mit.edu/droy/www > (mobile) +1 617 872 3267 > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at cs.uchicago.edu Fri Nov 21 14:26:09 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:55 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: <20081121190924.BA3276500A3@mail-svr1.cs.utah.edu> References: <932b2f1f0811211102u2507b9b1ye1088f1aedffc135@mail.gmail.com> <20081121190924.BA3276500A3@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0811211126w4efbb83arca6b1afb28877f45@mail.gmail.com> Oh! Sorry for the misinformation. Robby On Fri, Nov 21, 2008 at 1:09 PM, Matthew Flatt wrote: > At Fri, 21 Nov 2008 13:02:58 -0600, "Robby Findler" wrote: >> You might try 'include' but compilation won't track dependencies for >> those files > > `mzc' and `setup-plt' do track `include' dependencies. > > > Matthew > > > From gregory.woodhouse at gmail.com Fri Nov 21 14:42:33 2008 From: gregory.woodhouse at gmail.com (Woodhouse Gregory) Date: Thu Mar 26 02:33:56 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: <5F1F15C4-D9CD-4C58-9102-F60CD148FEF1@ccs.neu.edu> References: <5F1F15C4-D9CD-4C58-9102-F60CD148FEF1@ccs.neu.edu> Message-ID: It's not just size, either. Applications should be broken up into cohesive units (err.... modules). "Life can only be understood going backwards, but it must be lived going forwards." --S?ren Kierkegaard http://www.gwoodhouse.com http://GregWoodhouse.ImageKind.com On Nov 21, 2008, at 11:12 AM, Matthias Felleisen wrote: > > I urge you to break large modules into reasonably small modules and > link them. You're better off that way, for designing, debugging, > and maintenance. There is no hard limit of course but I tend to > think of my modules as somewhere between 20 and 2000 lines, with > the latter being on the very large side for me. > > -- Matthias > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081121/8add8151/attachment.html From grettke at acm.org Fri Nov 21 15:31:14 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:56 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> Message-ID: <756daca50811211231k7cbb1914icd7ac36681b24790@mail.gmail.com> On Fri, Nov 21, 2008 at 6:15 AM, Noel Welsh wrote: > Use structures and/or pattern matching (see match-lambda in > particular). Using lists as structures is, I think, quite bad > practice. You can get away with it for limited cases but it will bite > you in the arse if you change the data format. It is a worthwhile personal experiment to try using lists as data structures for a while, and it is true, eventually it will become terrible to maintain. Structure are the right way to go. From matthias at ccs.neu.edu Fri Nov 21 15:44:06 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:33:56 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: <756daca50811211231k7cbb1914icd7ac36681b24790@mail.gmail.com> References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> <756daca50811211231k7cbb1914icd7ac36681b24790@mail.gmail.com> Message-ID: Well this is where units shine. You can have one data structure implementation where define-struct is implemented via lists and another one where the same structure is a true struct. And you can relink the program to get lists for one purpose and structs for another. -- And you could do this in the same program, though you'd need a translator/adaptor unit to make them work together. -- Matthias On Nov 21, 2008, at 3:31 PM, Grant Rettke wrote: > On Fri, Nov 21, 2008 at 6:15 AM, Noel Welsh > wrote: >> Use structures and/or pattern matching (see match-lambda in >> particular). Using lists as structures is, I think, quite bad >> practice. You can get away with it for limited cases but it will >> bite >> you in the arse if you change the data format. > > It is a worthwhile personal experiment to try using lists as data > structures for a while, and it is true, eventually it will become > terrible to maintain. Structure are the right way to go. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From grettke at acm.org Fri Nov 21 16:40:35 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:33:56 2009 Subject: [plt-scheme] The Philosophy of DrScheme Message-ID: <756daca50811211340o2b50303ck6bec191de87338fd@mail.gmail.com> Hi folks, Last weekend I read about Emacs. I knew facts about it, but never before then never understood the philosophy behind it. The intention seems to be an extensible editor that you must customize. In particular, you do so by utilizing the interpreter on which it is built. This sort of helped me tie things together. I'm not sure why DrScheme is so under-appreciated. Perhaps people are not familiar. Is there some philosophy about how it works that users would find interesting? It would be too much work to document how the whole thing is implemented, but perhaps capturing the philosophy would be enough to get people more interested in writing tools and feature enhancements. Best wishes, Grant From rob.hunter at gmail.com Fri Nov 21 17:39:54 2008 From: rob.hunter at gmail.com (Rob Hunter) Date: Thu Mar 26 02:33:57 2009 Subject: [plt-scheme] contract questions--convention for "any" conflict and inline documentation Message-ID: I'm new to contracts, and had a couple of questions for the community: (1) If I try to do a simple (require scheme/contracts), I run up against a conflict with SRFI-1 "any" and the contract "any". I'm doing this right now, but was wondering if this was a common enough issue that a convention has been established: (rename-in scheme/contract (any c:any)) (2) I like the idea of using contracts as a way of augmenting the documentation of a function. My vision is to do use a convention like this for certain functions: ;; ;; my-great-fn ;; ;; squares any number you give it. ;; (provide/contract (my-great-fn (-> number? number?))) ;; (define (my-great-fn n) (* n n)) This is all well and good, except that I can no longer have my-great-fn in the (provide ...) form at the top of my module. I really like provide as an "always there" source of documenting what this module provides. So, I'm considering using the following "comment convention", but does anyone have a better idea? #lang scheme/base (require ...) (provide something something-else ;; provided with contracts: ;; my-great-fn ) ... impl ... Thanks! Rob From noelwelsh at gmail.com Fri Nov 21 17:43:39 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:57 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: Message-ID: On Fri, Nov 21, 2008 at 6:42 PM, Daniel Roy wrote: > Now, undoubtedly there is some re-factoring that could be done to identify > reusable and generic components that I could separate out as other modules > and reduce this file to a manageable size. But this is a research project > not a software development one All projects involve software engineering as they scale. You gotta pay off your entropy at some point, or it will overwhelm you. N. From noelwelsh at gmail.com Fri Nov 21 17:51:07 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:57 2009 Subject: [plt-scheme] contract questions--convention for "any" conflict and inline documentation In-Reply-To: References: Message-ID: On Fri, Nov 21, 2008 at 10:39 PM, Rob Hunter wrote: > I'm new to contracts, and had a couple of questions for the community: > > (1) If I try to do a simple (require scheme/contracts), I run up > against a conflict with SRFI-1 "any" and the contract "any". I'm > doing this right now, but was wondering if this was a common enough > issue that a convention has been established: > > (rename-in scheme/contract > (any c:any)) Yeah, this is a pain. By and large I've shifted to comprehensions and the PLT list library, so I don't run into it so often. When I do use SRFI 1 I typically require it using except-in any. > (2) I like the idea of using contracts as a way of augmenting the > documentation of a function. My vision is to do use a convention like > this for certain functions: ... > > This is all well and good, except that I can no longer have > my-great-fn in the (provide ...) form at the top of my module. I > really like provide as an "always there" source of documenting what > this module provides. So, I'm considering using the following > "comment convention", but does anyone have a better idea? I now put my provide forms at the bottom of modules, so they work consistently with contracts. You can bind a name to a contract, as a contract is just a value: (define my-fn-contract (-> number? number?)) (define (my-fn n) (* n n)) and at the bottom of the file: (provide/contract [my-fn my-fn-contract]) That's often too much work for me. N. From robby at cs.uchicago.edu Fri Nov 21 17:52:33 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:33:57 2009 Subject: [plt-scheme] contract questions--convention for "any" conflict and inline documentation In-Reply-To: References: Message-ID: <932b2f1f0811211452p341399c3t2567e5814dfe2834@mail.gmail.com> If things go well, I hope to be able to get rid of `any' from the contract library (by making all function contracts preserve tail recursion). Robby On Fri, Nov 21, 2008 at 4:51 PM, Noel Welsh wrote: > On Fri, Nov 21, 2008 at 10:39 PM, Rob Hunter wrote: >> I'm new to contracts, and had a couple of questions for the community: >> >> (1) If I try to do a simple (require scheme/contracts), I run up >> against a conflict with SRFI-1 "any" and the contract "any". I'm >> doing this right now, but was wondering if this was a common enough >> issue that a convention has been established: >> >> (rename-in scheme/contract >> (any c:any)) > > Yeah, this is a pain. By and large I've shifted to comprehensions and > the PLT list library, so I don't run into it so often. When I do use > SRFI 1 I typically require it using except-in any. > >> (2) I like the idea of using contracts as a way of augmenting the >> documentation of a function. My vision is to do use a convention like >> this for certain functions: > ... >> >> This is all well and good, except that I can no longer have >> my-great-fn in the (provide ...) form at the top of my module. I >> really like provide as an "always there" source of documenting what >> this module provides. So, I'm considering using the following >> "comment convention", but does anyone have a better idea? > > I now put my provide forms at the bottom of modules, so they work > consistently with contracts. You can bind a name to a contract, as a > contract is just a value: > > (define my-fn-contract (-> number? number?)) > (define (my-fn n) > (* n n)) > > and at the bottom of the file: > > (provide/contract > [my-fn my-fn-contract]) > > That's often too much work for me. > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From rob.hunter at gmail.com Fri Nov 21 17:56:35 2008 From: rob.hunter at gmail.com (Rob Hunter) Date: Thu Mar 26 02:33:57 2009 Subject: [plt-scheme] contract questions--convention for "any" conflict and inline documentation In-Reply-To: References: Message-ID: I like the name binding idea. Thanks, Rob On Fri, Nov 21, 2008 at 2:51 PM, Noel Welsh wrote: > On Fri, Nov 21, 2008 at 10:39 PM, Rob Hunter wrote: >> I'm new to contracts, and had a couple of questions for the community: >> >> (1) If I try to do a simple (require scheme/contracts), I run up >> against a conflict with SRFI-1 "any" and the contract "any". I'm >> doing this right now, but was wondering if this was a common enough >> issue that a convention has been established: >> >> (rename-in scheme/contract >> (any c:any)) > > Yeah, this is a pain. By and large I've shifted to comprehensions and > the PLT list library, so I don't run into it so often. When I do use > SRFI 1 I typically require it using except-in any. > >> (2) I like the idea of using contracts as a way of augmenting the >> documentation of a function. My vision is to do use a convention like >> this for certain functions: > ... >> >> This is all well and good, except that I can no longer have >> my-great-fn in the (provide ...) form at the top of my module. I >> really like provide as an "always there" source of documenting what >> this module provides. So, I'm considering using the following >> "comment convention", but does anyone have a better idea? > > I now put my provide forms at the bottom of modules, so they work > consistently with contracts. You can bind a name to a contract, as a > contract is just a value: > > (define my-fn-contract (-> number? number?)) > (define (my-fn n) > (* n n)) > > and at the bottom of the file: > > (provide/contract > [my-fn my-fn-contract]) > > That's often too much work for me. > > N. > From clements at brinckerhoff.org Fri Nov 21 18:05:31 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:33:58 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: <5F1F15C4-D9CD-4C58-9102-F60CD148FEF1@ccs.neu.edu> Message-ID: On Nov 21, 2008, at 11:42 AM, Woodhouse Gregory wrote: > It's not just size, either. Applications should be broken up into > cohesive units (err.... modules). Okay, but no one's addressing his circular dependency question. I'm by no means the voice of authority here, but there are at least two solutions to the circular dependency problem: 1) Units (search help desk), and 2) faking it using mutation. 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/20081121/9e982168/smime.bin From plragde at uwaterloo.ca Fri Nov 21 18:16:24 2008 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:33:58 2009 Subject: [plt-scheme] The Philosophy of DrScheme In-Reply-To: <756daca50811211340o2b50303ck6bec191de87338fd@mail.gmail.com> Message-ID: <49274148.4090700@uwaterloo.ca> Grant wrote: > I'm not sure why DrScheme is so under-appreciated. Perhaps people are > not familiar. Is there some philosophy about how it works that users > would find interesting? You know the saying about how the measure of a society is how it treats its weakest members? (It seems to have been said by just about everybody, so you've probably heard it, maybe even said it yourself.) To this external observer, it appears that the philosophy behind DrScheme is to focus on how it treats its weakest users... while not neglecting its strongest users. This is pretty rare among software developers, if you ask me. And at least part of the disdain some feel for DrScheme is related to it not pandering excessively to the strong to the extent of driving away the weak. --PR From noelwelsh at gmail.com Fri Nov 21 18:18:23 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:33:58 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: <5F1F15C4-D9CD-4C58-9102-F60CD148FEF1@ccs.neu.edu> Message-ID: On Fri, Nov 21, 2008 at 11:05 PM, John Clements wrote: > > Okay, but no one's addressing his circular dependency question. > > I'm by no means the voice of authority here, but there are at least two > solutions to the circular dependency problem: > 1) Units (search help desk), and > 2) faking it using mutation. 3) classes/objects The new unit system is fairly easy to use. N. From cce at ccs.neu.edu Fri Nov 21 18:38:50 2008 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:33:58 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: <5F1F15C4-D9CD-4C58-9102-F60CD148FEF1@ccs.neu.edu> Message-ID: <990e0c030811211538s4b1e356cl6ca3eb1f6fe33c46@mail.gmail.com> On Fri, Nov 21, 2008 at 6:05 PM, John Clements wrote: > > On Nov 21, 2008, at 11:42 AM, Woodhouse Gregory wrote: > >> It's not just size, either. Applications should be broken up into cohesive >> units (err.... modules). > > Okay, but no one's addressing his circular dependency question. > > I'm by no means the voice of authority here, but there are at least two > solutions to the circular dependency problem: > 1) Units (search help desk), and > 2) faking it using mutation. > > John Clements In 6,000 lines, I'd bet there's also some non-recursive modules that can be factored out first before even tackling the circularity issue. It may be possible to sidestep that problem and still reduce overall file size. -- Carl Eastlund From spdegabrielle at gmail.com Fri Nov 21 19:38:19 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:33:59 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> <756daca50811211231k7cbb1914icd7ac36681b24790@mail.gmail.com> Message-ID: <595b9ab20811211638k3f2934e5yc75b92f93fbebe5f@mail.gmail.com> Thank you all, I think I need to go read some code - the webserver is probably a good choice as it seems to be getting a lot of use lately. I'd also appreciate [code reading] suggestions if anyone would care to make any. s On Fri, Nov 21, 2008 at 8:44 PM, Matthias Felleisen wrote: > > Well this is where units shine. You can have one data structure > implementation where define-struct is implemented via lists and another one > where the same structure is a true struct. And you can relink the program to > get lists for one purpose and structs for another. -- And you could do this > in the same program, though you'd need a translator/adaptor unit to make > them work together. > > -- Matthias > > > > > > > On Nov 21, 2008, at 3:31 PM, Grant Rettke wrote: > > On Fri, Nov 21, 2008 at 6:15 AM, Noel Welsh wrote: >> >>> Use structures and/or pattern matching (see match-lambda in >>> particular). Using lists as structures is, I think, quite bad >>> practice. You can get away with it for limited cases but it will bite >>> you in the arse if you change the data format. >>> >> >> It is a worthwhile personal experiment to try using lists as data >> structures for a while, and it is true, eventually it will become >> terrible to maintain. Structure are the right way to go. >> _________________________________________________ >> 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 > -- 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/20081122/70eef86b/attachment.html From lunarc.lists at gmail.com Fri Nov 21 21:52:56 2008 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:33:59 2009 Subject: [plt-scheme] a single module split across several files In-Reply-To: References: <5F1F15C4-D9CD-4C58-9102-F60CD148FEF1@ccs.neu.edu> Message-ID: 2008/11/21 Noel Welsh : > On Fri, Nov 21, 2008 at 11:05 PM, John Clements > wrote: >> >> Okay, but no one's addressing his circular dependency question. >> >> I'm by no means the voice of authority here, but there are at least two >> solutions to the circular dependency problem: >> 1) Units (search help desk), and >> 2) faking it using mutation. > 3) classes/objects 4) dynamic-require as long as you are careful and don't do it at the top-level Henk From hendrik at topoi.pooq.com Sat Nov 22 16:17:03 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:33:59 2009 Subject: [plt-scheme] Nokia N800 In-Reply-To: <595b9ab20811210554i33e2e54fjd35a9ad1c23e83d0@mail.gmail.com> References: <20081120205609.GD12664@topoi.pooq.com> <595b9ab20811192358u76fd8774s2a16b5abb505ec28@mail.gmail.com> <20081121072458.GA16049@topoi.pooq.com> <595b9ab20811210554i33e2e54fjd35a9ad1c23e83d0@mail.gmail.com> Message-ID: <20081122211703.GA27342@topoi.pooq.com> On Fri, Nov 21, 2008 at 01:54:58PM +0000, Stephen De Gabrielle wrote: > I don't really know.... > > On Fri, Nov 21, 2008 at 7:24 AM, wrote: > > > On Thu, Nov 20, 2008 at 07:58:08AM +0000, Stephen De Gabrielle wrote: > > > I once built mzscheme for the 770. I don't think drscheme will fit/run. > > > > Does that mean mzscheme programs would probably run, but that you'd be > > better off developing them elsewhere? Would programs that actually need > > yes > > > > Would programs that actually need > > a windows-and-stylus interface be hopeless to use? > > Other people have ported stuff - but I understand their are significant > differences in interacting that you have to cope with > I don't know if you could port mred (the GUI libraries) > > Or does the bulk of > > drscheme lie elsewhere? > > > I don't know what that means. I'm asking whether it's the user-interface libraries and their run-time storage that makes drscheme awkward to fit in the 256meg, or whether it's other stuff, like all the programming tools you get with it. If the user-interface libraries and their dynamic data structures fit nicely, then it could be practical to use them. Otherwise, not. -- hendrik From spdegabrielle at gmail.com Sat Nov 22 09:27:50 2008 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:34:00 2009 Subject: [plt-scheme] Nokia N800 In-Reply-To: <20081122211703.GA27342@topoi.pooq.com> References: <20081120205609.GD12664@topoi.pooq.com> <595b9ab20811192358u76fd8774s2a16b5abb505ec28@mail.gmail.com> <20081121072458.GA16049@topoi.pooq.com> <595b9ab20811210554i33e2e54fjd35a9ad1c23e83d0@mail.gmail.com> <20081122211703.GA27342@topoi.pooq.com> Message-ID: <595b9ab20811220627l74e4cc5ex249f56a01b1fc8f3@mail.gmail.com> > > I'm asking whether it's the user-interface libraries and their > run-time storage that makes drscheme awkward to fit in the 256meg, or > whether it's other stuff, like all the programming tools you get with > it. > Sorry, I don't know. A related effort was made to put DrScheme on an olpc xo-1 - that worked for drscheme 372. but not 4.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081122/85173956/attachment.htm From etanter at dcc.uchile.cl Sat Nov 22 10:53:57 2008 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Thu Mar 26 02:34:00 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: References: <20081121154751.6FA256500AE@mail-svr1.cs.utah.edu> Message-ID: <9F7C9B76-54B3-4FF2-A1D8-39A4BE1B042A@dcc.uchile.cl> I'm glad this issue of module vs. unit pops up again, because I'm still not sure about when to use what. From the different responses here, I gather that if there is some syntactic extensions involved, modules are the way to go (at least for now). Is this right? In a problem I exposed on the list some months ago, I had problems with modules which were unrelated to needing syntactic extensions. It also did not have to do with extreme separation of interface/ implementation that Matthew is refering to. To recall, I just wanted to structure plain code nicer in order to be able to use the IDE tools (like module browser and multi-file debugging). But I ran into the limitation of not being able to define mutually recursive modules. Some people then suggested basically bootstrapping the recursion by hand (with explicit side effects), which I must say, although it works, seems rather dirty/ad-hoc to me. I also played with dynamic-require but then the debugging looped for ever or did not work. So I'm still puzzled about whether I should go for unit or keep to modules. As of now, since time was pressing (deadline), I finally just stayed with a plain multi-file/load configuration -- with poor IDE support. Thanks for helping! -- ?ric On Nov 21, 2008, at 12:53 , Matthias Felleisen wrote: > > P.S. One other point to note is that people often ask for contracts > for unit boundaries because the module boundaries come with it. > Stevie Strickland has just started working on the proper integration > of units and contracts, as a step toward typed units. -- Matthias > > > > On Nov 21, 2008, at 10:47 AM, Matthew Flatt wrote: > >> At Thu, 20 Nov 2008 20:57:51 -0500, "Ittai Balaban" wrote: >>> In many respects (syntax bindings not included), units provide a >>> much >>> richer framework than modules - the latter cannot be assembled >>> compositionally, prohibit cyclic dependencies, and do not allow >>> multiple >>> instantiations. Thus, my question is, since you make such a >>> convincing >>> case for units in the '99 paper, why did PLT find it necessary to >>> introduce a new abstraction in the form of modules? Did you run >>> into some >>> intrinsic limitations of units? >> >> The continuation of that work is Scott Owens's dissertation >> >> http://www.cs.utah.edu/plt/publications/owens-phd.pdf >> >> and related papers >> >> From Structures and Functors to Modules and Units >> ICFP 2006 Owens and Flatt >> http://www.cs.utah.edu/plt/publications/icfp06-of.pdf >> >> >> Syntactic Abstraction in Component Interfaces >> GPCE 2005 Culpepper, Owens, and Flatt. >> http://www.cs.utah.edu/plt/publications/gpce05-cof.pdf >> >> about the interplay of modules and units. >> >> >> As you and others noted, we introduced `module' to deal with >> syntactic >> extension. Another explanation is that you need some sort of module >> system to host a unit system: to create a unit that uses AN >> implementation of an interface, you need some way to refer to THE >> specification of the interface, as well as a way to refer to specific >> implementations to link them together. >> >> At the same time, the module system is weaker than a unit system for >> composing systems, and we really should be putting our libraries into >> units (i.e., I still believe most of the original `unit' motivation). >> The reason we don't, though, is the same reason that ML programmers >> don't write "fully functorized" code: it's a bit of a pain to split >> implementation from interface and to explicitly link implementations, >> and the resulting extra flexibility is needed so rarely that the pain >> doesn't seem worthwhile --- unless we really need the flexibility, in >> which case we do use units. >> >> We've attacked the "bit of a pain" problem using syntactic extension. >> With `#lang unit' and `define-compound-unit/infer', we've removed >> some >> tedious syntax and bookkeeping for using units. It will take more >> work >> in that direction, though, to make it as easy as throwing a module >> together. Possibly we just need to be more disciplined. Also, it >> would >> take more compiler work to get back the current level of performance >> for cross-module calls (e.g., if `+' were imported through a unit, >> then >> "just in time" would have to be later than it is currently). >> >> >> Matthew >> >> _________________________________________________ >> 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 Sat Nov 22 11:28:14 2008 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:34:01 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: <9F7C9B76-54B3-4FF2-A1D8-39A4BE1B042A@dcc.uchile.cl> References: <20081121154751.6FA256500AE@mail-svr1.cs.utah.edu> <9F7C9B76-54B3-4FF2-A1D8-39A4BE1B042A@dcc.uchile.cl> Message-ID: <11b141710811220828n723d1b8bib2ef6c75e5af63ac@mail.gmail.com> On Sat, Nov 22, 2008 at 3:53 PM, Eric Tanter wrote: > I'm glad this issue of module vs. unit pops up again, because I'm still not > sure about when to use what. > Maybe this is a too simplistic approach but I always use modules even if just to wrap units. I only used units once when I needed runtime pluggable components. I.e., like modules that I can load during runtime and connected them in my program extending its set of features. Would be units useful for anything else but this? I don't know... -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From clements at brinckerhoff.org Sat Nov 22 11:30:11 2008 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:34:01 2009 Subject: [plt-scheme] SchemeUnit 3: many thanks Message-ID: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> While I'm thinking of it: I cannot begin to tell you how much *more* likely I am to use schemeunit now that I can just write (check-equal? (+ 7 7) 14) Thanks to everyone that made this possible, both the implementors and the complainers :). 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/20081122/b24ed2e2/smime.bin From dherman at ccs.neu.edu Sat Nov 22 14:39:02 2008 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:34:01 2009 Subject: [plt-scheme] patch to suppress "missing out.sxref" warning Message-ID: <49285FD6.6030507@ccs.neu.edu> Attached is the smallest patch required to fix the annoying popup window that says WARNING: open-input-file: cannot open input file: "C:\Documents and Settings\dherman\Application Data\PLT Scheme\planet\300\4.1.3.1\cache\dherman\test.plt\2\0\doc\test\out.sxref" (The system cannot find the path specified.; errno=3) in various places in the PLT toolchain, including the first time you run Check Syntax in DrScheme. I don't know what out.sxref is, nor why it exists for handin-server on some people's computers but not others. But this patch at least causes it not to complain about it. The relevant file is $PLTHOME/collects/setup/xref.ss. Dave -------------- next part -------------- --- xref.ss.old 2008-11-22 14:33:07.951760400 -0500 +++ xref.ss.new 2008-11-22 14:32:40.873635400 -0500 @@ -23,8 +23,9 @@ (path-replace-suffix (file-name-from-path (car d)) #"")))]) (and (not (and (len . >= . 3) (memq 'omit (caddr d)))) - (let ([d (doc-path dir name flags 'false-if-missing)]) - (and d (build-path d "out.sxref"))))))) + (let* ([d (doc-path dir name flags 'false-if-missing)] + [p (and d (build-path d "out.sxref"))]) + (and p (file-exists? p) p)))))) (define (get-reader-thunks) (map (lambda (dest) From workmin at ccs.neu.edu Sat Nov 22 16:10:43 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:34:01 2009 Subject: [plt-scheme] vi mode and editor questions Message-ID: <49287553.30404@ccs.neu.edu> I have just put a vi-mode drscheme interface package on planet: http://planet.plt-scheme.org/display.ss?package=vi.plt&owner=kazzmir It doesn't do too much yet but it does have some basic commands. The only way to disable it is to uninstall it or hack the source, so be careful if you install it. I have a few questions about extending drscheme related to this: 1. I overrode the on-char and on-default-char methods of the editor. Is that too low level? 2. I would like to capture the control key for ctrl-d and whatnot but most ctrl-# key bindings do something in drscheme and when ctrl-# keys that aren't bound in drscheme don't seem to make their way to my editor. 3. How can I display stuff on the bottom border of drscheme? The same border that has the line:column information on it. 4. How do I add a menu item? I want something like Vi -> Enable / Disable. From robby at cs.uchicago.edu Sat Nov 22 16:36:33 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:02 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <49287553.30404@ccs.neu.edu> References: <49287553.30404@ccs.neu.edu> Message-ID: <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> On Sat, Nov 22, 2008 at 3:10 PM, Jon Rafkind wrote: > I have just put a vi-mode drscheme interface package on planet: > http://planet.plt-scheme.org/display.ss?package=vi.plt&owner=kazzmir > > It doesn't do too much yet but it does have some basic commands. The only > way to disable it is to uninstall it or hack the source, so be careful if > you install it. > > I have a few questions about extending drscheme related to this: > 1. I overrode the on-char and on-default-char methods of the editor. Is that > too low level? It is low-level, but for a vi mode, it might just be the right place. Probably you only need one or the other, tho. > 2. I would like to capture the control key for ctrl-d and whatnot but most > ctrl-# key bindings do something in drscheme and when ctrl-# keys that > aren't bound in drscheme don't seem to make their way to my editor. You should be able to catch them in on-char, if not on-default-char. > 3. How can I display stuff on the bottom border of drscheme? The same border > that has the line:column information on it. I think you want to look at frame:info-mixin and frame:info<%> in the framework. > 4. How do I add a menu item? I want something like Vi -> Enable / Disable. See menu% and frame% and menu-bar% etc. But maybe that belongs in the edit menu? In that case, see frame:standard-menus. Robby From workmin at ccs.neu.edu Sat Nov 22 17:04:22 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:34:02 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> Message-ID: <492881E6.1070405@ccs.neu.edu> > >> 2. I would like to capture the control key for ctrl-d and whatnot but most >> ctrl-# key bindings do something in drscheme and when ctrl-# keys that >> aren't bound in drscheme don't seem to make their way to my editor. >> > > You should be able to catch them in on-char, if not on-default-char. > > That doesn't seem to be the case. I am on Ubuntu. (define/override (on-char evt) (printf "Control ~a char ~a\n" (send evt get-control-down) (send evt get-key-code))) If I press the control key I see Control #f char control Then with (define/override (on-default-char evt) (send (car modes) do-char evt)) Where do-char does the same printing as on-char I don't get any control key events. Further more if I press ctrl-s the save box comes up but for vi mode I would like to disable things like this. From matthias at ccs.neu.edu Sat Nov 22 17:22:59 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:34:02 2009 Subject: [plt-scheme] Why Modules? In-Reply-To: <9F7C9B76-54B3-4FF2-A1D8-39A4BE1B042A@dcc.uchile.cl> References: <20081121154751.6FA256500AE@mail-svr1.cs.utah.edu> <9F7C9B76-54B3-4FF2-A1D8-39A4BE1B042A@dcc.uchile.cl> Message-ID: <8E416EEE-7280-4E62-B431-C23F88A4FF45@ccs.neu.edu> Always use modules. If you also need mutual recursion, use units too -- Matthias On Nov 22, 2008, at 10:53 AM, Eric Tanter wrote: > I'm glad this issue of module vs. unit pops up again, because I'm > still not sure about when to use what. > > From the different responses here, I gather that if there is some > syntactic extensions involved, modules are the way to go (at least > for now). Is this right? > > In a problem I exposed on the list some months ago, I had problems > with modules which were unrelated to needing syntactic extensions. > It also did not have to do with extreme separation of interface/ > implementation that Matthew is refering to. > > To recall, I just wanted to structure plain code nicer in order to > be able to use the IDE tools (like module browser and multi-file > debugging). But I ran into the limitation of not being able to > define mutually recursive modules. Some people then suggested > basically bootstrapping the recursion by hand (with explicit side > effects), which I must say, although it works, seems rather dirty/ > ad-hoc to me. I also played with dynamic-require but then the > debugging looped for ever or did not work. > > So I'm still puzzled about whether I should go for unit or keep to > modules. As of now, since time was pressing (deadline), I finally > just stayed with a plain multi-file/load configuration -- with poor > IDE support. > > Thanks for helping! > > -- ?ric > > > On Nov 21, 2008, at 12:53 , Matthias Felleisen wrote: > >> >> P.S. One other point to note is that people often ask for contracts >> for unit boundaries because the module boundaries come with it. >> Stevie Strickland has just started working on the proper integration >> of units and contracts, as a step toward typed units. -- Matthias >> >> >> >> On Nov 21, 2008, at 10:47 AM, Matthew Flatt wrote: >> >>> At Thu, 20 Nov 2008 20:57:51 -0500, "Ittai Balaban" wrote: >>>> In many respects (syntax bindings not included), units provide a >>>> much >>>> richer framework than modules - the latter cannot be assembled >>>> compositionally, prohibit cyclic dependencies, and do not allow >>>> multiple >>>> instantiations. Thus, my question is, since you make such a >>>> convincing >>>> case for units in the '99 paper, why did PLT find it necessary to >>>> introduce a new abstraction in the form of modules? Did you run >>>> into some >>>> intrinsic limitations of units? >>> >>> The continuation of that work is Scott Owens's dissertation >>> >>> http://www.cs.utah.edu/plt/publications/owens-phd.pdf >>> >>> and related papers >>> >>> From Structures and Functors to Modules and Units >>> ICFP 2006 Owens and Flatt >>> http://www.cs.utah.edu/plt/publications/icfp06-of.pdf >>> >>> >>> Syntactic Abstraction in Component Interfaces >>> GPCE 2005 Culpepper, Owens, and Flatt. >>> http://www.cs.utah.edu/plt/publications/gpce05-cof.pdf >>> >>> about the interplay of modules and units. >>> >>> >>> As you and others noted, we introduced `module' to deal with >>> syntactic >>> extension. Another explanation is that you need some sort of module >>> system to host a unit system: to create a unit that uses AN >>> implementation of an interface, you need some way to refer to THE >>> specification of the interface, as well as a way to refer to >>> specific >>> implementations to link them together. >>> >>> At the same time, the module system is weaker than a unit system for >>> composing systems, and we really should be putting our libraries >>> into >>> units (i.e., I still believe most of the original `unit' >>> motivation). >>> The reason we don't, though, is the same reason that ML programmers >>> don't write "fully functorized" code: it's a bit of a pain to split >>> implementation from interface and to explicitly link >>> implementations, >>> and the resulting extra flexibility is needed so rarely that the >>> pain >>> doesn't seem worthwhile --- unless we really need the >>> flexibility, in >>> which case we do use units. >>> >>> We've attacked the "bit of a pain" problem using syntactic >>> extension. >>> With `#lang unit' and `define-compound-unit/infer', we've removed >>> some >>> tedious syntax and bookkeeping for using units. It will take more >>> work >>> in that direction, though, to make it as easy as throwing a module >>> together. Possibly we just need to be more disciplined. Also, it >>> would >>> take more compiler work to get back the current level of performance >>> for cross-module calls (e.g., if `+' were imported through a >>> unit, then >>> "just in time" would have to be later than it is currently). >>> >>> >>> Matthew >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at cs.uchicago.edu Sat Nov 22 17:25:21 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:02 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <492881E6.1070405@ccs.neu.edu> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> Message-ID: <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> On Sat, Nov 22, 2008 at 4:04 PM, Jon Rafkind wrote: > >> >>> >>> 2. I would like to capture the control key for ctrl-d and whatnot but >>> most >>> ctrl-# key bindings do something in drscheme and when ctrl-# keys that >>> aren't bound in drscheme don't seem to make their way to my editor. >>> >> >> You should be able to catch them in on-char, if not on-default-char. >> >> > > That doesn't seem to be the case. I am on Ubuntu. > (define/override (on-char evt) > (printf "Control ~a char ~a\n" (send evt get-control-down) > (send evt get-key-code))) > > If I press the control key I see > > Control #f char control > > Then with > (define/override (on-default-char evt) > (send (car modes) do-char evt)) > > Where do-char does the same printing as on-char I don't get any control key > events. Further more if I press ctrl-s the save box comes up but for vi mode > I would like to disable things like this. I'm sorry -- that sounds like you do get the key events in on-char (and not in on-default-char). What did you want to happen? Robby From workmin at ccs.neu.edu Sat Nov 22 17:32:05 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:34:02 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> Message-ID: <49288865.7070708@ccs.neu.edu> Robby Findler wrote: > On Sat, Nov 22, 2008 at 4:04 PM, Jon Rafkind wrote: > >>>> 2. I would like to capture the control key for ctrl-d and whatnot but >>>> most >>>> ctrl-# key bindings do something in drscheme and when ctrl-# keys that >>>> aren't bound in drscheme don't seem to make their way to my editor. >>>> >>>> >>> You should be able to catch them in on-char, if not on-default-char. >>> >>> >>> >> That doesn't seem to be the case. I am on Ubuntu. >> (define/override (on-char evt) >> (printf "Control ~a char ~a\n" (send evt get-control-down) >> (send evt get-key-code))) >> >> If I press the control key I see >> >> Control #f char control >> >> Then with >> (define/override (on-default-char evt) >> (send (car modes) do-char evt)) >> >> Where do-char does the same printing as on-char I don't get any control key >> events. Further more if I press ctrl-s the save box comes up but for vi mode >> I would like to disable things like this. >> > > I'm sorry -- that sounds like you do get the key events in on-char > (and not in on-default-char). What did you want to happen? > > Oh yea, sorry. So when I press control I get an event that has the key code as 'control'. But shouldn't the get-control-down be #t in this case? What I want is to be able to press ctrl-d and have (get-control-down) be #t and (get-key-code) be #\d. From robby at cs.uchicago.edu Sat Nov 22 19:40:36 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:02 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <49288865.7070708@ccs.neu.edu> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> Message-ID: <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> On Sat, Nov 22, 2008 at 4:32 PM, Jon Rafkind wrote: > Oh yea, sorry. So when I press control I get an event that has the key code > as 'control'. But shouldn't the get-control-down be #t in this case? What I > want is to be able to press ctrl-d and have (get-control-down) be #t and > (get-key-code) be #\d. When I do the experiment myself (code below) I get what you seem to want. I'm on a mac tho, and I don't have a linux machine handy to test. So, I'm not sure what the right answer is. Matthew would probably know better, but maybe a first step is for you to try the below. Robby #lang scheme/gui (define t% (class text% (define/override (on-char evt) (printf "key-code ~s control ~s\n" (send evt get-key-code) (send evt get-control-down)) (super on-char evt)) (super-new))) (define f (new frame% [label ""] [width 200] [height 200])) (define t (new t%)) (define ec (new editor-canvas% [parent f] [editor t])) (send ec focus) (send f show #t) From workmin at ccs.neu.edu Sat Nov 22 20:04:23 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:34:03 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> Message-ID: <4928AC17.6040209@ccs.neu.edu> Robby Findler wrote: > On Sat, Nov 22, 2008 at 4:32 PM, Jon Rafkind wrote: > >> Oh yea, sorry. So when I press control I get an event that has the key code >> as 'control'. But shouldn't the get-control-down be #t in this case? What I >> want is to be able to press ctrl-d and have (get-control-down) be #t and >> (get-key-code) be #\d. >> > > When I do the experiment myself (code below) I get what you seem to > want. I'm on a mac tho, and I don't have a linux machine handy to > test. So, I'm not sure what the right answer is. Matthew would > probably know better, but maybe a first step is for you to try the > below. > > Robby > > #lang scheme/gui > > (define t% > (class text% > (define/override (on-char evt) > (printf "key-code ~s control ~s\n" > (send evt get-key-code) > (send evt get-control-down)) > (super on-char evt)) > (super-new))) > > (define f (new frame% [label ""] [width 200] [height 200])) > (define t (new t%)) > (define ec (new editor-canvas% [parent f] [editor t])) > (send ec focus) > (send f show #t) > > That seems to work. When I press ctrl-b I get key-code control control #f key-code #\b control #t key-code release control #t I don't see the difference between my code and yours except that I'm using whatever editor the definitions window uses. Does it handle key codes specially? If I hold down 'b' I see my code print 'key code #\b control #f' and then if I press control while still holding b, the b repeat stops and it says 'key code control control #f'. From robby at cs.uchicago.edu Sat Nov 22 21:17:23 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:03 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <4928AC17.6040209@ccs.neu.edu> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> Message-ID: <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> On Sat, Nov 22, 2008 at 7:04 PM, Jon Rafkind wrote: > I don't see the difference between my code and yours except that I'm using > whatever editor the definitions window uses. I made a little tool (code below; I added a planet link and an info.ss file so drscheme would find the tool), and I still see the same (ie, good) behavior. Robby #lang scheme/gui (require drscheme/tool) (provide tool@) (define tool@ (unit (import drscheme:tool^) (export drscheme:tool-exports^) (define phase1 void) (define phase2 void) (drscheme:get/extend:extend-definitions-text (? (t%) (class t% (define/override (on-char evt) (printf "key-code ~s control ~s\n" (send evt get-key-code) (send evt get-control-down)) (super on-char evt)) (super-new)))))) From workmin at ccs.neu.edu Sat Nov 22 22:08:17 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:34:03 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> Message-ID: <4928C921.7060908@ccs.neu.edu> Robby Findler wrote: > On Sat, Nov 22, 2008 at 7:04 PM, Jon Rafkind wrote: > >> I don't see the difference between my code and yours except that I'm using >> whatever editor the definitions window uses. >> > > I made a little tool (code below; I added a planet link and an info.ss > file so drscheme would find the tool), and I still see the same (ie, > good) behavior. > > Robby > > #lang scheme/gui > (require drscheme/tool) > > (provide tool@) > (define tool@ > (unit > (import drscheme:tool^) > (export drscheme:tool-exports^) > > (define phase1 void) > (define phase2 void) > > (drscheme:get/extend:extend-definitions-text > (? (t%) > (class t% > (define/override (on-char evt) > (printf "key-code ~s control ~s\n" > (send evt get-key-code) > (send evt get-control-down)) > (super on-char evt)) > (super-new)))))) > I just did an svn update to 4.1.3.1 (before I was using 4.1.2.2) and I have nothing in planet except for a link to the code above. I see the behavior from before where ctrl-b does not register. I tried this on my other desktop machine which also runs linux+x11 and drscheme 4.1.3.1 with the same behavior. From diggerrrrr at gmail.com Sun Nov 23 02:44:25 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:34:03 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <4928C921.7060908@ccs.neu.edu> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> <4928C921.7060908@ccs.neu.edu> Message-ID: Hello, Correct me if i am wrong , but this is my understanding : If you override default on-char in editor-canvas% and not pass the event to text% then it will not receive the event. In any case text% is derived from object% and any key event has to be passed to it explicitly to it, which is what is done by default on-char method of editor-canvas%. Key handling Code: (define (do-char who event) (printf "~s : Control? ~a key? ~a\n" who (send event get-control-down) (send event get-key-code))) (define frame (new frame% [label "Key Processing"] [width 300] [height 300])) (define ed% (class editor-canvas% (super-new) (define/override (on-char event) (do-char "ed%:on-char :" event) (send (send this get-editor) on-char event)) (define/override (on-subwindow-char receiver event) (do-char "ed%:on-subwindow-char :" event) #f))) (define my-text% (class text% (super-new) (define/override (on-default-char event) (do-char "my-text%" event)))) (define text-object (new my-text%)) (define my-ed (new ed% [parent frame] [editor text-object])) (send frame show #t) On Sun, Nov 23, 2008 at 8:38 AM, Jon Rafkind wrote: > Robby Findler wrote: >> >> On Sat, Nov 22, 2008 at 7:04 PM, Jon Rafkind wrote: >> >>> >>> I don't see the difference between my code and yours except that I'm >>> using >>> whatever editor the definitions window uses. >>> >> >> I made a little tool (code below; I added a planet link and an info.ss >> file so drscheme would find the tool), and I still see the same (ie, >> good) behavior. >> >> Robby >> >> #lang scheme/gui >> (require drscheme/tool) >> >> (provide tool@) >> (define tool@ >> (unit >> (import drscheme:tool^) >> (export drscheme:tool-exports^) >> >> (define phase1 void) >> (define phase2 void) >> >> (drscheme:get/extend:extend-definitions-text >> (? (t%) >> (class t% >> (define/override (on-char evt) >> (printf "key-code ~s control ~s\n" >> (send evt get-key-code) >> (send evt get-control-down)) >> (super on-char evt)) >> (super-new)))))) >> > > I just did an svn update to 4.1.3.1 (before I was using 4.1.2.2) and I have > nothing in planet except for a link to the code above. I see the behavior > from before where ctrl-b does not register. > > I tried this on my other desktop machine which also runs linux+x11 and > drscheme 4.1.3.1 with the same behavior. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From workmin at ccs.neu.edu Sun Nov 23 02:56:21 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:34:03 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221336y27f39a16u458b633a6456bdf7@mail.gmail.com> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> <4928C921.7060908@ccs.neu.edu> Message-ID: <49290CA5.6070208@ccs.neu.edu> Veer wrote: > Hello, > > Correct me if i am wrong , but this is my understanding : > > If you override default on-char in editor-canvas% and not pass the > event to text% then it > will not receive the event. In any case text% is derived from object% > and any key > event has to be passed to it explicitly to it, which is what is done > by default on-char > method of editor-canvas%. > > The issue is not that the text% object receives the on-char, but that in the editor-canvas's on-char I don't get key events with (get-control-down) as #t and (get-key-code) as some character. It only seems to not work on X11. > Key handling Code: > > (define (do-char who event) > (printf > "~s : Control? ~a key? ~a\n" > who (send event get-control-down) > (send event get-key-code))) > > (define frame > (new frame% > [label "Key Processing"] > [width 300] [height 300])) > > (define ed% > (class editor-canvas% > (super-new) > > (define/override (on-char event) > (do-char "ed%:on-char :" event) > (send (send this get-editor) on-char event)) > > (define/override (on-subwindow-char receiver event) > (do-char "ed%:on-subwindow-char :" event) > #f))) > > (define my-text% > (class text% > (super-new) > (define/override (on-default-char event) > (do-char "my-text%" event)))) > > (define text-object (new my-text%)) > (define my-ed (new ed% [parent frame] [editor text-object])) > (send frame show #t) > > > > > On Sun, Nov 23, 2008 at 8:38 AM, Jon Rafkind wrote: > >> Robby Findler wrote: >> >>> On Sat, Nov 22, 2008 at 7:04 PM, Jon Rafkind wrote: >>> >>> >>>> I don't see the difference between my code and yours except that I'm >>>> using >>>> whatever editor the definitions window uses. >>>> >>>> >>> I made a little tool (code below; I added a planet link and an info.ss >>> file so drscheme would find the tool), and I still see the same (ie, >>> good) behavior. >>> >>> Robby >>> >>> #lang scheme/gui >>> (require drscheme/tool) >>> >>> (provide tool@) >>> (define tool@ >>> (unit >>> (import drscheme:tool^) >>> (export drscheme:tool-exports^) >>> >>> (define phase1 void) >>> (define phase2 void) >>> >>> (drscheme:get/extend:extend-definitions-text >>> (? (t%) >>> (class t% >>> (define/override (on-char evt) >>> (printf "key-code ~s control ~s\n" >>> (send evt get-key-code) >>> (send evt get-control-down)) >>> (super on-char evt)) >>> (super-new)))))) >>> >>> >> I just did an svn update to 4.1.3.1 (before I was using 4.1.2.2) and I have >> nothing in planet except for a link to the code above. I see the behavior >> from before where ctrl-b does not register. >> >> I tried this on my other desktop machine which also runs linux+x11 and >> drscheme 4.1.3.1 with the same behavior. >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> From geoff at knauth.org Sun Nov 23 05:14:28 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:34:03 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <8783607.1227434327658.JavaMail.root@mswamui-backed.atl.sa.earthlink.net> References: <8783607.1227434327658.JavaMail.root@mswamui-backed.atl.sa.earthlink.net> Message-ID: <1227435268.10630.1286285203@webmail.messagingengine.com> Given a bookshelf at work fell on my MacBook Pro, my Ubuntu 8.10 machine running 4.1.3.1-svn22nov2008 [3m] is happy to test Robby's code. This is what I get when I press C-d: key-code #\d control #t Geoff -----Previous Context----- from: Robby Findler to: Jon Rafkind cc: PLT-list > ... What I want is to be able to press ctrl-d and have > (get-control-down) be #t and (get-key-code) be #\d. When I do the experiment myself (code below) I get what you seem to want. I'm on a mac tho, and I don't have a linux machine handy to test. So, I'm not sure what the right answer is. Matthew would probably know better, but maybe a first step is for you to try the below. Robby #lang scheme/gui (define t% (class text% (define/override (on-char evt) (printf "key-code ~s control ~s\n" (send evt get-key-code) (send evt get-control-down)) (super on-char evt)) (super-new))) (define f (new frame% [label ""] [width 200] [height 200])) (define t (new t%)) (define ec (new editor-canvas% [parent f] [editor t])) (send ec focus) (send f show #t) -- Geoffrey S. Knauth | http://knauth.org/gsk From diggerrrrr at gmail.com Sun Nov 23 06:05:45 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:34:03 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <49290CA5.6070208@ccs.neu.edu> References: <49287553.30404@ccs.neu.edu> <492881E6.1070405@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> <4928C921.7060908@ccs.neu.edu> <49290CA5.6070208@ccs.neu.edu> Message-ID: I also running linux ubuntu , while the above code as standalone program run as expected. I now see the point you are trying to make , indeed the canvas does not receive the proper key code , i guess it is filtered by the drscheme frame. Here is another code for debug purpose when pressed "control-b" it produces: "frame%:on-subwindow-char :" : Control? #f key? control "frame%:on-subwindow-char :" : Control? #f key? control "canvas%:on-subwindow-char :" : Control? #f key? control "canavs%:on-char : " : Control? #f key? control "definition-text%:on-char : " : Control? #f key? control "frame%:on-subwindow-char :" : Control? #t key? b "frame%:on-subwindow-char :" : Control? #t key? b "canvas%:on-subwindow-char :" : Control? #t key? b "canavs%:on-char : " : Control? #t key? b "definition-text%:on-char : " : Control? #t key? b "frame%:on-subwindow-char :" : Control? #t key? release "frame%:on-subwindow-char :" : Control? #t key? release "canvas%:on-subwindow-char :" : Control? #t key? release "canavs%:on-char : " : Control? #t key? release "definition-text%:on-char : " : Control? #t key? release "frame%:on-subwindow-char :" : Control? #t key? release "frame%:on-subwindow-char :" : Control? #t key? release "canvas%:on-subwindow-char :" : Control? #t key? release "canavs%:on-char : " : Control? #t key? release "definition-text%:on-char : " : Control? #t key? release For code : #lang scheme/gui (require drscheme/tool) (provide tool@) (define (do-char who event) (printf "~s : Control? ~a key? ~a\n" who (send event get-control-down) (send event get-key-code))) (define tool@ (unit (import drscheme:tool^) (export drscheme:tool-exports^) (define (phase1) void) ;(message-box "tool example" "phase1")) (define (phase2) void) ;(message-box "tool example" "phase2")) (drscheme:get/extend:extend-unit-frame (lambda (t%) (class t% (define/override (on-subwindow-char receiver event) (do-char "frame%:on-subwindow-char :" event) #f) (super-new)))) (drscheme:get/extend:extend-definitions-canvas (lambda (t%) (class t% (define/override (on-subwindow-char receiver event) (do-char "canvas%:on-subwindow-char :" event) #f) (define/override (on-char evt) (do-char "canavs%:on-char : " evt) (super on-char evt)) (super-new)))) (drscheme:get/extend:extend-definitions-text (? (t%) (class t% (define/override (on-char evt) (do-char "definition-text%:on-char : " evt) (super on-char evt)) (define/override (on-default-char evt) (do-char "definition-text%:on-default-char : " evt) (super on-default-char evt)) (super-new))) ))) 2008/11/23 Jon Rafkind : > Veer wrote: >> >> Hello, >> >> Correct me if i am wrong , but this is my understanding : >> >> If you override default on-char in editor-canvas% and not pass the >> event to text% then it >> will not receive the event. In any case text% is derived from object% >> and any key >> event has to be passed to it explicitly to it, which is what is done >> by default on-char >> method of editor-canvas%. >> >> > > The issue is not that the text% object receives the on-char, but that in the > editor-canvas's on-char I don't get key events with (get-control-down) as #t > and (get-key-code) as some character. It only seems to not work on X11. >> >> Key handling Code: >> >> (define (do-char who event) >> (printf >> "~s : Control? ~a key? ~a\n" >> who (send event get-control-down) >> (send event get-key-code))) >> >> (define frame >> (new frame% >> [label "Key Processing"] >> [width 300] [height 300])) >> >> (define ed% >> (class editor-canvas% >> (super-new) >> >> (define/override (on-char event) >> (do-char "ed%:on-char :" event) >> (send (send this get-editor) on-char event)) >> >> (define/override (on-subwindow-char receiver event) >> (do-char "ed%:on-subwindow-char :" event) >> #f))) >> >> (define my-text% >> (class text% >> (super-new) >> (define/override (on-default-char event) >> (do-char "my-text%" event)))) >> >> (define text-object (new my-text%)) >> (define my-ed (new ed% [parent frame] [editor text-object])) >> (send frame show #t) >> >> >> >> >> On Sun, Nov 23, 2008 at 8:38 AM, Jon Rafkind wrote: >> >>> >>> Robby Findler wrote: >>> >>>> >>>> On Sat, Nov 22, 2008 at 7:04 PM, Jon Rafkind >>>> wrote: >>>> >>>> >>>>> >>>>> I don't see the difference between my code and yours except that I'm >>>>> using >>>>> whatever editor the definitions window uses. >>>>> >>>>> >>>> >>>> I made a little tool (code below; I added a planet link and an info.ss >>>> file so drscheme would find the tool), and I still see the same (ie, >>>> good) behavior. >>>> >>>> Robby >>>> >>>> #lang scheme/gui >>>> (require drscheme/tool) >>>> >>>> (provide tool@) >>>> (define tool@ >>>> (unit >>>> (import drscheme:tool^) >>>> (export drscheme:tool-exports^) >>>> >>>> (define phase1 void) >>>> (define phase2 void) >>>> >>>> (drscheme:get/extend:extend-definitions-text >>>> (? (t%) >>>> (class t% >>>> (define/override (on-char evt) >>>> (printf "key-code ~s control ~s\n" >>>> (send evt get-key-code) >>>> (send evt get-control-down)) >>>> (super on-char evt)) >>>> (super-new)))))) >>>> >>>> >>> >>> I just did an svn update to 4.1.3.1 (before I was using 4.1.2.2) and I >>> have >>> nothing in planet except for a link to the code above. I see the behavior >>> from before where ctrl-b does not register. >>> >>> I tried this on my other desktop machine which also runs linux+x11 and >>> drscheme 4.1.3.1 with the same behavior. >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> > > From diggerrrrr at gmail.com Sun Nov 23 06:31:23 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:34:04 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> <4928C921.7060908@ccs.neu.edu> <49290CA5.6070208@ccs.neu.edu> Message-ID: One more thinng it seems that keys that are not bound are propagated further , so your text% will receive control-2 but not control-b , which is bound. 2008/11/23 Veer : > I also running linux ubuntu , while the above code as standalone > program run as expected. I now see the point you are trying to > make , indeed the canvas does not receive the proper key code , > i guess it is filtered by the drscheme frame. > > > Here is another code for debug purpose when pressed > "control-b" it produces: > > "frame%:on-subwindow-char :" : Control? #f key? control > "frame%:on-subwindow-char :" : Control? #f key? control > "canvas%:on-subwindow-char :" : Control? #f key? control > "canavs%:on-char : " : Control? #f key? control > "definition-text%:on-char : " : Control? #f key? control > "frame%:on-subwindow-char :" : Control? #t key? b > "frame%:on-subwindow-char :" : Control? #t key? b > "canvas%:on-subwindow-char :" : Control? #t key? b > "canavs%:on-char : " : Control? #t key? b > "definition-text%:on-char : " : Control? #t key? b > "frame%:on-subwindow-char :" : Control? #t key? release > "frame%:on-subwindow-char :" : Control? #t key? release > "canvas%:on-subwindow-char :" : Control? #t key? release > "canavs%:on-char : " : Control? #t key? release > "definition-text%:on-char : " : Control? #t key? release > "frame%:on-subwindow-char :" : Control? #t key? release > "frame%:on-subwindow-char :" : Control? #t key? release > "canvas%:on-subwindow-char :" : Control? #t key? release > "canavs%:on-char : " : Control? #t key? release > "definition-text%:on-char : " : Control? #t key? release > > For code : > > #lang scheme/gui > (require drscheme/tool) > > (provide tool@) > > (define (do-char who event) > (printf > "~s : Control? ~a key? ~a\n" > who (send event get-control-down) > (send event get-key-code))) > > (define tool@ > > (unit > > (import drscheme:tool^) > > (export drscheme:tool-exports^) > > (define (phase1) void) ;(message-box "tool example" "phase1")) > > (define (phase2) void) ;(message-box "tool example" "phase2")) > > (drscheme:get/extend:extend-unit-frame > (lambda (t%) > (class t% > > (define/override (on-subwindow-char receiver event) > (do-char "frame%:on-subwindow-char :" event) > #f) > (super-new)))) > > > (drscheme:get/extend:extend-definitions-canvas > (lambda (t%) > (class t% > > (define/override (on-subwindow-char receiver event) > (do-char "canvas%:on-subwindow-char :" event) > #f) > > (define/override (on-char evt) > (do-char "canavs%:on-char : " evt) > (super on-char evt)) > (super-new)))) > > > (drscheme:get/extend:extend-definitions-text > (? (t%) > (class t% > > (define/override (on-char evt) > (do-char "definition-text%:on-char : " evt) > (super on-char evt)) > > (define/override (on-default-char evt) > (do-char "definition-text%:on-default-char : " evt) > (super on-default-char evt)) > > > (super-new))) ))) > > > 2008/11/23 Jon Rafkind : >> Veer wrote: >>> >>> Hello, >>> >>> Correct me if i am wrong , but this is my understanding : >>> >>> If you override default on-char in editor-canvas% and not pass the >>> event to text% then it >>> will not receive the event. In any case text% is derived from object% >>> and any key >>> event has to be passed to it explicitly to it, which is what is done >>> by default on-char >>> method of editor-canvas%. >>> >>> >> >> The issue is not that the text% object receives the on-char, but that in the >> editor-canvas's on-char I don't get key events with (get-control-down) as #t >> and (get-key-code) as some character. It only seems to not work on X11. >>> >>> Key handling Code: >>> >>> (define (do-char who event) >>> (printf >>> "~s : Control? ~a key? ~a\n" >>> who (send event get-control-down) >>> (send event get-key-code))) >>> >>> (define frame >>> (new frame% >>> [label "Key Processing"] >>> [width 300] [height 300])) >>> >>> (define ed% >>> (class editor-canvas% >>> (super-new) >>> >>> (define/override (on-char event) >>> (do-char "ed%:on-char :" event) >>> (send (send this get-editor) on-char event)) >>> >>> (define/override (on-subwindow-char receiver event) >>> (do-char "ed%:on-subwindow-char :" event) >>> #f))) >>> >>> (define my-text% >>> (class text% >>> (super-new) >>> (define/override (on-default-char event) >>> (do-char "my-text%" event)))) >>> >>> (define text-object (new my-text%)) >>> (define my-ed (new ed% [parent frame] [editor text-object])) >>> (send frame show #t) >>> >>> >>> >>> >>> On Sun, Nov 23, 2008 at 8:38 AM, Jon Rafkind wrote: >>> >>>> >>>> Robby Findler wrote: >>>> >>>>> >>>>> On Sat, Nov 22, 2008 at 7:04 PM, Jon Rafkind >>>>> wrote: >>>>> >>>>> >>>>>> >>>>>> I don't see the difference between my code and yours except that I'm >>>>>> using >>>>>> whatever editor the definitions window uses. >>>>>> >>>>>> >>>>> >>>>> I made a little tool (code below; I added a planet link and an info.ss >>>>> file so drscheme would find the tool), and I still see the same (ie, >>>>> good) behavior. >>>>> >>>>> Robby >>>>> >>>>> #lang scheme/gui >>>>> (require drscheme/tool) >>>>> >>>>> (provide tool@) >>>>> (define tool@ >>>>> (unit >>>>> (import drscheme:tool^) >>>>> (export drscheme:tool-exports^) >>>>> >>>>> (define phase1 void) >>>>> (define phase2 void) >>>>> >>>>> (drscheme:get/extend:extend-definitions-text >>>>> (? (t%) >>>>> (class t% >>>>> (define/override (on-char evt) >>>>> (printf "key-code ~s control ~s\n" >>>>> (send evt get-key-code) >>>>> (send evt get-control-down)) >>>>> (super on-char evt)) >>>>> (super-new)))))) >>>>> >>>>> >>>> >>>> I just did an svn update to 4.1.3.1 (before I was using 4.1.2.2) and I >>>> have >>>> nothing in planet except for a link to the code above. I see the behavior >>>> from before where ctrl-b does not register. >>>> >>>> I tried this on my other desktop machine which also runs linux+x11 and >>>> drscheme 4.1.3.1 with the same behavior. >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> >> >> > From keydana at gmx.de Fri Nov 21 16:05:11 2008 From: keydana at gmx.de (stelvio) Date: Thu Mar 26 02:34:04 2009 Subject: [plt-scheme] view procedure source code Message-ID: Hi, I'd like to know if there's a possibility in PLT scheme to get at a procedure's source code? Trying to understand the amb evaluator in SICP, I would like to print out the success and failure continuations to see how exactly the continuations are passed on / replaced (so the usual printout does not help). Thanks a lot for your help! From robby at cs.uchicago.edu Sun Nov 23 11:11:46 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:04 2009 Subject: [plt-scheme] view procedure source code In-Reply-To: References: Message-ID: <932b2f1f0811230811h3e2a33b5redb60d3aad3f028d@mail.gmail.com> Probably the best tool for that is Redex. Robby On 11/21/08, stelvio wrote: > Hi, > > I'd like to know if there's a possibility in PLT scheme to get at a > procedure's source code? > Trying to understand the amb evaluator in SICP, I would like to print > out the success and failure continuations to see how exactly the > continuations are passed on / replaced (so the usual > printout does not help). > > Thanks a lot for your help! > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From noelwelsh at gmail.com Sun Nov 23 11:27:55 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:04 2009 Subject: [plt-scheme] SchemeUnit 3: many thanks In-Reply-To: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> Message-ID: Thanks! It is nice to get feedback, as it doesn't often happen and I typically have no idea if and how people are using a lot of the packages I release. I suspect a lot of simple improvements are missed as my workflow is moulded around the tools I use, so I don't see problems encountered by people with different workflows. On Sat, Nov 22, 2008 at 4:30 PM, John Clements wrote: > While I'm thinking of it: > > I cannot begin to tell you how much *more* likely I am to use schemeunit now > that I can just write > > (check-equal? (+ 7 7) 14) > > Thanks to everyone that made this possible, both the implementors and the > complainers :). Yep. The SchemeUnit acknowledgments include: "Robby Findler pushed me to release version 3" N. From workmin at ccs.neu.edu Sun Nov 23 12:05:05 2008 From: workmin at ccs.neu.edu (Jon Rafkind) Date: Thu Mar 26 02:34:04 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221425j51223082u65161a04af3a48a3@mail.gmail.com> <49288865.7070708@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> <4928C921.7060908@ccs.neu.edu> <49290CA5.6070208@ccs.neu.edu> Message-ID: <49298D41.8030506@ccs.neu.edu> Veer wrote: > One more thinng it seems that keys that are not > bound are propagated further , so your text% will > receive control-2 but not control-b , which is bound. > > Ah!! Apparently I was only testing bound keys, ctrl-s, ctrl-d, etc, and I thought ctrl-b wasn't bound because it didn't do anything apparent on the first try. But pressing ctrl-2 produces the behavior I want. So Robby, is there a way to unbind all ctrl-# keys in drscheme so that I can get them in the editor-canvas? From keydana at gmx.de Sun Nov 23 13:34:52 2008 From: keydana at gmx.de (stelvio) Date: Thu Mar 26 02:34:04 2009 Subject: [plt-scheme] Re: view procedure source code In-Reply-To: <932b2f1f0811230811h3e2a33b5redb60d3aad3f028d@mail.gmail.com> References: <932b2f1f0811230811h3e2a33b5redb60d3aad3f028d@mail.gmail.com> Message-ID: I will try that, thanks a lot! Sigrid On Nov 23, 5:11 pm, "Robby Findler" wrote: > Probably the best tool for that is Redex. > > Robby > > On 11/21/08, stelvio wrote:> Hi, > > > I'd like to know if there's a possibility in PLT scheme to get at a > > procedure's source code? > > Trying to understand the amb evaluator in SICP, I would like to print > > out the success and failure continuations to see how exactly the > > continuations are passed on / replaced (so the usual > > printout does not help). > > > Thanks a lot for your help! > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at cs.uchicago.edu Sun Nov 23 16:10:08 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:05 2009 Subject: [plt-scheme] vi mode and editor questions In-Reply-To: <49298D41.8030506@ccs.neu.edu> References: <49287553.30404@ccs.neu.edu> <932b2f1f0811221640i25c5c57me4c7ef837241aa06@mail.gmail.com> <4928AC17.6040209@ccs.neu.edu> <932b2f1f0811221817x47c65675mcc3f467fea078d86@mail.gmail.com> <4928C921.7060908@ccs.neu.edu> <49290CA5.6070208@ccs.neu.edu> <49298D41.8030506@ccs.neu.edu> Message-ID: <932b2f1f0811231310w69c70adah1a718040c3c92654@mail.gmail.com> On Sun, Nov 23, 2008 at 11:05 AM, Jon Rafkind wrote: > Veer wrote: >> >> One more thinng it seems that keys that are not >> bound are propagated further , so your text% will >> receive control-2 but not control-b , which is bound. >> >> > > Ah!! Apparently I was only testing bound keys, ctrl-s, ctrl-d, etc, and I > thought ctrl-b wasn't bound because it didn't do anything apparent on the > first try. But pressing ctrl-2 produces the behavior I want. > > So Robby, is there a way to unbind all ctrl-# keys in drscheme so that I can > get them in the editor-canvas? Maybe removing and restoring the keymap? (I didn't try, tho.) Or maybe there is a lower-level place to catch the events. Robby From robby at cs.uchicago.edu Sun Nov 23 16:11:02 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:05 2009 Subject: [plt-scheme] SchemeUnit 3: many thanks In-Reply-To: References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> Message-ID: <932b2f1f0811231311q5b2cdfd9q5d2d68331512161d@mail.gmail.com> Very kindly put. :) Robby On Sun, Nov 23, 2008 at 10:27 AM, Noel Welsh wrote: > Thanks! It is nice to get feedback, as it doesn't often happen and I > typically have no idea if and how people are using a lot of the > packages I release. I suspect a lot of simple improvements are missed > as my workflow is moulded around the tools I use, so I don't see > problems encountered by people with different workflows. > > On Sat, Nov 22, 2008 at 4:30 PM, John Clements > wrote: >> While I'm thinking of it: >> >> I cannot begin to tell you how much *more* likely I am to use schemeunit now >> that I can just write >> >> (check-equal? (+ 7 7) 14) >> >> Thanks to everyone that made this possible, both the implementors and the >> complainers :). > > Yep. The SchemeUnit acknowledgments include: > > "Robby Findler pushed me to release version 3" > > N. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From eli at barzilay.org Sun Nov 23 16:16:33 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:34:05 2009 Subject: [plt-scheme] Howto regexp-split string but keep delimiters In-Reply-To: <18726.57229.525435.352362@arabic.ccs.neu.edu> References: <1227273443.11000.5.camel@darkstar> <18726.57229.525435.352362@arabic.ccs.neu.edu> Message-ID: <18729.51249.710818.555801@arabic.ccs.neu.edu> On Nov 21, Eli Barzilay wrote: > On Nov 21, Erich Rast wrote: > > Hello all, > > > > I need to split a large string into separate words using a regexp, but > > need to keep non-whitespace delimiters: > > > > "Ab, c, dd,hello." ==> ("Ab" "," "c" "," "dd" "," "hello" ".") > > > > Can this be done using regexp-split? How? > > It's easier to do with regexp-match: > > > (regexp-match* #px"[\\w]+|[^\\s\\w]" "Ab, c, dd,hello.") > ("Ab" "," "c" "," "dd" "," "hello" ".") I should have said that it was difficult to do that with `regexp-split' for a technical reason regarding a problem that bugged me for a while. I've finally managed to solve it -- if you get today's nightly build, then you can get the same result more easily with `regexp-split': > (regexp-split #px"\\b| +" "Ab, c, dd,hello.") ("Ab" "," "c" "," "dd" "," "hello" ".") -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From esmith at acanac.net Sun Nov 23 16:58:31 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:34:05 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> Message-ID: <4929D207.7090002@acanac.net> The recent post about SchemeUnit stimulated me to post this question. So far all I have been using for unit testing is a rudimentary set of macros which I've written as a stop gap measure. The volume of code I'm writing is going up. It's time I pick something better to use. I can't make this question more precise, because I'm hoping to find something I can re-use in a variety of circumstances. so I don't want to narrow it down too much. I would like to be able settle on a very short list of testing 'framework' options which can cover the range of circumstances, including across different versions of PLT scheme, across different scheme implementations, across different developments and target environments, and across different size of project. In a nutshell I'm seeking any insight or advice I can get on choosing a testing strategy and tools that may avoid me having to backtrack bad choices later. Thanks in advance. From jadudm at gmail.com Sun Nov 23 20:49:38 2008 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:34:05 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: <4929D207.7090002@acanac.net> References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> Message-ID: On Sun, Nov 23, 2008 at 4:58 PM, Ernie Smith wrote: > options which can cover the range of circumstances, including across > different versions of PLT scheme, across different scheme implementations, > across different developments and target environments, and across different > size of project. Can you be more precise? Because in the Scheme world, that particular list of requirements usually ends with a request for a pony, too. Or world peace. (In short, you've already set yourself up to fail, unless you're a very competent, dedicated Scheme developer with broad experience across all of the implementations you intend to support.) Do you want to support PLT v103 through 4.1.3? Or, do you mean just v372 and HEAD? Or, do you mean PLT Scheme from now until some point in the future? Do you want to support *any* Scheme implementation, or just Scheme48 and PLT? (Insert your implementation list here, basically.) Do you want your tests to run in POSIX-compliant environments, or are you including embedded targets (where there are few Scheme implementations, but you intend to go there regardless)? If you want your project to take finite time, then I recommend you pick one Scheme that does what you need in all the environments you intend to support, and stick with it. Then, how to do testing is a much easier question. If you want to multiply the support effort, pick multiple Scheme implementations and figure out what the intersection of functionality is that you can use (basically, R5RS). You'll spend a significant amount of time writing portability wrappers for basic functionality, and you can probably use SRFI-78 as a bootstrap for testing. > In a nutshell I'm seeking any insight or advice I can get on > choosing a testing strategy and tools that may avoid me having to backtrack > bad choices later. In PLT Scheme, use SchemeUnit. Library versions may bite you if you expect to support old and new versions of PLT Scheme. SRFI-78 may get you started elsewhere... and possibly even a pony. Good luck. Cheers, Matt From thomas.gordon at fokus.fraunhofer.de Mon Nov 24 03:15:39 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:05 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> Message-ID: <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> On Nov 19, 2008, at 9:33 PM, Grant Rettke wrote: >> Anything which discourages people from making the effort to port >> libraries >> to R6RS, or write new libraries in R6RS, serves to undermine R6RS. > > By that rationale the PLT group also discourages the use of the HtDP > languages, and Typed Scheme for example! :) PLT Scheme supports a variety of languages in an integrated way, Typed Scheme, R5RS and R6RS amoung them. This is one of PLT's strengths, but it is a strength not shared by the current Scheme standard, R6RS. Developing systems using a variety of languages supported only by PLT leads to systems which are not portable, but dependent on PLT. I would like to see more libraries available in and for R6RS Scheme implementations and wonder whether the PLT team could or should do more to encourage their development and help organize the process of sharing portable libraries, along the lines of their PlaneT system. Would it be techically possible to develop a translator which can export modules written in any language supported by PLT into portable R6RS libraries, for interchange purposes? That might be a solution, allowing people to use the languages of their choice with PLT without sacrificing portability or inhibiting the development and sharing of portable libraries. >> Presumably what needs to happen for R6RS to succeed is for one or >> more R6RS >> implementations to become competive with PLT and begin to attract >> users away >> from PLT, on their own merits. > > Please elaborate. PLT is, it seems, the leading Scheme system at the moment. I'm not sure I would go so far as to say it sets the de facto standard, comparable to the way Microsoft set the de facto standard for "office" software, but the situtation is similar, albeit on a much smaller scale. It is an attractive environment which entices people to use it, but also become dependent on it. We now have a suitable standard to help regain portability and implementation independence, R6RS, but we still need something like Open Office, a strong competitor to PLT which fully and wholeheartedly supports R6RS. If such a competitor began to attract users away from PLT, the PLT team might have more of an incentive to make a larger commitment to R6RS, just as Microsoft in the end has begun to support the ISO Open Document Format. Some really good R6RS compilers and interpreters are now available, which are competitive with PLT, but they still lack PLT's rich programming environment and a comparably rich set of libraries. -Tom From geoff at knauth.org Mon Nov 24 03:50:25 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:34:05 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> Message-ID: <1227516625.26465.1286412943@webmail.messagingengine.com> On Mon, 24 Nov 2008 09:15:39 +0100, "Tom Gordon" said: > If such a competitor began to attract users away from PLT, > the PLT team might have more of an incentive to make a larger > commitment to R6RS, just as Microsoft in the end has begun to > support the ISO Open Document Format. > > Some really good R6RS compilers and interpreters are now available, > which are competitive with PLT, but they still lack PLT's rich > programming environment and a comparably rich set of libraries. The Microsoft analogy is weakened by the fact that PLT is free software, so anyone who wants to grab ideas from PLT's excellent developers can take what they like and develop such a competitor. PLT has not constrained anyone, so it strikes me as unbalanced to try to constrain PLT. I'm guessing that PLT goes beyond R6RS because they have so many ideas they want to explore, and as people say often, "it's a free country." PLT is so rich with fresh thoughts (every week!) the only reason I don't encourage them more is I hope they get some sleep. PLT went to great lengths to support R6RS, so it seems to me they've done their bit. If there's something lacking technically in PLT's R6RS support, what is it? If we want all the wonderfulness of DrScheme in a pure R6RS flavor and we want them to do the work, we could raise money for PLT research groups and support the next generation of gifted computer scientists. -- Geoffrey S. Knauth | http://knauth.org/gsk From kbohdan at mail.ru Mon Nov 24 04:32:41 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:34:06 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <1227516625.26465.1286412943@webmail.messagingengine.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> Message-ID: Geoffrey S. Knauth wrote: > The Microsoft analogy is weakened by the fact that PLT is free software, > so anyone who wants to grab ideas from PLT's excellent developers can > take what they like and develop such a competitor. PLT has not > constrained anyone, so it strikes me as unbalanced to try to constrain > PLT. Again, choosing between r6rs portability and PLT power *is* constraint. Portability *is* requirement when I'm going to create some real-world (non-research, non-study and not a game) software. > I'm guessing that PLT goes beyond R6RS because they have so many > ideas they want to explore, and as people say often, "it's a free > country." True, but wouldn't it be better to add all new ideas as R6RS core extensions and R6RS compatible libraries? IMHO in this case PLT & R6RS will benefit from each other. > PLT is so rich with fresh thoughts (every week!) the only > reason I don't encourage them more is I hope they get some sleep. I'm 99% sure they will have more time to sleep after switching PLT to r6rs ... because of community size increase. > PLT went to great lengths to support R6RS, so it seems to me they've > done their bit. If there's something lacking technically in PLT's R6RS > support, what is it? No AFAIK, but there are a lot of technically lacking things in r6rs standard. Actually r6rs is not very useful on practice. > If we want all the wonderfulness of DrScheme in a > pure R6RS flavor and we want them to do the work, we could raise money > for PLT research groups and support the next generation of gifted > computer scientists. 100%. But not until Scheme becomes software industry language. Currently it is only very nice and powerful toy. -- Bohdan From geoff at knauth.org Mon Nov 24 05:21:39 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:34:06 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> Message-ID: <1227522099.11465.1286424197@webmail.messagingengine.com> On Mon, 24 Nov 2008 11:32:41 +0200, kbohdan@mail.ru said: > Again, choosing between r6rs portability and PLT power *is* constraint. > Portability *is* requirement when I'm going to create some real-world > (non-research, non-study and not a game) software. You had some interesting points, but I'll focus on this one. If portability is important (it's usually a good thing), and R6RS has not emerged beautiful enough for PLT to ground their current work in it, then someone has to pay, in sweat or money or love, to make a R6RS DrScheme happen. My question to PLT would then be, "If someone were driven to create a R6RS-pure DrScheme, is it madness? Is it needless? Is it akin to the Emacs/XEmacs split? Or maybe it is no big deal?" I also remember the idea was floated of a translator, something that could generate R6RS code. DrScheme is not a game or toy. It is more like a gift of stem cells. It can be used for world class real-world software. The pieces have been coming together for years. -- Geoffrey S. Knauth | http://knauth.org/gsk From mvanier42 at gmail.com Mon Nov 24 05:27:47 2008 From: mvanier42 at gmail.com (Michael Vanier) Date: Thu Mar 26 02:34:06 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <1227522099.11465.1286424197@webmail.messagingengine.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <1227522099.11465.1286424197@webmail.messagingengine.com> Message-ID: <492A81A3.8090401@cs.caltech.edu> Geoffrey S. Knauth wrote: > On Mon, 24 Nov 2008 11:32:41 +0200, kbohdan@mail.ru said: > >> Again, choosing between r6rs portability and PLT power *is* constraint. >> Portability *is* requirement when I'm going to create some real-world >> (non-research, non-study and not a game) software. >> > > You had some interesting points, but I'll focus on this one. If > portability is important (it's usually a good thing), and R6RS has not > emerged beautiful enough for PLT to ground their current work in it, > then someone has to pay, in sweat or money or love, to make a R6RS > DrScheme happen. My question to PLT would then be, "If someone were > driven to create a R6RS-pure DrScheme, is it madness? Is it needless? > Is it akin to the Emacs/XEmacs split? Or maybe it is no big deal?" I > also remember the idea was floated of a translator, something that could > generate R6RS code. > > DrScheme is not a game or toy. It is more like a gift of stem cells. > It can be used for world class real-world software. The pieces have > been coming together for years. > I might add that Python, Ruby, Perl, etc. don't have "portability" in any official, blessed-by-committee sense but that hasn't stopped anyone from writing real-world, non-research, non-study and non-game software in them. Looked at this way, there is nothing ominous about PLT Scheme. Conversely, Common Lisp has had a blessed-by-committee standard for decades; how much real-world software is written in Common Lisp anymore, relative to that written in Python/Ruby/Perl? Portability has benefits, but it has big costs as well. For languages with smaller user bases, the costs often outweight the benefits. Mike From aghuloum at cs.indiana.edu Mon Nov 24 06:00:42 2008 From: aghuloum at cs.indiana.edu (Abdulaziz Ghuloum) Date: Thu Mar 26 02:34:06 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <1227516625.26465.1286412943@webmail.messagingengine.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> Message-ID: <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> On Nov 24, 2008, at 3:50 AM, Geoffrey S. Knauth wrote: > If we want all the wonderfulness of DrScheme in a > pure R6RS flavor and ... On Nov 24, 2008, at 5:21 AM, Geoffrey S. Knauth wrote: > My question to PLT would then be, "If someone were > driven to create a R6RS-pure DrScheme, is it madness? Geoffrey, I don't think Tom's point was that DrScheme should be rewritten such that its code base in pure R6RS. Tom is talking about libraries, modules, or code that people actively write specifically for PLT vs. libraries that people write for R6RS that can also be used under PLT. Suppose that you're developing some component that you need to develop anyways (it's not important what it is), and that you would like to make it available for others to use too (and thus enriching the commons), should you pick the first route or the second? (Assume you have the option of picking between writing a PLT module and writing an R6RS library with the same functionality) Aziz,,, From geoff at knauth.org Mon Nov 24 07:21:12 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:34:06 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> Message-ID: <1227529272.1535.1286439859@webmail.messagingengine.com> On Mon, 24 Nov 2008 06:00:42 -0500, "Abdulaziz Ghuloum" said: > I don't think Tom's point was that DrScheme should be > rewritten such that its code base in pure R6RS. Tom is > talking about libraries, modules, or code that people > actively write specifically for PLT vs. libraries that > people write for R6RS that can also be used under PLT. Aziz, OK, I understand now. Well, if I were an author of such a library, the first thing I would have to ask myself is, "Why did I write it for one platform and not for many?" Is it out of convenience or aesthetics? Then what process could make it easy to write or generate a portable version? Is it out of ignorance? Then users should educate me. Is it for technical reasons or a vision thing? Then users should ask me to document the issue explaining the divergence. I'd be happy watching PLT folks go at their own rapid pace, and for people concerned with (back? forward?) portability make that a separate effort. Imitation is the sincerest form of flattery. Count me as partial to PLT, but still interested in portability. Geoff -- Geoffrey S. Knauth | http://knauth.org/gsk From geoff at knauth.org Mon Nov 24 07:33:55 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:34:06 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> Message-ID: <1227530035.3588.1286444829@webmail.messagingengine.com> A generation ago, I learned a lot about C by dealing with portability issues. Portability is deja vu, good for our scheme-fu. -- Geoffrey S. Knauth | http://knauth.org/gsk From kbohdan at mail.ru Mon Nov 24 08:37:15 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:34:06 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <1227522099.11465.1286424197@webmail.messagingengine.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <1227522099.11465.1286424197@webmail.messagingengine.com> Message-ID: > DrScheme is not a game or toy. It is more like a gift of stem cells. > It can be used for world class real-world software. The pieces have > been coming together for years. You almost convinced me :) It was good. Unfortunately those pieces are *hidden* from real-world because of complexity. And this complexity is not related with advanced macrology or with coroutines ... (=stem cells). It is related to the fact that someone who tries to answer the question "What is this Scheme ?" sees following: " Wikipedia:Scheme (programming language) ... Current implementations include: Bigloo, Chez Scheme, Chicken, Gambit, Gauche, Guile, Ikarus, JScheme, Kawa, Larceny, MIT/GNU Scheme, Mosh, PLT Scheme, Pvts, RScheme, Scheme 48, SCM, SISC, Stalin, STk, STklos, TinyScheme, Ypsilon. ... " So, where is this stem with cells ? -- Bohdan From noelwelsh at gmail.com Mon Nov 24 08:52:23 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:07 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <1227522099.11465.1286424197@webmail.messagingengine.com> Message-ID: On Mon, Nov 24, 2008 at 1:37 PM, wrote: > It is related to the fact that > someone who tries to answer the question "What is this Scheme ?" sees > following: > ... Indeed, there are too many Scheme implementations. The Scheme community would be better off if a bunch of them disappeared. But that doesn't stop the programmer who has chosen an implementation from getting useful work done. N. From hendrik at topoi.pooq.com Tue Nov 25 04:14:29 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:34:07 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <1227529272.1535.1286439859@webmail.messagingengine.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> Message-ID: <20081125091429.GA6638@topoi.pooq.com> On Mon, Nov 24, 2008 at 07:21:12AM -0500, Geoffrey S. Knauth wrote: > On Mon, 24 Nov 2008 06:00:42 -0500, "Abdulaziz Ghuloum" > said: > > I don't think Tom's point was that DrScheme should be > > rewritten such that its code base in pure R6RS. Tom is > > talking about libraries, modules, or code that people > > actively write specifically for PLT vs. libraries that > > people write for R6RS that can also be used under PLT. > > Aziz, > > OK, I understand now. Well, if I were an author of such a library, the > first thing I would have to ask myself is, "Why did I write it for one > platform and not for many?" Is it out of convenience or aesthetics? > Then what process could make it easy to write or generate a portable > version? Is it out of ignorance? Then users should educate me. Is it > for technical reasons or a vision thing? Then users should ask me to > document the issue explaining the divergence. > > I'd be happy watching PLT folks go at their own rapid pace, and for > people concerned with (back? forward?) portability make that a separate > effort. Imitation is the sincerest form of flattery. Count me as > partial to PLT, but still interested in portability. If the reason they write them in nonR6RS PLT is that they use libraries not available in R6R6, then having those libraries (re)written in R6RS would promote portability. -- hendrik From robby at cs.uchicago.edu Mon Nov 24 10:19:27 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:07 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081125091429.GA6638@topoi.pooq.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> Message-ID: <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Folks, At the risk of repeating myself, core PLT members have put in a huge amount of effort into R6RS already. I think it is time to stop telling us how more would be better and instead step up and contribute. Thanks, Robby From hendrik at topoi.pooq.com Tue Nov 25 04:19:13 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:34:07 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> Message-ID: <20081125091913.GB6638@topoi.pooq.com> On Mon, Nov 24, 2008 at 09:15:39AM +0100, Tom Gordon wrote: > > PLT is, it seems, the leading Scheme system at the moment. I'm not > sure I would go so far as to say it sets the de facto standard, > comparable to the way Microsoft set the de facto standard for "office" > software, but the situtation is similar, albeit on a much smaller > scale. It is an attractive environment which entices people to use > it, but also become dependent on it. We now have a suitable standard > to help regain portability and implementation independence, R6RS, but > we still need something like Open Office, a strong competitor to PLT > which fully and wholeheartedly supports R6RS. If such a competitor > began to attract users away from PLT, the PLT team might have more of > an incentive to make a larger commitment to R6RS, just as Microsoft > in the end has begun to support the ISO Open Document Format. The easiest way to implement such a competitor would seem to be to take PLT Scheme and remove a lot of its code. The result might possibly fit on smaller machines, giving it a market niche. It might require little more than a different Make target in the existing code. > > Some really good R6RS compilers and interpreters are now available, > which are competitive with PLT, but they still lack PLT's rich > programming environment and a comparably rich set of libraries. > > -Tom > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From hendrik at topoi.pooq.com Tue Nov 25 04:23:54 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:34:07 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: <20081125092354.GC6638@topoi.pooq.com> On Mon, Nov 24, 2008 at 09:19:27AM -0600, Robby Findler wrote: > Folks, > > At the risk of repeating myself, core PLT members have put in a huge > amount of effort into R6RS already. I think it is time to stop telling > us how more would be better and instead step up and contribute. Indeed. Although the R6RS-only fanatics seem to be arguing that less is better. Still, I expect de-facto portability could also be achieved by porting PLT Scheme to more platforms. I have no idea how many platforms provide PLT Scheme at the moment, nor how difficult that is. - hendrik > > Thanks, > Robby > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From m.douglas.williams at gmail.com Mon Nov 24 10:31:56 2008 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:34:08 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: When we were migrating to PLT Scheme 4.0 - well, I still am in some cases - Matthew put together a guide that explained the differences and what we would need to do to convert to V4.0. Is there something similar for the differences between PLT Scheme V4.0 and R6RS? For my big packages like the science and simulation collections, I separated out the graphics (which is almost certainly not portable) and the base functionality (which probably could be ported) when I developed them. It hasn't been important for me to convert them to R6RS since I obviously use PLT Scheme. The science collection would probably be fairly easy to port. It's rather large, but it's pretty much just computational stuff - except for the graphics, which are already separated. The simulation collection uses some things like parameters that I'm not sure are in R6RS - I honestly haven't looked into it. Is there a real advantage to the Scheme community at large or the PLT Scheme community in general in creating R6RS versions of these packages? Is it possible, or better yet easy, to make a single package that is R6RS compliant and plays well with PLT Scheme modules, etc? Is there a good example of such a thing? Doug On Mon, Nov 24, 2008 at 8:19 AM, Robby Findler wrote: > Folks, > > At the risk of repeating myself, core PLT members have put in a huge > amount of effort into R6RS already. I think it is time to stop telling > us how more would be better and instead step up and contribute. > > Thanks, > Robby > _________________________________________________ > 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/20081124/a741d2b9/attachment.htm From eli at barzilay.org Mon Nov 24 10:49:02 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:34:08 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: <18730.52462.877850.699669@arabic.ccs.neu.edu> On Nov 24, Robby Findler wrote: > Folks, > > At the risk of repeating myself, core PLT members have put in a > huge amount of effort into R6RS already. I think it is time to stop > telling us how more would be better and instead step up and > contribute. I want to add one more point that for some reason was not mentioned so far. It's an obvious one, really: PLT Scheme is a ... [dramatic drum-roll effect] ... *HUGE* system. Just look through the collection tree, and you'll see that there are many modules that are still in the `mzscheme' language (which has been a legacy language for about a year now), you'll see many units that are not using the features that the unit system provie because they predate the module system (which has been around for 7 years), you'll see files that use the `class100' object system which is even older than that, and you'll even see a compatibility module for zodiac which is even older. The bottom line is that there's plenty of code, and far from enough people to port it all. Sure, you may play with the idea of porting things here and there, but these things would be painful -- and on the other hand, the people who are working on the project have very little motivation in spending yet more effort in making code portable accross implementations for obvious reasons. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From geoff at knauth.org Mon Nov 24 10:53:43 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:34:09 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: <1227542023.23621.1286481945@webmail.messagingengine.com> On Mon, 24 Nov 2008 09:19:27 -0600, "Robby Findler" said: > At the risk of repeating myself, core PLT members have put in a huge > amount of effort into R6RS already. I think it is time to stop telling > us how more would be better and instead step up and contribute. I totally agree, the PLT authors have done enough. So, if there's a R6RS seeker out there who wants a manageable piece of code converted to R6RS, send me a pointer and I'll give it a try. It will be educational. -- Geoffrey S. Knauth | http://knauth.org/gsk From thomas.gordon at fokus.fraunhofer.de Mon Nov 24 11:09:26 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:09 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? Message-ID: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> Robby Findler wrote: > Folks, > > At the risk of repeating myself, core PLT members have put in a huge > amount of effort into R6RS already. I think it is time to stop telling > us how more would be better and instead step up and contribute. > > Thanks, > Robby Just in case there was any misunderstanding, let me clearly state how much I appreciate the work of the PLT Team, also with regard to the work they've done to support R6RS Scheme. We use PLT all the time for developing R6RS libraries, which we make available as Open Source . But, having said that, I must admit having been somewhat disappointed when PLT Scheme Version 4.0 was announced. Having known that prominent members of the PLT team had been strong promoters of R6RS and that support for R6RS had been promised, I wrongly jumped to the conclusion that this support would take the form of making R6RS Scheme the "native" Scheme dialect for PLT Scheme. This choice does not send the kind of signal I would have hoped to the Scheme community, and new potential Scheme programmers. When the people who had been amoung the strongest supporters of the new R6RS standard choose to focus their energies on a non-standard dialect, it suggests they have doubts about thetechnical quality of the standard. Why else would they prefer to do things differenlty in their own dialect? Considering how controversial R6RS has been, what kind of impression does it make when one of its strongest *proponents* decides to go their own way? What kind of contribution would you like to see from others, to help make R6RS a success? Writing their code in R6RS? Porting libraries to R6RS? If the PLT Team really would like to encourage people to write portable code, using R6RS, why does it at the same time entice us with us with new non-standard dialect and a bunch of great tools available only when using this dialect? To me, PLT's support for R6RS seems somewhat half-hearted and ambiguous. -Tom From noelwelsh at gmail.com Mon Nov 24 11:30:19 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:09 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: <4929D207.7090002@acanac.net> References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> Message-ID: On Sun, Nov 23, 2008 at 9:58 PM, Ernie Smith wrote: SchemeUnit: > across different versions of PLT scheme Yes, there are versions going back to v200. > across different scheme implementations No(t yet) > across different developments and target environments I don't know what this means. > and across different size of project. Yes. N. From grettke at acm.org Mon Nov 24 11:34:06 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:34:09 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> Message-ID: <756daca50811240834y3a4ac513r308be8bfdfb6046a@mail.gmail.com> On Mon, Nov 24, 2008 at 10:30 AM, Noel Welsh wrote: >> across different scheme implementations > > No(t yet) Care to elaborate here? :) From noelwelsh at gmail.com Mon Nov 24 11:36:47 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:09 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: <595b9ab20811211638k3f2934e5yc75b92f93fbebe5f@mail.gmail.com> References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> <756daca50811211231k7cbb1914icd7ac36681b24790@mail.gmail.com> <595b9ab20811211638k3f2934e5yc75b92f93fbebe5f@mail.gmail.com> Message-ID: SchemeUnit is fairly clean, and the basic model is simple. Highlights: - define-check is an example of a moderately complex macro - the text-ui uses a monad to accumulate data - lots and lots of tests! N. On Sat, Nov 22, 2008 at 12:38 AM, Stephen De Gabrielle wrote: > Thank you all, > > I think I need to go read some code - the webserver is probably a good > choice as it seems to be getting a lot of use lately. I'd also appreciate > [code reading] suggestions if anyone would care to make any. > > s From noelwelsh at gmail.com Mon Nov 24 11:38:13 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:09 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: <756daca50811240834y3a4ac513r308be8bfdfb6046a@mail.gmail.com> References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> <756daca50811240834y3a4ac513r308be8bfdfb6046a@mail.gmail.com> Message-ID: On Mon, Nov 24, 2008 at 4:34 PM, Grant Rettke wrote: > On Mon, Nov 24, 2008 at 10:30 AM, Noel Welsh wrote: >>> across different scheme implementations >> >> No(t yet) > > Care to elaborate here? :) Basically, SchemeUnit could be easily ported to other Schemes (a while ago I ported it to SISC), but I haven't the need and no-one has either done so, or harassed me enough to make me do so, so I guess there isn't the demand. N. From matthias at ccs.neu.edu Mon Nov 24 11:41:49 2008 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:34:09 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> Message-ID: On Nov 24, 2008, at 11:09 AM, Tom Gordon wrote: > PLT's support for R6RS seems somewhat half-hearted and ambiguous. Tom, I reject this as unfair. Compare our implementation to those of others, and we are ahead still. Matthew provides test suits for R6RS and friends, which others borrow to develop their own R6RS implementations. Why should we do more than those people? But perhaps you're really requesting that PLT stay away from RnRS efforts. -- Matthias From grettke at acm.org Mon Nov 24 12:14:03 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:34:10 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> Message-ID: <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> Tom, Thanks for elaborating. I think I see your point. It sounds like you are lumping two topics together, Implementation of R6RS and the Advocacy of R6RS, into one thing that you call "Supporting R6RS". Those are two very different things. PLT has provided the first, and that is no small task. Since they worked on R6RS, arguably there is no better advocacy, but I won't speak for them here. It has been discussed before that Scheme is an experiment, it is an idea that has spawned many Scheme-like languages, since there is no one definition. Roughly, these are dialects. R6RS is one dialect in which you are interested, I am too. Look at PLT, though, it support a *lot* of dialects. That is the philosophy behind it. The philosophy is not to push one single philosophy. All of the maintainers have their own interests in particular dialects that meet their needs (Typed, HtDP, #scheme...), so it is unfair of us to expect them to push a single dialect. That is just not the spirit of Scheme, anyway. DrScheme can be used perfectly well for writing R6RS code and reading the documentation. Everything "just works". It is awesome for R6RS. From grettke at acm.org Mon Nov 24 12:16:37 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:34:10 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> <756daca50811211231k7cbb1914icd7ac36681b24790@mail.gmail.com> <595b9ab20811211638k3f2934e5yc75b92f93fbebe5f@mail.gmail.com> Message-ID: <756daca50811240916m52f3bf7gab5790d0b5fbaec8@mail.gmail.com> On Mon, Nov 24, 2008 at 10:36 AM, Noel Welsh wrote: > SchemeUnit is fairly clean, and the basic model is simple. Highlights: > > - the text-ui uses a monad to accumulate data Why does it use a monad? From grettke at acm.org Mon Nov 24 12:17:19 2008 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:34:10 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> <756daca50811240834y3a4ac513r308be8bfdfb6046a@mail.gmail.com> Message-ID: <756daca50811240917ud513ba0icc3eb5f3e20f2643@mail.gmail.com> On Mon, Nov 24, 2008 at 10:38 AM, Noel Welsh wrote: > Basically, SchemeUnit could be easily ported to other Schemes (a while > ago I ported it to SISC), but I haven't the need and no-one has either > done so, or harassed me enough to make me do so, so I guess there > isn't the demand. In *theory* it would be "interesting" to port it to R6RS. I won't claim anything more specific than that for now. From noelwelsh at gmail.com Mon Nov 24 12:25:06 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:10 2009 Subject: [plt-scheme] lambda-apply-values In-Reply-To: <756daca50811240916m52f3bf7gab5790d0b5fbaec8@mail.gmail.com> References: <595b9ab20811210407w45851bd5kc16ba9af869dd182@mail.gmail.com> <756daca50811211231k7cbb1914icd7ac36681b24790@mail.gmail.com> <595b9ab20811211638k3f2934e5yc75b92f93fbebe5f@mail.gmail.com> <756daca50811240916m52f3bf7gab5790d0b5fbaec8@mail.gmail.com> Message-ID: On Mon, Nov 24, 2008 at 5:16 PM, Grant Rettke wrote: > On Mon, Nov 24, 2008 at 10:36 AM, Noel Welsh wrote: >> SchemeUnit is fairly clean, and the basic model is simple. Highlights: >> >> - the text-ui uses a monad to accumulate data > > Why does it use a monad? > To hide the accumulator. N. From esmith at acanac.net Mon Nov 24 12:48:30 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:34:10 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> Message-ID: <492AE8EE.1000902@acanac.net> Matt Jadud wrote: > On Sun, Nov 23, 2008 at 4:58 PM, Ernie Smith wrote: >> options which can cover the range of circumstances, including across >> different versions of PLT scheme, across different scheme implementations, >> across different developments and target environments, and across different >> size of project. > > Can you be more precise? Because in the Scheme world, that particular > list of requirements usually ends with a request for a pony, too. Or Thanks for your contribution. I've distilled it to: Use Schemeunit if sticking to a single Version of PLT. Otherwise maybe not, maybe SRFI-78. Regarding your remark, As I said in the initial post. I can't be precise. I'm looking for insight I don't already have. Programmers, myself included, allways have difficulty offering insight, I think it is something to do with fear of saying something which may appear wrong in some context, in front of one's peers. So I fully appreciate your appeal for more precision despite my attempt to divert it by admitting my lack of precision up front. I'll post a more pedantic but no more precise try at my question in the hope that it will belay more appeals for precision: Question: I like to unit test code. That goes triple for untyped interpretive languages. Code I write tends to have a lot of test baggage which goes with it. When I re-use such code, the test-cases are as important as the code, if not more so. At the end of a long time, working in scheme, I expect to have a lot of pieces of code I may want to re-use, in a context that I do not yet know. What insight can more experienced scheme coders give me concerning minimizing the impact of test-cases on the re-usability of the code. For example, the ideal to strive for might be that test-cases add nothing to the port problem. Are there more experienced schemers who have a similar propensity to write test cases and re-use code, and who have learned some insights about this that they feel inclined to share. From kbohdan at mail.ru Mon Nov 24 14:54:15 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:34:11 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: Robby Findler wrote: > Folks, > > At the risk of repeating myself, core PLT members have put in a huge > amount of effort into R6RS already. I think it is time to stop telling > us how more would be better and instead step up and contribute. How to do it? How can *I* help ? Honestly estimating my Scheme experience I should recognize that port of the scheme core is still out of my possibilities by now, but allowing me to port some library can be very helpful for me from educational perspective. PS: Please do not accept all this noise a trial to tell you what to do. My feeling is that at least most of r6rs folks are trying to help, but they do not know *how*? -- Bohdan From ce.rohan at gmail.com Mon Nov 24 15:33:10 2008 From: ce.rohan at gmail.com (Rohan Golwala) Date: Thu Mar 26 02:34:11 2009 Subject: [plt-scheme] Working with database using scheme language Message-ID: Hi, I have set up a connection to the database using postgreSQL but I have a few questions while running the following queries: > (send a-connection map a-statement *proc*) map : Statement (field ... -> 'a) -> (list-of 'a) Executes a SQL query and applies the given function to the contents of each row, returning a list of results. > (send a-connection for-each a-statement *proc)* for-each : Statement (field ... -> void) -> void Executes a SQL query and applies the given function to the contents of each row, discarding the results. > (send a-connection mapfilter a-statement *map-proc* *filter-proc*) mapfilter : Statement (field ... -> 'a) (field ... -> boolean) -> (list-of 'a) Like 'map', but applies the map procedure (given first) to only those rows which satisfy the given predicate (given second). > (send a-connection fold a-statement *proc* init) fold : Statement ('a field ... -> 'a) 'a -> 'a What should be the structure of the proc...? Can you send me one entire example which explains the use of "*proc*" as well as "map-proc" and "filter-proc" and their structure or the body of these functions....? Any help would be much appreciated. -- Rohan.B.Golwala -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081124/1646aff0/attachment.html From sk at cs.brown.edu Mon Nov 24 15:56:13 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:34:11 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: Folks, Could those of you posting to it kindly state what it is you *want*? If there is a specific platform that *you use* and would like to see a port to, please name it. (We're aware of cell phones and already have a working preliminary compiler, with work actively under way, so you can skip that.) If there is a specific R6RS primitive missing, please *name it*. If it's that you are trying to program exclusively in R6RS and are being forced to use features not in it, please explain why. If it is the long-term survivability of your code, I think we've seen several responses to that already. Beyond that, this thread baffles me. In the past 7 years, I've advised the students who made three significant PLT code base efforts: the Web infrastructure, FrTime, and some aspects of debugging. (That's not even counting applications like Continue or XeLda, or frameworks like DrOCaml.) None of these would have been possible, at least in their present form, in R6RS alone. What would you like us to have done? Not written them at all? At least from some of you (perhaps only one of you), the disappointment seems to be that all the modules in DrScheme weren't immediately rewritten to be in R6RS. Would you like to volunteer to rewrite them (and how will you rewrite the numerous ones that use features not in R6RS)? And if not, who do you expect to do it? R6RS has already seen lots of contribution from PLT folks, at least a proportional amount. We're not out to sabotage the process. But we also have to balance our expectations for R6RS with our personal desire to make progress. Shriram From vyzo at media.mit.edu Mon Nov 24 16:09:21 2008 From: vyzo at media.mit.edu (Dimitris Vyzovitis) Date: Thu Mar 26 02:34:11 2009 Subject: [plt-scheme] exact/inexact and other r6rs prims in scheme/base In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: On Mon, 24 Nov 2008, Shriram Krishnamurthi wrote: > If there is a specific R6RS primitive missing, please *name it*. Actually, it would be nice to have exact/inexact (instead of exact->inexact and inexact->exact) and the fx/fl primitives in scheme/base -- vyzo PS: I am not among those bitching about the r6rs situation, your message just prompted me to point this out. From kbohdan at mail.ru Mon Nov 24 16:31:30 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:34:12 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: Shriram Krishnamurthi wrote: > At least from some of you (perhaps only one of you), the > disappointment seems to be that all the modules in DrScheme weren't > immediately rewritten to be in R6RS. > Would you like to volunteer to rewrite them Yes -- Bohdan From jensaxel at soegaard.net Mon Nov 24 17:01:12 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:34:12 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: <492B2428.7090800@soegaard.net> kbohdan@mail.ru wrote: > Shriram Krishnamurthi wrote: > >> At least from some of you (perhaps only one of you), the >> disappointment seems to be that all the modules in DrScheme weren't >> immediately rewritten to be in R6RS. Would you like to volunteer to >> rewrite them > > Yes If you are serious, then start here: http://docs.plt-scheme.org/mzlib/index.html -- Jens Axel S?gaard From jensaxel at soegaard.net Mon Nov 24 17:08:17 2008 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:34:12 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <492B2428.7090800@soegaard.net> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> <492B2428.7090800@soegaard.net> Message-ID: <492B25D1.3050001@soegaard.net> Jens Axel Soegaard wrote: > kbohdan@mail.ru wrote: >> Shriram Krishnamurthi wrote: >> >>> At least from some of you (perhaps only one of you), the >>> disappointment seems to be that all the modules in DrScheme weren't >>> immediately rewritten to be in R6RS. Would you like to volunteer to >>> rewrite them >> >> Yes > If you are serious, then start here: > > http://docs.plt-scheme.org/mzlib/index.html But wait - I have a better project for a rainy day: Implement pbm support for image-snip%. Reason: A Gnuplot without png or gif support can output pbm files, and thus with pbm support in image-snip% we can see the result directly in DrScheme. http://en.wikipedia.org/wiki/Portable_pixmap -- Jens Axel S?gaard From chust at web.de Mon Nov 24 17:31:26 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:34:12 2009 Subject: [plt-scheme] Working with database using scheme language In-Reply-To: References: Message-ID: <492B2B3E.2070208@web.de> Rohan Golwala schrieb: > [...] > I have set up a connection to the database using postgreSQL but I have a > few questions while running the following queries: > [...] Hello, maybe it will help you to read the documentation of the map, for-each and filter procedures in the PLT's core scheme, since the methods in spgsql are modelled after those primitives. map and for-each simply apply the given procedure to all the values from each database row and either collect the results in a list or discard them. mapfilter checks whether the filter procedure applied to the row returns a true result before it applies the other procedure. If you simply want to see the data returned by a query, the most obvious first choice is to pass list as the procedure argument to the map method. cu, Thomas From ryanc at ccs.neu.edu Mon Nov 24 18:19:32 2008 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:34:12 2009 Subject: [plt-scheme] Working with database using scheme language In-Reply-To: References: Message-ID: On Nov 24, 2008, at 3:33 PM, Rohan Golwala wrote: > Hi, > > I have set up a connection to the database using postgreSQL but I > have a few questions while running the following queries: > > > (send a-connection map a-statement proc) > map : Statement (field ... -> 'a) -> (list-of 'a) > > Executes a SQL query and applies the given function to the contents > of each row, returning a list of results. > > > (send a-connection for-each a-statement proc) > for-each : Statement (field ... -> void) -> void > > Executes a SQL query and applies the given function to the contents > of each row, discarding the results. > > > (send a-connection mapfilter a-statement map-proc filter-proc) > mapfilter : Statement (field ... -> 'a) (field ... -> boolean) -> > (list-of 'a) > > Like 'map', but applies the map procedure (given first) to only > those rows which satisfy the given predicate (given second). > > > (send a-connection fold a-statement proc init) > fold : Statement ('a field ... -> 'a) 'a -> 'a > > What should be the structure of the proc...? Can you send me one > entire example which explains the use of "proc" as well as "map- > proc" and "filter-proc" and their structure or the body of these > functions....? spgsql comes with a sample script that has a few examples of using the higher-order query methods (map, mapfilter, fold) about halfway through. You can look at it online at this address: http://planet.plt-scheme.org/package-source/schematics/spgsql.plt/2/2/samples/sample1.ss -- Here's some more explanation (with untested examples): For the 'map' method, the procedure should take as many arguments as there are fields in the query result. For example, suppose that you have the following table: CREATE TABLE Person (name TEXT, city TEXT, age INTEGER) INSERT INTO Person VALUES ('Bill', 'Boston', 7) INSERT INTO Person VALUES('Mary', 'Seattle', 8) and suppose you want to generate a report that says how old everyone is. You might write this query using the 'map' method: > (send my-connection map "SELECT name, age FROM Person" (lambda (name age) (format "~a is ~a years old" name age))) and you might get a result like this: (list "Bill is 7 years old" "Mary is 8 years old") The 'for-each' method is similar to 'map', but it executes the procedure for effect rather than gathering the resulting values in a list. Here's how you might use it: > (send my-connection for-each "SELECT name, age FROM Person" (lambda (name age) (printf "~a is ~a years old" name age))) and it would print out these lines: Bill is 7 years old Mary is 8 years old The 'fold' method, instead of accumulating the results into a list, lets you control the accumulator yourself. Unlike the other methods, the procedure takes one more argument than the number of fields returned by the query: the first argument is the previous accumulator value, and the first field is the second argument. For example, to compute the total age of people in the table, you could do this: > (send my-connection fold "SELECT name, age FROM Person" (lambda (total-age-so-far name age) (+ total-age-so-far age)) 0) 15 Of course, that particular task would be better accomplished thus: > (send my-connection query-value "SELECT SUM(age) FROM Person") 15 But you might have cases where you need to do the processing in Scheme. Ryan From jadudm at gmail.com Mon Nov 24 18:52:26 2008 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:34:12 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: <492AE8EE.1000902@acanac.net> References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> <492AE8EE.1000902@acanac.net> Message-ID: On Mon, Nov 24, 2008 at 12:48 PM, Ernie Smith wrote: > Regarding your remark, > As I said in the initial post. I can't be precise. > I'm looking for insight I don't already have. Hi Ernie, I hope I didn't come across as snarky. Your clarification helped a great deal. That is, it became more clear as to exactly why you weren't able to be precise. (And if that isn't clear...) We'll see if others chime in on the thread. Because my programming time is limited, it is often very task-focused. Ten years ago, I decided to simply choose the one Scheme implementation (PLT) and stick with it. I haven't looked back since. My most visible hacking is in relation to a language/virtual machine project, where the linker and various supporting tools are written in PLT Scheme. They all can be compiled to bundled executables for all major operating systems, and therefore PLT Scheme meets all of my needs. I can develop on my Mac, and deploy bundles for Windows, Linux, and Mac. Hence, my limited needs are met. Until such time as the PLT project "folds," and another Scheme makes it "obsolete," I'm not (personally) concerned about writing R6RS portable code to protect myself against an unknown future. (You decide what the scare-quoted words mean to you. Given that PLT Scheme is open, these aren't actual concerns.) Again, thank you for the clarification. Cheers, Matt From esmith at acanac.net Mon Nov 24 20:30:55 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:34:13 2009 Subject: [plt-scheme] Re: PLT R6RS questions and answers (renamed thread) In-Reply-To: <20081125092354.GC6638@topoi.pooq.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> <20081125092354.GC6638@topoi.pooq.com> Message-ID: <492B554F.9020804@acanac.net> I'm taking the liberty of trying to restart the other thread. Because I'm tired of being bombarded with a sensational seemingly derogatory subject line. derogatory to both PLT and R6Rs. Neither of which deserve it. Please start a new thread or reply to this one instead. From sk at cs.brown.edu Mon Nov 24 21:30:17 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:34:13 2009 Subject: [plt-scheme] Re: PLT R6RS questions and answers (renamed thread) In-Reply-To: <492B554F.9020804@acanac.net> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> <20081125092354.GC6638@topoi.pooq.com> <492B554F.9020804@acanac.net> Message-ID: Actually, it would be better if we didn't have another "thread", but focused on concrete issues. As Robby said, "I think it is time to stop telling us how more would be better and instead step up and contribute". Shriram From hendrik at topoi.pooq.com Tue Nov 25 15:34:39 2008 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:34:13 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: <20081125203439.GA8143@topoi.pooq.com> On Mon, Nov 24, 2008 at 03:56:13PM -0500, Shriram Krishnamurthi wrote: > Folks, > > Could those of you posting to it kindly state what it is you *want*? > > If there is a specific platform that *you use* and would like to see a > port to, please name it. (We're aware of cell phones and already have > a working preliminary compiler, with work actively under way, so you > can skip that.) I use the Nokia N800, and I'd like PLT SCheme to work on it. I've mentioned this elsewhere, but I have no idea whether it would be usable in 256M of RAM (that's foe everything, including the OS, the UI graphics buffers, etc.) -- hendrik From sk at cs.brown.edu Mon Nov 24 22:08:55 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:34:13 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <20081125203439.GA8143@topoi.pooq.com> References: <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> <20081125203439.GA8143@topoi.pooq.com> Message-ID: > I use the Nokia N800, and I'd like PLT SCheme to work on it. Sorry, I initially ignored this thinking it was another cell phone. Now I see it's not. The cross-compiler for cell-phones ought to generate code for this platform (or at least get you close). As for running Scheme directly on it, that's another matter, and I have no idea. Maybe someone who has an N800 would be willing to try running the build process for MzScheme on it and seeing how that works out. (Are you sure you want to enter programs on that thing?) Shriram From esmith at acanac.net Mon Nov 24 23:47:56 2008 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:34:13 2009 Subject: [plt-scheme] Re: PLT R6RS questions and answers (renamed thread) In-Reply-To: <20081125092354.GC6638@topoi.pooq.com> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> <20081125092354.GC6638@topoi.pooq.com> Message-ID: <492B837C.2010007@acanac.net> hendrik@topoi.pooq.com wrote: > On Mon, Nov 24, 2008 at 09:19:27AM -0600, Robby Findler wrote: >> Folks, >> >> At the risk of repeating myself, core PLT members have put in a huge >> amount of effort into R6RS already. I think it is time to stop telling >> us how more would be better and instead step up and contribute. > > Indeed. Although the R6RS-only fanatics seem to be arguing that less is > better. Still, I expect de-facto portability could also be achieved by > porting PLT Scheme to more platforms. I have no idea how many platforms > provide PLT Scheme at the moment, nor how difficult that is Portability is a trait. Dont think of it as merely the concern with getting program A to work on Congiguration B, of getting the game you are working on to run on a Mac and PC. Think of it as a quality of a program, or a function, that governs its re-usability. If you blindly use whatever falls out of your next search each time you accomplish something, before too long you have created re-usability grid-lock. So some people seek ways to keep baggage acquisition within predictable and manageable limits. That is not fanaticism, that is craftsmanship. From DekuDekuplex at Yahoo.com Mon Nov 24 23:50:15 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:34:13 2009 Subject: [plt-scheme] Re: The Philosophy of DrScheme References: <756daca50811211340o2b50303ck6bec191de87338fd@mail.gmail.com> <756daca50811211340o2b50303ck6bec191de87338fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> <49274148.4090700@uwaterloo.ca> Message-ID: <2tvmi4pbovk1kn1vlf5pm93qsn2ibsb8um@4ax.com> On Fri, 21 Nov 2008 18:16:24 -0500, Prabhakar Ragde wrote: >Grant wrote: > >> I'm not sure why DrScheme is so under-appreciated. Perhaps people are >> not familiar. Is there some philosophy about how it works that users >> would find interesting? > >You know the saying about how the measure of a society is how it treats >its weakest members? (It seems to have been said by just about >everybody, so you've probably heard it, maybe even said it yourself.) > >To this external observer, it appears that the philosophy behind >DrScheme is to focus on how it treats its weakest users... while not >neglecting its strongest users. This is pretty rare among software >developers, if you ask me. Perhaps at least part of the philosophy for DrScheme parallels the philosophy behind HtDP, outlined in the paper "The Structure and Interpretation of the Computer Science Curriculum" (see http://www.ccs.neu.edu/scheme/pubs/jfp2004-fffk.pdf). Specifically (p. 8: Section 3.3: Programming Environments): >The choice of language for a first-year course isn$B!G(Bt just about the linguistics; it >must also take into account the programming environment. After all, developing >and running a program means more than just writing correct code. It requires >support for editing; compiling and running programs; understanding how a program >is evaluated; and so on. > Like the language, we believe that the programming environment for the first >course should be a lightweight, easy-to-use tool. That is, it should provide just >enough to edit and execute functions and programs, plus some tools for under- >standing fundamental concepts, e.g., lexical scope and program reduction. Every- >thing else should be hidden from the student. > We believe that the lack of such a programming environment hurt the SICP >approach of teaching and the functional community in general. For that reason, we >have produced a programming environment that supports teaching program design >principles with Scheme (Findler et al., 2002). Others have had similar insights and >have produced alternative environments independently (Schemer$B!G(Bs Inc., 1991). >Grant wrote: > >And at least part of the disdain some feel for DrScheme is related to it >not pandering excessively to the strong to the extent of driving away >the weak. --PR Perhaps, but some also feel respect for DrScheme for not pandering excessively to this trend. It is precisely this driving away of the weak which causes some to write such essays as "Why Johnny Can't Code" (see http://www.salon.com/tech/feature/2006/09/14/basic/index.html). -- Benjamin L. Russell From DekuDekuplex at Yahoo.com Mon Nov 24 23:57:36 2008 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:34:14 2009 Subject: [plt-scheme] Re: The Philosophy of DrScheme References: <756daca50811211340o2b50303ck6bec191de87338fd@mail.gmail.com> <756daca50811211340o2b50303ck6bec191de87338fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> <49274148.4090700@uwaterloo.ca> <2tvmi4pbovk1kn1vlf5pm93qsn2ibsb8um@4ax.com> Message-ID: <261ni4t0ai4dg3kbjf9a03u0minn8ca1m1@4ax.com> Sorry, in my previous post in this thread, I had erroneously mis-attributed part of my quoted text. The following portion: >>Grant wrote: >> >>And at least part of the disdain some feel for DrScheme is related to it >>not pandering excessively to the strong to the extent of driving away >>the weak. --PR should have been attributed as follows: >On Fri, 21 Nov 2008 18:16:24 -0500, Prabhakar Ragde > wrote: >> >>And at least part of the disdain some feel for DrScheme is related to it >>not pandering excessively to the strong to the extent of driving away >>the weak. --PR My apologies. -- Benjamin L. Russell From thomas.gordon at fokus.fraunhofer.de Tue Nov 25 04:39:49 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:14 2009 Subject: [plt-scheme] Re: PLT R6RS questions and answers (renamed thread) In-Reply-To: <492B554F.9020804@acanac.net> References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> <20081125092354.GC6638@topoi.pooq.com> <492B554F.9020804@acanac.net> Message-ID: Hendrik wrote: > Indeed. Although the R6RS-only fanatics seem to be arguing that less > is better. Still, I expect de-facto portability could also be > achieved by porting PLT Scheme to more platforms. I have no idea how > many platforms provide PLT Scheme at the moment, nor how difficult > that is. - hendrik We R6RS "fanatics" want more, not less: more portable libraries, more choices of implementations, more indepedence, and more assurance that our investment will not be lost if one of the implementations stops being maintained for whatever reason. Also, it seems ironic to be accused wanting a small langauge, given all the criticism R6RS has received from R5RS fans, who think R6RS has become too large and too much like Common Lisp. PLT already supports enough platforms, at least for me. That's not an issue for me. -Tom From thomas.gordon at fokus.fraunhofer.de Tue Nov 25 05:01:06 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:14 2009 Subject: [plt-scheme] Re: PLT R6RS questions and answers In-Reply-To: References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> Message-ID: <8EF93349-13D0-4B27-A37C-6E30C4102E07@fokus.fraunhofer.de> On Nov 24, 2008, at 5:41 PM, Matthias Felleisen wrote: >> PLT's support for R6RS seems somewhat half-hearted and ambiguous. > > Tom, I reject this as unfair. Compare our implementation to those of > others, and we are ahead still. Matthew provides test suits for R6RS > and friends, which others borrow to develop their own R6RS > implementations. Why should we do more than those people? But > perhaps you're really requesting that PLT stay away from RnRS > efforts. -- Matthias Dear Matthias, I'm sorry you feel this way. I'm trying to be fair and have already said that I think I understand your dilemma, as researchers, between wanting both to support standards like R6RS while at the same time being innovative and pushing the envelope. I appreciate your work and do not feel it is my place to suggest what your priorities should be. I can try to give you, as a PLT user, some constructive feedback and let you know more about our requirements and preferences. I don't know what people you are talking about, who you claim are doing less than the PLT team to support R6RS. For my part, and my colleagues, we took the effort to port our entire system to from PLT Scheme to R6RS. This involved porting, or helping to port, a number of SRFIs, the SSAX and SXML libraries, the PSTK (Tcl/TK graphics library) and some other stuff to R6RS and make this code available to others . The lack of sufficient interoperability between PLT modules and R6RS libraries, in particular the problem with immutable PLT lists, made it necessary for us to port libraries, such as the SSAX library, which are already available for PLT. (But I do not want to complain about this, because it gave us the incentive to begin porting the libraries we need to R6RS.) Is the PLT Team planning to port any of its modules to R6RS libraries, or find a way to compile PLT modules to R6RS libraries? Are you planning to use R6RS when developing new libraries? In other words, does the PLT Team intend to participate in the effort to create a large collection of freely available and portable R6RS libraries, which would benefit the larger community of all R6RS users, and not just the PLT Scheme community? I do not feel you have any obligation or commitment to take part in this effort. I just would be grateful if you would share your vision and plans with us. I guess we all want Scheme to succeed. And there may be various paths to success. One model is the one taken by the Python and Perl communities: one implementation (more or less) the most recent version of which always serves as the de facto standard. Another model is based on an open, evolving standard, such as the RnRS series, with lots of different implementations. I had thought PLT was commited to working with other Scheme implementators on this second approach. But now I'm not so sure. Yours, Tom From noelwelsh at gmail.com Tue Nov 25 05:05:40 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:14 2009 Subject: [plt-scheme] Re: General advice on what to use for unit testing In-Reply-To: <492AE8EE.1000902@acanac.net> References: <2237F145-B67A-4EE3-98A1-92D6BDA2AE18@brinckerhoff.org> <4929D207.7090002@acanac.net> <492AE8EE.1000902@acanac.net> Message-ID: On Mon, Nov 24, 2008 at 5:48 PM, Ernie Smith wrote: > > For example, the ideal to strive for might be that test-cases add nothing to > the port problem. Are there more experienced schemers > who have a similar propensity to write test cases and re-use code, > and who have learned some insights about this that they feel > inclined to share. > There is no port problem. The small view is this: SchemeUnit can be made to work on any Scheme distribution with minor changes. It has no significant dependencies on non-standard features. The large view is this: history offers plenty of examples of projects that have failed due to excessive scope. In the computing world, GNU Hurd and TUNES are two examples of failures due to the desire to be everything resulting in nothing getting done. I strongly emerge you to concentrate on solving your immediate problem rather than worrying about what you might want to do in a future you cannot predict. N. From thomas.gordon at fokus.fraunhofer.de Tue Nov 25 05:08:32 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:14 2009 Subject: [plt-scheme] Re: PLT R6RS questions and answers (renamed thread) In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> <20081125092354.GC6638@topoi.pooq.com> <492B554F.9020804@acanac.net> Message-ID: <482861B5-43C2-4785-8090-79369B8CB800@fokus.fraunhofer.de> On Nov 25, 2008, at 3:30 AM, Shriram Krishnamurthi wrote: > Actually, it would be better if we didn't have another "thread", but > focused on concrete issues. As Robby said, "I think it is time to > stop telling us how more would be better and instead step up and > contribute". Lots of people, inside and outside the PLT Scheme community, have been contributing to the R6RS effort. I am aware of about 6 implementations of R6RS Scheme, in various states of completion: PLT, Ikarus, Larceny, Ypsilon, Mosh and IronScheme. And most of these implementations are focused on R6RS. Their developers contribute portable R6RS libraries to the larger community. Others have been busy porting SRFIs and other code to R6RS. (Myself included.) I just wish that more members of the PLT community would begin and effort to port their libraries to R6RS, and choose to develop new libraries, whenever feasible in R6RS, rather than some dialect supported only by the PLT implementation. (Not that there may not be good reasons for doing this on occasion.) -Tom From thomas.gordon at fokus.fraunhofer.de Tue Nov 25 05:18:37 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:14 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: On Nov 24, 2008, at 4:31 PM, Doug Williams wrote: > ... For my big packages like the science and simulation collections, > I separated out the graphics (which is almost certainly not > portable) and the base functionality (which probably could be > ported) when I developed them. It hasn't been important for me to > convert them to R6RS since I obviously use PLT Scheme. ... > > Is there a real advantage to the Scheme community at large or the > PLT Scheme community in general in creating R6RS versions of these > packages? In my opinion, yes! There are huge advantages. Your libraries could be used by users of other R6RS implementations, such as Ikarus, Larceny, and Ypsilon. And some users may find that one of these other implemenations bettter fits their requirements. Ikarus is faster. Ypislon is lighter weight and appears to require less memory. In other words, by porting your libraries to R6RS, you would be providing a great service to a larger number of people. -Tom From thomas.gordon at fokus.fraunhofer.de Tue Nov 25 05:37:42 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:15 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> Message-ID: Dear Grant, > It has been discussed before that Scheme is an experiment, it is an > idea that has spawned many Scheme-like languages, since there is no > one definition. One goal of a developing a standard such as R6RS is to try to get all the stakeholders together with the aim of developing a one definition, with the hope, if not expectation, that this will led to some convergence and reduction of unnecessary, indeed counterproductive, diversity. > Roughly, these are dialects. R6RS is one dialect in > which you are interested, I am too. Not all dialects are equal. R6RS is a standard. Arguably *the* standard. > Look at PLT, though, it support a *lot* of dialects. That is the > philosophy behind it. The philosophy is > not to push one single philosophy. I think this philosophy is really great for two purposes: 1) providing support for legacy code, and 2) experimenting with new dialects which can help us to gain the experience need to evolve the standard further. What I'm not too happy about, is the choice of the PLT team to develop and publish a new Scheme dialect which overlaps with R6RS, rather than building on or extending it, just *after* R6RS became ratified. I would much have prefered that R6RS had first been given a longer period of time to become established and waited a bit for feedback from users on their experiences with using R6RS, and use this feedback to build experimental extensions to R6RS which are feed into the development of R7RS. > All of the maintainers have their own interests in particular dialects > that meet their needs (Typed, HtDP, #scheme...), so it is unfair of us > to expect them to push a single dialect. That is just not the spirit > of Scheme, anyway. HtDP needs to be supported, because it is used for courses and one can't expect the book to be rewritten anytime soon. Fine. Type Scheme is a nice experimental language. I really appreciate this effort. But I would have appreciated it even more if it had been developed as an extension of R6RS. > DrScheme can be used perfectly well for writing R6RS code and > reading the documentation. Everything "just works". It is awesome > for R6RS. Here I have to disagree a bit. PLT is OK for developing R6RS code. I do this all the time. But it is not "awesome". Some features of the development environment don't work with R6RS code. Such as loading additional libraries into the "interactions" window. And many PLT modules cannot be used in R6RS programs, because of the incompatibility between mutable and immutable lists. (I've tried the suggested work around and do not find it sufficient.) A minor point: I also don't like R6RS lists being displayed with braces, {....}. Since the PLT lists are non-standard, it would have been better to have them displayed with the non-standard syntax. (I understand their is some way for me to change this behavior, but haven't figured it out yet.) Developing R6RS code using PLT makes me feel a bit like a second-class citizen. -Tom From thomas.gordon at fokus.fraunhofer.de Tue Nov 25 05:56:58 2008 From: thomas.gordon at fokus.fraunhofer.de (Tom Gordon) Date: Thu Mar 26 02:34:15 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <756daca50811191233v14c75118k11bee5503795bbab@mail.gmail.com> <58AF8BBA-07A6-42CD-B675-94D9F9351478@fokus.fraunhofer.de> <1227516625.26465.1286412943@webmail.messagingengine.com> <99E4AC8E-EDF8-43C0-9779-00C604CE8823@cs.indiana.edu> <1227529272.1535.1286439859@webmail.messagingengine.com> <20081125091429.GA6638@topoi.pooq.com> <932b2f1f0811240719t7ede913bp57f698403435ccd1@mail.gmail.com> Message-ID: <30432D92-C3AB-4645-BDC1-9671B8338739@fokus.fraunhofer.de> On Nov 24, 2008, at 9:56 PM, Shriram Krishnamurthi wrote: > Folks, > > Could those of you posting to it kindly state what it is you *want*? What I would like is for PLT to make R6RS the default language and make all the tools and libraries work well with R6RS programs. And I would like the PLT team to use R6RS when developing new libraries, whenever feasible. Of course it would also be nice if an effort was made to port exisiting PLT code to R6RS. But I appreciate that this would require a huge effort. I do not *expect*, let alone demand, any of this. But you asked what we *want*. > If there is a specific platform that *you use* and would like to see a > port to, please name it. No thank you. PLT supports enough platforms for my needs already. > If there is a specific R6RS primitive missing, please *name it*. Nope. Everything OK here. > If it's that you are trying to program exclusively in R6RS and are > being forced to use features not in it, please explain why. There are some things missing from R6RS that we need, but the ability to define system-specific implementations, using the foo.mzscheme.sls naming convention is sufficient. Nothing needed here. > ... In the past 7 years, I've advised the students who made three > significant PLT code base efforts: the Web infrastructure, FrTime, and > some aspects of debugging. (That's not even counting applications > like Continue or XeLda, or frameworks like DrOCaml.) None of these > would have been possible, at least in their present form, in R6RS > alone. What would you like us to have done? Not written them at all? No. Just write as much as you can in R6RS and isolate the code which depends on extensions in specific, system dependent libraries. If your project requires a completely different language than R6RS, well OK. Than use another language. > At least from some of you (perhaps only one of you), the > disappointment seems to be that all the modules in DrScheme weren't > immediately rewritten to be in R6RS. This wasn't *my* concern. But it would have been nice if it were possible to use PLT modules in R6RS libraries to a greater extent. Changing lists in PLT Scheme to be immutable came at an unfortunate time. And, again, it would have been nice if *new* PLT libraries were written in R6RS, but this does not seem to be your intention. > Would you like to volunteer to rewrite them (and how will you > rewrite the numerous ones that use > features not in R6RS)? And if not, who do you expect to do it? For our part, we have ported, or helped to port both our own code and the code others to R6RS. And we will continue to do so, as the need arises for our application. I don't expect anything from the PLT Team. Its up to you to set your own goals and priorities and I will respect them. > R6RS has already seen lots of contribution from PLT folks, at least > a proportional amount. We're not out to sabotage the process. But we > also have to balance our expectations for R6RS with our personal > desire to make progress. Surely no one on the PLT Team is intentional trying to "sabotage" the R6RS process. I don't recall anyone even suggesting this. But I do feel, sorry, that some of your choices recently tend to *undermine* R6RS and reduce its chance of succeeding as a standard. I don't think this was intentional. But can we now agree that this is in fact a risk? And if you care about R6RS, let's all work together to minimize this risk. -Tom From foolsmart2005 at gmail.com Mon Nov 24 01:50:00 2008 From: foolsmart2005 at gmail.com (SamuelXiao) Date: Thu Mar 26 02:34:15 2009 Subject: [plt-scheme] How to change the following code to make it handle nested lists? Message-ID: I have following code: (define (mysum list) (if (null? list) 0 (+ (car list) (mysum (cdr list))) ) ) It can handle the case summing up a list of numbers....however, I want to handle case like '(1 (2 3) 4), how can I make it? The code can handle (mysum '(1 2 3)) => 6, but when it comes to (mysum '(1 (2 3) 4))=>error. Any help would be appreciated. From eli at barzilay.org Tue Nov 25 07:28:20 2008 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:34:15 2009 Subject: [plt-scheme] How to change the following code to make it handle nested lists? In-Reply-To: References: Message-ID: <18731.61284.724754.733158@arabic.ccs.neu.edu> On Nov 23, SamuelXiao wrote: > I have following code: > > (define (mysum list) > (if (null? list) > 0 > (+ (car list) (mysum (cdr list))) > ) > ) > > It can handle the case summing up a list of numbers....however, I want > to handle case like '(1 (2 3) 4), how can I make it? > The code can handle (mysum '(1 2 3)) => 6, but when it comes to (mysum > '(1 (2 3) 4))=>error. Any help would be appreciated. (require scheme/list) (define (mysum list) (foldl + 0 (flatten list))) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From noelwelsh at gmail.com Tue Nov 25 07:30:49 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:15 2009 Subject: [plt-scheme] How to change the following code to make it handle nested lists? In-Reply-To: References: Message-ID: This reads like homework. If you're doing the HtDP curriculum, the answer is always "follow the design recipe". If your course is not following HtDP you might walk to talk to your instructor (or read HtDP). N. On Mon, Nov 24, 2008 at 6:50 AM, SamuelXiao wrote: > I have following code: ... > It can handle the case summing up a list of numbers....however, I want > to handle case like '(1 (2 3) 4), how can I make it? > The code can handle (mysum '(1 2 3)) => 6, but when it comes to (mysum > '(1 (2 3) 4))=>error. Any help would be appreciated. From geoff at knauth.org Tue Nov 25 07:52:21 2008 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:34:15 2009 Subject: [plt-scheme] How to change the following code to make it handle nested lists? In-Reply-To: References: Message-ID: <1227617541.3162.1286660269@webmail.messagingengine.com> On Sun, 23 Nov 2008 22:50:00 -0800 (PST), "SamuelXiao" said: > > (define (mysum list) > (if (null? list) > 0 > (+ (car list) (mysum (cdr list))))) > > It can handle the case summing up a list of numbers....however, I want > to handle case like '(1 (2 3) 4), how can I make it? > The code can handle (mysum '(1 2 3)) => 6, but when it comes to (mysum > '(1 (2 3) 4))=>error. Any help would be appreciated. In your first example, everything in your list was a number. In your second example, the list contained a number, a list, and another number. The first call sees: '(1 (2 3) 4) It adds 1 to (mysum '((2 3) 4)) The second call sees: '((2 3) 4) It tries to add '(2 3) to (mysum '(4)) but + was expecting a number, not the list '(2 3) + generated the error. + got a list because (car '((2 3) 4)) turned out not to be a number. There could have been a check at that point. Put another way, do not call + unless every argument is (or will be) a number. Do you know about cond? Have you seen this before? (cond ((empty? L) ...) ((pair? L) ...) ((number? L) ...) (else ...)) Have you read How to Design Programs (HtDP)? If so, it would help to know where you are in the book, because then it is clear what you have seen so far. If not, reading HtDP teaches you how to handle situations like this and many others, so that instinctively you just do the right thing. It is online at: http://www.htdp.org/ -- Geoffrey S. Knauth | http://knauth.org/gsk From morazanm at gmail.com Tue Nov 25 08:46:28 2008 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:34:15 2009 Subject: [plt-scheme] How to change the following code to make it handle nested lists? In-Reply-To: References: Message-ID: <9b1fff280811250546p31c66e52jee0e03c366712bc8@mail.gmail.com> On Mon, Nov 24, 2008 at 1:50 AM, SamuelXiao wrote: > I have following code: > > (define (mysum list) > (if (null? list) > 0 > (+ (car list) (mysum (cdr list))) > ) > ) > So, by looking at the above code the parameter, list, is a list-of-numbers defined as: 1. empty OR 2. (cons n L), where n is a number and L is a list-of-numbers. > to handle case like '(1 (2 3) 4), how can I make it? '(1 (2 3) 4) is *NOT* a list-of-numbers. Define this type of data as list-of-numbers above and it should become clear how to solve your problem. -- Cheers, Marco From samth at ccs.neu.edu Tue Nov 25 09:10:49 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:34:16 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> Message-ID: <63bb19ae0811250610g5ca87634q32b65c958328a79@mail.gmail.com> On Tue, Nov 25, 2008 at 5:37 AM, Tom Gordon wrote: > Dear Grant, >> Look at PLT, though, it support a *lot* of dialects. That is the >> philosophy behind it. The philosophy is >> not to push one single philosophy. > > I think this philosophy is really great for two purposes: 1) providing > support for legacy code, and 2) experimenting with new dialects which can > help us to gain the experience need to evolve the standard further. > > What I'm not too happy about, is the choice of the PLT team to develop and > publish a new Scheme dialect which overlaps with R6RS, rather than building > on or extending it, just *after* R6RS became ratified. I would much have > prefered that R6RS had first been given a longer period of time to become > established and waited a bit for feedback from users on their experiences > with using R6RS, and use this feedback to build experimental extensions to > R6RS which are feed into the development of R7RS. PLT Scheme was not created new just after the R6RS. PLT version 4 makes some minor and some major changes to the language, but it is fundamentally the same language that it has been for many years. >> All of the maintainers have their own interests in particular dialects >> that meet their needs (Typed, HtDP, #scheme...), so it is unfair of us >> to expect them to push a single dialect. That is just not the spirit >> of Scheme, anyway. > > HtDP needs to be supported, because it is used for courses and one can't > expect the book to be rewritten anytime soon. Fine. > > Type Scheme is a nice experimental language. I really appreciate this > effort. But I would have appreciated it even more if it had been developed > as an extension of R6RS. I hope you appreciate that this is not actually possible. Please see my paper with Ryan Culpepper and Matthew Flatt in the Scheme Workshop last year for the implementation details, very few of which can be done in R6RS. Thanks, -- sam th samth@ccs.neu.edu From sbloch at adelphi.edu Tue Nov 25 09:21:22 2008 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:34:16 2009 Subject: [plt-scheme] How to change the following code to make it handle nested lists? In-Reply-To: References: Message-ID: At the risk of "me-too"-ism, you need to start by revising your data definition to include nested lists of numbers. Once you've done that, clearly and unambiguously, the structure of a function to work on such lists should fall out as naturally as did the flat-list-processing structure. Stephen Bloch sbloch@adelphi.edu From kbohdan at mail.ru Tue Nov 25 10:07:27 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:34:16 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <63bb19ae0811250610g5ca87634q32b65c958328a79@mail.gmail.com> References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> <63bb19ae0811250610g5ca87634q32b65c958328a79@mail.gmail.com> Message-ID: Sam TH wrote: > On Tue, Nov 25, 2008 at 5:37 AM, Tom Gordon > wrote: >> Type Scheme is a nice experimental language. I really appreciate this >> effort. But I would have appreciated it even more if it had been developed >> as an extension of R6RS. > > I hope you appreciate that this is not actually possible. Please see > my paper with Ryan Culpepper and Matthew Flatt in the Scheme Workshop > last year for the implementation details, very few of which can be > done in R6RS. I think Tom assumes corresponding extensions to R6RS core. Standard or de facto standard for Typed Scheme would be miracle. And such standardizing would be much easier if Typed Scheme is based *mostly* on R6RS. -- Bohdan From diggerrrrr at gmail.com Tue Nov 25 11:05:16 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:34:16 2009 Subject: [plt-scheme] scroll-event produce wrong direction? Message-ID: Hello , The code below captures the on-scroll event and outputs the direction. So when i run the program and continuously drag the vertical scrollbar the output produces "vertical" which is correct , but once i stop dragging the bar the last output is "horizontal" . Since i have enabled only vertical scrollbar , any reason for this? Code : (define a-frame (new frame% [label "Scrollbars"] [width 300] [height 300])) (define scroll-canvas% (class canvas% (super-new) (inherit get-dc) (define (char-height) (send (get-dc) get-char-height)) (define (page-unit) (inexact->exact (floor (/ (send this get-height) (char-height))))) (define/override (on-size w h) (send this set-scroll-page 'vertical (page-unit))) (define/override (on-scroll event) (printf "Direction : ~a\n" (send event get-direction))) (send this init-manual-scrollbars #f 100 1 (page-unit) 0 0) )) (define scroll (new scroll-canvas% [parent a-frame] [style '(vscroll)])) (send a-frame show #t) Thanks Veer From diggerrrrr at gmail.com Tue Nov 25 11:09:06 2008 From: diggerrrrr at gmail.com (Veer) Date: Thu Mar 26 02:34:16 2009 Subject: [plt-scheme] Re: scroll-event produce wrong direction? In-Reply-To: References: Message-ID: Sorry , i forgot to attach the output. Output: Direction : vertical Direction : vertical Direction : vertical Direction : vertical Direction : vertical Direction : vertical Direction : vertical Direction : vertical Direction : horizontal On Tue, Nov 25, 2008 at 9:35 PM, Veer wrote: > Hello , > > The code below captures the on-scroll event and outputs the direction. > So when i run the program and continuously drag the vertical scrollbar > the output produces "vertical" which is correct , but once i stop dragging > the bar the last output is "horizontal" . Since i have enabled only > vertical scrollbar , any reason for this? > > Code : > > (define a-frame > (new frame% > [label "Scrollbars"] > [width 300] > [height 300])) > > (define scroll-canvas% > (class canvas% > > (super-new) > (inherit get-dc) > > (define (char-height) > (send (get-dc) get-char-height)) > > (define (page-unit) > (inexact->exact > (floor (/ (send this get-height) (char-height))))) > > (define/override (on-size w h) > (send this set-scroll-page 'vertical (page-unit))) > > (define/override (on-scroll event) > (printf "Direction : ~a\n" (send event get-direction))) > > (send this init-manual-scrollbars #f 100 1 (page-unit) 0 0) > > )) > > (define scroll (new scroll-canvas% [parent a-frame] [style '(vscroll)])) > (send a-frame show #t) > > Thanks > Veer > From samth at ccs.neu.edu Tue Nov 25 11:19:19 2008 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:34:16 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> <63bb19ae0811250610g5ca87634q32b65c958328a79@mail.gmail.com> Message-ID: <63bb19ae0811250819u5846b14drd41a50fe4015ca3e@mail.gmail.com> On Tue, Nov 25, 2008 at 10:07 AM, wrote: > Sam TH wrote: >> >> On Tue, Nov 25, 2008 at 5:37 AM, Tom Gordon >> wrote: > > >>> >>> Type Scheme is a nice experimental language. I really appreciate this >>> effort. But I would have appreciated it even more if it had been >>> developed >>> as an extension of R6RS. >> >> I hope you appreciate that this is not actually possible. Please see >> my paper with Ryan Culpepper and Matthew Flatt in the Scheme Workshop >> last year for the implementation details, very few of which can be >> done in R6RS. > > I think Tom assumes corresponding extensions to R6RS core. > > Standard or de facto standard for Typed Scheme would be miracle. > And such standardizing would be much easier if Typed Scheme is > based *mostly* on R6RS. I really suggest you look at the paper. Typed Scheme doesn't rely on PLT specific extensions in the sense of an extra function here or there. It relies fundamentally on aspects of the PLT macro and module system that do not have analogues in the R6RS (such as the language position and #%module-begin). PLT Scheme, in a sense, *is* the extension needed to implement Typed Scheme. I think this really gets to the heart of the question under discussion. Some small modules in PLT Scheme could be ported to R6RS (scheme/bool, for example). But virtually anything that would be interesting relies fundamentally on the extensions that we've developed, and that we don't want to sacrifice in the name of portability. We do not see PLT as simply a mechanism for developing potential extensions to the R6RS. Thanks, -- sam th samth@ccs.neu.edu From kbohdan at mail.ru Tue Nov 25 11:43:03 2008 From: kbohdan at mail.ru (kbohdan@mail.ru) Date: Thu Mar 26 02:34:16 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: <63bb19ae0811250819u5846b14drd41a50fe4015ca3e@mail.gmail.com> References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> <63bb19ae0811250610g5ca87634q32b65c958328a79@mail.gmail.com> <63bb19ae0811250819u5846b14drd41a50fe4015ca3e@mail.gmail.com> Message-ID: Sam TH wrote: > I really suggest you look at the paper. Typed Scheme doesn't rely on > PLT specific extensions in the sense of an extra function here or > there. It relies fundamentally on aspects of the PLT macro and module > system that do not have analogues in the R6RS (such as the language > position and #%module-begin). PLT Scheme, in a sense, *is* the > extension needed to implement Typed Scheme. > > I think this really gets to the heart of the question under > discussion. Some small modules in PLT Scheme could be ported to R6RS > (scheme/bool, for example). But virtually anything that would be > interesting relies fundamentally on the extensions that we've > developed, and that we don't want to sacrifice in the name of > portability. We do not see PLT as simply a mechanism for developing > potential extensions to the R6RS. Thanks. Your answer greatly clarifies situation. -- Bohdan From robby at cs.uchicago.edu Tue Nov 25 11:48:48 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:17 2009 Subject: [plt-scheme] Re: Is R6RS useless for PLT? In-Reply-To: References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> <756daca50811240914y1d8ab99bx92749411d21b4bf6@mail.gmail.com> <63bb19ae0811250610g5ca87634q32b65c958328a79@mail.gmail.com> <63bb19ae0811250819u5846b14drd41a50fe4015ca3e@mail.gmail.com> Message-ID: <932b2f1f0811250848p313cfa1dube5425d17b243559@mail.gmail.com> Its time for me to tune of this conversation, but I think that Sam overstates the case a little bit. I'm sure there are modules that are interesting that could be ported. bye, Robby On Tue, Nov 25, 2008 at 10:43 AM, wrote: > Sam TH wrote: > >> >> I really suggest you look at the paper. Typed Scheme doesn't rely on >> PLT specific extensions in the sense of an extra function here or >> there. It relies fundamentally on aspects of the PLT macro and module >> system that do not have analogues in the R6RS (such as the language >> position and #%module-begin). PLT Scheme, in a sense, *is* the >> extension needed to implement Typed Scheme. >> >> I think this really gets to the heart of the question under >> discussion. Some small modules in PLT Scheme could be ported to R6RS >> (scheme/bool, for example). But virtually anything that would be >> interesting relies fundamentally on the extensions that we've >> developed, and that we don't want to sacrifice in the name of >> portability. We do not see PLT as simply a mechanism for developing >> potential extensions to the R6RS. > > Thanks. Your answer greatly clarifies situation. > > -- > Bohdan > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From michael at schuerig.de Tue Nov 25 11:53:18 2008 From: michael at schuerig.de (Michael Schuerig) Date: Thu Mar 26 02:34:17 2009 Subject: [plt-scheme] Differences between PLT and R6RS? Message-ID: <200811251753.18898.michael@schuerig.de> With all the current discussion about the differences between PLT and R6RS, has anyone compiled a list of what these differences actually are? And, on top of that, ways to emulate PLT-specifics using R6RS? As a beginning user of PLT scheme, I tend to an opportunistic position. I see the value of standard, R6RS, code, however, I have no qualms to take advantage of PLT-specific functionality where useful. Michael -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/ From noelwelsh at gmail.com Tue Nov 25 11:57:53 2008 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:34:17 2009 Subject: [plt-scheme] Differences between PLT and R6RS? In-Reply-To: <200811251753.18898.michael@schuerig.de> References: <200811251753.18898.michael@schuerig.de> Message-ID: Search the docs (doc.plt-scheme.org or your local install) for R6RS and you'll get some information. N. On Tue, Nov 25, 2008 at 4:53 PM, Michael Schuerig wrote: > > With all the current discussion about the differences between PLT and > R6RS, has anyone compiled a list of what these differences actually > are? And, on top of that, ways to emulate PLT-specifics using R6RS? > > As a beginning user of PLT scheme, I tend to an opportunistic position. > I see the value of standard, R6RS, code, however, I have no qualms to > take advantage of PLT-specific functionality where useful. > > Michael From pocmatos at gmail.com Tue Nov 25 14:54:19 2008 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:34:17 2009 Subject: [plt-scheme] Parser Tools group-id for tokens Message-ID: <11b141710811251154u65544170o4646e1520bd01dd@mail.gmail.com> Hi all, I am wondering why do we need to specify a group id for tokens? What's the usefulness of this group-id? Regards, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From sk at cs.brown.edu Tue Nov 25 15:23:21 2008 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:34:17 2009 Subject: [plt-scheme] Re: PLT R6RS questions and answers In-Reply-To: <8EF93349-13D0-4B27-A37C-6E30C4102E07@fokus.fraunhofer.de> References: <5D825541-931C-4B79-88F1-4315A26356F1@fokus.fraunhofer.de> <8EF93349-13D0-4B27-A37C-6E30C4102E07@fokus.fraunhofer.de> Message-ID: > Is the PLT Team planning to port any of its modules to R6RS > libraries, or find a way to compile PLT modules to R6RS libraries? > Are you planning to use R6RS when developing new libraries? In > other words, does the PLT Team intend to participate in the effort > to create a large collection of freely available and portable R6RS > libraries, which would benefit the larger community of all R6RS > users, and not just the PLT Scheme community? I don't speak for PLT Scheme, but I'll give you my educated guess: no. This is not a core priority. (Certainly isn't for any of the code we've written at Brown.) But all the code is public (and sitting on your filesystem). Several non-PLT people have made code contributions. You are welcome to do so in the form of porting and contributing back your ports. But, as I pointed out earlier and SamTH reinforced, an awful lot of code does make use of PLT-isms that do not translate to R6RS (certainly much of the code written at Brown is of this form), and I have no idea what you plan to do about those. We sure don't, which is why we have no plans to port. Shriram From ce.rohan at gmail.com Tue Nov 25 17:10:37 2008 From: ce.rohan at gmail.com (Rohan Golwala) Date: Thu Mar 26 02:34:18 2009 Subject: [plt-scheme] Application with Scheme Language Message-ID: Hi, I want to start building an application where I can create forms and controls such as buttons, textbox etc. and make the user enter data in that and store that in a database. I have achieved connection with a database and to run the simple querries but is there a way I can build this entire application. If anyone can help me it will be of great importance to me right now as I am working on a project.... Or please guide me from where should I start....? Thanks. -- Rohan. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20081125/914b1985/attachment.htm From czhu at cs.utah.edu Tue Nov 25 17:26:55 2008 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:34:18 2009 Subject: [plt-scheme] Application with Scheme Language In-Reply-To: References: Message-ID: <492C7BAF.9030908@cs.utah.edu> http://docs.plt-scheme.org/gui/index.html ? Rohan Golwala wrote: > Hi, > > I want to start building an application where I can create forms and > controls such as buttons, textbox etc. and make the user enter data in > that and store that in a database. I have achieved connection with a > database and to run the simple querries but is there a way I can build > this entire application. If anyone can help me it will be of great > importance to me right now as I am working on a project.... Or please > guide me from where should I start....? > > Thanks. > > -- > Rohan. > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From rob.hunter at gmail.com Tue Nov 25 17:33:24 2008 From: rob.hunter at gmail.com (Rob Hunter) Date: Thu Mar 26 02:34:18 2009 Subject: [plt-scheme] Application with Scheme Language In-Reply-To: References: Message-ID: You might want to take a look at LeftParen, which helps you write web apps in PLT Scheme. I have a tutorial up which shows how to write a simple blog web app, with persistent data, in 19 lines of code (http://planet.plt-scheme.org/package-source/vegashacker/leftparen.plt/2/2/planet-docs/leftparen/index.html#(part._.Blogerton_the_.Blog). Btw, a new version of the framework (0.4) is due out any day now. Feel free to email me off this thread with any question/suggestions you have. Good luck with your project, Rob On Tue, Nov 25, 2008 at 2:10 PM, Rohan Golwala wrote: > Hi, > > I want to start building an application where I can create forms and > controls such as buttons, textbox etc. and make the user enter data in that > and store that in a database. I have achieved connection with a database and > to run the simple querries but is there a way I can build this entire > application. If anyone can help me it will be of great importance to me > right now as I am working on a project.... Or please guide me from where > should I start....? > > Thanks. > > -- > Rohan. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From pbewig at gmail.com Tue Nov 25 17:49:13 2008 From: pbewig at gmail.com (Phil Bewig) Date: Thu Mar 26 02:34:19 2009 Subject: [plt-scheme] Application with Scheme Language In-Reply-To: References: Message-ID: For a Scheme interface to the Tk graphical user interface toolkit, portable to most Scheme implementations including PLT, see PS/Tk at SourceForge: http://sourceforge.net/projects/pstk. On Tue, Nov 25, 2008 at 4:10 PM, Rohan Golwala wrote: > Hi, > > I want to start building an application where I can create forms and > controls such as buttons, textbox etc. and make the user enter data in that > and store that in a database. I have achieved connection with a database and > to run the simple querries but is there a way I can build this entire > application. If anyone can help me it will be of great importance to me > right now as I am working on a project.... Or please guide me from where > should I start....? > > Thanks. > > -- > Rohan. > > _________________________________________________ > 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/20081125/c352ab72/attachment.html From chust at web.de Tue Nov 25 18:09:19 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:34:19 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme Message-ID: <492C859F.9050008@web.de> Hello, the discussion about R6RS support in PLT Scheme brought the topic of immutable pairs in PLT's default Scheme dialect to my attention again. Basically, I think having immutable pairs as the default is a good thing, but I start wondering why mutable and immutable pairs are completely disjunct types. Other datatypes, like strings, vectors and hash tables, that also exist in mutable and immutable variants in PLT Scheme, are not disjunct, but the pairs, maybe the most prominent datatype(s) of Scheme, behave differently. Is there any clever rationale behind this? I would actually have expected that the following conditions all hold (pair? (mcons 1 2)) (pair? (cons 1 2)) (not (immutable? (mcons 1 2))) (immutable? (cons 1 2)) However, mutable pairs are not pairs, as far as pair?, car and cdr are concerned and immutable pairs are not immutable, as far as immutable? is concerned. This seems totally counterintuitive to me! So unless there is a deeper reason for the disjunctness of the mutable and immutable pair types, I suggest that the type of mutable pairs should be made a subtype of the type of pairs, and consequently car and cdr could be used to access mutable pairs just like immutable ones but set-car! and set-cdr! could only be used on mutable ones. mpair? or immutable? could be used to distinguish the types. As far as I can see, my proposal would not introduce problems in most existing code, the exception being code that explicitly relies on immutable pairs being declared mutable by immutable? or code that uses exception handling to catch expected parameter type errors -- both things that I would consider bad programming practice. The proposal would however greatly improve compatibility between libraries written in R6RS and those written in PLT Scheme, since one could always work with pairs returned from R6RS on the PLT Scheme side without problems and, in many cases one could also pass PLT Scheme's immutable pairs to R6RS code without causing trouble. And last but not least, I think this behaviour would just feel more natural. What do you think about it? cu, Thomas From robby at cs.uchicago.edu Tue Nov 25 18:26:31 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:19 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <492C859F.9050008@web.de> References: <492C859F.9050008@web.de> Message-ID: <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> Please read Matthew's blog post on the subject. It contains the answer you seek. http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html Robby On 11/25/08, Thomas Chust wrote: > Hello, > > the discussion about R6RS support in PLT Scheme brought the topic of > immutable pairs in PLT's default Scheme dialect to my attention again. > > Basically, I think having immutable pairs as the default is a good > thing, but I start wondering why mutable and immutable pairs are > completely disjunct types. Other datatypes, like strings, vectors and > hash tables, that also exist in mutable and immutable variants in PLT > Scheme, are not disjunct, but the pairs, maybe the most prominent > datatype(s) of Scheme, behave differently. Is there any clever rationale > behind this? > > I would actually have expected that the following conditions all hold > > (pair? (mcons 1 2)) > (pair? (cons 1 2)) > > (not (immutable? (mcons 1 2))) > (immutable? (cons 1 2)) > > However, mutable pairs are not pairs, as far as pair?, car and cdr are > concerned and immutable pairs are not immutable, as far as immutable? is > concerned. This seems totally counterintuitive to me! > > So unless there is a deeper reason for the disjunctness of the mutable > and immutable pair types, I suggest that the type of mutable pairs > should be made a subtype of the type of pairs, and consequently car and > cdr could be used to access mutable pairs just like immutable ones but > set-car! and set-cdr! could only be used on mutable ones. mpair? or > immutable? could be used to distinguish the types. > > As far as I can see, my proposal would not introduce problems in most > existing code, the exception being code that explicitly relies on > immutable pairs being declared mutable by immutable? or code that uses > exception handling to catch expected parameter type errors -- both > things that I would consider bad programming practice. The proposal > would however greatly improve compatibility between libraries written in > R6RS and those written in PLT Scheme, since one could always work with > pairs returned from R6RS on the PLT Scheme side without problems and, in > many cases one could also pass PLT Scheme's immutable pairs to R6RS code > without causing trouble. And last but not least, I think this behaviour > would just feel more natural. > > What do you think about it? > > cu, > Thomas > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From andrew-scheme at areilly.bpc-users.org Tue Nov 25 19:44:58 2008 From: andrew-scheme at areilly.bpc-users.org (Andrew Reilly) Date: Thu Mar 26 02:34:20 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <492C859F.9050008@web.de> References: <492C859F.9050008@web.de> Message-ID: <20081126004458.GA70105@duncan.reilly.home> On Wed, Nov 26, 2008 at 12:09:19AM +0100, Thomas Chust wrote: > Basically, I think having immutable pairs as the default is a good > thing Me too. [snip] > things that I would consider bad programming practice. The proposal > would however greatly improve compatibility between libraries written in > R6RS and those written in PLT Scheme, since one could always work with > pairs returned from R6RS on the PLT Scheme side without problems and, in > many cases one could also pass PLT Scheme's immutable pairs to R6RS code > without causing trouble. And last but not least, I think this behaviour > would just feel more natural. I've just re-read Matthew's blog entry, as Robby suggested, and I regret that I didn't "get" why the type of mcons couldn't be a sub-type of cons, as a practical matter, but I can see why you wouldn't want them to be, from the perspective of the experiment performed in PLT 4.0. However, the issue of compatability would seem to be a significant one, and perhaps a major reason why one wouldn't want to write or introduce R6RS libraries as standard elements of the PLT system, or find them on PLaneT: PLT4.0 code wouldn't want to have a bunch of wrappers to translate result mlists into normal lists. However, given the result of the PLT4.0 experiment, wouldn't it be possible for PLT-hosted R6RS libraries to have switchable behaviour with respect to cons cells, depending on whether or not they import the set-car! and set-cdr! functions? That is, one would expect that most modern R6RS libraries would *not* import these, and so could happily assume immutable cons behaviour, and so could happily interact with #lang/scheme modules on an equal footing? Maybe that is how it is already: I haven't tried to convert any of my code to R6RS style, but am intrigued by the possibility that I should, one day. But since it already works happily without mcons, I would prefer to not have to do anything special in R6RS to get the same behaviour. I'm in no hurry to change, though: I've been getting some good milage from module contracts in PLT-land. Cheers, Andrew From mflatt at cs.utah.edu Tue Nov 25 20:03:41 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:34:20 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <20081126004458.GA70105@duncan.reilly.home> References: <492C859F.9050008@web.de> <20081126004458.GA70105@duncan.reilly.home> Message-ID: <20081126010343.4254B6500C8@mail-svr1.cs.utah.edu> At Wed, 26 Nov 2008 11:44:58 +1100, Andrew Reilly wrote: > I've just re-read Matthew's blog entry, as Robby suggested, and > I regret that I didn't "get" why the type of mcons couldn't be a > sub-type of cons To get the reasoning benefits of immutable pairs, functions generally need to insist that they're given immutable pairs. We could change all the `pair?' tests to `immutable-pair?' and all the `list?' tests to `immutable-list?', but we'd want to change the vast majority of them. So, instead, we changed `pair?' and `list?' to mean the immutable versions, and we switched to `mpair?' and `mlist?' in the very few places where we really wanted mutable pairs. > However, given the result of the PLT4.0 > experiment, wouldn't it be possible for PLT-hosted R6RS > libraries to have switchable behaviour with respect to cons > cells, depending on whether or not they import the set-car! > and set-cdr! functions? That is, one would expect that most > modern R6RS libraries would *not* import these, and so could > happily assume immutable cons behaviour, and so could happily > interact with #lang/scheme modules on an equal footing? Yes, we have long planned (but still not found the time to implement) a way to import R6RS source as if it were "R6iRS" source --- where "R6iRS" is an imaginary language just like R6RS, except with only immutable pairs. Matthew From chust at web.de Tue Nov 25 20:05:57 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:34:20 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> References: <492C859F.9050008@web.de> <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> Message-ID: <492CA0F5.50804@web.de> Robby Findler schrieb: > Please read Matthew's blog post on the subject. It contains the answer you seek. > > http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html > [...] I see, it's all about predictability and safety. And I fully agree that using immutable data structures by default helps to achieve these properties and is a good idea in many cases. However, the same problems that can be caused by mutable pairs can be caused by mutable vectors or hash tables being passed to a procedure that doesn't expect the incoming data to change. One can guard against such problems. For example by using contracts like (and/c immutable? ...) for the procedure arguments in question. But this would work with pairs as well, if immutable? (or some additional procedure made for that purpose) scanned list structures recursively to check for immutability of every node; or if immutable lists were not allowed to contain mutable tails... It's less the fact that mutable and immutable pairs are disjunct types that bites me, it's the asymmetry between the pair types and all the other aggregate types. Why is hash-map allowed on mutable hash tables but map is not allowed on mutable lists, for example? If programmers have to be protected from themselves when using lists, why don't they need the protection any longer as soon as they start using hash tables? I'm not convinced, yet, that this asymmetry is in any way necessary or useful. I would still vote for interoperability between modules written in different languages instead of extra protection from myself ;-) If the extra protection is absolutely necessary, why is it only implemented for one data type? Or would you say that the other mutable aggregate types should be changed as well to be disjunct from their immutable counterparts? cu, Thomas From robby at cs.uchicago.edu Tue Nov 25 20:49:05 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:20 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <20081126004458.GA70105@duncan.reilly.home> References: <492C859F.9050008@web.de> <20081126004458.GA70105@duncan.reilly.home> Message-ID: <932b2f1f0811251749k67731f2br85032d68a807d6c2@mail.gmail.com> On Tue, Nov 25, 2008 at 6:44 PM, Andrew Reilly wrote: > On Wed, Nov 26, 2008 at 12:09:19AM +0100, Thomas Chust wrote: >> Basically, I think having immutable pairs as the default is a good >> thing > > Me too. > > [snip] > >> things that I would consider bad programming practice. The proposal >> would however greatly improve compatibility between libraries written in >> R6RS and those written in PLT Scheme, since one could always work with >> pairs returned from R6RS on the PLT Scheme side without problems and, in >> many cases one could also pass PLT Scheme's immutable pairs to R6RS code >> without causing trouble. And last but not least, I think this behaviour >> would just feel more natural. > > I've just re-read Matthew's blog entry, as Robby suggested, and > I regret that I didn't "get" why the type of mcons couldn't be a > sub-type of cons, as a practical matter, Of course, you can define a predicate that tests for both kinds of cons's if you wanted, so in some sense this is really just a naming issue. The relevant lesson from Matthew's post is that when you write a function that tests its arguments using `cons?' very often it breaks if the pairs are mutable. Of course, as Matthew has said many times, if you have experience where these other sets of primitives make things substantially easier (as opposed to opinions that this is the case -- we have no shortage of all kinds of opinions around here :) we'd love to hear about it. Robby From mflatt at cs.utah.edu Tue Nov 25 21:26:49 2008 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:34:20 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <492CA0F5.50804@web.de> References: <492C859F.9050008@web.de> <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> <492CA0F5.50804@web.de> Message-ID: <20081126022651.94DEC6500EC@mail-svr1.cs.utah.edu> At Wed, 26 Nov 2008 02:05:57 +0100, Thomas Chust wrote: > However, the same problems that can be caused by mutable pairs can be > caused by mutable vectors or hash tables being passed to a procedure > that doesn't expect the incoming data to change. True, but I think functions that consume a vector and expect it not to be mutated are quite rare. When a function accepts or produces a vector, I think it's much more common that the consumer is expected to mutate the vector. (I have not actually checked documented libraries to see whether that's the case; if someone is interested enough to check, please let us know what you find.) The case for hash tables is less clear. I think it's rare for a hash table to be either an argument or result, but maybe it should be more common (instead of using an assoc list, for example), and probably many cases should use immutable tables. Such suspicions let us to to expand support for immutable hash tables in PLT Scheme v4.0. Overall, as the blog post tries to say, it's all about what is in the programmers mind. Speaking for myself --- and I imagine that I'm typical in this respect --- "list" usually says "functional" to me, while "vector" usually says "imperative". That's why it's important for lists to be immutable while vectors can be mutable. > If programmers > have to be protected from themselves when using lists, why don't they > need the protection any longer as soon as they start using hash tables? This, perhaps, is the main difference in our perspectives. I don't see these constructs as protecting me from myself, but instead as protecting me from other programmers who call my functions. This defensive perspective is probably different from a traditional Lisp mindset --- especially as compared to the Lisp machine, where users expect to be able to change anything, anywhere. I note that my perspective affects a lot of my work on PLT Scheme, not only with immutable pairs, but also custodians, eventspaces, and designs for "kill safety", so I won't be swayed easily. :) > I would still vote for interoperability between modules written > in different languages Exactly. And until the Scheme community has more experience with always-immutable pairs, votes will (and should) always fall on the side of mutable pairs. But how will the community that produces R7RS know whether immutable pairs are a good idea or a bad idea? If we continue the compromise on pairs in the PLT Scheme languages, then not only will PLT Scheme continue to suffer (at least in the implementors' opinion), but we'll all continue to just guess about whether it would work. Meanwhile, settling on immutable pairs certainly sets up an interoperability problem that we have yet to solve. I rank experience with immutable pairs over avoiding the interoperability problem; on this point, too, we may have to agree to disagree. Matthew From raould at gmail.com Tue Nov 25 21:30:29 2008 From: raould at gmail.com (Raoul Duke) Date: Thu Mar 26 02:34:20 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <20081126022651.94DEC6500EC@mail-svr1.cs.utah.edu> References: <492C859F.9050008@web.de> <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> <492CA0F5.50804@web.de> <20081126022651.94DEC6500EC@mail-svr1.cs.utah.edu> Message-ID: <91a2ba3e0811251830y44742bf2u24be6fce07586dcb@mail.gmail.com> > typical in this respect --- "list" usually says "functional" to me, > while "vector" usually says "imperative". That's why it's important for > ... > perspective affects a lot of my work on PLT Scheme, not only with > immutable pairs, but also custodians, eventspaces, and designs for > "kill safety", so I won't be swayed easily. :) these are the attitudes that make PLT Scheme so cool, imhumbleiamnobodyo. sincerely. From robby at cs.uchicago.edu Tue Nov 25 21:35:26 2008 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:34:21 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <91a2ba3e0811251830y44742bf2u24be6fce07586dcb@mail.gmail.com> References: <492C859F.9050008@web.de> <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> <492CA0F5.50804@web.de> <20081126022651.94DEC6500EC@mail-svr1.cs.utah.edu> <91a2ba3e0811251830y44742bf2u24be6fce07586dcb@mail.gmail.com> Message-ID: <932b2f1f0811251835y341d1f77nfb45cf3a99c348a9@mail.gmail.com> On Tue, Nov 25, 2008 at 8:30 PM, Raoul Duke wrote: >> typical in this respect --- "list" usually says "functional" to me, >> while "vector" usually says "imperative". That's why it's important for >> ... >> perspective affects a lot of my work on PLT Scheme, not only with >> immutable pairs, but also custodians, eventspaces, and designs for >> "kill safety", so I won't be swayed easily. :) > > these are the attitudes that make PLT Scheme so cool, imhumbleiamnobodyo. Just to check: is this sarcastic? Assuming so (and I apologize in advance if I mistake your intent), I find it embarrasing (for you). Matthew is still willing to listen after spending the last 15 or so years making deep contributions to the research community that back up this point of view and the best answer you have is "imhumbleiamnobodyo"? Woah. Robby From raould at gmail.com Tue Nov 25 21:40:32 2008 From: raould at gmail.com (Raoul Duke) Date: Thu Mar 26 02:34:21 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <932b2f1f0811251835y341d1f77nfb45cf3a99c348a9@mail.gmail.com> References: <492C859F.9050008@web.de> <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> <492CA0F5.50804@web.de> <20081126022651.94DEC6500EC@mail-svr1.cs.utah.edu> <91a2ba3e0811251830y44742bf2u24be6fce07586dcb@mail.gmail.com> <932b2f1f0811251835y341d1f77nfb45cf3a99c348a9@mail.gmail.com> Message-ID: <91a2ba3e0811251840s5e07e378o5613528878cee425@mail.gmail.com> >> these are the attitudes that make PLT Scheme so cool, imhumbleiamnobodyo. > Just to check: is this sarcastic? Assuming so (and I apologize in > advance if I mistake your intent) okeydokey, apology accepted. :-) my own apologies for apparently coming across very poorly. i am not somebody who contributes to or makes use of PLT a lot compared to the real movers and shakers, hence my 'humble' 'nobody' status. but my personal gut knee jerk feeling based on experience is that immutable is way better whenever possible. sincerely. From chust at web.de Tue Nov 25 22:53:05 2008 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:34:21 2009 Subject: [plt-scheme] Mutable and immutable pairs in PLT Scheme In-Reply-To: <20081126022651.94DEC6500EC@mail-svr1.cs.utah.edu> References: <492C859F.9050008@web.de> <932b2f1f0811251526j1b0b2ce3pb2c3dabd1eb11127@mail.gmail.com> <492CA0F5.50804@web.de> <20081126022651.94DEC6500EC@mail-svr1.cs.utah.edu> Message-ID: <492CC821.6060609@web.de> Matthew Flatt schrieb: > At Wed, 26 Nov 2008 02:05:57 +0100, Thomas Chust wrote: >> However, the same problems that can be caused by mutable pairs can be >> caused by mutable vectors or hash tables being passed to a procedure >> that doesn't expect the incoming data to change. > > True, but I think functions that consume a vector and expect it not to > be mutated are quite rare. When a function accepts or produces a > vector, I think it's much more common that the consumer is expected to > mutate the vector. [...] Hmm, I can accept that reasoning for vectors. > The case for hash tables is less clear. I think it's rare for a hash > table to be either an argument or result, but maybe it should be more > common (instead of using an assoc list, for example), [...] I do pass hash tables around as arguments and I'm very happy about the improved support for immutable ones :-) >> I would still vote for intero