From rcleis at mac.com Thu Jan 1 00:28:41 2009 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:36:47 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> Message-ID: On Dec 31, 2008, at 4:18 PM, Matthias Felleisen wrote: > > You could imagine a world that looks like this: > > #lang scheme > > (define (fcore a b c) > (+ a b c)) > > (define (f #:a (a #f) #:b (b #f) #:c (c #f)) > (cond > [(and a b c) (fcore a b c)] > [(and a b) (lambda (c) (fcore a b c))] > [(and a c) (lambda (b) (fcore a b c))] > [(and b c) (lambda (a) (fcore a b c))] > [a (lambda (b c) (fcore a b c))] > [b (lambda (a c) (fcore a b c))] > [c (lambda (a b) (fcore a b c))])) > > ((f #:a 0) 1 2) > ((f #:a 0 #:c 2) 1) > .. > > John Lamping explored this form of abstraction in his dissertation > and I always thought there was something neat about it. > > -- Matthias In the spirit of the opening post, I offer a laymen application of this exact form. To point telescopes at ufo's, fcore is replaced by a geometric calculation based on functions that are represented by strings, here. Currying is useful for reasons such as: 1) the earth wobbles slowly with heavy-duty computations, so it only needs to be calculated occasionally. 2) most of the calculations don't need to be repeated for multiple telescopes 3) most of the calculations don't need to be repeated for multiple ufo's I have never used keywords for this sort of thing; instead, I make function-producers with verbose names. The keyword abstraction suggestion is worth considering, though, since it concentrates complication inside of a single producer. Roughly: simple keywords and one function replace no-keywords and functions which need to be corralled by comments or a module, or user won't know what is available. #lang scheme (define (view-info ufo telescope earth) (string-append "Geometric calcs of: " ufo ", " telescope ", " earth)) (define (produce-ufo-viewer #:ufo (ufo #f) #:telescope (telescope #f) #:earth (earth #f)) (cond [(and ufo telescope earth) (lambda () (view-info ufo telescope earth))] [(and ufo telescope) (lambda (e) (view-info ufo telescope e))] [(and ufo earth) (lambda (t) (view-info ufo t earth))] [(and telescope earth) (lambda (u) (view-info u telescope earth))] [ufo (lambda (t e) (view-info ufo t e))] [telescope (lambda (u e) (view-info u telescope e))] [earth (lambda (u t) (view-info u t earth))])) ((produce-ufo-viewer #:ufo "green ufo at 12:01" #:telescope "big telescope" #:earth "earth at 12:00")) ((produce-ufo-viewer #:telescope "big telescope" #:earth "earth at 12:00") "green ufo at 12:01") Welcome to DrScheme, version 4.1 [3m]. Language: Module; memory limit: 128 megabytes. "Geometric calcs of: green ufo at 12:01, big telescope, earth at 12:00" "Geometric calcs of: green ufo at 12:01, big telescope, earth at 12:00" > rac From a.rottmann at gmx.at Thu Jan 1 09:08:26 2009 From: a.rottmann at gmx.at (Andreas Rottmann) Date: Thu Mar 26 02:36:49 2009 Subject: [plt-scheme] scheme/foreign, callbacks and NULL Message-ID: <87ababunj9.fsf@delenn.lan> Hi! Writing an FFI compatiblity layer that targets Ikarus, PLT and Ypsilon, I have run into this problem on PLT: I want to bind a C function that takes a callback (function pointer) argument, and want to be able to pass a NULL pointer as callback. Here's some example code, using GLib: #lang scheme (require scheme/foreign (only-in '#%foreign ffi-callback)) (unsafe!) (define libglib (ffi-lib "libglib-2.0" '("0"))) (define g-idle-add-full% (get-ffi-obj "g_idle_add_full" libglib _fpointer)) (define g-idle-add-full (function-ptr g-idle-add-full% (_cprocedure (list _int _fpointer _pointer _fpointer) _uint))) (define my-idle-callback (ffi-callback (lambda args (printf "idle, args: ~s~n" args) 1) (list _pointer) _int)) (g-idle-add-full 200 my-idle-callback #f #f) ;; EOF This causes the following error when run: Scheme->C: expects argument of type ; given #f I'm using MzScheme v4.1.3.8 [3m] (recent build from SVN). PS: I know one is not really supposed to use `ffi-callback' directly, but I need it to provide a compatible API across all implementations. Regards, Rotty -- Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at http://rotty.uttx.net | GnuPG Key: http://rotty.uttx.net/gpg.asc Fingerprint | C38A 39C5 16D7 B69F 33A3 6993 22C8 27F7 35A9 92E7 v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com Life is a sexually transmitted disease. From rcleis at mac.com Thu Jan 1 10:21:13 2009 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:36:49 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <81addec70812311611r26070cf5iacb1143ff4a64fd@mail.gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <81addec70812311611r26070cf5iacb1143ff4a64fd@mail.gmail.com> Message-ID: On Dec 31, 2008, at 5:11 PM, Anthony Cowley wrote: > On Wed, Dec 31, 2008 at 12:44 AM, Richard Cleis wrote: >> However, I am not certain that Currying refers to reducing the >> arguments in >> any order. I have the impression that Currying literally means >> reducing >> them in the order that they appear so that other functions may be >> written to >> take advantage of such strictness. Freeform reduction of arguments >> is >> simply making use of closures. No? >> >> rac > > I've always found the ordering aspect mildly troubling. Currying > transforms (a x b) -> c into a -> b -> c, but is (a x b) the same as > (b x a)? Not normally for programmers, but if you justify Currying > with the logical argument that (a /\ b) -> c <=> a -> b -> c, and you > believe that conjunctions are commutative, then I'm not sure where > that leaves you since you have identified product types with > conjunctions. I think the safe bet is to just call it partial > application and not have to worry about offending anyone :) > > For practical purposes, functions of fewer arguments are more common, > so the flip function in Haskell's Prelude is commonly used when > exploiting one's automatically curried functions. For example, > > Prelude> let f x y = x / y > Prelude> let g = flip f 3 > Prelude> g 6 > 2.0 > > I don't think there is a flip automatically in scope in SML/NJ, but > it's a very handy function when working in this style as it handles > the case of functions of two arguments where the arguments are > "equally important." If your function takes more arguments, one > technique is to order them in terms of heavyness, or import, and put > the heavy ones first. I often deal with functions of time, so program design involves deciding whether to make 'time' an argument of the higher level functions, or make 'time' an argument of each of the functions that are provided as arguments to those higher level functions. In other words, a single variable can affect the heaviness and ordering issues to which you refer. To make best use of the fundamentals of a language, it seems necessary to invest resources in starting to develop independent solutions in order to reveal advantages. If I am wearing a programming hat, such parallel effort is enjoyable; if I am wearing a project managers hat, it's the reason that we are behind schedule :) > > > Anthony > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From gregory.woodhouse at gmail.com Thu Jan 1 14:33:44 2009 From: gregory.woodhouse at gmail.com (Gregory Woodhouse) Date: Thu Mar 26 02:36:50 2009 Subject: [plt-scheme] Currying and physics Message-ID: It seems to me that operators actually provide a more direct analog to currying than the (classical) fields discussed in that note. In elementary quantum mechanics, a particle is represented by a wave function (a complex valuied function of time and position). Observable quantities (or just observables) correspond to (linear) operators on the space of so-called wave functions. For example, in one dimension, position corresponds to i h bar (the imaginary unit times Planck's constant divided 2 pi) times differentiation with respect to x). In LaTeX, that's P = i\hbar \frac{\partial}{\partial x} So, if psi (the letter traditionally used to represent wave functions) is x^2, then Px is 2i \hbar x (never mind the fact that it isn't square integrable). So, if you think of the probability density for position being function of both the observable (in this case, position) and the quantum state, you take the first input variable (the observable) and generate a function (or, as some people like to say, functional) that can be applied to to the wave function to give you a new function (this time of the interval over which you are integrating), then you take the integral (another function!) to get the expected position. Without that last step, you get yet another function the norm of which is the probability density of position. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090101/0f506b3a/attachment.html From mflatt at cs.utah.edu Thu Jan 1 16:20:18 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:36:50 2009 Subject: [plt-scheme] Using one signature in place of two In-Reply-To: <20081230223344.CE08C6500CF@mail-svr1.cs.utah.edu> References: <20081230223344.CE08C6500CF@mail-svr1.cs.utah.edu> Message-ID: <20090101212019.7EEEC650111@mail-svr1.cs.utah.edu> At Tue, 30 Dec 2008 16:33:28 -0600, Matthew Flatt wrote: > At Tue, 30 Dec 2008 16:57:16 +0000, "Noel Welsh" wrote: > > I'm having some fun with the unit system. > > > > I have two signatures a^ and b^ which are used by mutually recursive > > units. The consumers of the resulting compound unit always want to > > use the union of a^ and b^, so I defined a signature thus: > > > > (define-signature c^ extends a^ > > ((open b^))) > > > > and consumers specify they import c^ and I invoke thus: > > > > (define-values/invoke-unit consumer@ > > (import c^) > > (export consumer^)) > > > > This, however, doesn't work. I get complaints about duplicate > > identifiers. E.g.: > > > > :unit: rename created duplicate identifier row-col->idx40 at: (rename > > row^ (struct:row22 struct:row) (make-row23 make-row) ... > > I'm fairly certain that this is a bug in the unit system (related to > the expansion of `open' within a signature), but I don't yet know how > to fix it. I'm still thinking about it. My solution involved changing the meaning of `rename', `only', and `except' in signatures. Now, when you write (rename [new old]) then `old' must be equal to the old binding in the `bound-identifier=?' sense instead of `free-identifier=?'. (There should be some way to say that without appealing to syntax-object operations...) This change fixes `open' because `open' is implemented using `rename'. For the same reason that it fixes `open', I think it's a sensible change in general. Let me know, of course, if the change breaks anything else in your use of `scheme/unit'. Matthew From mflatt at cs.utah.edu Thu Jan 1 16:49:45 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:36:50 2009 Subject: [plt-scheme] scheme/foreign, callbacks and NULL In-Reply-To: <87ababunj9.fsf@delenn.lan> References: <87ababunj9.fsf@delenn.lan> Message-ID: <20090101214946.CEE0D6500C3@mail-svr1.cs.utah.edu> At Thu, 01 Jan 2009 15:08:26 +0100, Andreas Rottmann wrote: > Hi! > > Writing an FFI compatiblity layer that targets Ikarus, PLT and Ypsilon, > I have run into this problem on PLT: I want to bind a C function that > takes a callback (function pointer) argument, and want to be able to > pass a NULL pointer as callback. Here's some example code, using GLib: > > #lang scheme > > (require scheme/foreign > (only-in '#%foreign ffi-callback)) > > (unsafe!) > > (define libglib (ffi-lib "libglib-2.0" '("0"))) > (define g-idle-add-full% (get-ffi-obj "g_idle_add_full" libglib _fpointer)) > > (define g-idle-add-full > (function-ptr g-idle-add-full% > (_cprocedure (list _int _fpointer _pointer _fpointer) _uint))) > > (define my-idle-callback > (ffi-callback (lambda args > (printf "idle, args: ~s~n" args) > 1) > (list _pointer) > _int)) > > (g-idle-add-full 200 my-idle-callback #f #f) > ;; EOF > > This causes the following error when run: > Scheme->C: expects argument of type ; given #f You can use `_pointer' instead of `_fpointer' as the last argument to `g-idle-add-full%'. I'll fix the docs to clarify that `_fpointer' doesn't allow NULL pointers. Or maybe it should allow NULLs? > PS: I know one is not really supposed to use `ffi-callback' directly, > but I need it to provide a compatible API across all > implementations. Another doc issue: I forgot to update the docs for `function-ptr' to say that you can provide a Scheme procedure as the first argument. So, you could use `function-ptr' instead of `ffi-callback'. Matthew From jmarshall at alum.mit.edu Thu Jan 1 17:31:30 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:36:50 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> Message-ID: On Wed, Dec 31, 2008 at 5:55 PM, Gregory Woodhouse wrote: > Isn't the point of using monads.... I'm not a real fan of monads, but the original idea was to take a program that operated on base types, like int -> int, and transform it to a program that operated on (f int) -> (f int). In this new space, you can plug the elements together to create a program that operates on ints, but is explicitly `wired' to behave in a certain way. For example, you can mimic state by passing around a state variable. You tranform your int -> int functions to (f int state) -> (f int state), plug the transformed functions together linearly so the state variable behaves correctly, then run the resulting program. I'm sure you've done something similar with Scheme programs by passing around an accumulator or something. Now here's the magic part. If you look at the transformed code, you'll see that the bulk of it isn't really using the state variable, it is simply passing it along to the next guy. So move the state variable to the end of the argument list, *curry the function*, and voila! the state variable is gone! You can do this to most of the code and make the state variable virtually disappear. What you've done is factored your code such that the `plumbing' --- the state variable and associated argument passing --- can be separated from the more interesting computation. The step of moving the state variable to the end of the argument list and currying is critical. The trick wouldn't be nearly as interesting if you couldn't drop the curried variable out of the picture. In Scheme, this is a bit of a pain because currying the argument list means changing *every* call site. In Haskell, however, you can simply omit the required variable and the language takes care of it. That's why I said that the Haskell community would be far less excited about monads if their language didn't automagically do the currying. -- ~jrm From grettke at acm.org Thu Jan 1 18:24:04 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:36:50 2009 Subject: [plt-scheme] Code generation question from Shriram's Automata via Macros In-Reply-To: <932b2f1f0708020650t6420bdc6gb134a6614c62dcf@mail.gmail.com> References: <756daca50708012019x3f551a41g6abe1b526ee9a456@mail.gmail.com> <932b2f1f0708020650t6420bdc6gb134a6614c62dcf@mail.gmail.com> Message-ID: <756daca50901011524p6acff4b7lb8ab7d06421bf1aa@mail.gmail.com> On Thu, Aug 2, 2007 at 7:50 AM, Robby Findler wrote: > On 8/2/07, Noel Welsh wrote: >> On 8/2/07, Grant Rettke wrote: >> > Suppose I took that definition and did something like: >> > >> > (define the-data >> > "(automaton init >> > (init : >> > (c -> more)) >> > (more : >> > (a -> more) >> > (d -> more) >> > (r -> end)) >> > (end : )))" >> > >> > First question, how would I got about evaluating it and binding it to >> > a value like in previous example? >> >> http://schemecookbook.org/Cookbook/StringEval > > One could use eval here, but may I ask why you've got a string in the > first place? I used a string there because I didn't understand what I was doing. I should have quoted it. From a.rottmann at gmx.at Thu Jan 1 18:43:57 2009 From: a.rottmann at gmx.at (Andreas Rottmann) Date: Thu Mar 26 02:36:50 2009 Subject: [plt-scheme] scheme/foreign, callbacks and NULL In-Reply-To: <20090101214946.CEE0D6500C3@mail-svr1.cs.utah.edu> (Matthew Flatt's message of "Thu, 1 Jan 2009 14:49:45 -0700") References: <87ababunj9.fsf@delenn.lan> <20090101214946.CEE0D6500C3@mail-svr1.cs.utah.edu> Message-ID: <87abaatww2.fsf@delenn.lan> Matthew Flatt writes: > At Thu, 01 Jan 2009 15:08:26 +0100, Andreas Rottmann wrote: [example snipped] >> >> This causes the following error when run: >> Scheme->C: expects argument of type ; given #f > > You can use `_pointer' instead of `_fpointer' as the last argument to > `g-idle-add-full%'. > Updating my example accordingly: #lang scheme (require scheme/foreign (only-in '#%foreign ffi-callback)) (unsafe!) (define libglib (ffi-lib "libglib-2.0" '("0"))) (define g-idle-add-full% (get-ffi-obj "g_idle_add_full" libglib _fpointer)) (define g-idle-add-full (function-ptr g-idle-add-full% (_cprocedure (list _int _fpointer _pointer _pointer) _uint))) (define my-idle-callback (function-ptr (lambda args (printf "idle, args: ~s~n" args) 1) (_cprocedure (list _pointer) _int))) (define my-destroy-callback (function-ptr (lambda args (printf "destroy, args: ~s~n" args)) (_cprocedure (list _pointer) _void))) (g-idle-add-full 200 my-idle-callback #f #f) (g-idle-add-full 200 my-idle-callback #f my-destroy-callback) ;; EOF I now get: Scheme->C: expects argument of type ; given # > I'll fix the docs to clarify that `_fpointer' doesn't allow NULL > pointers. Or maybe it should allow NULLs? > Either it should, or (preferably) you would be able to pass # objects for _pointer arguments. > >> PS: I know one is not really supposed to use `ffi-callback' directly, >> but I need it to provide a compatible API across all >> implementations. > > Another doc issue: I forgot to update the docs for `function-ptr' to > say that you can provide a Scheme procedure as the first argument. So, > you could use `function-ptr' instead of `ffi-callback'. > Good to hear I don't need to rely on quasi-non-public API :-). Thanks & Regards, Rotty -- Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at http://rotty.uttx.net | GnuPG Key: http://rotty.uttx.net/gpg.asc Fingerprint | C38A 39C5 16D7 B69F 33A3 6993 22C8 27F7 35A9 92E7 v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com To iterate is human; to recurse, divine. From mflatt at cs.utah.edu Thu Jan 1 18:49:43 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:36:51 2009 Subject: [plt-scheme] scheme/foreign, callbacks and NULL In-Reply-To: <87abaatww2.fsf@delenn.lan> References: <87ababunj9.fsf@delenn.lan> <20090101214946.CEE0D6500C3@mail-svr1.cs.utah.edu> <87abaatww2.fsf@delenn.lan> Message-ID: <20090101234945.6CA336500B2@mail-svr1.cs.utah.edu> At Fri, 02 Jan 2009 00:43:57 +0100, Andreas Rottmann wrote: > Matthew Flatt writes: > > > At Thu, 01 Jan 2009 15:08:26 +0100, Andreas Rottmann wrote: > [example snipped] > >> > >> This causes the following error when run: > >> Scheme->C: expects argument of type ; given #f > > > > You can use `_pointer' instead of `_fpointer' as the last argument to > > `g-idle-add-full%'. > > > Updating my example accordingly: > > #lang scheme > > (require scheme/foreign > (only-in '#%foreign ffi-callback)) > > (unsafe!) > > (define libglib (ffi-lib "libglib-2.0" '("0"))) > (define g-idle-add-full% (get-ffi-obj "g_idle_add_full" libglib _fpointer)) > > (define g-idle-add-full > (function-ptr g-idle-add-full% > (_cprocedure (list _int _fpointer _pointer _pointer) _uint))) > > (define my-idle-callback > (function-ptr (lambda args > (printf "idle, args: ~s~n" args) > 1) > (_cprocedure (list _pointer) _int))) > > (define my-destroy-callback > (function-ptr (lambda args > (printf "destroy, args: ~s~n" args)) > (_cprocedure (list _pointer) _void))) > > (g-idle-add-full 200 my-idle-callback #f #f) > (g-idle-add-full 200 my-idle-callback #f my-destroy-callback) > ;; EOF > > I now get: > > Scheme->C: expects argument of type ; given # > > > I'll fix the docs to clarify that `_fpointer' doesn't allow NULL > > pointers. Or maybe it should allow NULLs? > > > Either it should, or (preferably) you would be able to pass > # objects for _pointer arguments. Hm... yes, I think ffi-callback objects probably should be allowed as pointers. I'll wait for Eli to weigh in, though. Matthew From grettke at acm.org Thu Jan 1 23:54:17 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:36:51 2009 Subject: [plt-scheme] How does help desk work when you run from SVN? Message-ID: <756daca50901012054o1d4f99c0q4b81e72cabba976e@mail.gmail.com> Hi folks, I just downloaded and built the trunk on Windows. When I hit F1 on a name, the documentation seems to come up for the SVN build.The information page here http://svn.plt-scheme.org/ though, explains that one needs to download documentation separately. Is this a holdover from pre-4.x days or does it still apply Best wishes, Grant From geoff at knauth.org Fri Jan 2 03:50:08 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:36:51 2009 Subject: [plt-scheme] How does help desk work when you run from SVN? In-Reply-To: <756daca50901012054o1d4f99c0q4b81e72cabba976e@mail.gmail.com> References: <756daca50901012054o1d4f99c0q4b81e72cabba976e@mail.gmail.com> Message-ID: <3EBB71BE-6E57-49D9-900C-62C9471FE987@knauth.org> On Jan 1, 2009, at 23:54, Grant Rettke wrote: > http://svn.plt-scheme.org/ > though, explains that one needs to download documentation separately. > Is this a holdover from pre-4.x days or does it still apply That page looks pre-4.x. I'm really, really happy with the 4.x documentation that loads locally at the press of F1. Scribble, the use of Javascript, style and links all make me smile every time I use them. My mid-December svn update differs quite a bit from the web page above. I've marked with an A or D those directories that have been added or deleted. collects A doc man src A src/a-list A src/foreign A src/lt src/mac src/mred src/mysterx A src/mzcom src/mzscheme src/srpersist D src/starter src/worksp src/wxcommon src/wxmac src/wxwindow src/wxxt Geoffrey -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090102/9042ef17/attachment.htm From jos.koot at telefonica.net Fri Jan 2 04:16:17 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:36:52 2009 Subject: [plt-scheme] Currying and physics References: Message-ID: <3E28B4EF8F174A5896A1BDA9EBB6CEDE@uw2b2dff239c4d> ----- Original Message ----- From: Gregory Woodhouse To: PLT List Sent: Thursday, January 01, 2009 8:33 PM Subject: [plt-scheme] Currying and physics It seems to me that operators actually provide a more direct analog to currying than the (classical) fields discussed in that note. In elementary quantum mechanics, a particle is represented by a wave function (a complex valuied function of time and position). Observable quantities (or just observables) correspond to (linear) operators on the space of so-called wave functions. For example, in one dimension, position corresponds to i h bar (the imaginary unit times Planck's constant divided 2 pi) times differentiation with respect to x). In LaTeX, that's You probably mean (linear) momentum. Position can be represented by an operator (function, functional) ? -> x?. The probability to find the particle at position x at time t is: integral over x of ?*(x,t) x ?(x,t) divided by the integral over x of ?*(x,t) ?(x,t), where ?* is the complex conjugate of ?. In this case momentum is represented by the function ? -> (i?/2?)(??/?x). You could have choosen ?(x)=1/(1+x^2) as a function with finite norm, or in three dimensions 1/(1+x^2+y^2+z^2) In practice wave functions are often represented by time independent vectors (called kets) in a Hilbert space. Which functions ? are to be included in this space is determined by the law of conservation of energy. In quantum mechanics this law says: H?=E?, where H is the so called Hamiltonian (an operator representing energy) and E a real number. The equation must be solved for both ? and E (and the solution usually consists of an infinite number of pairs ? and E) By using the symmetry properties of the system being studied, many parts of the integrals can be simplified to summations. Jos P = i\hbar \frac{\partial}{\partial x} So, if psi (the letter traditionally used to represent wave functions) is x^2, then Px is 2i \hbar x (never mind the fact that it isn't square integrable). So, if you think of the probability density for position being function of both the observable (in this case, position) and the quantum state, you take the first input variable (the observable) and generate a function (or, as some people like to say, functional) that can be applied to to the wave function to give you a new function (this time of the interval over which you are integrating), then you take the integral (another function!) to get the expected position. Without that last step, you get yet another function the norm of which is the probability density of position. ------------------------------------------------------------------------------ _________________________________________________ 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/20090102/5a1e1cf5/attachment.html From eli at barzilay.org Fri Jan 2 07:32:36 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:36:52 2009 Subject: [plt-scheme] How does help desk work when you run from SVN? In-Reply-To: <3EBB71BE-6E57-49D9-900C-62C9471FE987@knauth.org> References: <756daca50901012054o1d4f99c0q4b81e72cabba976e@mail.gmail.com> <3EBB71BE-6E57-49D9-900C-62C9471FE987@knauth.org> Message-ID: <92932db60901020432l3c1471btb305b20d6778d994@mail.gmail.com> On Fri, Jan 2, 2009 at 3:50 AM, Geoffrey S. Knauth wrote: > On Jan 1, 2009, at 23:54, Grant Rettke wrote: > > > http://svn.plt-scheme.org/ > > though, explains that one needs to download documentation separately. > > Is this a holdover from pre-4.x days or does it still apply > > That page looks pre-4.x. Yes, I didn't notice that text -- fixed now. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Fri Jan 2 09:57:35 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:36:52 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> Message-ID: <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> On Tue, Dec 30, 2008 at 11:44 PM, Richard Cleis wrote: > On Dec 30, 2008, at 9:12 PM, Grant Rettke wrote: >> Why do layman (working programmers) care about Currying? Or how are >> they applied in daily use to help one out? > > I'm not sure if you are referring to 'using a function that curries other > functions,' or if you mean (as the wikisnip says) "if you fix some > arguments, you get a function of the remaining arguments." I manually do the > latter frequently, and it's one of the reasons I like Scheme so much. I don't understand the practical application of currying in Scheme, so I'm not asking about one or the other; the wikipedia link was just my going in position on trying to understand what is currying. When you do apply the latter, what are the idioms or patterns that you most often encounter? I understand the idea of using bindings to capture state, but I don't see how that translates into normal usage. For example, if you write (define (((foo a) b) c) (? () (do-something-to a b c))) you will get a function back 3 times, but only the third time is the result you expect. How do you know when to stop, keep track of how many times you called it? Is this a good example? From gregory.woodhouse at gmail.com Fri Jan 2 10:48:43 2009 From: gregory.woodhouse at gmail.com (Gregory Woodhouse) Date: Thu Mar 26 02:36:53 2009 Subject: [plt-scheme] Currying and physics In-Reply-To: <3E28B4EF8F174A5896A1BDA9EBB6CEDE@uw2b2dff239c4d> References: <3E28B4EF8F174A5896A1BDA9EBB6CEDE@uw2b2dff239c4d> Message-ID: <49B8A95E-2D6B-4723-9C73-6D2189131F2B@gmail.com> Yes, I did. I even called it P! On Jan 2, 2009, at 1:16 AM, Jos Koot wrote: > You probably mean (linear) momentum. Position can be represented by > an operator (function, functional) ? -> x?. The probability to find > the particle at position x at time t is: > integral over x of ?*(x,t) x ?(x,t) divided by > the integral over x of ?*(x,t) ?(x,t), > where ?* is the complex conjugate of ?. > In this case momentum is represented by the function ? -> (i?/2?) > (??/?x). > You could have choosen ?(x)=1/(1+x^2) as a function with finite norm, > or in three dimensions 1/(1+x^2+y^2+z^2) > In practice wave functions are often represented by time independent > vectors (called kets) in a Hilbert space. > Which functions ? are to be included in this space is determined by > the law of conservation of energy. In quantum mechanics this law > says: H?=E?, where H is the so called Hamiltonian (an operator > representing energy) and E a real number. The equation must be > solved for both ? and E (and the solution usually consists of an > infinite number of pairs ? and E) By using the symmetry properties > of the system being studied, many parts of the integrals can be > simplified to summations. > Jos > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090102/3ace4bca/attachment.htm From noelwelsh at gmail.com Fri Jan 2 11:09:33 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:36:53 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> Message-ID: 2009/1/2 Grant Rettke : > When you do apply the latter, what are the idioms or patterns that you > most often encounter? I very rarely define functions in curried form, but I use cut (srfi 26) a lot to make ad-hoc "curried" forms of functions. For example, I use cut here to check that two vectors are within e of each other: (check (cut vector-= <> <> e) v1 v2) HTH, Noel From noelwelsh at gmail.com Fri Jan 2 11:22:57 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:36:53 2009 Subject: [plt-scheme] Using one signature in place of two In-Reply-To: <20090101212019.7EEEC650111@mail-svr1.cs.utah.edu> References: <20081230223344.CE08C6500CF@mail-svr1.cs.utah.edu> <20090101212019.7EEEC650111@mail-svr1.cs.utah.edu> Message-ID: On Thu, Jan 1, 2009 at 9:20 PM, Matthew Flatt wrote: > This change fixes `open' because `open' is implemented using `rename'. > For the same reason that it fixes `open', I think it's a sensible > change in general. Let me know, of course, if the change breaks > anything else in your use of `scheme/unit'. All my tests pass with a fresh build from svn. I haven't had time to revert back my use of signatures to a single sig; I'll let you know if that doesn't work for some reason. Thanks! N. From apatinoii at gmail.com Fri Jan 2 15:30:17 2009 From: apatinoii at gmail.com (apatinoii@gmail.com) Date: Thu Mar 26 02:36:53 2009 Subject: [plt-scheme] DrScheme creation of Adam Message-ID: Initially DrScheme would show the creation of Adam from by Michelangelo when it started up, but now it doesn't. Is there a way to get that back? Also, Is it possible to place the cursor in the search box automatically when doing a search? Is it possible to close the last file without quitting? I notice that there is an option to close and quit, but closing the last file results in quitting. From robby at cs.uchicago.edu Fri Jan 2 15:32:20 2009 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:36:53 2009 Subject: [plt-scheme] DrScheme creation of Adam In-Reply-To: References: Message-ID: <932b2f1f0901021232j690ae030v2af151664c029829@mail.gmail.com> On Fri, Jan 2, 2009 at 2:30 PM, apatinoii@gmail.com wrote: > Initially DrScheme would show the creation of Adam from by > Michelangelo when it started up, but now it doesn't. Is there a way to > get that back? It only does that on Christmas day (for no good particularly good reason). > Also, > Is it possible to place the cursor in the search box automatically > when doing a search? If you hit control-f (or command-f on a mac), you should get put automatically into the search bar. You have the latest version, right? > Is it possible to close the last file without quitting? I notice that > there is an option to close and quit, but closing the last file > results in quitting. Not on windows or linux. On the mac it already doesn't quit. DrScheme tried to follow the platform's conventions in this matter. Robby From apatinoii at gmail.com Fri Jan 2 15:42:12 2009 From: apatinoii at gmail.com (Adrian Patino) Date: Thu Mar 26 02:36:54 2009 Subject: [plt-scheme] Re: DrScheme creation of Adam In-Reply-To: <932b2f1f0901021232j690ae030v2af151664c029829@mail.gmail.com> References: <932b2f1f0901021232j690ae030v2af151664c029829@mail.gmail.com> Message-ID: On Jan 2, 2:32?pm, "Robby Findler" wrote: > On Fri, Jan 2, 2009 at 2:30 PM, apatin...@gmail.com wrote: > > Initially DrScheme would show the creation of Adam from by > > Michelangelo when it started up, but now it doesn't. Is there a way to > > get that back? > > It only does that on Christmas day (for no good particularly good reason). > > > Also, > > Is it possible to place the cursor in the search box automatically > > when doing a search? > > If you hit control-f (or command-f on a mac), you should get put > automatically into the search bar. You have the latest version, right? I have version 4.1.3 installed. Hitting control-f moves the cursor forward one space, hitting control-s opens the search bar but leaves my cursor where it is. > > Is it possible to close the last file without quitting? I notice that > > there is an option to close and quit, but closing the last file > > results in quitting. > > Not on windows or linux. On the mac it already doesn't quit. DrScheme > tried to follow the platform's conventions in this matter. > > Robby > _________________________________________________ > ? For list-related administrative tasks: > ?http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jos.koot at telefonica.net Fri Jan 2 15:46:03 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:36:54 2009 Subject: [plt-scheme] Currying and physics References: <3E28B4EF8F174A5896A1BDA9EBB6CEDE@uw2b2dff239c4d> <49B8A95E-2D6B-4723-9C73-6D2189131F2B@gmail.com> Message-ID: <0868AC1EFB714243B39D09022EF74065@uw2b2dff239c4d> Ok, I am sure you are sure are familiar with the mather (:. You did show a nice example of currying, no doubt about that. Jos ----- Original Message ----- From: Gregory Woodhouse To: Jos Koot Cc: PLT List Sent: Friday, January 02, 2009 4:48 PM Subject: Re: [plt-scheme] Currying and physics Yes, I did. I even called it P! On Jan 2, 2009, at 1:16 AM, Jos Koot wrote: You probably mean (linear) momentum. Position can be represented by an operator (function, functional) ? -> x?. The probability to find the particle at position x at time t is: integral over x of ?*(x,t) x ?(x,t) divided by the integral over x of ?*(x,t) ?(x,t), where ?* is the complex conjugate of ?. In this case momentum is represented by the function ? -> (i?/2?)(??/?x). You could have choosen ?(x)=1/(1+x^2) as a function with finite norm, or in three dimensions 1/(1+x^2+y^2+z^2) In practice wave functions are often represented by time independent vectors (called kets) in a Hilbert space. Which functions ? are to be included in this space is determined by the law of conservation of energy. In quantum mechanics this law says: H?=E?, where H is the so called Hamiltonian (an operator representing energy) and E a real number. The equation must be solved for both ? and E (and the solution usually consists of an infinite number of pairs ? and E) By using the symmetry properties of the system being studied, many parts of the integrals can be simplified to summations. Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090102/111e209c/attachment.html From robby at cs.uchicago.edu Fri Jan 2 15:51:16 2009 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:36:54 2009 Subject: [plt-scheme] Re: DrScheme creation of Adam In-Reply-To: References: <932b2f1f0901021232j690ae030v2af151664c029829@mail.gmail.com> Message-ID: <932b2f1f0901021251n52a00954y9edee8636e709e31@mail.gmail.com> On Fri, Jan 2, 2009 at 2:42 PM, Adrian Patino wrote: >> > Also, >> > Is it possible to place the cursor in the search box automatically >> > when doing a search? >> >> If you hit control-f (or command-f on a mac), you should get put >> automatically into the search bar. You have the latest version, right? > > I have version 4.1.3 installed. Hitting control-f moves the cursor > forward one space, hitting control-s opens the search bar but leaves > my cursor where it is. What OS? Did you change any menu-related preferences? Robby From jos.koot at telefonica.net Fri Jan 2 15:53:58 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:36:55 2009 Subject: [plt-scheme] Currying and physics References: <3E28B4EF8F174A5896A1BDA9EBB6CEDE@uw2b2dff239c4d><49B8A95E-2D6B-4723-9C73-6D2189131F2B@gmail.com> <0868AC1EFB714243B39D09022EF74065@uw2b2dff239c4d> Message-ID: <59C39960493B4FB2BEC0421383739ADC@uw2b2dff239c4d> Sorry. Because I am dont look much at parentheses I wrote '(;' meaning '):' of course, Jos ----- Original Message ----- From: Jos Koot To: Gregory Woodhouse Cc: plt-scheme@list.cs.brown.edu Sent: Friday, January 02, 2009 9:46 PM Subject: Re: [plt-scheme] Currying and physics Ok, I am sure you are sure are familiar with the mather (:. You did show a nice example of currying, no doubt about that. Jos ----- Original Message ----- From: Gregory Woodhouse To: Jos Koot Cc: PLT List Sent: Friday, January 02, 2009 4:48 PM Subject: Re: [plt-scheme] Currying and physics Yes, I did. I even called it P! On Jan 2, 2009, at 1:16 AM, Jos Koot wrote: You probably mean (linear) momentum. Position can be represented by an operator (function, functional) ? -> x?. The probability to find the particle at position x at time t is: integral over x of ?*(x,t) x ?(x,t) divided by the integral over x of ?*(x,t) ?(x,t), where ?* is the complex conjugate of ?. In this case momentum is represented by the function ? -> (i?/2?)(??/?x). You could have choosen ?(x)=1/(1+x^2) as a function with finite norm, or in three dimensions 1/(1+x^2+y^2+z^2) In practice wave functions are often represented by time independent vectors (called kets) in a Hilbert space. Which functions ? are to be included in this space is determined by the law of conservation of energy. In quantum mechanics this law says: H?=E?, where H is the so called Hamiltonian (an operator representing energy) and E a real number. The equation must be solved for both ? and E (and the solution usually consists of an infinite number of pairs ? and E) By using the symmetry properties of the system being studied, many parts of the integrals can be simplified to summations. Jos ------------------------------------------------------------------------------ _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090102/2e18470a/attachment.htm From apatinoii at gmail.com Fri Jan 2 16:00:15 2009 From: apatinoii at gmail.com (Adrian Patino) Date: Thu Mar 26 02:36:55 2009 Subject: [plt-scheme] Re: DrScheme creation of Adam In-Reply-To: <932b2f1f0901021251n52a00954y9edee8636e709e31@mail.gmail.com> References: <932b2f1f0901021232j690ae030v2af151664c029829@mail.gmail.com> <932b2f1f0901021251n52a00954y9edee8636e709e31@mail.gmail.com> Message-ID: <4dc5b748-92f0-4e02-a919-4a50d7efb791@e1g2000pra.googlegroups.com> On Jan 2, 2:51?pm, "Robby Findler" wrote: > On Fri, Jan 2, 2009 at 2:42 PM, Adrian Patino wrote: > >> > Also, > >> > Is it possible to place the cursor in the search box automatically > >> > when doing a search? > > >> If you hit control-f (or command-f on a mac), you should get put > >> automatically into the search bar. You have the latest version, right? > > > I have version 4.1.3 installed. Hitting control-f moves the cursor > > forward one space, hitting control-s opens the search bar but leaves > > my cursor where it is. > > What OS? Did you change any menu-related preferences? > Fedora 10 I did disable the keybindings in the menu, which turned out to be the problem. However, enabling them does not allow the normal emacs keybindings. How can I have both? From sbloch at adelphi.edu Fri Jan 2 16:25:47 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:36:55 2009 Subject: [plt-scheme] image-snip stuff Message-ID: What does it mean when two images satisfy (= (image-width pic1) (image-width pic2)) (= (image-height pic1) (image-height pic2)) (equal? (image->alpha-color-list pic1) (image->alpha-color-list pic2)) but not (image=? pic1 pic2) ? Stephen Bloch sbloch@adelphi.edu From robby at cs.uchicago.edu Fri Jan 2 16:32:39 2009 From: robby at cs.uchicago.edu (Robby Findler) Date: Thu Mar 26 02:36:55 2009 Subject: [plt-scheme] Re: DrScheme creation of Adam In-Reply-To: <4dc5b748-92f0-4e02-a919-4a50d7efb791@e1g2000pra.googlegroups.com> References: <932b2f1f0901021232j690ae030v2af151664c029829@mail.gmail.com> <932b2f1f0901021251n52a00954y9edee8636e709e31@mail.gmail.com> <4dc5b748-92f0-4e02-a919-4a50d7efb791@e1g2000pra.googlegroups.com> Message-ID: <932b2f1f0901021332sf9acbeat7089c9d54777d6a2@mail.gmail.com> On Fri, Jan 2, 2009 at 3:00 PM, Adrian Patino wrote: > > > On Jan 2, 2:51 pm, "Robby Findler" wrote: >> On Fri, Jan 2, 2009 at 2:42 PM, Adrian Patino wrote: >> >> > Also, >> >> > Is it possible to place the cursor in the search box automatically >> >> > when doing a search? >> >> >> If you hit control-f (or command-f on a mac), you should get put >> >> automatically into the search bar. You have the latest version, right? >> >> > I have version 4.1.3 installed. Hitting control-f moves the cursor >> > forward one space, hitting control-s opens the search bar but leaves >> > my cursor where it is. >> >> What OS? Did you change any menu-related preferences? >> > Fedora 10 > I did disable the keybindings in the menu, which turned out to be the > problem. However, enabling them does not allow the normal emacs > keybindings. How can I have both? Looks like I missed that one when I was mapping out the keybindings. I've changed 'f3' so that it behaves like the Edit|Find menu item (ie, like you want). This is checked in to SVN. If you need it before that, I'm afraid you'll have to look into adding it yourself. See the documentation for how to do that. Robby From sbloch at adelphi.edu Fri Jan 2 16:35:17 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:36:55 2009 Subject: [plt-scheme] image-snip stuff In-Reply-To: References: Message-ID: <236F4018-5B8A-428B-BD9E-31DA53814F6D@adelphi.edu> On Jan 2, 2009, at 4:25 PM, Stephen Bloch wrote: > What does it mean when two images satisfy > (= (image-width pic1) (image-width pic2)) > (= (image-height pic1) (image-height pic2)) > (equal? (image->alpha-color-list pic1) (image->alpha-color-list pic2)) > > but not > > (image=? pic1 pic2) Never mind: they have different pinholes. Is there any other way it can happen? Stephen Bloch sbloch@adelphi.edu From grettke at acm.org Fri Jan 2 17:10:26 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:36:55 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data Message-ID: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> Hi folks, I am trying to understand how reuse macro data, in this particular contrived scenario: Suppose you want to crack a safe. The first attempt you make is to use a safe cracking machine so you write this code for someone to use who provides the specification via a safe cracking data format: #|safe-opener-one.scm|# #lang scheme (provide crack-safe) ; Given a safe cracking definition, define a command list for processing ; by the SafeCracker2K machine. (define-syntax crack-safe (syntax-rules (→) [(_ (1st-num → 2nd-num → 3rd-num) ...) (list "Init-code 1024" "Init-code 2048" "Push epoch starttime" (string-append "Crack-safe: " (number->string 1st-num) " then " (number->string 2nd-num) " and-finally " (number->string 3rd-num)) ...)])) ; (crack-safe (36 → 24 → 38) (63 → 42 → 83)) => ; ("Init-code 1024" ; "Init-code 2048" ; "Push epoch starttime" ; "Crack-safe: 36 then 24 and-finally 38" ; "Crack-safe: 63 then 42 and-finally 83") They try using it here, but the safe isn't cracked: #|safe-opener-test.scm|# #lang scheme (require "safe-opener-one.scm") (crack-safe (36 → 24 → 38) (63 → 42 → 83)) So they go about it by a different means, not wanting to change their specification of course: #|safe-opener-two.scm|# #lang scheme (provide crack-safe) ; Given a safe cracking definition, print out a request to give to ; "Vinnie" who will crack the safe for us. (define-syntax crack-safe (syntax-rules (→) [(_ (1st-num → 2nd-num → 3rd-num) ...) (string-append "Dear \"Vinnie\", we have a job for you.\n" "We gave you know who an offer he couldn't refuse and he said that \n" "the following codes might work.\n" (string-append "" (number->string 1st-num) "-" (number->string 2nd-num) "-" (number->string 3rd-num) "\n") ... "If they don't, that is fine. Bring your special toolkit.")])) ; (display (crack-safe (36 → 24 → 38) (63 → 42 → 83))) => ; Dear "Vinnie", we have a job for you. ; We gave you know who an offer he couldn't refuse and he said that ; the following codes might work. ; 36-24-38 ; 63-42-83 ; If they don't, that is fine. Bring your special toolkit. #|safe-opener-test.scm|# #lang scheme (require "safe-opener-two.scm") (crack-safe (36 → 24 → 38) (63 → 42 → 83)) This one works, but now they find that for some contrived reason they want to use that specification to generate commands both for the safe cracking machine, and for Vinnie. Also, since the specification is so complicated (please pretend it is long and complicated), they don't want to have to maintain two copies of it. On top of that, they don't want to have to change how the definition looks at all. They want to be able to store that config in a single file, and just pass the data to either of the two safe cracker macros. I'm not sure how one would do this. As I write this, I feel like if we could capture the config data: (define config '((36 → 24 → 38) (63 → 42 → 83))) and when we apply it to either of the macros, what we would really want to have happen is rather than: (crack-safe config) which would complain about we really want: (crack-safe ) This seems ok because the data specification is static. I only thought about this just now, so I didn't dig any deeper yet. Is this a reasonable approach? If so, what is the best way to approach it? What is the right/idiomatic solution here? Or is this bad idea? Best wishes, Grant -- http://www.wisdomandwonder.com/ From jmarshall at alum.mit.edu Fri Jan 2 17:11:24 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:36:56 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> Message-ID: 2009/1/2 Grant Rettke : > > I don't understand the practical application of currying in Scheme, so > I'm not asking about one or the other; the wikipedia link was just my > going in position on trying to understand what is currying. > > When you do apply the latter, what are the idioms or patterns that you > most often encounter? Your best bet would be to look at existing Scheme code. I found this example in the MIT Scheme loader: (define (fasloader->loader loader) (lambda (environment purify?) (let ((scode (loader))) (if purify? (purify (load/purification-root scode))) (extended-scode-eval scode environment)))) (define (source-loader pathname) (lambda (environment purify?) purify? (call-with-input-file pathname (lambda (port) (let loop ((value unspecific)) (let ((sexp (read port environment))) (if (eof-object? sexp) value (loop (repl-eval sexp environment))))))))) (define (wrap-loader pathname loader) (lambda (environment purify?) (lambda () (with-load-environment environment (lambda () (with-eval-unit (pathname->uri pathname) (lambda () (loader environment purify?)))))))) Each of these curried functions expect an environment and a boolean. When you load a file, a procedure called `choose-load-method' is invoked and it calls one of these procedures. The caller of `choose-load-method' can then invoke the appropriate method to actually get the code loaded. -- ~jrm From jmarshall at alum.mit.edu Fri Jan 2 17:18:56 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:36:56 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> Message-ID: On Fri, Jan 2, 2009 at 2:10 PM, Grant Rettke wrote: > > This seems ok because the data specification is static. I only thought > about this just now, so I didn't dig any deeper yet. Is this a > reasonable approach? If so, what is the best way to approach it? > > What is the right/idiomatic solution here? Or is this bad idea? Just my 2 cents. Use a function rather than a macro. Macros are a great tool for syntactic abstraction, but you aren't doing that. -- ~jrm From jpc-ml at zenburn.net Fri Jan 2 18:48:27 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:36:56 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> Message-ID: <495EA7CB.5010502@zenburn.net> On 1/2/09 11:18 PM, Joe Marshall wrote: > On Fri, Jan 2, 2009 at 2:10 PM, Grant Rettke wrote: >> This seems ok because the data specification is static. I only thought >> about this just now, so I didn't dig any deeper yet. Is this a >> reasonable approach? If so, what is the best way to approach it? >> >> What is the right/idiomatic solution here? Or is this bad idea? > > Just my 2 cents. > > Use a function rather than a macro. > > Macros are a great tool for syntactic abstraction, but you aren't > doing that. AFAIK just use define instead of define-syntax. syntax-case returns a normal function so this should work (maybe with some syntax->datum on the result). Or use match-lambda instead of syntax-case. -- regards, Jakub Piotr C?apa From jpc-ml at zenburn.net Fri Jan 2 18:54:53 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:36:56 2009 Subject: [plt-scheme] match-lambda and source location Message-ID: <495EA94D.4040209@zenburn.net> match-lambda creates a lambda without overriding syntax information. This greatly reduces the information content in stack traces. OTOH overriding the source information for the lambda keyword greatly reduces the clarity of the macro code... An idea: (WARNING: may be stupid ;) Maybe the stack trace should not trace the real stack at all? It could get new marks every time the source location barier is crossed (so the lambda is reported as a part of match-lambda macro definition source but the expression in its body is also mentioned). It could also track tail calls in a length limited list (forgetting older "stack" frames). -- regards, Jakub Piotr C?apa From grettke at acm.org Fri Jan 2 19:25:57 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:36:56 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> Message-ID: <756daca50901021625i1283d6b8k8eefc9521ce8178b@mail.gmail.com> On Fri, Jan 2, 2009 at 4:18 PM, Joe Marshall wrote: > On Fri, Jan 2, 2009 at 2:10 PM, Grant Rettke wrote: >> >> This seems ok because the data specification is static. I only thought >> about this just now, so I didn't dig any deeper yet. Is this a >> reasonable approach? If so, what is the best way to approach it? >> >> What is the right/idiomatic solution here? Or is this bad idea? > > Just my 2 cents. > > Use a function rather than a macro. > > Macros are a great tool for syntactic abstraction, but you aren't > doing that. The last time I tried something like this, I ended up using the match library to destructure the data and delegated the work to different classes that implemented the same interface. It worked out fine, but I am starting to think that I could have implemented it in a more easily maintained manner. I also wonder what my solution would have looked like if I had stuck with the now availabe R6RS and not used an object system at all. I suspect that structures would have made my approach easier to maintain. My lurking question is one of Scheme style. Since I am not interested in evaluating code from "somewhere else", and I am really just interested in utilizing the data to generate some code based on "what is says", it doesn't seem like an abuse of the macro system. I just want to take some symbols and generate code differently based on what I see. Does the fact that I'm taking this data and compiling it down to something trivial disqualify it? What if it were being compiled into a compelling "thing" written in Scheme? Your point makes sense. It can be a standard approach; macros are for syntactic abstraction, period. The confusing part here is that if I am using that data to to control how something is generated with a macro in Scheme, it is not syntactic abstraction, but, it doesn't seem like an abuse of the macro system either. I recently reread Shriram's "Automata via Macros", and was thinking about this sort of a scenario and how one might deal with the same specification being used to generate different types of code. I think that is the key, it is not about parsing data, it is about generating code differently based on the input data. I believe I am closer to asking the right question than I did to start with, because that is not the question that I asked in the original post. I see now, there is a clear delineation: once scenario is parsing data differently (with different functions or classes) and another is generating code differently based on the input. The problem I am trying to solve is the former, macros don't make sense. That said, if they did make sense, how would one go about reusing that data definition? From yinso.chen at gmail.com Fri Jan 2 21:40:53 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:36:57 2009 Subject: [plt-scheme] parser-tools: recursive lex? Message-ID: <779bf2730901021840i2c0d1114r7fd23d91d1e93ec6@mail.gmail.com> Hi, I am trying to parse internet messages, which is mostly regular besides for comment (which can nest), and I am not sure how to handle comment correctly with lex. The code below (lexing internet message comment syntax) results in an infinite loop, so I assume lex can only handle regular expressions, but want to check to see if it can be done (or how the problem can be solved), or if I need to use yacc? Thanks, yc (require parser-tools/lex (prefix-in : parser-tools/lex-sre)) ;; below defines a simpled internet message comment (define-lex-abbrevs (ctext (:- any-char (:or #\( #\)))) (ccontent (:or ctext comment)) (comment (:: #\( (:* ccontent) #\)))) (define comment-lexer (lexer (comment lexeme))) ;; inf loop (comment-lexer (open-input-string "(this is a internet message comment)")) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090102/906a12fe/attachment.html From rcleis at mac.com Sat Jan 3 00:29:32 2009 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:36:58 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> Message-ID: On Jan 2, 2009, at 7:57 AM, Grant Rettke wrote: > On Tue, Dec 30, 2008 at 11:44 PM, Richard Cleis wrote: >> On Dec 30, 2008, at 9:12 PM, Grant Rettke wrote: >>> Why do layman (working programmers) care about Currying? Or how are >>> they applied in daily use to help one out? >> >> I'm not sure if you are referring to 'using a function that curries >> other >> functions,' or if you mean (as the wikisnip says) "if you fix some >> arguments, you get a function of the remaining arguments." I >> manually do the >> latter frequently, and it's one of the reasons I like Scheme so much. > > I don't understand the practical application of currying in Scheme, so > I'm not asking about one or the other; the wikipedia link was just my > going in position on trying to understand what is currying. > > When you do apply the latter, what are the idioms or patterns that you > most often encounter? I often encounter core functions of at least several arguments, most or all of which are results of independent computations of diverse complexity. Efficiency is enhanced by ordering the arguments by complexity and using Curry-related closures. The organization of the program tends to be more appealing to me since variables contain intermediate functions of specific meaning, rather than specific data that are used by a generally-named core function. In other words, Currying permits repeated use of intermediate functions as an alternative to overtly managing arguments to a core function. > I understand the idea of using bindings to capture state, but I don't > see how that translates into normal usage. For example, if you write > > (define (((foo a) b) c) > (? () (do-something-to a b c))) > > you will get a function back 3 times, but only the third time is the > result you expect. How do you know when to stop, keep track of how > many times you called it? Is this a good example? The earlier post, http://list.cs.brown.edu/pipermail/plt-scheme/2009-January/029418.html is a specific example of producing intermediate functions using keywords. Below is a way to use the Currying form that you present. The function that would return 'earth' is used much less often than the core function. The function that would return 'telescope' is used more often, but not as much as the core function. The outer function would then be used perhaps thousands or millions of times to generate flightpaths of one or more ufos. (define (((view-info earth) telescope) ufo) (string-append "Geometric calcs of: " ufo ", " telescope ", " earth)) (((view-info "earth at 12:00") "big telescope") "green ufo at 12:01") ; a test, but not practical (define use-earth-at-12:00 (view-info "earth at 12:00")) (define view-from-starfire (use-earth-at-12:00 "starfire telescope")) (define view-from-firepond (use-earth-at-12:00 "firepond telescope")) (define ufos (list "green-ufo-at-12:01" "green-ufo-at-12:02" "red-ufo- at-12:01")) (map view-from-starfire ufos) (map view-from-firepond ufos) Welcome to DrScheme, version 4.1 [3m]. Language: Module; memory limit: 128 megabytes. "Geometric calcs of: green ufo at 12:01, big telescope, earth at 12:00" ("Geometric calcs of: green-ufo-at-12:01, starfire telescope, earth at 12:00" "Geometric calcs of: green-ufo-at-12:02, starfire telescope, earth at 12:00" "Geometric calcs of: red-ufo-at-12:01, starfire telescope, earth at 12:00") ("Geometric calcs of: green-ufo-at-12:01, firepond telescope, earth at 12:00" "Geometric calcs of: green-ufo-at-12:02, firepond telescope, earth at 12:00" "Geometric calcs of: red-ufo-at-12:01, firepond telescope, earth at 12:00") > rac "We ascribe beauty to that which is simple." --Ralph Waldo Emerson -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090102/3788d3bf/attachment.htm From jpc-ml at zenburn.net Sat Jan 3 05:12:33 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:36:58 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: <495EA7CB.5010502@zenburn.net> References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> <495EA7CB.5010502@zenburn.net> Message-ID: <495F3A11.5070804@zenburn.net> On 1/3/09 12:48 AM, Jakub Piotr C?apa wrote: > On 1/2/09 11:18 PM, Joe Marshall wrote: >> On Fri, Jan 2, 2009 at 2:10 PM, Grant Rettke wrote: >>> This seems ok because the data specification is static. I only thought >>> about this just now, so I didn't dig any deeper yet. Is this a >>> reasonable approach? If so, what is the best way to approach it? >>> >>> What is the right/idiomatic solution here? Or is this bad idea? > > AFAIK just use define instead of define-syntax. syntax-case returns a > normal function so this should work (maybe with some syntax->datum on > the result). Or use match-lambda instead of syntax-case. This is of course not really true but the idea should be ok. Check this as well: http://www.kimbly.com/blog/000447.html -- regards, Jakub Piotr C?apa From mflatt at cs.utah.edu Sat Jan 3 13:51:15 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:36:58 2009 Subject: [plt-scheme] scheme/foreign, callbacks and NULL In-Reply-To: <20090101234945.6CA336500B2@mail-svr1.cs.utah.edu> References: <87ababunj9.fsf@delenn.lan> <20090101214946.CEE0D6500C3@mail-svr1.cs.utah.edu> <87abaatww2.fsf@delenn.lan> <20090101234945.6CA336500B2@mail-svr1.cs.utah.edu> Message-ID: <20090103185116.A8A1A65012F@mail-svr1.cs.utah.edu> At Thu, 1 Jan 2009 16:49:43 -0700, Matthew Flatt wrote: > At Fri, 02 Jan 2009 00:43:57 +0100, Andreas Rottmann wrote: > > Matthew Flatt writes: > > > > > At Thu, 01 Jan 2009 15:08:26 +0100, Andreas Rottmann wrote: > > [example snipped] > > >> > > >> This causes the following error when run: > > >> Scheme->C: expects argument of type ; given #f > > > > > > You can use `_pointer' instead of `_fpointer' as the last argument to > > > `g-idle-add-full%'. > > > > > Updating my example accordingly: > > > > #lang scheme > > > > (require scheme/foreign > > (only-in '#%foreign ffi-callback)) > > > > (unsafe!) > > > > (define libglib (ffi-lib "libglib-2.0" '("0"))) > > (define g-idle-add-full% (get-ffi-obj "g_idle_add_full" libglib _fpointer)) > > > > (define g-idle-add-full > > (function-ptr g-idle-add-full% > > (_cprocedure (list _int _fpointer _pointer _pointer) _uint))) > > > > (define my-idle-callback > > (function-ptr (lambda args > > (printf "idle, args: ~s~n" args) > > 1) > > (_cprocedure (list _pointer) _int))) > > > > (define my-destroy-callback > > (function-ptr (lambda args > > (printf "destroy, args: ~s~n" args)) > > (_cprocedure (list _pointer) _void))) > > > > (g-idle-add-full 200 my-idle-callback #f #f) > > (g-idle-add-full 200 my-idle-callback #f my-destroy-callback) > > ;; EOF > > > > I now get: > > > > Scheme->C: expects argument of type ; given # > > > > > I'll fix the docs to clarify that `_fpointer' doesn't allow NULL > > > pointers. Or maybe it should allow NULLs? > > > > > Either it should, or (preferably) you would be able to pass > > # objects for _pointer arguments. > > Hm... yes, I think ffi-callback objects probably should be allowed as > pointers. I'll wait for Eli to weigh in, though. Well, I've made the change for now, and we'll see what Eli says. The existing docs for `cpointer?' suggest that callbacks were meant to be allowed as pointers. While I was at it, I changed `_fpointer' to treat #f as NULL and vice-versa. Matthew From mflatt at cs.utah.edu Sat Jan 3 14:04:56 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:36:59 2009 Subject: [plt-scheme] parser-tools: recursive lex? In-Reply-To: <779bf2730901021840i2c0d1114r7fd23d91d1e93ec6@mail.gmail.com> References: <779bf2730901021840i2c0d1114r7fd23d91d1e93ec6@mail.gmail.com> Message-ID: <20090103190458.8BA8C65011F@mail-svr1.cs.utah.edu> At Fri, 2 Jan 2009 18:40:53 -0800, YC wrote: > The code below (lexing internet message comment syntax) results in an > infinite loop, so I assume lex can only handle regular expressions, but want > to check to see if it can be done (or how the problem can be solved), or if > I need to use yacc? A lexer can only directly match regular expressions, but you can match just the beginning of a comment, and then you can use a function call as the action to parse more. For an example of this technique, collects/syntax-color/scheme-lexer.ss which has a lexer that calls `read-nested-comment' when it matches "#|". Matthew From mflatt at cs.utah.edu Sat Jan 3 14:11:55 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:36:59 2009 Subject: [plt-scheme] match-lambda and source location In-Reply-To: <495EA94D.4040209@zenburn.net> References: <495EA94D.4040209@zenburn.net> Message-ID: <20090103191157.2380765011F@mail-svr1.cs.utah.edu> At Sat, 03 Jan 2009 00:54:53 +0100, Jakub Piotr C?apa wrote: > match-lambda creates a lambda without overriding syntax information. > This greatly reduces the information content in stack traces. > > OTOH overriding the source information for the lambda keyword greatly > reduces the clarity of the macro code... I don't understand what you mean. Can you provide an example, describe how it behaves, and describe how it should behave instead? > An idea: (WARNING: may be stupid ;) > Maybe the stack trace should not trace the real stack at all? It could > get new marks every time the source location barier is crossed (so the > lambda is reported as a part of match-lambda macro definition source but > the expression in its body is also mentioned). It could also track tail > calls in a length limited list (forgetting older "stack" frames). I may misunderstand this part, too, but I think the first half is what Errortrace (in the "errortrace" collection) does. It instruments code to push continuation marks that indicates source locations, and then the exception handler collects the marks to reconstruct a stack trace. Errortrace doesn't try to track tail calls beyond the immediate one. Matthew From d.j.gurnell at gmail.com Sat Jan 3 15:08:33 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:36:59 2009 Subject: [plt-scheme] ANN: Deprecation of Instaservlet and Instaweb Message-ID: <23700CD9-10C3-4081-AB9A-205A2DF6E39A@gmail.com> I just updated Instaservlet and Instaweb to work with PLT 4.1.3. I have released the packages to PLaneT: http://planet.plt-scheme.org/display.ss?package=instaservlet.plt&owner=untyped http://planet.plt-scheme.org/display.ss?package=instaweb.plt&owner=schematics Instaservlet and Instaweb should now be considered deprecated: no further updates are planned once the current versions are stable. The new "web-server/servlet-env" module (added in PLT 4.1.3) effectively replaces both packages: http://docs.plt-scheme.org/web-server/servlet-env_ss.html Users of either package are advised to rewrite their applications using web-server/servlet-env. This is a straightforward process: further information, including a deprecation notice and migration guidelines, is available in the docs: http://planet.plt-scheme.org/package-source/untyped/instaservlet.plt/2/1/planet-docs/instaservlet/index.html http://planet.plt-scheme.org/package-source/schematics/instaweb.plt/4/0/planet-docs/instaweb/index.html Many thanks to everyone who contributed to and used Instaservlet and Instaweb! -- Dave From jmarshall at alum.mit.edu Sat Jan 3 17:03:20 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:36:59 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: <756daca50901021625i1283d6b8k8eefc9521ce8178b@mail.gmail.com> References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> <756daca50901021625i1283d6b8k8eefc9521ce8178b@mail.gmail.com> Message-ID: On Fri, Jan 2, 2009 at 4:25 PM, Grant Rettke wrote: > > My lurking question is one of Scheme style. Since I am not interested > in evaluating code from "somewhere else", and I am really just > interested in utilizing the data to generate some code based on "what > is says", it doesn't seem like an abuse of the macro system. I just > want to take some symbols and generate code differently based on what > I see. > > Does the fact that I'm taking this data and compiling it down to > something trivial disqualify it? What if it were being compiled into a > compelling "thing" written in Scheme? Here's the logic behind my opinion. In your example, you are manipulating `means to open safes'. You have primitives like `try this combination' and `ask Vinnie', and means of combination like `first try primitive1, then try primitive2'. Now, given several primitives and some combinators, you want to reason about strategy. It seems to me that your primitives and combinators should be first-class objects. You want to bind them to variables, make lists of them, put them together and take them apart, etc. Macros, however, aren't designed for this sort of thing. A macro isn't a first-class object. You are using the macro only to parse the list representation of *one* of the primitive means to open a safe. A parsing library would get you further, and you wouldn't be limited by requiring that the list representation appear as a literal in the code. > I see now, there is a clear delineation: once scenario is parsing data > differently (with different functions or classes) and another is > generating code differently based on the input. The problem I am > trying to solve is the former, macros don't make sense. > > That said, if they did make sense, how would one go about reusing that > data definition? I have seen *very* few cases where this would make sense, but I think what you would want to do is write meta-macros that wrap the macros with a let-syntax form that does the base macro processing. It'd be one of those hairballs that Al* Petrofsky is so fond of. -- ~jrm From chust at web.de Sat Jan 3 17:21:13 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:36:59 2009 Subject: [plt-scheme] Trouble with mirrors.plt Message-ID: <495FE4D9.7060406@web.de> Hello, I'm using PLT Scheme 4.1.3.8 (SVN trunk from a few hours ago) on a PowerPC system running Gentoo Linux. I just tried to install (planet untyped/dispatch:1:7) which requires (planet untyped/mirrors:1:3) and ran into some problems. Do you know whether the errors I see are known problems and whether they are likely to impact the correct operation of dispatch.plt or not? For a description of the problems read on... The following errors occurred during the installation ($HOME stands for the my home directory): error: during making for /untyped/mirrors.plt/1/3 (mirrors) run-tests.ss:7:3: compile: unbound identifier in module in: test/text-ui error: during Building docs for $HOME/.plt-scheme/planet/300/4.1.3.8/cache/untyped/mirrors.plt/1/3/doc/mirrors.scrbl default-load-handler: cannot open input file: "$HOME/.plt-scheme/planet/300/4.1.3.8/cache/untyped/mirrors.plt/1/3/doc/mirrors.scrbl" (No such file or directory; errno=2) After that, the main documentation page for PLT Scheme now shows a red, broken entry (part ("(planet mirrors.scrbl (untyped mirrors.plt 1 3) doc)" "top")) and DrScheme reports the following entry unless the JavaScript tool, which seems to be part of mirrors.plt, is disabled in the preferences (again $HOME stands for my home directory): Error in phase 2 for tool #; "JavaScript" class*: interface-required method missing: extra-repl-information for class: ...ked/drscheme/tool.ss:34:8 for interface: language<%> === context === /opt/plt/collects/scheme/private/class-internal.ss:3669:2: obj-error /opt/plt/collects/scheme/private/map.ss:49:17: loop /opt/plt/collects/scheme/private/map.ss:44:11: for-each /opt/plt/collects/scheme/private/class-internal.ss:1793:2: compose-class $HOME/.plt-scheme/planet/300/4.1.3.8/cache/untyped/mirrors.plt/1/3/javascript.plt-5.4-hacked/drscheme/tool.ss:29:6: phase2 /opt/plt/collects/drscheme/private/tools.ss:421:0: run-phases cu, Thomas From meertdavid at gmail.com Sat Jan 3 15:16:59 2009 From: meertdavid at gmail.com (David Meert) Date: Thu Mar 26 02:37:00 2009 Subject: [plt-scheme] immutable list r6rs Message-ID: <495FC7BB.80707@gmail.com> Hello, I want to know how I can use immutable lists in r6rs. This is because [style '(border)] gives the following error: initialization for canvas%: expected argument of type ; given {border} my code is below: (import (rnrs base (6)) (only (scheme base) require)) (require scheme/class) (require scheme/gui/base) (new canvas% [parent vp-left] [style '(border)] [label "playerhimstats"] [min-height 224]) ) From geoff at knauth.org Sat Jan 3 17:58:53 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:37:00 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> <756daca50901021625i1283d6b8k8eefc9521ce8178b@mail.gmail.com> Message-ID: <72A4070C-D48C-493B-84D5-5199BE089B71@knauth.org> On Jan 3, 2009, at 17:03, Joe Marshall wrote to Grant Rettke: > Here's the logic behind my opinion. In your example, you are > manipulating `means to open safes'. You have primitives like `try > this combination' and `ask Vinnie', and means of combination like > `first try primitive1, then try primitive2'. Now, given several > primitives and some combinators, you want to reason about strategy. > It seems to me that your primitives and combinators should be first- > class objects. You want to bind them to variables, make lists of > them, put them together and take them apart, etc. > > Macros, however, aren't designed for this sort of thing. A macro > isn't a first-class object. You are using the macro only to parse > the list representation of *one* of the primitive means to open a > safe. A parsing library would get you further, and you wouldn't be > limited by requiring that the list representation appear as a > literalin the code. Maybe there is a use for macros in the artificial safe-cracking scheme. Macros could be used to deceive the user. Instead of asking Vinnie or just trying a combination, bindings could be manipulated and code replaced to send Vinnie's advice or working combinations to an untrusted third party. Geoffrey From yinso.chen at gmail.com Sat Jan 3 19:44:32 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:37:01 2009 Subject: [plt-scheme] parser-tools: recursive lex? In-Reply-To: <20090103190458.8BA8C65011F@mail-svr1.cs.utah.edu> References: <779bf2730901021840i2c0d1114r7fd23d91d1e93ec6@mail.gmail.com> <20090103190458.8BA8C65011F@mail-svr1.cs.utah.edu> Message-ID: <779bf2730901031644j1c85c595o6a8ab35b8563d220@mail.gmail.com> On Sat, Jan 3, 2009 at 11:04 AM, Matthew Flatt wrote: > > A lexer can only directly match regular expressions, but you can match > just the beginning of a comment, and then you can use a function call > as the action to parse more. > > For an example of this technique, > > collects/syntax-color/scheme-lexer.ss > > which has a lexer that calls `read-nested-comment' when it matches > "#|". > Thanks Matthew. I would look into it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090103/49d3d705/attachment.html From clements at brinckerhoff.org Sun Jan 4 00:30:05 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:01 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> Message-ID: <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> I think you've misunderstood monads: see my comments below. On Jan 1, 2009, at 2:31 PM, Joe Marshall wrote: > On Wed, Dec 31, 2008 at 5:55 PM, Gregory Woodhouse > wrote: >> Isn't the point of using monads.... > > I'm not a real fan of monads, but the original idea was to take a > program that > operated on base types, like int -> int, and transform it to a > program that > operated on (f int) -> (f int). In this new space, you can plug the > elements > together to create a program that operates on ints, but is > explicitly `wired' > to behave in a certain way. > > For example, you can mimic state by passing around a state variable. > You tranform your int -> int functions to (f int state) -> (f int > state), plug the > transformed functions together linearly so the state variable behaves > correctly, then run the resulting program. > > I'm sure you've done something similar with Scheme programs by > passing around an accumulator or something. > > Now here's the magic part. If you look at the transformed code, > you'll > see that the bulk of it isn't really using the state variable, it is > simply > passing it along to the next guy. So move the state variable to the > end > of the argument list, *curry the function*, and voila! the state > variable > is gone! You can do this to most of the code and make the state > variable virtually disappear. > > What you've done is factored your code such that the `plumbing' > --- the state variable and associated argument passing --- can be > separated from the more interesting computation. Yep. > The step of moving the state variable to the end of the argument list > and currying is critical. The trick wouldn't be nearly as interesting > if you couldn't drop the curried variable out of the picture. In > Scheme, > this is a bit of a pain because currying the argument list means > changing *every* call site. In Haskell, however, you can simply > omit the required variable and the language takes care of it. What you're saying makes some sense, but I don't think you'd describe this programming pattern as being a monadic one. As a matter of fact, using e.g. the store monad in Haskell *does* require quite an elaborate rewrite, typically using 'do' & 'return' in every function to be transformed. The 'do' monad can easily be implemented as a scheme macro (see below). Using this macro in Scheme is exactly as much work as using 'do' in Haskell. Returning to your proposed programming pattern: yes, what you're describing could be useful in implementing store-passing, but (unlike 'do') it doesn't help with the much more painful part of store- passing, which is threading the store through multiple calls made by a single procedure. There *is* one way in which Haskell's 'do' is much nicer than this one: Haskell's type system makes it possible to define a 'do' that works for a whole bunch of different monads, and isn't chained to just one. In Scheme, if you want to use 'do' for different monads, you'll probably have to enrich uses of 'do' to indicate which monad's 'bind' to expand into. > That's why I said that the Haskell community would be far less > excited about monads if their language didn't automagically do the > currying. By the above, I believe this is incorrect. I would instead suggest that the Haskell community would be far less excited about monads if their language provided mutation. Feel free to correct any mistakes I've made, John Implementation of 'do' for the state monad in plt scheme. This expands into uses of 'bind', so you'd better have 'bind' defined in this scope. There's also an example, which depends the particulars of the homework assignment it was a part of (including PLAI-style structures), but should serve to illustrate (assuming you're already fairly familiar with Haskell's 'do'). ;; sdo : an imitation of Haskell's do: (define-syntax (sdo stx) (letrec ([popclause (lambda (clause) (syntax-case clause (<-) [(a <- rhs) (list #'a #'rhs)] [rhs (list #'bogus #'rhs)]))] [rearrange (lambda (lopops) (if (null? (cdr lopops)) (cadar lopops) #`(bind #,(cadar lopops) (lambda (#,(caar lopops)) #,(rearrange (cdr lopops))))))]) (syntax-case stx () [(_ clause ...) (let* ([popped (map popclause (syntax->list #'(clause ...)))]) (rearrange popped))]))) Here's an example of using it: (test (run (sdo (s <- getstore) (p <- (return (litV (+ (litV-val (store-lookup s 0)) 1)))) (setstore (aSto 0 p s)) (return 4)) (aSto 0 (litV 4) (mtSto))) (a*s 4 (aSto 0 (litV 5) (aSto 0 (litV 4) (mtSto))))) -------------- 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/20090103/ac400c77/smime.bin From noelwelsh at gmail.com Sun Jan 4 04:34:28 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:37:01 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> Message-ID: Below is some code I've just written that uses a heavily curried style. I probably won't have written it in such a form if this thread hadn't been active, but as it is I think it gives a good example how currying can be advantageous. The code is defining a bunch of functions that can be used to generate observations for a simulated robot as it moves about a map. It's completely untested. HTH, N. ;; The map, a simplified CS department floor: ;; ;; A -- D -- E -- H ;; | | | | ;; B -- C F -- G (define (make-generator) (vector->pseudo-random-generator #(1 1 1 1 1 1))) (define noise 0.2) ;; (psuedo-random-generator -> (U 0 1) -> -> (U 0 1)) (define (make-wall generator) (lambda (real) (define false (if (zero? real) 1 0)) (lambda () (define real? (if (< (random generator) noise) #f #t)) (if real? real false)))) ;; (psuedo-random-generator -> (U 0 1) (U 0 1) (U 0 1) (U 0 1) -> -> (U 0 1)) (define (make-place generator) (define wall-maker (make-wall generator)) (lambda (n e s w) (define north (wall-maker n)) (define east (wall-maker e)) (define south (wall-maker s)) (define west (wall-maker w)) (lambda () (vector (north) (east) (south) (west))))) (define generator (make-generator)) (define place-maker (make-place generator)) (define a (place-maker 1 0 0 1)) (define b (place-maker 0 0 1 1)) (define c (place-maker 0 1 1 0)) (define d (place-maker 1 0 0 0)) (define e (place-maker 1 0 0 0)) (define f (place-maker 0 0 1 1)) (define g (place-maker 0 1 1 0)) (define h (place-maker 1 1 0 0)) From d.j.gurnell at gmail.com Sun Jan 4 08:10:51 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:02 2009 Subject: [plt-scheme] Trouble with mirrors.plt In-Reply-To: <495FE4D9.7060406@web.de> References: <495FE4D9.7060406@web.de> Message-ID: <31DB6040-330A-4E7A-B175-825A8AAD5699@gmail.com> Thomas Chust wrote: > I just tried to install (planet untyped/dispatch:1:7) which requires > (planet untyped/mirrors:1:3) and ran into some problems. > > Do you know whether the errors I see are known problems and whether > they > are likely to impact the correct operation of dispatch.plt or not? Hi Thomas, My bad, sorry. There was a missing version number on the require statements for Schemeunit in Mirrors. Fixed in v1.5 on PLaneT. Let me know if you have any further problems. Cheers, -- Dave From neil at neilvandyke.org Sun Jan 4 08:52:50 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:02 2009 Subject: [plt-scheme] supported character set conversions in PLT 4.x on Linux Message-ID: <4960BF32.2060306@neilvandyke.org> If my application runs on Linux, can I be reasonably confident that, in future PLT 4.x versions, "bytes-open-converter" will support all the encodings of "iconv_open"? And furthermore that future versions will support all the encoding names of "iconv_open" (e.g., will support the name "CP1252" as meaning the Windows-1252 encoding)? http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html Thanks. -- http://www.neilvandyke.org/ From mflatt at cs.utah.edu Sun Jan 4 09:01:09 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:02 2009 Subject: [plt-scheme] supported character set conversions in PLT 4.x on Linux In-Reply-To: <4960BF32.2060306@neilvandyke.org> References: <4960BF32.2060306@neilvandyke.org> Message-ID: <20090104140111.7F7246500BF@mail-svr1.cs.utah.edu> At Sun, 04 Jan 2009 08:52:50 -0500, Neil Van Dyke wrote: > If my application runs on Linux, can I be reasonably confident that, in > future PLT 4.x versions, "bytes-open-converter" will support all the > encodings of "iconv_open"? > > And furthermore that future versions will support all the encoding names > of "iconv_open" (e.g., will support the name "CP1252" as meaning the > Windows-1252 encoding)? Yes. Matthew From neil at neilvandyke.org Sun Jan 4 09:13:53 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:02 2009 Subject: [plt-scheme] supported character set conversions in PLT 4.x on Linux In-Reply-To: <20090104140111.7F7246500BF@mail-svr1.cs.utah.edu> References: <4960BF32.2060306@neilvandyke.org> <20090104140111.7F7246500BF@mail-svr1.cs.utah.edu> Message-ID: <4960C421.4000802@neilvandyke.org> Matthew Flatt wrote at 01/04/2009 09:01 AM: > Yes. > Excellent. Thanks, Matthew. From chust at web.de Sun Jan 4 09:15:32 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:37:02 2009 Subject: [plt-scheme] Trouble with mirrors.plt In-Reply-To: <31DB6040-330A-4E7A-B175-825A8AAD5699@gmail.com> References: <495FE4D9.7060406@web.de> <31DB6040-330A-4E7A-B175-825A8AAD5699@gmail.com> Message-ID: <4960C484.5040108@web.de> Dave Gurnell wrote: > Thomas Chust wrote: >> I just tried to install (planet untyped/dispatch:1:7) which requires >> (planet untyped/mirrors:1:3) and ran into some problems. > > My bad, sorry. There was a missing version number on the require > statements for Schemeunit in Mirrors. Fixed in v1.5 on PLaneT. Hello Dave, thanks for the quick fix! untyped/dispatch:1:7 seems to work flawlessly now :-) While I installed the new untyped/mirrors:1:5, planet reported some more errors generating the documentation for dherman/test:2:0 and dherman/javascript:8:0. However these errors are hardly your fault and a quick check suggests that they don't impact the correct operation of these packages either, just their documentation is missing. cu, Thomas From neil at neilvandyke.org Sun Jan 4 11:25:03 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:02 2009 Subject: [plt-scheme] efficiently converting from foo to Latin-1-safe for storage in strings Message-ID: <4960E2DF.1000105@neilvandyke.org> Let's say that most of my system is using UTF-8, but there is one part that is not yet. Until that part can be reworked, I want to make sure that all user-supplied strings (which are read from a port in character encoding "foo") have been converted to Latin-1, with any non-Latin-1 characters replaced with question-marks. These converted Latin-1-safe string values are stored in Scheme strings. What's an efficient way to do this? Plug multiple "reencode-input-port" together, to convert from "foo" to Latin-1 to UTF-8? Thanks. From jpc-ml at zenburn.net Sun Jan 4 13:16:20 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:37:02 2009 Subject: [plt-scheme] Source location infromation and tracebacks (was: match-lambda and source location) In-Reply-To: <20090103191157.2380765011F@mail-svr1.cs.utah.edu> References: <495EA94D.4040209@zenburn.net> <20090103191157.2380765011F@mail-svr1.cs.utah.edu> Message-ID: <4960FCF4.9010305@zenburn.net> On 1/3/09 8:11 PM, Matthew Flatt wrote: > At Sat, 03 Jan 2009 00:54:53 +0100, Jakub Piotr C?apa wrote: >> match-lambda creates a lambda without overriding syntax information. >> This greatly reduces the information content in stack traces. >> >> OTOH overriding the source information for the lambda keyword greatly >> reduces the clarity of the macro code... > > I don't understand what you mean. Can you provide an example, describe > how it behaves, and describe how it should behave instead? Ok. I think I misinterpreted the problem since I last stumbled upon it. Here is the test case: (define test-1 (match-lambda [(list a b) #t])) (define (test-2 l) (match l [(list a b) #t])) Notice the difference in tracebacks between (test-1 #t) and (test-2 #t). This is as far as I (now) understand related to source location information of the match form. The problem with readability of the macros was in my own code: (define-syntax (on-notif stx) (syntax-case stx () [(on-notif (notif arg ...) expr expr+ ...) (with-syntax ([fun (datum->syntax #'here (syntax-e #'(lambda (arg ...) expr expr+ ...)) #'on-notif)]) #'(begin #;(** 'notif (list fun (notif-observers notif))) (notif-add-observer! notif fun)))])) Not very pretty and AFAIR I had to datum->syntax the whole expression and not only the lambda keyword... Is there a better way to solve this? (I wanted to differentiate the resulting closures when they were printed) > I may misunderstand this part, too, but I think the first half is what > Errortrace (in the "errortrace" collection) does. It instruments code > to push continuation marks that indicates source locations, and then > the exception handler collects the marks to reconstruct a stack trace. > Errortrace doesn't try to track tail calls beyond the immediate one. 1. My (uneducated) idea was to add a note every time the source location info suggests that we changed from macro generated code to user code and vice versa. 2. Tracing several previous tail calls could ease the debugging of loops and should be possible without breaking the space efficiency of tail calls. This would provide for Scheme loops what tracebacks provide for normal function calls. An answer to the question: How I got here? This is something that Scheme style iteration could do much better than an average imperative loop. A related concern is that even when tail calls are not used for looping we sometimes loose information: (define (sqrt-inv a) (let ([inv (/ a)]) (sqrt inv))) (define (do-b b) (sqrt-inv (* 2 b))) (define (do-c c) (if (< c 0) #f (do-b c))) When we call (do-c 0) we don't get any of the do- functions in the traceback. I have only limited knowledge of how continuation marks (and the traceback machinery) work in PLT Scheme so I apologize if my remarks are not very good. -- regards, Jakub Piotr C?apa From jos.koot at telefonica.net Sun Jan 4 14:33:22 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:03 2009 Subject: [plt-scheme] Source location infromation and tracebacks (was: match-lambda and source location) References: <495EA94D.4040209@zenburn.net><20090103191157.2380765011F@mail-svr1.cs.utah.edu> <4960FCF4.9010305@zenburn.net> Message-ID: <55C861D0441C4D8F9CC17A1EFF0E3EAD@uw2b2dff239c4d> ----- Original Message ----- From: "Jakub Piotr C?apa" To: "PLT-list" Cc: "Matthew Flatt" Sent: Sunday, January 04, 2009 7:16 PM Subject: [plt-scheme] Source location infromation and tracebacks (was: match-lambda and source location) > This would provide for Scheme loops what tracebacks provide for normal > function calls. An answer to the question: How I got here? This is > something that Scheme style iteration could do much better than an average > imperative loop. > > A related concern is that even when tail calls are not used for looping we > sometimes loose information: > (define (sqrt-inv a) > (let ([inv (/ a)]) > (sqrt inv))) > > (define (do-b b) > (sqrt-inv (* 2 b))) > > (define (do-c c) > (if (< c 0) > #f > (do-b c))) > > When we call (do-c 0) we don't get any of the do- functions in the > traceback. Because almost everything is in tail position. When finally '/' is called, the stack no longer contains info on the calls to do-c and do-b. They have gone. The only thing that is left is the argument given to '/' and the continuation of (do-c 0) Even variable a is no longer on the stack (only its value) The only things left on the stack are the call to ',' and the continuation of (do-c 0) and they are both shown in the trace back. Without deleting the stuff from the stack we would not have proper tail-recursion. So asking for a trace of the last so many tail recursive calls would violate the proper tail-recursivity. You may see the diffrence by removing the tail positions (define (sqrt-inv a) (let ([inv (/ a)]) (sqrt inv))) (define (do-b b) (let ((x (sqrt-inv (* 2 b)))) x)) ; inhibit tail position (define (do-c c) (if (< c 0) #f (let ((x (do-b c))) x))) ; inhibit tail position (do-c 0) This gives a trace back along all stuff. Jos From benjisimon at gmail.com Sun Jan 4 14:48:24 2009 From: benjisimon at gmail.com (Ben Simon) Date: Thu Mar 26 02:37:03 2009 Subject: [plt-scheme] Re: Why do layman programmers care about Currying? In-Reply-To: <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> Message-ID: On Jan 2, 9:57?am, "Grant Rettke" wrote: > On Tue, Dec 30, 2008 at 11:44 PM, Richard Cleis wrote: > > On Dec 30, 2008, at 9:12 PM, Grant Rettke wrote: > >> Why do layman (working programmers) care about Currying? Or how are > >> they applied in daily use to help one out? > [...] > I don't understand the practical application of currying in Scheme, so > I'm not asking about one or the other; the wikipedia link was just my > going in position on trying to understand what is currying. For me, the practical side of currying has to do with providing some arguments to a function, while leaving others unset. The result is a new function that takes in just the unset arguments. This may not sound very useful, but as the example below attempts to show, it can actually be quite handy. My suggestion is to read up on SRFI 26 and make it one of the standard tools you use. ;;; ---------------------------------------------------------- #lang scheme ;; Scheme doesn't offer automatic currying, but SRFI-26 provides ;; the (cut ...) operator which gets us close enough. (require srfi/26) ;; A function to send e-mail. This is a bogus implementation, ;; could easily be a "real" implementation (define (send-mail smtp-host smtp-port from to subject message) (printf "Would have sent a message: \n") (printf " SMTP server: ~a:~a\n" smtp-host smtp-port) (printf " From: ~a\n" from) (printf " To: ~a\n" to) (printf " Subject: ~a\n" subject) (printf " Message: ~a\n" message)) ;; A place holder function to return a list of e-mail addresses. Used ;; for testing below. (define (list-of-emails) '("foo@nowhere.com" "bar@nowhere.com" "baz@nowhere.com")) ;; Let's start currying... ;; EXAMPLE 1 ;; Here we provide two arguments to our send-mail function, and leave ;; 3 unset (<> serves as a place holder). The result of this is a those ;; function that takes in just 3 remaining arguments. ;; ;; Now we can use `mailer' throughout our application and not have to worry about providing ;; the SMTP host and port. (define mailer (cut send-mail "mail.myhost.com" 25 "noreply@myhost.com" <> <> <>)) ;; Use our mailer (mailer "example@nowhere.com" "Hello World" "This is just a test...") ;; EXAMPLE 2 ;; Let's say we want to send the same message over and over again. We can use (cut ...) to ;; provide every argument but the to address. Notice how we can operate on our already curried ;; function. (define broadcaster (cut mailer <> "A Special offer, Just For You" "Here's a special offer, sent only to you. We promise...")) ;; Use our broadcaster (for-each broadcaster (list-of-emails)) ;; EXAMPLE 3 ;; We can provide all the arguments except for a message, and turn our mail ;; function into a logger. (define logger (cut mailer "logging@nowhere.com" "Log Message" <>)) ;; Pretend this is some complicated function (define (something-complicated logger) (logger "Starting to do something complicated...") (void) (logger "Whew, and we're done.")) (something-complicated logger) From jos.koot at telefonica.net Sun Jan 4 15:29:14 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:04 2009 Subject: [plt-scheme] Re: Why do layman programmers care about Currying? References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <756daca50901020657k26068f72ve33a019fdfbce1a7@mail.gmail.com> Message-ID: <75099CE170274F67B2B840E4D2604C8E@uw2b2dff239c4d> #lang scheme ; permute : list-of-a (a a -> boolean) -> (list-of list-of-a) ; take all permutations of a list, but do not include more than one ; copy of all permutations A and B for which (andmap eq A B) (define (permute lst eq) (if (null? lst) '(()) (apply append (map (curry process-rotation eq) (rotations lst eq))))) ; rotations : list-of-a (a a -> boolean) -> (list-of list-of-a) ; take all rotations of a list, but only those with different cars. (define (rotations lst eq) (let loop ((head lst) (tail '())) (cond ((null? head) '()) ((ormap (curry eq (car head)) tail) (loop (cdr head) (cons (car head) tail))) (else (cons (append head (reverse tail)) ; (*) (loop (cdr head) (cons (car head) tail))))))) ; process-rotation : (a a -> boolean) (list-of a) -> (listof list-of a) ; cons the car of a rotation to all permutations of the cdr of that rotation. (define (process-rotation eq rot) (map (curry cons (car rot)) (permute (cdr rot) eq))) ; curry : procedure any ... -> procedure ; curry from left (define (curry fun . args) (lambda other-args (apply fun (append args other-args)))) ;test (equal? (permute '(a a b c) eq?) '((a a b c) (a a c b) (a b c a) (a b a c) (a c a b) (a c b a) (b c a a) (b a a c) (b a c a) (c a a b) (c a b a) (c b a a))) ; --> #t (*) the reversal is not necessary, but without it the word 'rotation' would be misleading and the permutations may be listed in another order. Jos ----- Original Message ----- From: "Ben Simon" To: Sent: Sunday, January 04, 2009 8:48 PM Subject: [plt-scheme] Re: Why do layman programmers care about Currying? On Jan 2, 9:57 am, "Grant Rettke" wrote: > On Tue, Dec 30, 2008 at 11:44 PM, Richard Cleis wrote: > > On Dec 30, 2008, at 9:12 PM, Grant Rettke wrote: > >> Why do layman (working programmers) care about Currying? Or how are > >> they applied in daily use to help one out? > [...] > I don't understand the practical application of currying in Scheme, so > I'm not asking about one or the other; the wikipedia link was just my > going in position on trying to understand what is currying. For me, the practical side of currying has to do with providing some arguments to a function, while leaving others unset. The result is a new function that takes in just the unset arguments. This may not sound very useful, but as the example below attempts to show, it can actually be quite handy. My suggestion is to read up on SRFI 26 and make it one of the standard tools you use. ;;; ---------------------------------------------------------- #lang scheme ;; Scheme doesn't offer automatic currying, but SRFI-26 provides ;; the (cut ...) operator which gets us close enough. (require srfi/26) ;; A function to send e-mail. This is a bogus implementation, ;; could easily be a "real" implementation (define (send-mail smtp-host smtp-port from to subject message) (printf "Would have sent a message: \n") (printf " SMTP server: ~a:~a\n" smtp-host smtp-port) (printf " From: ~a\n" from) (printf " To: ~a\n" to) (printf " Subject: ~a\n" subject) (printf " Message: ~a\n" message)) ;; A place holder function to return a list of e-mail addresses. Used ;; for testing below. (define (list-of-emails) '("foo@nowhere.com" "bar@nowhere.com" "baz@nowhere.com")) ;; Let's start currying... ;; EXAMPLE 1 ;; Here we provide two arguments to our send-mail function, and leave ;; 3 unset (<> serves as a place holder). The result of this is a those ;; function that takes in just 3 remaining arguments. ;; ;; Now we can use `mailer' throughout our application and not have to worry about providing ;; the SMTP host and port. (define mailer (cut send-mail "mail.myhost.com" 25 "noreply@myhost.com" <> <> <>)) ;; Use our mailer (mailer "example@nowhere.com" "Hello World" "This is just a test...") ;; EXAMPLE 2 ;; Let's say we want to send the same message over and over again. We can use (cut ...) to ;; provide every argument but the to address. Notice how we can operate on our already curried ;; function. (define broadcaster (cut mailer <> "A Special offer, Just For You" "Here's a special offer, sent only to you. We promise...")) ;; Use our broadcaster (for-each broadcaster (list-of-emails)) ;; EXAMPLE 3 ;; We can provide all the arguments except for a message, and turn our mail ;; function into a logger. (define logger (cut mailer "logging@nowhere.com" "Log Message" <>)) ;; Pretend this is some complicated function (define (something-complicated logger) (logger "Starting to do something complicated...") (void) (logger "Whew, and we're done.")) (something-complicated logger) _________________________________________________ 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/20090104/3db202f4/attachment.html From mflatt at cs.utah.edu Sun Jan 4 18:54:58 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:04 2009 Subject: [plt-scheme] efficiently converting from foo to Latin-1-safe for storage in strings In-Reply-To: <4960E2DF.1000105@neilvandyke.org> References: <4960E2DF.1000105@neilvandyke.org> Message-ID: <20090104235459.879676500D9@mail-svr1.cs.utah.edu> At Sun, 04 Jan 2009 11:25:03 -0500, Neil Van Dyke wrote: > Let's say that most of my system is using UTF-8, but there is one part > that is not yet. > > Until that part can be reworked, I want to make sure that all > user-supplied strings (which are read from a port in character encoding > "foo") have been converted to Latin-1, with any non-Latin-1 characters > replaced with question-marks. > > These converted Latin-1-safe string values are stored in Scheme strings. > > What's an efficient way to do this? Plug multiple "reencode-input-port" > together, to convert from "foo" to Latin-1 to UTF-8? If you control the reading of strings from the port, then I recommend composing `string->bytes/latin-1' (using `(char->integer #\?)' as the second argument) and `bytes->string/latin-1' to filter the strings. If you need a port whose stream contains only Latin-1 characters, then it's more complicated, and I doubt that you can do it with `reencode-input-port'. The solution I see is to create a pipe and a background process that read from the original and writes filtered bytes/characters into the pipe, so that you use the read end of the pipe in place of the original port. (The filter should always read characters, but after filtering, it should write either characters or bytes back into the pipe, depending on whether the Latin-1 content is to be read with functions like `read-string' or like `read-bytes'.) Matthew From mflatt at cs.utah.edu Sun Jan 4 18:59:24 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:04 2009 Subject: [plt-scheme] immutable list r6rs In-Reply-To: <495FC7BB.80707@gmail.com> References: <495FC7BB.80707@gmail.com> Message-ID: <20090104235925.CA8806500C3@mail-svr1.cs.utah.edu> At Sat, 03 Jan 2009 21:16:59 +0100, David Meert wrote: > I want to know how I can use immutable lists in r6rs. > This is because [style '(border)] gives the following error: > initialization for canvas%: expected argument of type symbols>; given {border} > my code is below: > > (import (rnrs base (6)) > (only (scheme base) require)) > > (require scheme/class) > (require scheme/gui/base) > > (new canvas% > [parent vp-left] > [style '(border)] > [label "playerhimstats"] > [min-height 224]) > ) You can use `mlist->list' from `scheme/mpair': (require scheme/mpair) .... [style (mlist->list '(border))] ..... Matthew From mflatt at cs.utah.edu Sun Jan 4 19:34:49 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:04 2009 Subject: [plt-scheme] Source location infromation and tracebacks (was: match-lambda and source location) In-Reply-To: <4960FCF4.9010305@zenburn.net> References: <495EA94D.4040209@zenburn.net> <20090103191157.2380765011F@mail-svr1.cs.utah.edu> <4960FCF4.9010305@zenburn.net> Message-ID: <20090105003450.7C3416500D9@mail-svr1.cs.utah.edu> At Sun, 04 Jan 2009 19:16:20 +0100, Jakub Piotr C?apa wrote: > On 1/3/09 8:11 PM, Matthew Flatt wrote: > > At Sat, 03 Jan 2009 00:54:53 +0100, Jakub Piotr C?apa wrote: > >> match-lambda creates a lambda without overriding syntax information. > >> This greatly reduces the information content in stack traces. > >> > >> OTOH overriding the source information for the lambda keyword greatly > >> reduces the clarity of the macro code... > > > > I don't understand what you mean. Can you provide an example, describe > > how it behaves, and describe how it should behave instead? > > Ok. I think I misinterpreted the problem since I last stumbled upon it. > Here is the test case: > > (define test-1 > (match-lambda > [(list a b) #t])) > > (define (test-2 l) > (match l > [(list a b) #t])) > > Notice the difference in tracebacks between (test-1 #t) and (test-2 #t). > This is as far as I (now) understand related to source location > information of the match form. Ah, I see what you mean... > The problem with readability of the macros was in my own code: > > (define-syntax (on-notif stx) > (syntax-case stx () > [(on-notif (notif arg ...) > expr expr+ ...) > (with-syntax ([fun (datum->syntax #'here > (syntax-e #'(lambda (arg ...) > expr expr+ ...)) > #'on-notif)]) > #'(begin > #;(** 'notif (list fun (notif-observers notif))) > (notif-add-observer! notif fun)))])) The `syntax/loc' form makes this more readable: (with-syntax ([fun (syntax/loc #'on-notif #'(lambda (arg ...) expr expr+ ...))]) #'(begin (notif-add-observer! notif fun))) As another example, the `match-lambda' form could be implemented as (define-syntax (match-lambda stx) (syntax-case stx () [(k . clauses) (quasisyntax/loc stx (lambda (exp) #,(syntax/loc stx (match exp . clauses))))])) This would cause the stack trace for `(test-1 #t)' to give more information: it would show the `match-lambda' as a representative of the implicit `match' form. While that would give more information, it would look strange, because evaluating a `match-lambda' form doesn't actually evaluate its body. In other words, the `match-lambda' form isn't really a good representative for the macro-introduced `match'. > > I may misunderstand this part, too, but I think the first half is what > > Errortrace (in the "errortrace" collection) does. It instruments code > > to push continuation marks that indicates source locations, and then > > the exception handler collects the marks to reconstruct a stack trace. > > Errortrace doesn't try to track tail calls beyond the immediate one. > > 1. My (uneducated) idea was to add a note every time the source location > info suggests that we changed from macro generated code to user code and > vice versa. > > 2. Tracing several previous tail calls could ease the debugging of loops > and should be possible without breaking the space efficiency of tail calls. > > This would provide for Scheme loops what tracebacks provide for normal > function calls. I see what you mean about tail calls. In your original example, though, tail calls are not quite the problem. The real problem seems to be that there's no source expression within `test-1' whose dynamic extent includes the exception-raising expression --- that is, no expression in `test-1' to be a representative for the macro-introduced `match' form. In `test-2', the `match' expression's dynamic extent includes the evaluation of the exception-raising expression. It turns out that the exception-raising expression is called in tail position with respect to the `match' form, but the exception-raising expression doesn't have a source location. That's why the `match' form shows up in the stack trace. That is, a certain amount of tail-call history is currently preserved --- but only in that "no information" doesn't replace "some information". Even more detail: Why does `(test-2 #t)' show up in the stack trace, when the `match' form (and therefore the exception-raising expression) replaces the `(test-2 #t)' call? Shouldn't it get overwritten with the location of the `match' form? Actually, it does, and the `(test-2 #t)' that you see reported in the stack trace is actually the representative of something like `(print-value (test-2 #t))', where the `print-value' part was introduced by the module-body expander of the `scheme' language. If you switch the module to the `mzscheme' language --- which doesn't inject printing code --- you'll see that `(test-2 #t)' no longer appears in the trace. This also explains why `(test-1 #t)' shows up in the trace twice. The deeper call is really the printing expression, while the inner one is the function call --- and since there was no representative source expression for the `match' within `test-1' (or the exception-raising expression within the `match'), the location of the function call is never replaced later. From samth at ccs.neu.edu Sun Jan 4 21:49:33 2009 From: samth at ccs.neu.edu (Sam TH) Date: Thu Mar 26 02:37:04 2009 Subject: [plt-scheme] Source location infromation and tracebacks (was: match-lambda and source location) In-Reply-To: <20090105003450.7C3416500D9@mail-svr1.cs.utah.edu> References: <495EA94D.4040209@zenburn.net> <20090103191157.2380765011F@mail-svr1.cs.utah.edu> <4960FCF4.9010305@zenburn.net> <20090105003450.7C3416500D9@mail-svr1.cs.utah.edu> Message-ID: <63bb19ae0901041849i3a78da84o92e4854003a2e426@mail.gmail.com> On Sun, Jan 4, 2009 at 7:34 PM, Matthew Flatt wrote: > At Sun, 04 Jan 2009 19:16:20 +0100, Jakub Piotr C?apa wrote: >> On 1/3/09 8:11 PM, Matthew Flatt wrote: >> > At Sat, 03 Jan 2009 00:54:53 +0100, Jakub Piotr C?apa wrote: >> >> match-lambda creates a lambda without overriding syntax information. >> >> This greatly reduces the information content in stack traces. >> >> >> >> OTOH overriding the source information for the lambda keyword greatly >> >> reduces the clarity of the macro code... >> > >> > I don't understand what you mean. Can you provide an example, describe >> > how it behaves, and describe how it should behave instead? >> >> Ok. I think I misinterpreted the problem since I last stumbled upon it. >> Here is the test case: >> >> (define test-1 >> (match-lambda >> [(list a b) #t])) >> >> (define (test-2 l) >> (match l >> [(list a b) #t])) >> >> Notice the difference in tracebacks between (test-1 #t) and (test-2 #t). >> This is as far as I (now) understand related to source location >> information of the match form. > > Ah, I see what you mean... > >> The problem with readability of the macros was in my own code: >> >> (define-syntax (on-notif stx) >> (syntax-case stx () >> [(on-notif (notif arg ...) >> expr expr+ ...) >> (with-syntax ([fun (datum->syntax #'here >> (syntax-e #'(lambda (arg ...) >> expr expr+ ...)) >> #'on-notif)]) >> #'(begin >> #;(** 'notif (list fun (notif-observers notif))) >> (notif-add-observer! notif fun)))])) > > The `syntax/loc' form makes this more readable: > > (with-syntax ([fun (syntax/loc #'on-notif > #'(lambda (arg ...) expr expr+ ...))]) > #'(begin > (notif-add-observer! notif fun))) > > > As another example, the `match-lambda' form could be implemented as > > (define-syntax (match-lambda stx) > (syntax-case stx () > [(k . clauses) (quasisyntax/loc stx > (lambda (exp) > #,(syntax/loc stx (match exp . clauses))))])) > > This would cause the stack trace for `(test-1 #t)' to give more > information: it would show the `match-lambda' as a representative of > the implicit `match' form. While that would give more information, it > would look strange, because evaluating a `match-lambda' form doesn't > actually evaluate its body. In other words, the `match-lambda' form > isn't really a good representative for the macro-introduced `match'. So what should I (as the maintainer of `match') do here? It seems like it might be better for Jakub just to get the additional information, even if it looks weird. Another possibility would be to give the generated `match' expression the source locations for the body of the `match-lambda' (here `clauses'). It's currently not convenient to do that, but I could do it, and it might make more sense. Thanks, -- sam th samth@ccs.neu.edu From DekuDekuplex at Yahoo.com Sun Jan 4 22:03:31 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:37:04 2009 Subject: [plt-scheme] Re: DrScheme creation of Adam References: <932b2f1f0901021232j690ae030v2af151664c029829@mail.gmail.com> Message-ID: On Fri, 2 Jan 2009 14:32:20 -0600, "Robby Findler" wrote: >On Fri, Jan 2, 2009 at 2:30 PM, apatinoii@gmail.com wrote: >> Initially DrScheme would show the creation of Adam from by >> Michelangelo when it started up, but now it doesn't. Is there a way to >> get that back? > >It only does that on Christmas day (for no good particularly good reason). You can get that behavior back by changing your system clock date to Christmas day. -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From kumar_lista at mac.com Sun Jan 4 22:31:44 2009 From: kumar_lista at mac.com (kumar_lista@mac.com) Date: Thu Mar 26 02:37:05 2009 Subject: [plt-scheme] Creating executable from DrScheme ... Message-ID: Hi, I'm trying to create a gui executable using "Scheme->Create executable..." in v4.1.3. As recommended, my language is "Module" and my source file starts with "#lang scheme/gui". My app runs fine when launched from within DrScheme (my module creates a single frame upon load). However, the created MrEd executable fails to run with the following error message in standard output window - >>>>> call-with-input-file: expects type as 1st argument, given: #f; other arguments were # === context === loop <<<<< I'm sure I'm missing something pretty simple, but can't figure out what that simple thing is. Btw - creating a "launcher" executable works I want to create a "stand alone" or "distributable", both modes give the same error on both Windows and MacOSX. Thanks in advance for any pointers. -Kumar From grettke at acm.org Sun Jan 4 23:10:40 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:05 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> <756daca50901021625i1283d6b8k8eefc9521ce8178b@mail.gmail.com> Message-ID: <756daca50901042010n4e41f3aen6f6219ae43ec2747@mail.gmail.com> On Sat, Jan 3, 2009 at 4:03 PM, Joe Marshall wrote: > On Fri, Jan 2, 2009 at 4:25 PM, Grant Rettke wrote: >> Does the fact that I'm taking this data and compiling it down to >> something trivial disqualify it? What if it were being compiled into a >> compelling "thing" written in Scheme? > > Here's the logic behind my opinion.... I see. Thanks for elaborating. >> I see now, there is a clear delineation: once scenario is parsing data >> differently (with different functions or classes) and another is >> generating code differently based on the input. The problem I am >> trying to solve is the former, macros don't make sense. >> >> That said, if they did make sense, how would one go about reusing that >> data definition? > > I have seen *very* few cases where this would make sense, but I think > what you would want to do is write meta-macros that wrap the macros > with a let-syntax form that does the base macro processing. It'd be one > of those hairballs that Al* Petrofsky is so fond of. I forgot about an example in TSPL that does something like this: http://www.scheme.com/tspl3/syntax.html#./syntax:s38 From grettke at acm.org Sun Jan 4 23:11:45 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:05 2009 Subject: [plt-scheme] Help with understanding how to reuse macro data In-Reply-To: <72A4070C-D48C-493B-84D5-5199BE089B71@knauth.org> References: <756daca50901021410u6abe21f5j6709c8f3600e9d0f@mail.gmail.com> <756daca50901021625i1283d6b8k8eefc9521ce8178b@mail.gmail.com> <72A4070C-D48C-493B-84D5-5199BE089B71@knauth.org> Message-ID: <756daca50901042011s11e0277eh28064faf23a57a9c@mail.gmail.com> On Sat, Jan 3, 2009 at 4:58 PM, Geoffrey S. Knauth wrote: > Maybe there is a use for macros in the artificial safe-cracking scheme. > Macros could be used to deceive the user. Instead of asking Vinnie or just > trying a combination, bindings could be manipulated and code replaced to > send Vinnie's advice or working combinations to an untrusted third party. Should I ever find myself in such a position, I will take note of that, as willl I watch "Sneakers" many times in hopes of determining how to better my situation :). From srihari.ramanathan at gmail.com Sun Jan 4 23:29:09 2009 From: srihari.ramanathan at gmail.com (Srihari Ramanathan) Date: Thu Mar 26 02:37:05 2009 Subject: [plt-scheme] Crash with unbalanced parentheses in DrScheme? Message-ID: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> Hi, I wonder if anyone is able to reproduce a crash I'm seeing with the latest pre-release builds of DrScheme (version 4.1.3.8-svn2jan2009, windows xp) in a file with unbalanced parentheses? The simplest example I see this crash on is: @@ -0,0 +1,2 @@ +#lang scheme +( Either running or doing a 'Check Syntax' on this causes a crash for me. Regards, Srihari. From grettke at acm.org Sun Jan 4 23:32:39 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:05 2009 Subject: [plt-scheme] Crash with unbalanced parentheses in DrScheme? In-Reply-To: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> References: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> Message-ID: <756daca50901042032t78ce683au4965daf7c6336747@mail.gmail.com> On Sun, Jan 4, 2009 at 10:29 PM, Srihari Ramanathan wrote: > I wonder if anyone is able to reproduce a crash I'm seeing with the > latest pre-release builds of DrScheme (version 4.1.3.8-svn2jan2009, > windows xp) in a file with unbalanced parentheses? > > The simplest example I see this crash on is: > > @@ -0,0 +1,2 @@ > +#lang scheme > +( > > Either running or doing a 'Check Syntax' on this causes a crash for me. It is reproducable on Vista, at revision 12966 of the trunk. From jos.koot at telefonica.net Mon Jan 5 02:35:00 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] Crash with unbalanced parentheses in DrScheme? References: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> Message-ID: <94F3BF63FCBD492CA8673D0BE1EDD8BA@uw2b2dff239c4d> Same problem here on windows XP. I went back to the previous build. Jos ----- Original Message ----- From: "Srihari Ramanathan" To: Sent: Monday, January 05, 2009 5:29 AM Subject: [plt-scheme] Crash with unbalanced parentheses in DrScheme? > Hi, > > I wonder if anyone is able to reproduce a crash I'm seeing with the > latest pre-release builds of DrScheme (version 4.1.3.8-svn2jan2009, > windows xp) in a file with unbalanced parentheses? > > The simplest example I see this crash on is: > > @@ -0,0 +1,2 @@ > +#lang scheme > +( > > Either running or doing a 'Check Syntax' on this causes a crash for me. > > Regards, > Srihari. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mflatt at cs.utah.edu Mon Jan 5 04:41:18 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] Crash with unbalanced parentheses in DrScheme? In-Reply-To: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> References: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> Message-ID: <20090105094121.65F12650058@mail-svr1.cs.utah.edu> At Mon, 5 Jan 2009 09:59:09 +0530, "Srihari Ramanathan" wrote: > I wonder if anyone is able to reproduce a crash I'm seeing with the > latest pre-release builds of DrScheme (version 4.1.3.8-svn2jan2009, > windows xp) in a file with unbalanced parentheses? > > The simplest example I see this crash on is: > > @@ -0,0 +1,2 @@ > +#lang scheme > +( > > Either running or doing a 'Check Syntax' on this causes a crash for me. This has been fixed in SVN, but the nightly build has failed for the past few attempts. We should have a new pre-release build soon. Matthew From mflatt at cs.utah.edu Mon Jan 5 06:29:46 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] Creating executable from DrScheme ... In-Reply-To: References: Message-ID: <20090105112949.0F67A6500BA@mail-svr1.cs.utah.edu> At Mon, 05 Jan 2009 11:31:44 +0800, kumar_lista@mac.com wrote: > I'm trying to create a gui executable using "Scheme->Create > executable..." in v4.1.3. > > As recommended, my language is "Module" and my source file starts with > "#lang scheme/gui". My app runs fine when launched from within DrScheme > (my module creates a single frame upon load). > > However, the created MrEd executable fails to run with the following > error > message in standard output window - > >>>>> > call-with-input-file: expects type as 1st > argument, given: #f; other arguments were # > > === context === > loop > <<<<< Since "Create Executable..." works on the examples I tried, can you provide an example (ideally a small variant of your actual program) that shows the problem? Matthew From neil at neilvandyke.org Mon Jan 5 07:55:52 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] kudos for PLT's character set support Message-ID: <49620358.3030808@neilvandyke.org> I just wanted to compliment PLT on the character set support. With less effort than I would've expected, a client's large PLT-based Web application has been converted to support UTF-8 throughout (including C bindings to database and statistics libraries) and to support various charsets of browsers' HTTP POSTs. Looking at the PLT documentation and C code, it's clear that someone spent a lot of effort on doing character sets well. Thanks, Neil -- http://www.neilvandyke.org/ From robby at eecs.northwestern.edu Mon Jan 5 08:00:54 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] kudos for PLT's character set support In-Reply-To: <49620358.3030808@neilvandyke.org> References: <49620358.3030808@neilvandyke.org> Message-ID: <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com> On Mon, Jan 5, 2009 at 6:55 AM, Neil Van Dyke wrote: > Looking at the PLT documentation and C code, it's clear that someone spent a > lot of effort on doing character sets well. That would be Matthew. Robby From kumar_lista at mac.com Mon Jan 5 09:35:50 2009 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] Creating executable from DrScheme ... In-Reply-To: <20090105112949.0F67A6500BA@mail-svr1.cs.utah.edu> References: <20090105112949.0F67A6500BA@mail-svr1.cs.utah.edu> Message-ID: <65CCAE2D-A06E-47D3-BB3E-4C738A1CB88D@mac.com> Figured it out. The problem is with the "html" module. The following program will demonstrate the "Create executable.." problem I mentioned - #lang scheme (require html) as simple as that :) The html module, when loaded, tries to read the "html-spec" file from the collection path, which is undefined (i.e. #f) when packaged as a standalone executable. If I turn the html-spec file into a html-spec.ss module which exports the contents as a constant *html-may-contain* and use that constant in the html-unit.ss module, replacing lines 121-122 with (define may-contain (sgml:gen-may-contain *html-may-contain*)) I'm able to use the html module in a standalone executable. Is there any rationale behind not doing it like that in the first place? If not, I think it is worth modifying the html module to not need find-library at (require) time. -Kumar On 05 Jan 2009, at 7:29 PM, Matthew Flatt wrote: > At Mon, 05 Jan 2009 11:31:44 +0800, kumar_lista@mac.com wrote: >> I'm trying to create a gui executable using "Scheme->Create >> executable..." in v4.1.3. >> >> As recommended, my language is "Module" and my source file starts >> with >> "#lang scheme/gui". My app runs fine when launched from within >> DrScheme >> (my module creates a single frame upon load). >> >> However, the created MrEd executable fails to run with the following >> error >> message in standard output window - >>>>>>> >> call-with-input-file: expects type as 1st >> argument, given: #f; other arguments were # >> >> === context === >> loop >> <<<<< > > Since "Create Executable..." works on the examples I tried, can you > provide an example (ideally a small variant of your actual program) > that shows the problem? > > > Matthew > From mflatt at cs.utah.edu Mon Jan 5 10:54:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] Creating executable from DrScheme ... In-Reply-To: <65CCAE2D-A06E-47D3-BB3E-4C738A1CB88D@mac.com> References: <20090105112949.0F67A6500BA@mail-svr1.cs.utah.edu> <65CCAE2D-A06E-47D3-BB3E-4C738A1CB88D@mac.com> Message-ID: <20090105155436.3D08A6500C8@mail-svr1.cs.utah.edu> At Mon, 05 Jan 2009 22:35:50 +0800, kumar wrote: > The html module, when loaded, tries to read the "html-spec" > file from the collection path, which is undefined (i.e. #f) > when packaged as a standalone executable. > > If I turn the html-spec file into a html-spec.ss module > which exports the contents as a constant *html-may-contain* > and use that constant in the html-unit.ss module, replacing > lines 121-122 with > > (define may-contain > (sgml:gen-may-contain *html-may-contain*)) > > I'm able to use the html module in a standalone executable. Thanks for tracking this down! I've committed your repair in SVN. Matthew From grettke at acm.org Mon Jan 5 13:16:52 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:06 2009 Subject: [plt-scheme] kudos for PLT's character set support In-Reply-To: <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com> References: <49620358.3030808@neilvandyke.org> <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com> Message-ID: <756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> On Mon, Jan 5, 2009 at 7:00 AM, Robby Findler wrote: > On Mon, Jan 5, 2009 at 6:55 AM, Neil Van Dyke wrote: >> Looking at the PLT documentation and C code, it's clear that someone spent a >> lot of effort on doing character sets well. > That would be Matthew. After Neil posted that question on libiconv it got me wondering about the kind of motivations that drive an implementer of any language to care about, and, expend the effort to provide such good support. Is it personal interest? Is it demand of the users? It is the desire for "common sense" functionality. From what I have read some vocal folks think that Scheme and different encodings (Unicode for one) go together like oil and water, so PLT's support stands out. From robby at eecs.northwestern.edu Mon Jan 5 13:49:12 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:07 2009 Subject: [plt-scheme] kudos for PLT's character set support In-Reply-To: <756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> References: <49620358.3030808@neilvandyke.org> <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com> <756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> Message-ID: <932b2f1f0901051049x62815b8se022898304b10b53@mail.gmail.com> On Mon, Jan 5, 2009 at 12:16 PM, Grant Rettke wrote: > On Mon, Jan 5, 2009 at 7:00 AM, Robby Findler > wrote: >> On Mon, Jan 5, 2009 at 6:55 AM, Neil Van Dyke wrote: >>> Looking at the PLT documentation and C code, it's clear that someone spent a >>> lot of effort on doing character sets well. >> That would be Matthew. > > After Neil posted that question on libiconv it got me wondering about > the kind of motivations that drive an implementer of any language to > care about, and, expend the effort to provide such good support. > > Is it personal interest? Is it demand of the users? It is the desire > for "common sense" functionality. From what I have read some vocal > folks think that Scheme and different encodings (Unicode for one) go > together like oil and water, so PLT's support stands out. It is because we wanted to type the lambda characters in drscheme and still be able to save the files in text mode. (Am I serious? You be the judge.) Robby From chust at web.de Mon Jan 5 15:35:11 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:37:07 2009 Subject: [plt-scheme] Suggestion about formlets and (X)HTML Message-ID: <49626EFF.6020905@web.de> Hello, when one uses send/formlet to render a web form and send it to the browser, the result is always invalid (X)HTML, since a form element should not appear as the root of a document. Thus this procedure encourages bad programming practice. I think it would be nice if send/formlet allowed for some way to wrap the form element it creates in a proper (X)HTML document. Alternatively the procedure could simply be deprecated since embed-formlet can be used for the same job without the problems. cu, Thomas From jay.mccarthy at gmail.com Mon Jan 5 16:09:04 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:07 2009 Subject: [plt-scheme] Suggestion about formlets and (X)HTML In-Reply-To: <49626EFF.6020905@web.de> References: <49626EFF.6020905@web.de> Message-ID: Good point! I will look into it. Jay On Mon, Jan 5, 2009 at 1:35 PM, Thomas Chust wrote: > Hello, > > when one uses send/formlet to render a web form and send it to the > browser, the result is always invalid (X)HTML, since a form element > should not appear as the root of a document. Thus this procedure > encourages bad programming practice. > > I think it would be nice if send/formlet allowed for some way to wrap > the form element it creates in a proper (X)HTML document. Alternatively > the procedure could simply be deprecated since embed-formlet can be used > for the same job without the problems. > > cu, > Thomas > _________________________________________________ > 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 eli at barzilay.org Mon Jan 5 16:42:43 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:37:07 2009 Subject: [plt-scheme] Crash with unbalanced parentheses in DrScheme? In-Reply-To: <20090105094121.65F12650058@mail-svr1.cs.utah.edu> References: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> <20090105094121.65F12650058@mail-svr1.cs.utah.edu> Message-ID: <18786.32467.929061.668336@arabic.ccs.neu.edu> On Jan 5, Matthew Flatt wrote: > At Mon, 5 Jan 2009 09:59:09 +0530, "Srihari Ramanathan" wrote: > > I wonder if anyone is able to reproduce a crash I'm seeing with the > > latest pre-release builds of DrScheme (version 4.1.3.8-svn2jan2009, > > windows xp) in a file with unbalanced parentheses? > > > > The simplest example I see this crash on is: > > > > @@ -0,0 +1,2 @@ > > +#lang scheme > > +( > > > > Either running or doing a 'Check Syntax' on this causes a crash for me. > > This has been fixed in SVN, but the nightly build has failed for the > past few attempts. We should have a new pre-release build soon. There is a new pre-release build now. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From kumar_lista at mac.com Mon Jan 5 19:24:40 2009 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:37:07 2009 Subject: [plt-scheme] Creating executable from DrScheme ... In-Reply-To: <20090105155436.3D08A6500C8@mail-svr1.cs.utah.edu> References: <20090105112949.0F67A6500BA@mail-svr1.cs.utah.edu> <65CCAE2D-A06E-47D3-BB3E-4C738A1CB88D@mac.com> <20090105155436.3D08A6500C8@mail-svr1.cs.utah.edu> Message-ID: <94A12B85-65E8-4ABB-8E2E-53D5FC4C16B6@mac.com> Great! Thanks. -Kumar On 05 Jan 2009, at 11:54 PM, Matthew Flatt wrote: > At Mon, 05 Jan 2009 22:35:50 +0800, kumar wrote: >> The html module, when loaded, tries to read the "html-spec" >> file from the collection path, which is undefined (i.e. #f) >> when packaged as a standalone executable. >> >> If I turn the html-spec file into a html-spec.ss module >> which exports the contents as a constant *html-may-contain* >> and use that constant in the html-unit.ss module, replacing >> lines 121-122 with >> >> (define may-contain >> (sgml:gen-may-contain *html-may-contain*)) >> >> I'm able to use the html module in a standalone executable. > > Thanks for tracking this down! I've committed your repair in SVN. > > > Matthew > From hendrik at topoi.pooq.com Tue Jan 6 14:47:45 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:37:07 2009 Subject: [plt-scheme] kudos for PLT's character set support In-Reply-To: <932b2f1f0901051049x62815b8se022898304b10b53@mail.gmail.com> References: <49620358.3030808@neilvandyke.org> <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com> <756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> <932b2f1f0901051049x62815b8se022898304b10b53@mail.gmail.com> Message-ID: <20090106194745.GB31393@topoi.pooq.com> On Mon, Jan 05, 2009 at 12:49:12PM -0600, Robby Findler wrote: > On Mon, Jan 5, 2009 at 12:16 PM, Grant Rettke wrote: > > On Mon, Jan 5, 2009 at 7:00 AM, Robby Findler > > wrote: > >> On Mon, Jan 5, 2009 at 6:55 AM, Neil Van Dyke wrote: > >>> Looking at the PLT documentation and C code, it's clear that someone spent a > >>> lot of effort on doing character sets well. > >> That would be Matthew. > > > > After Neil posted that question on libiconv it got me wondering about > > the kind of motivations that drive an implementer of any language to > > care about, and, expend the effort to provide such good support. > > > > Is it personal interest? Is it demand of the users? It is the desire > > for "common sense" functionality. From what I have read some vocal > > folks think that Scheme and different encodings (Unicode for one) go > > together like oil and water, so PLT's support stands out. > > It is because we wanted to type the lambda characters in drscheme and > still be able to save the files in text mode. > > (Am I serious? You be the judge.) > > Robby The origin of lambda. It seems Curry originally wanted a kind of giant circumflex accent, with one arm on the bound variable, and the other stretching over to the end of its scope. But the printer couldn't do that, so they compromised on a circumflex accent on the bound variable only. Only something else went wrong, and it seems the normal circumflex wasn't available either. So the printer picked the most similar character he *did* have at the moment, and it was a lambda. So I heard from John Seldin. It it weren't for a shortage of characters in ancient typesetting equipment, we wouldn't have Unicode in PLT Scheme! -- hendrik From jpc-ml at zenburn.net Mon Jan 5 20:54:57 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:37:08 2009 Subject: [plt-scheme] kudos for PLT's character set support In-Reply-To: <756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> References: <49620358.3030808@neilvandyke.org> <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com> <756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> Message-ID: <4962B9F1.5090901@zenburn.net> On 1/5/09 7:16 PM, Grant Rettke wrote: > On Mon, Jan 5, 2009 at 7:00 AM, Robby Findler > wrote: >> On Mon, Jan 5, 2009 at 6:55 AM, Neil Van Dyke wrote: >>> Looking at the PLT documentation and C code, it's clear that someone spent a >>> lot of effort on doing character sets well. >> That would be Matthew. > > After Neil posted that question on libiconv it got me wondering about > the kind of motivations that drive an implementer of any language to > care about, and, expend the effort to provide such good support. > > Is it personal interest? Is it demand of the users? It is the desire > for "common sense" functionality. From what I have read some vocal > folks think that Scheme and different encodings (Unicode for one) go > together like oil and water, so PLT's support stands out. I obviously can't speak for Matthew but my guess is that it is simply about doing the right (and beautiful - at least on the external API front ;-) thing. PS. The division between byte- and normal strings and the fact that normal strings are the default is great and makes many programs support Unicode without the programmer having to take care of it. Compare this to Python's Unicode support which is considered very good as far as mainstream programming languages go. PS.2. The same goes for Scribble, the module system, the create executable option and many others. Beautiful pieces of machinery which surprise me with their ingenuity every time I use them. (just compare the implementation of the verbatim mode in Scribble reader to the nightmare of forcing this functionality upon (La)TeX or the create executable option with py2exe) Big thanks to Matthew and to the whole PLT Team! :) -- regards, Jakub Piotr C?apa From srihari.ramanathan at gmail.com Mon Jan 5 22:28:59 2009 From: srihari.ramanathan at gmail.com (Srihari Ramanathan) Date: Thu Mar 26 02:37:08 2009 Subject: [plt-scheme] Crash with unbalanced parentheses in DrScheme? In-Reply-To: <18786.32467.929061.668336@arabic.ccs.neu.edu> References: <4b35d45c0901042029y21927680jdfded0f96f603f4b@mail.gmail.com> <20090105094121.65F12650058@mail-svr1.cs.utah.edu> <18786.32467.929061.668336@arabic.ccs.neu.edu> Message-ID: <4b35d45c0901051928k3be1b88kd63452c0161efdfe@mail.gmail.com> On Tue, Jan 6, 2009 at 3:12 AM, Eli Barzilay wrote: > On Jan 5, Matthew Flatt wrote: >> At Mon, 5 Jan 2009 09:59:09 +0530, "Srihari Ramanathan" wrote: >> > I wonder if anyone is able to reproduce a crash I'm seeing with the >> > latest pre-release builds of DrScheme (version 4.1.3.8-svn2jan2009, >> > windows xp) in a file with unbalanced parentheses? >> > >> This has been fixed in SVN, but the nightly build has failed for the >> past few attempts. We should have a new pre-release build soon. > > There is a new pre-release build now. Thanks Eli and Matthew! This is fixed in the latest pre-release build. From jos.koot at telefonica.net Tue Jan 6 07:09:07 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:08 2009 Subject: [plt-scheme] kudos for PLT's character set support References: <49620358.3030808@neilvandyke.org><932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com><756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com><932b2f1f0901051049x62815b8se022898304b10b53@mail.gmail.com> <20090106194745.GB31393@topoi.pooq.com> Message-ID: I heave read that lambda stems from period backslash .\ So identity would have been written as (.\x.x) or shortly .\x.x (; Jos ----- Original Message ----- From: To: Sent: Tuesday, January 06, 2009 8:47 PM Subject: Re: [plt-scheme] kudos for PLT's character set support > The origin of lambda. It seems Curry originally wanted a kind of giant > circumflex accent, with one arm on the bound variable, and the other > stretching over to the end of its scope. But the printer couldn't do > that, so they compromised on a circumflex accent on the bound variable > only. Only something else went wrong, and it seems the normal > circumflex wasn't available either. So the printer picked the most > similar character he *did* have at the moment, and it was a lambda. > > So I heard from John Seldin. > > It it weren't for a shortage of characters in ancient typesetting > equipment, we wouldn't have Unicode in PLT Scheme! > > -- hendrik > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jos.koot at telefonica.net Tue Jan 6 07:09:58 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:08 2009 Subject: [plt-scheme] kudos for PLT's character set support References: <49620358.3030808@neilvandyke.org> <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com><756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> <4962B9F1.5090901@zenburn.net> Message-ID: I second that. ----- Original Message ----- From: "Jakub Piotr C?apa" To: "PLT-list" Sent: Tuesday, January 06, 2009 2:54 AM Subject: Re: [plt-scheme] kudos for PLT's character set support snip> > Big thanks to Matthew and to the whole PLT Team! :) > > -- > regards, > Jakub Piotr C?apa > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From clklein at cs.uchicago.edu Tue Jan 6 07:43:33 2009 From: clklein at cs.uchicago.edu (Casey Klein) Date: Thu Mar 26 02:37:08 2009 Subject: [plt-scheme] Keyword argument macros Message-ID: I'd like to write a macro that accepts keyword arguments, e.g., (my-macro e1 #:kw e2 e3). syntax-case isn't much help in parsing the macro's input. Do I need to do this parsing myself, checking for duplicate/missing keywords, or is there some library solution I'm missing? Thanks, Casey From matthias at ccs.neu.edu Tue Jan 6 08:23:34 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:37:08 2009 Subject: [plt-scheme] Keyword argument macros In-Reply-To: References: Message-ID: When you're done, let me know. I just did this for big-bang and universe in the new universe teachpack -- Matthias p.s. I decided to parenthesize. On Jan 6, 2009, at 7:43 AM, Casey Klein wrote: > I'd like to write a macro that accepts keyword arguments, e.g., > (my-macro e1 #:kw e2 e3). syntax-case isn't much help in parsing the > macro's input. Do I need to do this parsing myself, checking for > duplicate/missing keywords, or is there some library solution I'm > missing? > > Thanks, > Casey > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From noelwelsh at gmail.com Tue Jan 6 08:33:55 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:37:08 2009 Subject: [plt-scheme] Keyword argument macros In-Reply-To: References: Message-ID: Something that might work, depending on your macro Pass the arguments to the a define-for-syntax function with appropriate keyword arguments. HTH, N. On Tue, Jan 6, 2009 at 12:43 PM, Casey Klein wrote: > I'd like to write a macro that accepts keyword arguments, e.g., > (my-macro e1 #:kw e2 e3). syntax-case isn't much help in parsing the > macro's input. Do I need to do this parsing myself, checking for > duplicate/missing keywords, or is there some library solution I'm > missing? > > Thanks, > Casey From mflatt at cs.utah.edu Tue Jan 6 08:43:15 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:09 2009 Subject: [plt-scheme] Keyword argument macros In-Reply-To: References: Message-ID: <20090106134316.E2E096500AA@mail-svr1.cs.utah.edu> At Tue, 6 Jan 2009 06:43:33 -0600, "Casey Klein" wrote: > I'd like to write a macro that accepts keyword arguments, e.g., > (my-macro e1 #:kw e2 e3). syntax-case isn't much help in parsing the > macro's input. Do I need to do this parsing myself, checking for > duplicate/missing keywords, or is there some library solution I'm > missing? I don't think you're missing anything. I've implemented form using something like (syntax-case stx () [(_ #:optional-stuff a expr ...) (generate #'(expr ...) #'a)] [(_ expr ...) (generate #'(expr ...) #f)]) which works ok (but not great) if the keyword addition has a fixed position in the form and if there are not many optional parts. For more complex forms, I've so far resorted to manual parsing. From d.j.gurnell at gmail.com Tue Jan 6 08:52:20 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:10 2009 Subject: [plt-scheme] Keyword argument macros In-Reply-To: References: Message-ID: <83D2C070-2D05-4C4B-B734-53A07FBE62CB@gmail.com> Casey Klein wrote: > I'd like to write a macro that accepts keyword arguments, e.g., > (my-macro e1 #:kw e2 e3). syntax-case isn't much help in parsing the > macro's input. Do I need to do this parsing myself, checking for > duplicate/missing keywords, or is there some library solution I'm > missing? syntax-case does correctly match on keywords if you use them in your patterns. For what it's worth, I have adopted an idiom I found in the definition of new define-struct: (define-syntax (my-form stx) (define (do-arguments args-stx) (syntax-case args-stx () [() (do-final)] [(#:arg1 val other ...) (begin ; do something with the argument and its value (do-arguments #'(other ...)))])) (define (do-final) ; produce some final syntax ) (syntax-case stx () [(_ arg ...) (do-arguments #'(arg ...)])) I typically store a bunch of state as internal defines and use it in do-final. Something unrelated but potentially useful... I wrote a "human- friendly" macro version of keyword-apply that I'm going to add to the next version of Unlib.plt. Code is attached below. Hope this helps, -- Dave -------------- next part -------------- Skipped content of type multipart/mixed From jay.mccarthy at gmail.com Tue Jan 6 10:37:55 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:10 2009 Subject: [plt-scheme] Suggestion about formlets and (X)HTML In-Reply-To: References: <49626EFF.6020905@web.de> Message-ID: This is fixed in SVN. It now defaults to including an html and body tag, but takes an optional wrapper function. Jay On Mon, Jan 5, 2009 at 2:09 PM, Jay McCarthy wrote: > Good point! I will look into it. > > Jay > > On Mon, Jan 5, 2009 at 1:35 PM, Thomas Chust wrote: >> Hello, >> >> when one uses send/formlet to render a web form and send it to the >> browser, the result is always invalid (X)HTML, since a form element >> should not appear as the root of a document. Thus this procedure >> encourages bad programming practice. >> >> I think it would be nice if send/formlet allowed for some way to wrap >> the form element it creates in a proper (X)HTML document. Alternatively >> the procedure could simply be deprecated since embed-formlet can be used >> for the same job without the problems. >> >> cu, >> Thomas >> _________________________________________________ >> 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 > -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From clklein at cs.uchicago.edu Tue Jan 6 10:55:45 2009 From: clklein at cs.uchicago.edu (Casey Klein) Date: Thu Mar 26 02:37:10 2009 Subject: [plt-scheme] Keyword argument macros In-Reply-To: References: Message-ID: On Tue, Jan 6, 2009 at 7:33 AM, Noel Welsh wrote: > Something that might work, depending on your macro > > Pass the arguments to the a define-for-syntax function with > appropriate keyword arguments. > using keyword-apply? From d.j.gurnell at gmail.com Tue Jan 6 13:00:36 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:11 2009 Subject: [plt-scheme] Keyword argument macros In-Reply-To: References: Message-ID: On 6 Jan 2009, at 15:55, Casey Klein wrote: > On Tue, Jan 6, 2009 at 7:33 AM, Noel Welsh > wrote: >> Something that might work, depending on your macro >> >> Pass the arguments to the a define-for-syntax function with >> appropriate keyword arguments. > > using keyword-apply? Yes. That will work, but you still need to fold over the arguments to accumulate keyword/value pairs. That keyword-apply* macro will do that for you. I've added it to Unlib (version 3.11): #lang scheme (require (for-syntax (planet untyped/unlib:3:11/keyword))) (define-for-syntax keywords->alist (lambda (#:a [a 1] #:b [b 2] [c 3] [d 4]. rest) (list (cons 'a a) (cons 'b b) (cons 'c c) (cons 'd d) (cons 'rest rest)))) (define-syntax (test-macro stx) (syntax-case stx () [(_ arg ...) (let ([args (map syntax->datum (syntax->list #'(arg ...)))]) #`(quote #,(keyword-apply* keywords->alist args)))])) ; Try these: ; (test-macro) ; (test-macro 123) ; (test-macro 123 234 345) ; (test-macro #:a 123 #:b 234 345) ; (test-macro #:a 123 #:b 234 #:c 345) Hope this helps, -- Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090106/0e38e53f/attachment.html From neil at neilvandyke.org Tue Jan 6 14:24:10 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:11 2009 Subject: [plt-scheme] confusing behavior with "reencode-input-port" Message-ID: <4963AFDA.5020703@neilvandyke.org> I'm confused about a behavior of "reencode-input-port". If the input is a port created with "open-input-bytes", then it works as expected. If the input port is created with "open-input-string", however, then "reencode-input-port" has an effect that looks like the input is being *doubly* reencoded. I have reduced my confusion to the below demonstration code. Perhaps someone else can immediately see what I am doing wrong? (require mzlib/port) ;; First, these two expressions are as expected. (bytes->list (read-bytes 1000 (open-input-string (bytes->string/latin-1 (bytes 169))))) ;; ==> (194 169) (char->integer (read-char (open-input-string (bytes->string/latin-1 (bytes 169))))) ;; ==> 169 ;; The following is what is confusing. (define (foo in-port) (let* ((re-in-port (reencode-input-port in-port ; in "ISO-8859-1" ; encoding #f ; error-bytes #f ; close? "foo" ; name #f ; convert-newlines? ))) (begin0 (bytes->list (read-bytes 1000 re-in-port)) (close-input-port re-in-port)))) (let ((in-bytes (bytes 169))) `((BYTES-INPUT-PORT (input ,(bytes->list in-bytes)) (output ,(foo (open-input-bytes in-bytes)))) (STRING-INPUT-PORT ,@(let* ((in-str (bytes->string/latin-1 in-bytes))) `((input ,(bytes->list (string->bytes/latin-1 in-str))) (output ,(foo (open-input-string in-str)))))))) ;; ==> ;; ((BYTES-INPUT-PORT (input (169)) (output (194 169))) ;; (STRING-INPUT-PORT (input (169)) (output (195 130 194 169)))) From farr at MIT.EDU Tue Jan 6 15:16:49 2009 From: farr at MIT.EDU (Will Farr) Date: Thu Mar 26 02:37:11 2009 Subject: [plt-scheme] TRAC ticket workflow problem Message-ID: Hello everyone, I'm not sure who is responsible for maintenance of the PLaneT TRAC system, so I'm sending this to the general list. I just noticed that after setting the status of one of the tickets assigned to me to "needinfo", I cannot subsequently set the status to "resolved". Is this done for a reason, or is it a bug in the workflow? (I set the status to "needinfo" without thinking, but it turns out that the ticket was submitted by anonymous, so I'm probably going to be waiting a while :).) If it is a bug, it's probably easy to fix by poking around in the files mentioned at http://planet.plt-scheme.org/trac/wiki/TracWorkflow Thanks! Will From robby at eecs.northwestern.edu Tue Jan 6 15:46:45 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:12 2009 Subject: [plt-scheme] TRAC ticket workflow problem In-Reply-To: References: Message-ID: <932b2f1f0901061246h311b9b1vc4f15a843d1075b7@mail.gmail.com> Should be fixed now. Thanks for pointing that out! (I have no clue why that was in there like that. Very strange.) Robby On Tue, Jan 6, 2009 at 2:16 PM, Will Farr wrote: > Hello everyone, > > I'm not sure who is responsible for maintenance of the PLaneT TRAC system, > so I'm sending this to the general list. I just noticed that after setting > the status of one of the tickets assigned to me to "needinfo", I cannot > subsequently set the status to "resolved". Is this done for a reason, or is > it a bug in the workflow? (I set the status to "needinfo" without thinking, > but it turns out that the ticket was submitted by anonymous, so I'm probably > going to be waiting a while :).) > > If it is a bug, it's probably easy to fix by poking around in the files > mentioned at > > http://planet.plt-scheme.org/trac/wiki/TracWorkflow > > Thanks! > Will > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From lunarc.lists at gmail.com Tue Jan 6 16:38:03 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:12 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server Message-ID: I've asked about this a couple of times before, but I guess I should try again. I'd like to limit the maximum number of connections to be handled concurrently by the web server. Last June I posted about it on this mailing list and was advised to file a bug report: http://bugs.plt-scheme.org/query/?cmd=view&pr=9444 A couple weeks ago I wrote a trivial dispatcher to limit connections using a semaphore, but it didn't seem to work, as the semaphore wasn't always released (I think due to the way dropped requests are terminated). It doesn't sound hard to implement this properly, and I'd like to take a look, but I'm not familiar enough with the web server code to know where to look. What would be the appropriate way to implement this? Ideally there would be some way to filter requests so that, for example, only certain requests are affected. For example, I wouldn't want the limit to affect static file requests, or hypothetically, long-polling requests. Henk From chust at web.de Tue Jan 6 16:46:11 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:37:12 2009 Subject: [plt-scheme] confusing behavior with "reencode-input-port" In-Reply-To: <4963AFDA.5020703@neilvandyke.org> References: <4963AFDA.5020703@neilvandyke.org> Message-ID: <4963D123.2090309@web.de> Neil Van Dyke wrote: > I'm confused about a behavior of "reencode-input-port". > > If the input is a port created with "open-input-bytes", then it works as > expected. > > If the input port is created with "open-input-string", however, then > "reencode-input-port" has an effect that looks like the input is being > *doubly* reencoded. > [...] Hello, a string in PLT Scheme doesn't carry any information about the encoding of the data from which it was created (and that's a good thing). When you open a string input port, you always get data in the same encoding, which happens to be UTF-8 by default. Therefore the behaviour you see is exactly what I would have expected: You tell the system to convert some character data into an UTF-8 stream by using open-input-string, but then you tell the system to "convert" that stream from ISO-Latin-1 encoding to UTF-8 with reencode-input-port. So you get a second UTF-8 stream, but you can't expect that its contents still have the same meaning as the original data. Conceptually you perform an unchecked cast from UTF-8 data via raw bytes to ISO-Latin-1 data and then turn the result into UTF-8 again with a "correct" type conversion, only the data now typed as ISO-Latin-1 is really not in that format. If what you wanted to do was to create an input port from which you could read (as binary data) the representation of your initial string in ISO-Latin-1 encoding, the best way I can think of is to create a pipe, use reencode-output-port with ISO-Latin-1 encoding on the sink end of the pipe, dump the string into it and read the result from the source end of the pipe. At the moment I don't see how that could be useful, though. cu, Thomas From neil at neilvandyke.org Tue Jan 6 16:58:45 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:12 2009 Subject: [plt-scheme] confusing behavior with "reencode-input-port" In-Reply-To: <4963D123.2090309@web.de> References: <4963AFDA.5020703@neilvandyke.org> <4963D123.2090309@web.de> Message-ID: <4963D415.2080903@neilvandyke.org> Thomas Chust wrote at 01/06/2009 04:46 PM: > a string in PLT Scheme doesn't carry any information about the encoding > of the data from which it was created (and that's a good thing). When > Oh, duh. Thanks. The problem that I was trying to reproduce lies elsewhere. From jmarshall at alum.mit.edu Tue Jan 6 17:03:23 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:37:12 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> Message-ID: On Sat, Jan 3, 2009 at 9:30 PM, John Clements wrote: > I think you've misunderstood monads: see my comments below. I don't *think* so, but I did gloss over some stuff. > What you're saying makes some sense, but I don't think you'd describe this > programming pattern as being a monadic one. > > As a matter of fact, using e.g. the store monad in Haskell *does* require > quite an elaborate rewrite, typically using 'do' & 'return' in every > function to be transformed. Er, well, you caught me out. I was thinking of the maybe monad when I started the paragraph, but when I got to the end I decided I'd refer to the state monad instead and simply changed a few words. It is true that if you wish to refer to the state (or whatever it is you factored out of the code) that you have to use a `do' `return' pair, and the whole point of a state monad is so each function can `modify' the state, thus nearly every function needs to be modified. > There *is* one way in which Haskell's 'do' is much nicer than this one: > Haskell's type system makes it possible to define a 'do' that works for a > whole bunch of different monads, and isn't chained to just one. In Scheme, > if you want to use 'do' for different monads, you'll probably have to enrich > uses of 'do' to indicate which monad's 'bind' to expand into. I think this is a seductively bad idea. Yeah, it's nice that the type system figures out what to dispatch to, but dispatching on the return type is heinous. (It introduces context sensitivity.) >> That's why I said that the Haskell community would be far less >> excited about monads if their language didn't automagically do the >> currying. > > > By the above, I believe this is incorrect. I would instead suggest that the > Haskell community would be far less excited about monads if their language > provided mutation. True, but it's hardly as amusing. But I think it is the confluence of a few things that make monads attractive to Haskellers. There is the strong motivation to find *some* mechanism to write serial code without breaking the entire world, but there are alternatives to monads. The other contributing factors are the ability to automatically dispatch on the return type, the ease of currying, and the nastiness of continuation-passing-style in fully typed languages. Incidentally, I observed someone writing code with the state monad the other day. He didn't actually need to model state, he just wanted to program in `imperative style' (smash this `register', assign this to that, for i from 1 to 10, etc.) and the monad was there just to let him use the `do' syntax. Yuck! -- ~jrm From jmarshall at alum.mit.edu Tue Jan 6 17:19:00 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:37:12 2009 Subject: [plt-scheme] Keyword argument macros In-Reply-To: References: Message-ID: It's easy enough to do with syntax-rules. I wrote a syntax-rules macro that implements Common Lisp argument lists. There are keywords such as &optional, &rest, &aux, &key and &allow-other-keys. Here is how the &aux keyword is parsed out: (define-syntax rewrite-aux (syntax-rules (&aux) ((rewrite-aux "start" lambda lambda-list body) (rewrite-aux "scan-lambda-list" lambda () lambda-list body)) ((rewrite-aux "scan-lambda-list" lambda (lambda-list ...) (&aux . params) body) (rewrite-aux "reverse-aux" lambda (lambda-list ...) () params body)) ((rewrite-aux "scan-lambda-list" lambda (lambda-list ...) (param . params) body) (rewrite-aux "scan-lambda-list" lambda (lambda-list ... param) params body)) ;; Didn't find an aux, just paste it back together. ((rewrite-aux "scan-lambda-list" lambda lambda-list () body) (lambda lambda-list . body)) ((rewrite-aux "reverse-aux" lambda lambda-list reversed (aux . params) body) (rewrite-aux "reverse-aux" lambda lambda-list (aux . reversed) params body)) ((rewrite-aux "reverse-aux" lambda lambda-list reversed () body) (rewrite-aux "aux-found" lambda lambda-list reversed body)) ((rewrite-aux "aux-found" lambda lambda-list (aux . params) body) (rewrite-aux "rewrite-one-aux" lambda lambda-list aux params body)) ((rewrite-aux "rewrite-one-aux" lambda lambda-list (param init) params body) (rewrite-aux "aux-found" lambda lambda-list params ((let ((param init)) . body)))) ((rewrite-aux "rewrite-one-aux" lambda lambda-list (param) params body) (rewrite-aux "aux-found" lambda lambda-list params ((let ((param (default-aux-value))) . body)))) ((rewrite-aux "rewrite-one-aux" lambda lambda-list param params body) (rewrite-aux "aux-found" lambda lambda-list params ((let ((param (default-aux-value))) . body)))) ((rewrite-aux "aux-found" lambda lambda-list () body) (lambda lambda-list . body)))) Ok, it's a bit ugly, the gist of it is that you iteratively expand the `rewrite-aux' macro and accumulate the lambda-list in the third argument. If you see a list starting with &aux, you start collecting the aux args. -- ~jrm From lunarc.lists at gmail.com Tue Jan 6 17:34:34 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:13 2009 Subject: [plt-scheme] Errors from Snooze Quick Start Message-ID: I just tried to follow the Quick Start at http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/4/planet-docs/snooze/quick.html When I try to run "mzscheme test.ss", I get the error: test.ss:41:18: person: identifier for static struct-type information cannot be used as an expression in: person Henk From d.j.gurnell at gmail.com Tue Jan 6 17:59:35 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:13 2009 Subject: [plt-scheme] Errors from Snooze Quick Start In-Reply-To: References: Message-ID: > I just tried to follow the Quick Start at > > http://planet.plt-scheme.org/package-source/untyped/snooze.plt/2/4/planet-docs/snooze/quick.html > > When I try to run "mzscheme test.ss", I get the error: > > test.ss:41:18: person: identifier for static struct-type information > cannot be used as an expression in: person > > Henk Damn - sorry - that's a typo. You want "entity:person" in that case rather than "person". define-persistent-struct binds "person" to the same sort of thing "define-struct" creates - its expansion-time value contains useful information but it's basically useless at run time. define-persistent- struct also binds "entity:person" to a struct containing metadata to use at run time. All the macros in Snooze use "person" and the procedures use "entity:person". For example you have: (define-alias p person) but you have: (create-table entity:person) It's ugly but when I wrote the code I didn't know how to do it any other way (suggestions for improvement would be much appreciated). Anyway the docs are clearly wrong, which is my bad. I'll run through the quick start and correct it and post to this thread when I'm done. Feel free to contact me off-list if you need specific advice. Cheers, -- Dave From lunarc.lists at gmail.com Tue Jan 6 18:17:26 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:13 2009 Subject: [plt-scheme] Errors from Snooze Quick Start In-Reply-To: References: Message-ID: 2009/1/6 Dave Gurnell : > Damn - sorry - that's a typo. You want "entity:person" in that case rather > than "person". Cool, with that fix the only hitch I ran into was that the sqlite3 version of make-database seems to expect a path, and not a string as the Quick Start suggests. > define-persistent-struct binds "person" to the same sort of thing > "define-struct" creates - its expansion-time value contains useful > information but it's basically useless at run time. define-persistent-struct > also binds "entity:person" to a struct containing metadata to use at run > time. All the macros in Snooze use "person" and the procedures use > "entity:person". For example you have: > > (define-alias p person) > > but you have: > > (create-table entity:person) > > It's ugly but when I wrote the code I didn't know how to do it any other way > (suggestions for improvement would be much appreciated). I see, I've been thinking that it would be convenient for the structure syntax to expand to dynamic structure information when used as an expression. This is one place that would be useful. > Anyway the docs are clearly wrong, which is my bad. I'll run through the > quick start and correct it and post to this thread when I'm done. Feel free > to contact me off-list if you need specific advice. This is more of a general question, not related to the quick start, so I guess the list is still the right place. Is there a way to avoid having two sets of names for each data type? I can see that person1 is used to prevent the names from conflicting with the structure accessors, but it's confusing to have to remember the differences between person and person1. On the other hand, if we really need the two sets of names in every case, why not have define-persistent-struct generate the alias automatically, using a consistent naming convention? (e.g. person:, person:id, person:revision, etc.) Henk From clements at brinckerhoff.org Tue Jan 6 18:18:29 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:13 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> Message-ID: Snipping everything that I agree with: On Jan 6, 2009, at 2:03 PM, Joe Marshall wrote: > On Sat, Jan 3, 2009 at 9:30 PM, John Clements > wrote: >> I think you've misunderstood monads: see my comments below. > > I don't *think* so, but I did gloss over some stuff. Okay, fair enough. > >> There *is* one way in which Haskell's 'do' is much nicer than this >> one: >> Haskell's type system makes it possible to define a 'do' that works >> for a >> whole bunch of different monads, and isn't chained to just one. In >> Scheme, >> if you want to use 'do' for different monads, you'll probably have >> to enrich >> uses of 'do' to indicate which monad's 'bind' to expand into. > > I think this is a seductively bad idea. Yeah, it's nice that the type > system figures > out what to dispatch to, but dispatching on the return type is > heinous. (It > introduces context sensitivity.) If I understand you correctly, this is a problem with inferred types being heinous, right? If you explicitly specify the return type of any function whose type is monadic, then the context sensitivity goes away. If I understand you correctly. > ... > and the nastiness of continuation-passing-style in fully typed > languages. Hang on. We've got "statically typed" and "strongly typed," and you're adding "fully typed" to the pile? Urg... > > Incidentally, I observed someone writing code with the state monad the > other day. > He didn't actually need to model state, he just wanted to program in > `imperative style' > (smash this `register', assign this to that, for i from 1 to 10, etc.) > and the monad was there > just to let him use the `do' syntax. Yuck! Yes, that's gross. On the other hand, I find that when writing Scheme these days, using mutation gives me the willies; it seems less error- prone to use a state monad, where I don't have to worry about other bits of the computation coming in and messing up the state. I *think* this logic is bogus, but that's how it feels. John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090106/9401c1b5/smime.bin From d.j.gurnell at gmail.com Tue Jan 6 18:59:57 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:14 2009 Subject: [plt-scheme] Errors from Snooze Quick Start In-Reply-To: References: Message-ID: <3762020B-069F-40B8-BCE5-ADF59881D6F3@gmail.com> Typos corrected in Snooze 2.5. > Cool, with that fix the only hitch I ran into was that the sqlite3 > version of make-database seems to expect a path, and not a string as > the Quick Start suggests. I saw and fixed that one too. It turns out Jay has added support for in-memory and temporary-file databases to sqlite.plt as well, which is rather nice! Pass one of the following special paths to specify them: (make-database ':memory:) (make-database ':temp:) >> It's ugly but when I wrote the code I didn't know how to do it any >> other way >> (suggestions for improvement would be much appreciated). > > I see, I've been thinking that it would be convenient for the > structure syntax to expand to dynamic structure information when used > as an expression. This is one place that would be useful. Sorry - this is going to make me look really dense. Does "as an expression" mean wrapping it in parentheses? If so I think I might have had the same or a similar idea. See below. > This is more of a general question, not related to the quick start, so > I guess the list is still the right place. Is there a way to avoid > having two sets of names for each data type? I can see that person1 is > used to prevent the names from conflicting with the structure > accessors, but it's confusing to have to remember the differences > between person and person1. This has always bugged me. I've been working on an SQL language for Mirrors, to give people the ability to create SQL without all the ERA trappings of Snooze. I thought about this problem again and I came up with a tentative solution. The Mirrors language as it stands will have a define-table macro, which is basically like define-persistent-struct: (define-table person ([name ...] [age ...])) One you have defined a table, you can access the run-time metadata using the identifier without parentheses: (table-name person) ; ==> symbol (table-columns person) ; ==> (listof column) ; and so on ... but if you use my-table with parentheses, you get what is effectively an alias for use in queries: (person) ; ==> table-alias (person name) ; ==> column-alias (sql (select #:from (my-table))) You still have access to define-alias if you need to reference two instances of a table in a single query: (define-alias my-table-1 my-table) (sql (select #:from (outer my-table my-table-1))) This is obviously a bit cryptic but it does solve a number of problems: - you don't have to use define-alias unless you want to alias a table twice within the same query; - you have a default alias you can rely on when constructing queries from code spread across several modules; - all the aliases for a table and its columns come from a single identifier, making them easier to provide/require. What do you think? -- Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090106/587c8446/attachment.html From d.j.gurnell at gmail.com Tue Jan 6 19:16:31 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:14 2009 Subject: [plt-scheme] Generating Java source from Scheme Message-ID: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Hi all, I'm looking for a way of generating Java source code from Scheme. Does anyone know of any libraries that might be useful for? Perhaps there's something in Professor-J that could help? Cheers, -- Dave From jpc-ml at zenburn.net Tue Jan 6 19:29:29 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:37:14 2009 Subject: [plt-scheme] Arbitrary TTF fonts in MrEd Message-ID: <4963F769.7080409@zenburn.net> As far as I understand it is impossible to use arbitrary (supplied with the application; without a system-wide installation) TTF fonts in MrEd? I undertand that there were some supported platforms in the past which didn't support TTF fonts at all and that it is good to look as native as possible but I hope to achive some more consistent visual style on Win32, OS X and modern Linux in an industrial automation app in which I won't even use native widgets. Would such a thing be difficult to add? -- regards, Jakub Piotr C?apa From dvanhorn at ccs.neu.edu Tue Jan 6 19:36:25 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:37:14 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Message-ID: <4963F909.4080902@ccs.neu.edu> Dave Gurnell wrote: > I'm looking for a way of generating Java source code from Scheme. Does > anyone know of any libraries that might be useful for? Are you asking for a Scheme source to Java source translator, or a Scheme library for writing Java source files? If the former, maybe you want a full-bore Scheme-to-Java compiler. There's Kawa -- but I don't know if it goes source-to-source, it may be a source-to-bytecode compiler. What kind of requirements do you have? Does it have to be a complete and featured Scheme? Does code need to operate with arbitrary Java code? If the answer to both is no, you could take any textbook treatment of a Scheme (or FL) compiler and map it into Java by hand. > Perhaps there's something in Professor-J that could help? Professor-J is going from Java to Scheme, so I doubt it. David From matthias at ccs.neu.edu Tue Jan 6 19:37:15 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:37:15 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Message-ID: On Jan 6, 2009, at 7:16 PM, Dave Gurnell wrote: > Hi all, > > I'm looking for a way of generating Java source code from Scheme. > Does anyone know of any libraries that might be useful for? > > Perhaps there's something in Professor-J that could help? No, the poor professor is spending his days macro-expanding Java code into Scheme. But, I did use macros around 1996 to generate Java and Scheme code from the same source, partly for class, partly for ALJ. So don't be afraid, just plunge ahead. -- Matthias From dvanhorn at ccs.neu.edu Tue Jan 6 19:43:12 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:37:15 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <4963F909.4080902@ccs.neu.edu> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <4963F909.4080902@ccs.neu.edu> Message-ID: <4963FAA0.6000405@ccs.neu.edu> David Van Horn wrote: > If the answer to both is no, you could take any textbook > treatment of a Scheme (or FL) compiler and map it into Java by hand. I meant: map the output language into Java. The compiler itself can still be written in Scheme, of course. David From lunarc.lists at gmail.com Tue Jan 6 19:45:10 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:15 2009 Subject: [plt-scheme] Errors from Snooze Quick Start In-Reply-To: <3762020B-069F-40B8-BCE5-ADF59881D6F3@gmail.com> References: <3762020B-069F-40B8-BCE5-ADF59881D6F3@gmail.com> Message-ID: 2009/1/6 Dave Gurnell : > Typos corrected in Snooze 2.5. Thanks! > Sorry - this is going to make me look really dense. Does "as an expression" > mean wrapping it in parentheses? If so I think I might have had the same or > a similar idea. See below. I actually meant without the parentheses. I've never tried this, but I'm under the impression that this can be done with make-set!-transformer. > This has always bugged me. > I've been working on an SQL language for Mirrors, to give people the ability > to create SQL without all the ERA trappings of Snooze. I thought about this > problem again and I came up with a tentative solution. > The Mirrors language as it stands will have a define-table macro, which is > basically like define-persistent-struct: > (define-table person > ([name ...] > [age ...])) > One you have defined a table, you can access the run-time metadata using the > identifier without parentheses: > (table-name person) ; ==> symbol > (table-columns person) ; ==> (listof column) > ; and so on ... > but if you use my-table with parentheses, you get what is effectively an > alias for use in queries: > (person) ; ==> table-alias > (person name) ; ==> column-alias > (sql (select #:from (my-table))) That could work, but why not allow the use of the accessors directly? It seems that that would be much simpler. > You still have access to define-alias if you need to reference two instances > of a table in a single query: > (define-alias my-table-1 my-table) > (sql (select #:from (outer my-table my-table-1))) > This is obviously a bit cryptic but it does solve a number of problems: > - you don't have to use define-alias unless you want to alias a table > twice within the same query; > - you have a default alias you can rely on when constructing queries from > code spread across several modules; > - all the aliases for a table and its columns come from a single > identifier, making them easier to provide/require. > What do you think? I agree on all counts. The flipside of your last point, though, is that it becomes hard to export only certain parts of the alias. I can't think of a situation where you would want to export the alias without also exporting the corresponding accessors. Thanks for listening =) Henk From lunarc.lists at gmail.com Tue Jan 6 19:49:51 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:15 2009 Subject: [plt-scheme] Errors from Snooze Quick Start In-Reply-To: References: <3762020B-069F-40B8-BCE5-ADF59881D6F3@gmail.com> Message-ID: 2009/1/6 Henk Boom : > 2009/1/6 Dave Gurnell : >> This has always bugged me. >> I've been working on an SQL language for Mirrors, to give people the ability >> to create SQL without all the ERA trappings of Snooze. I thought about this >> problem again and I came up with a tentative solution. >> The Mirrors language as it stands will have a define-table macro, which is >> basically like define-persistent-struct: >> (define-table person >> ([name ...] >> [age ...])) >> One you have defined a table, you can access the run-time metadata using the >> identifier without parentheses: >> (table-name person) ; ==> symbol >> (table-columns person) ; ==> (listof column) >> ; and so on ... >> but if you use my-table with parentheses, you get what is effectively an >> alias for use in queries: >> (person) ; ==> table-alias >> (person name) ; ==> column-alias >> (sql (select #:from (my-table))) > > That could work, but why not allow the use of the accessors directly? > It seems that that would be much simpler. I quoted so much here I'm not sure it's clear what I was referring to. What I was suggesting is that rather than using person-name as an accessor and (person name) as an alias, you allow the use of person-name as both a structure accessor and as an sql column alias. I think that would be much clearer to use. Henk From sk at cs.brown.edu Tue Jan 6 20:02:07 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:15 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Message-ID: Kathi and I use Kawa in one of our research tools and we're happy with it. Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning Student + WORLD subset of Scheme. Would that be of interest? Is that something others would be interested in contributing to? Shriram From jmarshall at alum.mit.edu Tue Jan 6 20:34:38 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:37:16 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> Message-ID: On Tue, Jan 6, 2009 at 3:18 PM, John Clements wrote: >>> There *is* one way in which Haskell's 'do' is much nicer than this one: >>> Haskell's type system makes it possible to define a 'do' that works for a >>> whole bunch of different monads, and isn't chained to just one. In >>> Scheme, >>> if you want to use 'do' for different monads, you'll probably have to >>> enrich >>> uses of 'do' to indicate which monad's 'bind' to expand into. >> >> I think this is a seductively bad idea. Yeah, it's nice that the type >> system figures >> out what to dispatch to, but dispatching on the return type is heinous. >> (It >> introduces context sensitivity.) > > If I understand you correctly, this is a problem with inferred types being > heinous, right? If you explicitly specify the return type of any function > whose type is monadic, then the context sensitivity goes away. If I > understand you correctly. What I object to is not being able to understand what the expression foo (x) means without knowing what you intend to do with answer. >> ... >> and the nastiness of continuation-passing-style in fully typed languages. > > Hang on. We've got "statically typed" and "strongly typed," and you're > adding "fully typed" to the pile? Urg... Sorry. What I am referring to here is this. When I write a function FOO from int -> int, I am saying that the function accepts a continuation that is expecting an int, but I do not constrain that function in any other way. But if the language expects me to statically type both the arguments and return values of any funarg, the when I CPS convert FOO, I get foo (x:int, receiver:(int -> a)) -> a Suddenly there is an `a' here that wasn't here before. Suppose I write a parser that has both succeed and fail continuations. Now the type signature is getting pretty hairy. Now suppose I add the Kleene `*' to my parser as a higher order CPS function. The type signature is essentially impenetrable. >> Incidentally, I observed someone writing code with the state monad the >> other day. >> He didn't actually need to model state, he just wanted to program in >> `imperative style' >> (smash this `register', assign this to that, for i from 1 to 10, etc.) >> and the monad was there >> just to let him use the `do' syntax. Yuck! > > Yes, that's gross. On the other hand, I find that when writing Scheme these > days, using mutation gives me the willies; it seems less error-prone to use > a state monad, where I don't have to worry about other bits of the > computation coming in and messing up the state. I *think* this logic is > bogus, but that's how it feels. I just avoid using state altogether. -- ~jrm From d.j.gurnell at gmail.com Tue Jan 6 20:36:47 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:16 2009 Subject: [plt-scheme] Errors from Snooze Quick Start In-Reply-To: References: <3762020B-069F-40B8-BCE5-ADF59881D6F3@gmail.com> Message-ID: <0AE37A54-F5EE-42AB-91AE-EE1CFC8E2759@gmail.com> Henk Boom wrote: > I actually meant without the parentheses. I've never tried this, but > I'm under the impression that this can be done with > make-set!-transformer. That's what I'm using in this new code. It definitely sounds like we're thinking along the same lines. > Dave Gurnell wrote:: >> [...] if you use person with parentheses, you get what is >> effectively an alias for use in queries: >> (person) ; ==> table-alias >> (person name) ; ==> column-alias >> (sql (select #:from (person))) > > That could work, but why not allow the use of the accessors > directly? [...] > rather than using person-name as an accessor and (person name) as an > alias, > you allow the use of person-name as both a structure accessor and as > an sql > column alias. I think that would be much clearer to use. Ah yes... I get you. That's a neat way of doing it. There are a lot of factors in play here, though, and I can see arguments that run both ways. One thing to consider is that there are two query languages in Snooze. There's the syntax query language, which is terse and neat: (sql (select #:from (inner person employer (= person-employer-id employer-id)))) and there's a procedural version that's a little more flexible in that you can use things like "apply": (sql:select #:from (sql:inner person employer (apply sql:= (list person-employer-id employer-id)))) (The latter is provided from snooze.ss but is pretty poorly covered in the docs.) I find that the procedural language is an infrequent but definite necessity in Untyped applications: there are a few queries that just can't be constructed without it. Ideally we need a consistent way of referring to aliases that works in both situations. The unparenthesised approach is fine in the syntax language because we can design the language to interpret identifiers in whatever way is appropriate. The procedural language is tricker, though, because it is just regular Scheme. The identifier "person" is already used at expansion time (struct type identifier) and run time (entity metadata). We need a way of referring to the alias (instead of these other things) when we're in a query. The parenthesised approach works for this because a parenthesised use of the identifier can always be resolved to an alias: (sql:select #:what (list (person name)) #:from (sql:inner (person) ...)) However, the unparenthesised approach requires further thought. One approach would be to store a default alias in the entity metadata and lift entities and accessor procedures at run-time (neat but slower): (sql:select #:what (list person-name) #:from (sql:inner person ...))) Another approach would be to require the programmer to wrap the identifiers in (sql ...) blocks so the identifiers can be interpretted at expansion time (faster but much messier): (sql:select #:what (list (sql person-name)) #:from (sql:inner (sql person) ...))) And now it's after midnight. I'm probably not making much sense so I'll stop. This is definitely worth further discussion, though. I'll give it some solid thought, chat to the other Untypers, and post again when the ideas are more solidly formed in my head. Thank you for the injection of fresh ideas! Cheers, -- Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090107/ebfc1ee5/attachment.htm From d.j.gurnell at gmail.com Tue Jan 6 20:38:07 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:16 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <4963F909.4080902@ccs.neu.edu> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <4963F909.4080902@ccs.neu.edu> Message-ID: <7B5C5069-9BEA-4E92-A6CE-DBA7A91E658D@gmail.com> On 7 Jan 2009, at 00:36, David Van Horn wrote: > Dave Gurnell wrote: >> I'm looking for a way of generating Java source code from Scheme. >> Does anyone know of any libraries that might be useful for? > > Are you asking for a Scheme source to Java source translator, or a > Scheme library for writing Java source files? > > If the former, maybe you want a full-bore Scheme-to-Java compiler. > There's Kawa -- but I don't know if it goes source-to-source, it may > be a source-to-bytecode compiler. It's the latter. I want to generate Java stubs from Scheme data structures. It's so I can set up some RPC calls between Java and Scheme code (specifically, GWT applications and a Snooze-based data server). >> Perhaps there's something in Professor-J that could help? > > Professor-J is going from Java to Scheme, so I doubt it. And Matthias agrees with so I'll assume that alley is a dead end :) -- Dave From d.j.gurnell at gmail.com Tue Jan 6 20:41:47 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:17 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Message-ID: <2C43EE81-9EBD-4C16-A5A5-7C791B7F5C1D@gmail.com> > Kathi and I use Kawa in one of our research tools and we're happy with > it. > > Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning > Student + WORLD subset of Scheme. Would that be of interest? Is that > something others would be interested in contributing to? This could potentially be useful. Following on from my previous post, though, this would definitely have to be on the level of Java source code (GWT compiles from Java source rather than bytecode). -- Dave From lunarc.lists at gmail.com Tue Jan 6 20:56:14 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:17 2009 Subject: [plt-scheme] Errors from Snooze Quick Start In-Reply-To: <0AE37A54-F5EE-42AB-91AE-EE1CFC8E2759@gmail.com> References: <3762020B-069F-40B8-BCE5-ADF59881D6F3@gmail.com> <0AE37A54-F5EE-42AB-91AE-EE1CFC8E2759@gmail.com> Message-ID: 2009/1/6 Dave Gurnell : > However, the unparenthesised approach requires further thought. One approach > would be to store a default alias in the entity metadata and lift entities > and accessor procedures at run-time (neat but slower): > (sql:select #:what (list person-name) #:from (sql:inner person ...))) I'm not sure what you mean by 'lift' in this context. The implementation I was thinking of was to give aliases (which I assume are structs) the prop:procedure property so that they act as accessors, and use those as a replacement for the original accessors. That surely has a run-time cost as well though. > Thank you for the injection of fresh ideas! It was fun, I hope they are helpful! Henk From grettke at acm.org Tue Jan 6 21:00:22 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:17 2009 Subject: [plt-scheme] kudos for PLT's character set support In-Reply-To: References: <49620358.3030808@neilvandyke.org> <932b2f1f0901050500n7c5dd063n520e2cdcf6a98fdb@mail.gmail.com> <756daca50901051016v8fa1ffcn4427f167d24f4de6@mail.gmail.com> <4962B9F1.5090901@zenburn.net> Message-ID: <756daca50901061800r4904f71dx54f7a714491869b6@mail.gmail.com> On Tue, Jan 6, 2009 at 6:09 AM, Jos Koot wrote: > I second that. Thanks guys. From kumar_lista at mac.com Tue Jan 6 21:22:16 2009 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:37:17 2009 Subject: [plt-scheme] Application distribution mechanisms ... Message-ID: I'd like to be able to distribute a scheme app in a small package for those who already have DrScheme installed. There are currently three methods for creating executables in DrScheme - 1. Create a launcher that loads source files 2. Create a launcher that uses compiled versions of code. 3. Create a distribution zip package containing all necessary dlls. Approach 1 and 2, work only on the machine where they are built. Approach 3 is great if you're distributing to people who won't have DrScheme installed. However, for those who *do* have DrScheme installed, it'll be nice to have a distribution mechanism that isn't as big as options 2 or 3. It'll be awesome if we can install a runtime and create application packages that are on the average < 100k without resources. Is this possible at the moment? It used to be possible with v3xx, but with v4xx it looks like support for this mode has been removed. Am I right? Regards, -Kumar From grettke at acm.org Tue Jan 6 21:22:26 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:17 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Message-ID: <756daca50901061822o523d9d3ctd42e2656f76511f3@mail.gmail.com> On Tue, Jan 6, 2009 at 7:02 PM, Shriram Krishnamurthi wrote: > Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning > Student + WORLD subset of Scheme. Would that be of interest? Is that > something others would be interested in contributing to? That is interesting. For what are you looking for others to contribute? From grettke at acm.org Tue Jan 6 21:36:28 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:17 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> Message-ID: <756daca50901061836i17e5c8d6m7dce99d342be7550@mail.gmail.com> On Tue, Jan 6, 2009 at 5:18 PM, John Clements wrote: > Yes, that's gross. On the other hand, I find that when writing Scheme these > days, using mutation gives me the willies; it seems less error-prone to use > a state monad, where I don't have to worry about other bits of the > computation coming in and messing up the state. Please elaborate on how you use the state monad in Scheme. From lunarc.lists at gmail.com Tue Jan 6 21:51:47 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:18 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: References: Message-ID: 2009/1/6 kumar : > > I'd like to be able to distribute a scheme app in a small package for > those who already have DrScheme installed. > > There are currently three methods for creating executables in DrScheme - > 1. Create a launcher that loads source files > 2. Create a launcher that uses compiled versions of code. > 3. Create a distribution zip package containing all necessary dlls. I'll go one step in the other direction and suggest that it would be useful to have some automatic way of generating *really* standalone executables. It would be handy for things like ludum dare, where it has to be super-convenient to run your game or people don't bother; I have always had trouble getting the environment set up right so things generated by option 3 above know how to find the included dynamic libraries on Linux. It would also be handy to not be stuck with the bin/ and lib/ directory structure on Linux, since it makes the paths to texture and sound files platform-dependent. That being said, I love how easy it is to generate the standalone packages on other platforms, I usually end up having less trouble with it than the folks using py2exe. =) Henk From kumar_lista at mac.com Tue Jan 6 22:12:23 2009 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:37:18 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: References: Message-ID: <5FF1627B-5A76-4CF8-B42A-F7AA83FF6610@mac.com> > That being said, I love how easy it is to generate the standalone > packages on other platforms, I usually end up having less trouble with > it than the folks using py2exe. =) It is easy indeed! If the app's size is of the order of several 10s of MB, then option 3 is great on both Windows and MacOSX (haven't used it on Linux). For small applets and utilities, though, it feels awkward and inefficient to download a 7MB file, particularly since the downloadees in my case are likely to have > 90% of the files already installed on their machine :) -Kumar On 07 Jan 2009, at 10:51 AM, Henk Boom wrote: > 2009/1/6 kumar : >> >> I'd like to be able to distribute a scheme app in a small package for >> those who already have DrScheme installed. >> >> There are currently three methods for creating executables in >> DrScheme - >> 1. Create a launcher that loads source files >> 2. Create a launcher that uses compiled versions of code. >> 3. Create a distribution zip package containing all necessary dlls. > > I'll go one step in the other direction and suggest that it would be > useful to have some automatic way of generating *really* standalone > executables. It would be handy for things like ludum dare, where it > has to be super-convenient to run your game or people don't bother; I > have always had trouble getting the environment set up right so things > generated by option 3 above know how to find the included dynamic > libraries on Linux. It would also be handy to not be stuck with the > bin/ and lib/ directory structure on Linux, since it makes the paths > to texture and sound files platform-dependent. > > That being said, I love how easy it is to generate the standalone > packages on other platforms, I usually end up having less trouble with > it than the folks using py2exe. =) > > Henk From sk at cs.brown.edu Tue Jan 6 22:42:40 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:18 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <756daca50901061822o523d9d3ctd42e2656f76511f3@mail.gmail.com> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <756daca50901061822o523d9d3ctd42e2656f76511f3@mail.gmail.com> Message-ID: On Tue, Jan 6, 2009 at 9:22 PM, Grant Rettke wrote: > On Tue, Jan 6, 2009 at 7:02 PM, Shriram Krishnamurthi wrote: >> Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning >> Student + WORLD subset of Scheme. Would that be of interest? Is that >> something others would be interested in contributing to? > > That is interesting. For what are you looking for others to contribute? There is a large set of primitive functions even in Beginner Scheme. Many of these are pretty straightforward to translate to Java, but someone still needs to do the translation by hand, to account for subtle differences in semantics. It's not the most exciting thing in the world, but it is easy to dive in and help with (because we've already got several translated, so you have examples to help you). We are currently also wrestling with the differences between J2ME, which most non-dumb cell phones now support, and the Android platform, which has its own libraries for the same tasks. (I'm ignoring the iPhone because I, personally, don't have one; but if someone who does have one is interested in scripting that, that would be yet another platform to throw into this mix.) We need to figure out some form of bridge/adapter between these. We have just begun to investigate some Open projects that purport to do this, but we don't yet know their state of affairs. This is something where expertise would be even more valuable than coding cycles (eg, "use bridge project X for graphics, project Y for HTTP, and don't touch project Z"). Shriram From dvanhorn at ccs.neu.edu Tue Jan 6 22:58:19 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:37:18 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <756daca50901061836i17e5c8d6m7dce99d342be7550@mail.gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> <756daca50901061836i17e5c8d6m7dce99d342be7550@mail.gmail.com> Message-ID: <4964285B.4000909@ccs.neu.edu> Grant Rettke wrote: > On Tue, Jan 6, 2009 at 5:18 PM, John Clements wrote: >> Yes, that's gross. On the other hand, I find that when writing Scheme these >> days, using mutation gives me the willies; it seems less error-prone to use >> a state monad, where I don't have to worry about other bits of the >> computation coming in and messing up the state. > > Please elaborate on how you use the state monad in Scheme. You might have a look at these: http://groups.google.com/group/comp.lang.functional/msg/2fde5545c6657c81 http://okmij.org/ftp/Scheme/monad-in-Scheme.html David From clements at brinckerhoff.org Wed Jan 7 00:47:02 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:19 2009 Subject: [plt-scheme] Why do layman programmers care about Currying? In-Reply-To: <756daca50901061836i17e5c8d6m7dce99d342be7550@mail.gmail.com> References: <756daca50812302012i492c77b2o484da69220d8d76a@mail.gmail.com> <617742ED-C283-41A5-819B-1D3DB9CED172@ccs.neu.edu> <8269CA49-3C48-42AE-B86A-218374E62250@gmail.com> <9CB367AD-BB75-4148-93A5-E8BD9C82FBE3@brinckerhoff.org> <756daca50901061836i17e5c8d6m7dce99d342be7550@mail.gmail.com> Message-ID: On Jan 6, 2009, at 6:36 PM, Grant Rettke wrote: > On Tue, Jan 6, 2009 at 5:18 PM, John Clements > wrote: >> Yes, that's gross. On the other hand, I find that when writing >> Scheme these >> days, using mutation gives me the willies; it seems less error- >> prone to use >> a state monad, where I don't have to worry about other bits of the >> computation coming in and messing up the state. > > Please elaborate on how you use the state monad in Scheme. Here's one example; for a compilers class that I'm teaching, I've written a toy compiler. The standard way of translating expression trees into linear code causes a problem, though; you want to know, for instance, what the last basic block was labeled. One natural way to do this is to mutate a variable that stores the label of the most recent basic block. (There are certainly other ways to do this.) When trying this style, though, I felt more comfortable using a state monad to hook things up, rather than using actual mutation. ... or were you just asking how to write code in scheme that uses the state monad? 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/20090106/88567bf7/smime.bin From mflatt at cs.utah.edu Wed Jan 7 08:32:11 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:19 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: References: Message-ID: <20090107133212.DA2396500AF@mail-svr1.cs.utah.edu> At Tue, 6 Jan 2009 21:51:47 -0500, "Henk Boom" wrote: > 2009/1/6 kumar : > > > > I'd like to be able to distribute a scheme app in a small package for > > those who already have DrScheme installed. > > > > There are currently three methods for creating executables in DrScheme - > > 1. Create a launcher that loads source files > > 2. Create a launcher that uses compiled versions of code. > > 3. Create a distribution zip package containing all necessary dlls. > > I'll go one step in the other direction and suggest that it would be > useful to have some automatic way of generating *really* standalone > executables. It would be handy for things like ludum dare, where it > has to be super-convenient to run your game or people don't bother; I > have always had trouble getting the environment set up right so things > generated by option 3 above know how to find the included dynamic > libraries on Linux. Do you mean "libmzscheme3m.so"? Or do you mean other libraries, like, say, "libpng.so"? > It would also be handy to not be stuck with the > bin/ and lib/ directory structure on Linux, since it makes the paths > to texture and sound files platform-dependent. Are you using `define-runtime-path' to access the files within Scheme? Matthew From mflatt at cs.utah.edu Wed Jan 7 08:57:43 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:19 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: References: Message-ID: <20090107135744.C51DE6500AF@mail-svr1.cs.utah.edu> At Wed, 07 Jan 2009 10:22:16 +0800, kumar wrote: > However, for those who *do* have DrScheme installed, it'll be nice to > have a distribution mechanism that isn't as big as options 2 or 3. It'll > be awesome if we can install a runtime and create application packages > that are on the average < 100k without resources. Is this possible > at the moment? It used to be possible with v3xx, but with v4xx > it looks like support for this mode has been removed. Am I right? Long before the end of the v3xx series, we moved away from installing libraries into a shared or system area. Windows DLLs used to go into the system folder, and Mac OS X frameworks used to go in "/Library/Frameworks". We moved away from that kind of installation because it created problems for non-administrators and non-expert administrators. Also, we concluded that if a user already has DrScheme installed, then you could given them a Planet path or ".plt" file that creates an executable, instead of trying to distribute executables. As an added benefit, installing a Planet or ".plt" package avoids a lot of linking and compatibility problems with shared-library versions. We could bring back support for creating an installation with libraries in a standard place (the --enable-libfw configuration option probably still works for Mac OS X) and for building executables that assume such an installation. For this to be the right default installation, tough, there'd have to be many users downloading many PLT-based executables, and the users must really want executables instead of executable-creating ".plt" files. Is there such a group of people? From mflatt at cs.utah.edu Wed Jan 7 09:06:04 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:19 2009 Subject: [plt-scheme] Arbitrary TTF fonts in MrEd In-Reply-To: <4963F769.7080409@zenburn.net> References: <4963F769.7080409@zenburn.net> Message-ID: <20090107140605.B3E4E6500AD@mail-svr1.cs.utah.edu> At Wed, 07 Jan 2009 01:29:29 +0100, Jakub Piotr C?apa wrote: > As far as I understand it is impossible to use arbitrary (supplied with > the application; without a system-wide installation) TTF fonts in MrEd? > > I undertand that there were some supported platforms in the past which > didn't support TTF fonts at all and that it is good to look as native as > possible but I hope to achive some more consistent visual style on > Win32, OS X and modern Linux in an industrial automation app in which I > won't even use native widgets. > > Would such a thing be difficult to add? I don't know. My guess is that each platform provides a function that takes a filename containing a TTF font, and it adds the font to the set available for the application to use. If that's right, then maybe you could use `scheme/foreign' to call the function, and then you could use the font name as a "face" in the `font%' world. Matthew From geoff at knauth.org Wed Jan 7 09:38:00 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:37:20 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Message-ID: <952AB7AC-34B9-482E-BF75-12D14A82C5F2@knauth.org> On Jan 6, 2009, at 20:02, Shriram Krishnamurthi wrote: > Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning > Student + WORLD subset of Scheme. Would that be of interest? Is that > something others would be interested in contributing to? If only I had a J2ME device to play with. My iPhone is allergic to Java, thanks (I think) to Steve Jobs. From geoff at knauth.org Wed Jan 7 09:40:38 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:37:20 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <756daca50901061822o523d9d3ctd42e2656f76511f3@mail.gmail.com> Message-ID: <80A1640B-5E00-41F0-A8AB-AB14296CB53B@knauth.org> On Jan 6, 2009, at 22:42, Shriram Krishnamurthi wrote: > (I'm ignoring the iPhone because I, personally, don't have one; but > if someone who does have one is interested in scripting that, that > would be yet another platform to throw into this mix.) I'd love to help with the iPhone, except I don't think it supports Java at all. From spdegabrielle at gmail.com Wed Jan 7 09:42:39 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:37:20 2009 Subject: [plt-scheme] plt web server serving .eml files as text/html Message-ID: <595b9ab20901070642p7c48f8dduebfe55f586794164@mail.gmail.com> Hi, I'm using the plt web server, and I have some static files (email messages in .eml ) that I want the browser to pass on to thunderbird mail client; When I put them behind the plt webserver they get shown by the browser (as text/html), but under apache, or even as a local file in the browser they get passed to thunderbird. Is there any way to convince the plt-web server let firefox know they should go to thunderbird? (I'm pretty sure text/html Content-Type is the problem) Thanks, Stephen From geoff at knauth.org Wed Jan 7 09:50:00 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:37:20 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <80A1640B-5E00-41F0-A8AB-AB14296CB53B@knauth.org> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <756daca50901061822o523d9d3ctd42e2656f76511f3@mail.gmail.com> <80A1640B-5E00-41F0-A8AB-AB14296CB53B@knauth.org> Message-ID: <16CA6A90-A798-4BCB-9DC9-AB0F55FAC257@knauth.org> On Jan 7, 2009, at 09:40, I wrote: > On Jan 6, 2009, at 22:42, Shriram Krishnamurthi wrote: >> (I'm ignoring the iPhone because I, personally, don't have one; but >> if someone who does have one is interested in scripting that, that >> would be yet another platform to throw into this mix.) > > I'd love to help with the iPhone, except I don't think it supports > Java at all. Maybe I was wrong. Looks like there is a path from [Scheme to] Java to Objective-C, O Boy: http://blog.taragana.com/index.php/archive/how-to-develop-iphone-applications-in-java/ From jadudm at gmail.com Wed Jan 7 10:02:05 2009 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:37:20 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: <20090107135744.C51DE6500AF@mail-svr1.cs.utah.edu> References: <20090107135744.C51DE6500AF@mail-svr1.cs.utah.edu> Message-ID: On Wed, Jan 7, 2009 at 8:57 AM, Matthew Flatt wrote: > benefit, installing a Planet or ".plt" package avoids a lot of linking > and compatibility problems with shared-library versions. I will say that the new distribution method works great for me. I love the fact that we no longer have a dependency on the entirety of PLT Scheme to distribute parts of our toolchain. A few MB for a tool is a great trade-off from requiring users to install 30+MB (and possibly get the wrong version, or bung things up, or ...). Like you say: "For this to be the right default installation, though, there'd have to be many users downloading many PLT-based executables, and the users must really want executables instead of executable-creating ".plt" files. Is there such a group of people?" I don't know how big those numbers are, but I've never achieved them. I'm still in the 1-10 user range on most things, and the simplicity of "Create Executable" makes things a lot better. (I take that back: when we use our tools in the classroom, I guess we have more users... and still, requiring PLT Scheme so students can program a robot in another language really doesn't play out well.) My (unasked for) 2c. Cheers, Matt From noelwelsh at gmail.com Wed Jan 7 10:04:52 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:37:20 2009 Subject: [plt-scheme] plt web server serving .eml files as text/html In-Reply-To: <595b9ab20901070642p7c48f8dduebfe55f586794164@mail.gmail.com> References: <595b9ab20901070642p7c48f8dduebfe55f586794164@mail.gmail.com> Message-ID: There is a mime.types file that the web server uses to determine the content type. Probably you need to add .eml files to it. The file is mime.types in collects/web-server/default-web-root. N. On Wed, Jan 7, 2009 at 2:42 PM, Stephen De Gabrielle wrote: > Hi, > > I'm using the plt web server, and I have some static files (email > messages in .eml ) that I want the browser to pass on to thunderbird > mail client; > > When I put them behind the plt webserver they get shown by the browser > (as text/html), but under apache, or even as a local file in the > browser they get passed to thunderbird. > > Is there any way to convince the plt-web server let firefox know they > should go to thunderbird? (I'm pretty sure text/html Content-Type is > the problem) > > Thanks, > > Stephen > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From spdegabrielle at gmail.com Wed Jan 7 10:11:53 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:37:21 2009 Subject: [plt-scheme] plt web server serving .eml files as text/html In-Reply-To: References: <595b9ab20901070642p7c48f8dduebfe55f586794164@mail.gmail.com> Message-ID: <595b9ab20901070711g438cb5bet6aa27baeb0f9ee0d@mail.gmail.com> Thanks, that was perfect -three tabs and the characters eml and it was fixed. I was thrashing about with (make #:url->path (lambda (path) (*must create contract here*) )#:path->mime-type (lambda (path) #"message/rfc822")) and getting nowhere fast. Cheers, Stephen From kumar_lista at mac.com Wed Jan 7 10:59:59 2009 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:37:21 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: <20090107135744.C51DE6500AF@mail-svr1.cs.utah.edu> References: <20090107135744.C51DE6500AF@mail-svr1.cs.utah.edu> Message-ID: Hmmmm ... haven't thought about creating a .plt file yet. The "distribution" executable option, I must say, is perfect for most situations where you don't even want the user to be aware that the application is written in Scheme. The question of the runtime + small app package split is more a problem of compatibility maintenance as I see it. Newer versions, in that case, cannot break older code and so it becomes difficult to throw away stuff. I wouldn't really ask you guys to go out of your way to officially bring back the older installation method, but it'll be nice to allow us to shoot ourselves in the foot if we want to ... unofficially :-P -Kumar On 07 Jan 2009, at 9:57 PM, Matthew Flatt wrote: > At Wed, 07 Jan 2009 10:22:16 +0800, kumar wrote: >> However, for those who *do* have DrScheme installed, it'll be nice to >> have a distribution mechanism that isn't as big as options 2 or 3. >> It'll >> be awesome if we can install a runtime and create application >> packages >> that are on the average < 100k without resources. Is this possible >> at the moment? It used to be possible with v3xx, but with v4xx >> it looks like support for this mode has been removed. Am I right? > > Long before the end of the v3xx series, we moved away from installing > libraries into a shared or system area. Windows DLLs used to go into > the system folder, and Mac OS X frameworks used to go in > "/Library/Frameworks". We moved away from that kind of installation > because it created problems for non-administrators and non-expert > administrators. > > Also, we concluded that if a user already has DrScheme installed, then > you could given them a Planet path or ".plt" file that creates an > executable, instead of trying to distribute executables. As an added > benefit, installing a Planet or ".plt" package avoids a lot of linking > and compatibility problems with shared-library versions. > > We could bring back support for creating an installation with > libraries > in a standard place (the --enable-libfw configuration option probably > still works for Mac OS X) and for building executables that assume > such > an installation. For this to be the right default installation, tough, > there'd have to be many users downloading many PLT-based executables, > and the users must really want executables instead of > executable-creating ".plt" files. Is there such a group of people? > From toddobryan at gmail.com Wed Jan 7 10:50:11 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Mar 26 02:37:21 2009 Subject: [plt-scheme] Slightly OT--How to print from DrScheme using CUPS Message-ID: <904774730901070750t15c2dd27kf28f8746896f860d@mail.gmail.com> Could anybody tell me what print command or symbolic link trickery I can use to get DrScheme to print using CUPS? Right now, we print to a file, open the file in Evince, and then print. I've thought about allowing direct printing for a while, but every time I look it up, I run out of time before I can find an answer. Thanks, Todd From icfp.publicity at googlemail.com Wed Jan 7 11:40:27 2009 From: icfp.publicity at googlemail.com (Matthew Fluet (ICFP Publicity Chair)) Date: Thu Mar 26 02:37:21 2009 Subject: [plt-scheme] ICFP: Child care at conference Message-ID: <53ff55480901070840n73e063bducdeab05f3a3ed20@mail.gmail.com> Potential ICFP attendees: The ACM-SIGPLAN Executive Committee, which oversees and sponsors ICFP, is considering expanding its travel grants for event participants in need of child care assistance. (Such expansion would also apply to other major SIGPLAN-sponsored conferences, such as PLDI, POPL, OOPSLA.) The purpose of this message is to solicit feedback from potential attendees regarding the desirability for child care assistance and what forms of assistance be most appropriate. If child care assistance at ICFP (or other SIGPLAN events) is of interest to you, please contact me (at icfp.publicity@gmail.com -or- fluet@tti-c.org) with your comments. Some questions of particular interest: * What age groups of children are most appropriate to cover? * What types of costs might SIGPLAN cover to facilitate your participation in events? Sincerely, -Matthew Fluet (ICFP Publicity Chair) From lunarc.lists at gmail.com Wed Jan 7 11:54:34 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:21 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: <20090107133212.DA2396500AF@mail-svr1.cs.utah.edu> References: <20090107133212.DA2396500AF@mail-svr1.cs.utah.edu> Message-ID: 2009/1/7 Matthew Flatt : > At Tue, 6 Jan 2009 21:51:47 -0500, "Henk Boom" wrote: >> 2009/1/6 kumar : >> > >> > I'd like to be able to distribute a scheme app in a small package for >> > those who already have DrScheme installed. >> > >> > There are currently three methods for creating executables in DrScheme - >> > 1. Create a launcher that loads source files >> > 2. Create a launcher that uses compiled versions of code. >> > 3. Create a distribution zip package containing all necessary dlls. >> >> I'll go one step in the other direction and suggest that it would be >> useful to have some automatic way of generating *really* standalone >> executables. It would be handy for things like ludum dare, where it >> has to be super-convenient to run your game or people don't bother; I >> have always had trouble getting the environment set up right so things >> generated by option 3 above know how to find the included dynamic >> libraries on Linux. > > Do you mean "libmzscheme3m.so"? Or do you mean other libraries, like, > say, "libpng.so"? I mean libmzscheme3m.so, since it is usual for people to have the other libraries I require to be installed (or easy for them to install them). I must say that my main problem is having the program not be able to find these libraries on Linux systems. I would be more precise about the conditions but I don't have a linux machine without mzscheme installed handy right now to test. >> It would also be handy to not be stuck with the >> bin/ and lib/ directory structure on Linux, since it makes the paths >> to texture and sound files platform-dependent. > > Are you using `define-runtime-path' to access the files within Scheme? I didn't know about this function before, it's useful! I'm curious why DrScheme puts the data files used in lib/plt//exts/ert/ when creating a .tgz distribution, what does that path signify? Henk From mflatt at cs.utah.edu Wed Jan 7 12:12:40 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:21 2009 Subject: [plt-scheme] Application distribution mechanisms ... In-Reply-To: References: <20090107133212.DA2396500AF@mail-svr1.cs.utah.edu> Message-ID: <20090107171241.C90EA6500AA@mail-svr1.cs.utah.edu> At Wed, 7 Jan 2009 11:54:34 -0500, "Henk Boom" wrote: > 2009/1/7 Matthew Flatt : > > At Tue, 6 Jan 2009 21:51:47 -0500, "Henk Boom" wrote: > >> I'll go one step in the other direction and suggest that it would be > >> useful to have some automatic way of generating *really* standalone > >> executables. It would be handy for things like ludum dare, where it > >> has to be super-convenient to run your game or people don't bother; I > >> have always had trouble getting the environment set up right so things > >> generated by option 3 above know how to find the included dynamic > >> libraries on Linux. > > > > Do you mean "libmzscheme3m.so"? Or do you mean other libraries, like, > > say, "libpng.so"? > > I mean libmzscheme3m.so, since it is usual for people to have the > other libraries I require to be installed (or easy for them to install > them). I must say that my main problem is having the program not be > able to find these libraries on Linux systems. I would be more precise > about the conditions but I don't have a linux machine without mzscheme > installed handy right now to test. Hm... Let me know when you (or anyone else on the list) can say more. The executable created by the distribution-bundling process is supposed to set LD_LIBRARY_PATH and then exec() the mzscheme executable, so it's supposed to find the dynamic libraries automatically. It sounds like there's a problem with that part (though it works for me). A workaround is to not build PLT Scheme with `--enable-shared', in which case there is no "libmzscheme3m.so" to not find. > >> It would also be handy to not be stuck with the > >> bin/ and lib/ directory structure on Linux, since it makes the paths > >> to texture and sound files platform-dependent. > > > > Are you using `define-runtime-path' to access the files within Scheme? > > I didn't know about this function before, it's useful! I'm curious why > DrScheme puts the data files used in lib/plt//exts/ert/ when > creating a .tgz distribution, what does that path signify? The name "exts" came from "extensions". The directory was created as a place to copy `require'd native-code extensions. It became the directory to hold files that are automatically copied by a particular phase of the distribution creator. The "ert" is "e. run time". (Why the "e" here? I've forgotten.) An extra directory layer is used to ensure that there are no name conflicts between the files that a program references via `define-runtime-path' and the native-code extensions that are referenced via `require'. Matthew From jay.mccarthy at gmail.com Wed Jan 7 12:32:43 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:22 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: Message-ID: I'm not sure why you think yours doesn't work. If I set up the following test server: #lang scheme (require setup/dirs web-server/web-server web-server/http web-server/http/response web-server/dispatchers/dispatch (prefix-in filter: web-server/dispatchers/dispatch-filter) (prefix-in sequencer: web-server/dispatchers/dispatch-sequencer)) (define (make-limit-dispatcher num inner) (let ([sem (make-semaphore num)]) (lambda (conn req) (printf "Enter limit~n") (call-with-semaphore sem (lambda () (inner conn req))) (printf "Exit limit~n")))) (serve #:dispatch (sequencer:make (filter:make #rx"/limited" (make-limit-dispatcher 5 (lambda (conn req) (sleep 1) (output-response/method conn (make-response/full 200 "Okay" (current-seconds) TEXT/HTML-MIME-TYPE empty (list "Limited")) (request-method req))))) (lambda (conn req) (output-response/method conn (make-response/full 200 "Okay" (current-seconds) TEXT/HTML-MIME-TYPE empty (list "Unlimited")) (request-method req)))) #:port 8080) (do-not-return) -- Then a run of httperf looks like this in the server log: $ mzscheme -t exp/limit.ss # Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Enter limit Enter limit Enter limit Enter limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Exit limit Enter limit Enter limit Enter limit Enter limit Enter limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit Exit limit -- which is what you would expect. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://jay.teammccarthy.org "The glory of God is Intelligence" - D&C 93 From keydana at gmx.de Wed Jan 7 13:55:14 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:37:22 2009 Subject: [plt-scheme] PLT projects waiting for contributors? Message-ID: <4964FA92.3050608@gmx.de> Hi, in a recent thread, I read Shriram Krishnamurthi's >> Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning >> Student + WORLD subset of Scheme. Would that be of interest? Is that >> something others would be interested in contributing to? This reminded me of something: I'm a Java developer at work and studying scheme in my spare time (mainly by doing SICP exercises). Doing the exercises is great to understand the theoretical stuff, but I'd like to do "real-world" programming in a functional language, too. Of course I was thinking of developing an own application, but recently I realized that if I took part in a project, I'd get feedback and would learn to write better code. So my question is, are there any PLT projects that need contributors (and can afford taking in people who are not so experienced yet)? In fact something like the above - compiling for the JVM - would really interest me, but I'd be curious for any suggestions! Thanks in advance Sigrid From clements at brinckerhoff.org Wed Jan 7 15:17:56 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:22 2009 Subject: [plt-scheme] PLT projects waiting for contributors? In-Reply-To: <4964FA92.3050608@gmx.de> References: <4964FA92.3050608@gmx.de> Message-ID: <3D08F01C-1E9E-4386-9D71-33BC1F2E9FA1@brinckerhoff.org> On Jan 7, 2009, at 10:55 AM, Sigrid Keydana wrote: > Hi, > > in a recent thread, I read Shriram Krishnamurthi's > >>> Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning >>> Student + WORLD subset of Scheme. Would that be of interest? Is >>> that >>> something others would be interested in contributing to? > > > This reminded me of something: I'm a Java developer at work and > studying > scheme in my spare time (mainly by doing SICP exercises). Doing the > exercises is great to understand the theoretical stuff, but I'd like > to > do "real-world" programming in a functional language, too. > Of course I was thinking of developing an own application, but > recently > I realized that if I took part in a project, I'd get feedback and > would > learn to write better code. > So my question is, are there any PLT projects that need contributors > (and can afford taking in people who are not so experienced yet)? > In fact something like the above - compiling for the JVM - would > really > interest me, but I'd be curious for any suggestions! Hmm... projects that need work? You could call those Requests For Implementation. Or even: Scheme Requests For Implementation! Interestingly, that's not really how SRFIs are currently used. Perhaps srfi.schemers.org could have a request-only category? I suppose that one thing that nearly every SRFI could use would be a good test suite. There are a bunch of SRFI's that I've used (e.g. 19) that have no test suite to speak of. In fact, you could even make that part of the standards document, if you could agree on a format for test cases... 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/20090107/af1bf2e6/smime.bin From matthias at ccs.neu.edu Wed Jan 7 16:02:51 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:37:22 2009 Subject: [plt-scheme] PLT projects waiting for contributors? In-Reply-To: <4964FA92.3050608@gmx.de> References: <4964FA92.3050608@gmx.de> Message-ID: On Jan 7, 2009, at 1:55 PM, Sigrid Keydana wrote: > > So my question is, are there any PLT projects that need contributors > (and can afford taking in people who are not so experienced yet)? > In fact something like the above - compiling for the JVM - would > really > interest me, but I'd be curious for any suggestions! Sigrid, Sam is about to release a call for contributions to Typed Scheme, a subproject of PLT Scheme. The idea is to create adapter modules for existing untyped libraries and/or planet packages so that Typed Scheme programmers can exploit the whole language easily (not write these things on their own all the time). On occasion there are other such calls for help. Just keep your eyes and ears open. PLT needs your help and wants you! -- Matthias From s.degabrielle at cs.ucl.ac.uk Wed Jan 7 16:05:58 2009 From: s.degabrielle at cs.ucl.ac.uk (Stephen De Gabrielle) Date: Thu Mar 26 02:37:23 2009 Subject: [plt-scheme] what tools can I turn off in DrScheme? Message-ID: <595b9ab20901071305sd01cca4j70919068c515e305@mail.gmail.com> Hi, I've worked out throught trial and error that I can turn a bunch of tools like swindle and slideshow off and have drscheme load up a bit faster. Are there any tools I shouldn't turn off ?(perhaps due to dependencies between DrScheme or the Tools themselves?) I tend to use PLT-Full releases because I like reading code. Stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090107/9b2d102f/attachment.html From robby at eecs.northwestern.edu Wed Jan 7 16:10:31 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:23 2009 Subject: [plt-scheme] what tools can I turn off in DrScheme? In-Reply-To: <595b9ab20901071305sd01cca4j70919068c515e305@mail.gmail.com> References: <595b9ab20901071305sd01cca4j70919068c515e305@mail.gmail.com> Message-ID: <932b2f1f0901071310x2e2070e9o3d54bf80578dfeff@mail.gmail.com> You can disable all of them and DrScheme will run fine (without lots of stuff). There are dependencies between some pairs of tools, tho. Robby On Wed, Jan 7, 2009 at 3:05 PM, Stephen De Gabrielle wrote: > Hi, > > I've worked out throught trial and error that I can turn a bunch of tools > like swindle and slideshow off and have drscheme load up a bit faster. > > Are there any tools I shouldn't turn off ?(perhaps due to dependencies > between DrScheme or the Tools themselves?) > > I tend to use PLT-Full releases because I like reading code. > > > Stephen > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From billclem at gmail.com Wed Jan 7 16:12:14 2009 From: billclem at gmail.com (Bill Clementson) Date: Thu Mar 26 02:37:23 2009 Subject: [plt-scheme] Vancouver Lisp Users Group meeting for January 2009 - Practical SCons for Game Development Message-ID: <8757cb490901071312k1b0a185cxf3bde57fcad4b12c@mail.gmail.com> Hi all, Now that we have some "good ol rainy weather" again in Vancouver and no longer have to shovel snow, it's time to schedule some technical meetups so that we can avoid the onset of cabin fever. ;-) Dean Giberson gave a presentation on SCons at the Montreal International Game Summit (MIGS) 2008 and will give a version of that presentation to our first lispvan meeting of 2009. For those who aren't familiar with SCons, the SCons site describes it as: "SCons is an Open Source software construction tool-that is, a next-generation build tool. Think of SCons as an improved, cross-platform substitute for the classic Make utility with integrated functionality similar to autoconf/automake and compiler caches such as ccache. In short, SCons is an easier, more reliable and faster way to build software." Dean has been heavily involved in the Game Industry for some time (see here and here for details on his earlier "Using PLT Scheme for Game Development" lispvan presentation and some biographical details), so this promises to be an interesting follow-on to his previous lispvan presentation. Here's the "official" meeting notice: Topic: Practical Scons for Game Development Presenter: Dean Giberson Date: Wednesday, January 21st, 2009 Time: 7pm - 10pm (or whenever) Venue: The Hackery, 304 Victoria Dr (entrance off Franklin), Vancouver Summary: SCons has quietly been gaining usage throughout development houses, it provides a robust and powerful build system which fixes problems that caused people to question using make for large builds. SCons was used in the production of "SOCOM: Confrontation" for the PS3. We will show how it was used to build data, ensure consistency, and reduce turn around time. Care will be taken to show extensions developed explicitly for a production game house, and how they can be applied to other projects. Join us for a beer (bring your own - there's a fridge), some technical chat, and an opportunity to get back out into the "real world" after a few weeks of holiday fun in the snow! ;-) Updates/links will be posted on my blog: http://bc.tech.coop/blog/090107.html If there are no technical hiccups, I will post a screencast of the presentation at a later date. -- Bill Clementson From jensaxel at soegaard.net Wed Jan 7 16:42:48 2009 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:37:23 2009 Subject: [plt-scheme] PLT projects waiting for contributors? In-Reply-To: <4964FA92.3050608@gmx.de> References: <4964FA92.3050608@gmx.de> Message-ID: <496521D8.3060705@soegaard.net> Hi Sigrid, > in a recent thread, I read Shriram Krishnamurthi's > >>> Danny Yoo has a reasonable Scheme -> J2ME compiler for the Beginning >>> Student + WORLD subset of Scheme. Would that be of interest? Is that >>> something others would be interested in contributing to? > > This reminded me of something: I'm a Java developer at work and studying > scheme in my spare time (mainly by doing SICP exercises). Doing the > exercises is great to understand the theoretical stuff, but I'd like to > do "real-world" programming in a functional language, too. > Of course I was thinking of developing an own application, but recently > I realized that if I took part in a project, I'd get feedback and would > learn to write better code. > So my question is, are there any PLT projects that need contributors > (and can afford taking in people who are not so experienced yet)? > In fact something like the above - compiling for the JVM - would really > interest me, but I'd be curious for any suggestions! One project that comes to mind is the Scheme Cookbook. The recipes of the Wiki often originate from questions asked on this list. However, quite a few recipes was written for the 3xx-series and needs to be updated for the 4xx-series. http://schemecookbook.org/Cookbook/TOC?skin=voidtoc It would also be nice to see new recipes appear. Note: To avoid spam contributors need to registrate. http://schemecookbook.org/Cookbook/BecomingAnAuthor -- Jens Axel S?gaard From ryanc at ccs.neu.edu Wed Jan 7 16:54:52 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:37:24 2009 Subject: [plt-scheme] what tools can I turn off in DrScheme? In-Reply-To: <932b2f1f0901071310x2e2070e9o3d54bf80578dfeff@mail.gmail.com> References: <595b9ab20901071305sd01cca4j70919068c515e305@mail.gmail.com> <932b2f1f0901071310x2e2070e9o3d54bf80578dfeff@mail.gmail.com> Message-ID: <277415EF-3702-4BFC-A823-51486C089573@ccs.neu.edu> On Jan 7, 2009, at 4:10 PM, Robby Findler wrote: > You can disable all of them and DrScheme will run fine (without lots > of stuff). There are dependencies between some pairs of tools, tho. For example, some of the teaching language tools (How to Design Programs, ProfessorJ) rely on the Test Engine tool. That's the only dependency that I'm aware of, though. Ryan > On Wed, Jan 7, 2009 at 3:05 PM, Stephen De Gabrielle > wrote: >> Hi, >> >> I've worked out throught trial and error that I can turn a bunch of >> tools >> like swindle and slideshow off and have drscheme load up a bit >> faster. >> >> Are there any tools I shouldn't turn off ?(perhaps due to >> dependencies >> between DrScheme or the Tools themselves?) >> >> I tend to use PLT-Full releases because I like reading code. >> >> >> Stephen >> >> _________________________________________________ >> 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 lunarc.lists at gmail.com Wed Jan 7 16:58:16 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:24 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: Message-ID: 2009/1/7 Jay McCarthy : > I'm not sure why you think yours doesn't work. If I set up the > following test server: > ... I can duplicate your results. However, try removing the sleep and changing (list "Limited") to include a computation which takes a long time to finish. I'm not at my main computer right now (battery's dead =(), so I can't say exactly what I was using until I get home tonight, but I had something like (list (format "hello ~a" (sort (build-list 1000000 (lambda (x) (random 10))) <))) With that, when I go into firefox and hit refresh twice quickly (i.e. again before the first one exits), I only see "Exit limit" one time. It's interesting that if I replace the (sleep 1) with the calculation instead of putting it in the body the problem doesn't show up. Henk From dherman at ccs.neu.edu Wed Jan 7 18:41:54 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:37:24 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> Message-ID: <94332053-1677-45CE-BE55-44AA42DAAA74@ccs.neu.edu> I have a PLaneT package for parsing, manipulating, and generating Java: http://planet.plt-scheme.org/display.ss?package=java.plt&owner=dherman I haven't updated it in a while so it may need some tweaking, but I'd be willing to update it if it satisfied a need. Dave On Jan 6, 2009, at 7:16 PM, Dave Gurnell wrote: > Hi all, > > I'm looking for a way of generating Java source code from Scheme. > Does anyone know of any libraries that might be useful for? > > Perhaps there's something in Professor-J that could help? > > Cheers, > > -- Dave > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From gregory.woodhouse at gmail.com Wed Jan 7 20:12:29 2009 From: gregory.woodhouse at gmail.com (Greg Woodhouse) Date: Thu Mar 26 02:37:25 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <80A1640B-5E00-41F0-A8AB-AB14296CB53B@knauth.org> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <756daca50901061822o523d9d3ctd42e2656f76511f3@mail.gmail.com> <80A1640B-5E00-41F0-A8AB-AB14296CB53B@knauth.org> Message-ID: <5f07325f0901071712r42111e92u51e7a282d7dd1c0c@mail.gmail.com> No. it supports Objective-C and Cocoa Touch, which is sort of the Cocoa version of J2ME. On Wed, Jan 7, 2009 at 6:40 AM, Geoffrey S. Knauth wrote: > On Jan 6, 2009, at 22:42, Shriram Krishnamurthi wrote: > >> (I'm ignoring the iPhone because I, personally, don't have one; but if >> someone who does have one is interested in scripting that, that would be yet >> another platform to throw into this mix.) >> > > I'd love to help with the iPhone, except I don't think it supports Java at > all. > > > > _________________________________________________ > 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/20090107/83b60f32/attachment.htm From geoff at knauth.org Wed Jan 7 20:49:35 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:37:25 2009 Subject: [plt-scheme] v4 support for Reasoned Schemer? (set NXT goals via DrScheme) Message-ID: <8F1D43BF-A62D-4CB3-AE94-C0D9D4EC5E04@knauth.org> Support for Reasoned Schemer code came up in 2005 (with v3), and the answer then was "it's all standard R5RS," but now we have PLT v4, the FFI and R6RS, and I'm wondering if I play with the Reasoned Schemer code in v4, if anyone knows of problems I might encounter. I'm working with Mindstorms NXT rewriting old code, and after discovering a Prolog interface to NXT from Poland [1], it seemed it might be nice to put the two ideas together. Geoff [1] (google "Grzegorz J. Nalepa" "Hekate Project") -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090107/a3fa689c/attachment.html From farr at MIT.EDU Wed Jan 7 21:51:51 2009 From: farr at MIT.EDU (Will Farr) Date: Thu Mar 26 02:37:25 2009 Subject: [plt-scheme] Profiling Information Message-ID: <0A5676E6-97E0-4D7F-9B82-8DF5DEB8C33F@mit.edu> Hello everyone, I've been doing a bit of profiling using DrScheme this afternoon, and I'd like to get more information out of the profile. I keep seeing entries like: Msec Calls Function 1112249 1 < < unknown > >: 39.0 924659 1 < < unknown > >: 66.16 in the list. Is there any way I can get a module name that these anonymous functions (I'm assuming that they are anonymous functions) are associated with? It seems odd that it can give me a 39.0 or 66.16 (line, character numbers?) but no informative name. Is there some sort of profile fu that I need, or could somebody point me at the appropriate place to poke in the profiling code? Thanks! Will From lunarc.lists at gmail.com Wed Jan 7 22:07:19 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:26 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: Message-ID: Here is a concrete example. First the server code: ---- #lang scheme (require setup/dirs web-server/web-server web-server/http web-server/http/response web-server/dispatchers/dispatch (prefix-in filter: web-server/dispatchers/dispatch-filter) (prefix-in sequencer: web-server/dispatchers/dispatch-sequencer)) (define (make-limit-dispatcher num inner) (let ([sem (make-semaphore num)]) (lambda (conn req) (printf "Enter limit~n") (call-with-semaphore sem (lambda () (inner conn req))) (printf "Exit limit~n")))) (serve #:dispatch (sequencer:make (filter:make #rx"/limited" (make-limit-dispatcher 5 (lambda (conn req) (output-response/method conn (make-response/full 200 "Okay" (current-seconds) TEXT/HTML-MIME-TYPE empty (list (format "hello world ~a" (sort (build-list 100000 (? x (random 1000))) <)))) (request-method req))))) (lambda (conn req) (output-response/method conn (make-response/full 200 "Okay" (current-seconds) TEXT/HTML-MIME-TYPE empty (list "Unlimited")) (request-method req)))) #:port 8080) (do-not-return) ---- Using the following httperf command (the timeout seems to have the same effect as hitting refresh a second time in firefox): httperf --port 8080 --uri=/limited --timeout=0.1 --connections The web server output is: henk@korhal ~/test $ mzscheme server.ss # Enter limit Enter limit Enter limit Enter limit Enter limit See that the semaphore is never released. After this, no further requests get served. Could this be due to the same thing that I hit here? http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/026121.html Henk From lunarc.lists at gmail.com Wed Jan 7 22:09:21 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:26 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: Message-ID: The httperf command should actually be: httperf --port 8080 --uri=/limited --timeout=0.1 --num-conns=5 I'm not sure how that mis-paste happened. =) Henk From robby at eecs.northwestern.edu Wed Jan 7 23:10:21 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:26 2009 Subject: [plt-scheme] Profiling Information In-Reply-To: <0A5676E6-97E0-4D7F-9B82-8DF5DEB8C33F@mit.edu> References: <0A5676E6-97E0-4D7F-9B82-8DF5DEB8C33F@mit.edu> Message-ID: <932b2f1f0901072010k739f57a7mf2bf88711f53dab6@mail.gmail.com> For now, the easiest thing is probably to use the profiling directly from mzscheme via the errortrace library. The relevant code in drscheme is in plt/collects/drscheme/private/debug.ss, if you want to try, but I'm working on that myself so patchs won't be that useful. Robby On Wed, Jan 7, 2009 at 8:51 PM, Will Farr wrote: > Hello everyone, > > I've been doing a bit of profiling using DrScheme this afternoon, and I'd > like to get more information out of the profile. I keep seeing entries > like: > > Msec Calls Function > 1112249 1 < < unknown > >: 39.0 > 924659 1 < < unknown > >: > 66.16 > > in the list. Is there any way I can get a module name that these anonymous > functions (I'm assuming that they are anonymous functions) are associated > with? It seems odd that it can give me a 39.0 or 66.16 (line, character > numbers?) but no informative name. Is there some sort of profile fu that I > need, or could somebody point me at the appropriate place to poke in the > profiling code? > > Thanks! > > Will > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From laalaalovesu at yahoo.com Thu Jan 8 01:45:46 2009 From: laalaalovesu at yahoo.com (laa laa) Date: Thu Mar 26 02:37:26 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion Message-ID: <468947.12674.qm@web32705.mail.mud.yahoo.com> my son and i coded a program to compute fibonacci sequences. it works fine for low numbers, but when you try to do something higher like (fib 100) Dr.Scheme freaks out and freezes up. we're wondering what's going on? is there a reason for this. . . . (define (fib n) (if (< n 3) 1 (+ (fib (- n 1)) (fib (- n 2))))) From rcleis at mac.com Thu Jan 8 02:00:57 2009 From: rcleis at mac.com (Richard Cleis) Date: Thu Mar 26 02:37:26 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: <468947.12674.qm@web32705.mail.mud.yahoo.com> References: <468947.12674.qm@web32705.mail.mud.yahoo.com> Message-ID: (fib 100) is a big number for that function; it'll take awhile to compute. Are you sure it is freezing? When you click the stop sign, does the program stop? rac On Jan 7, 2009, at 11:45 PM, laa laa wrote: > my son and i coded a program to compute fibonacci sequences. it > works fine for low numbers, but when you try to do something higher > like (fib 100) Dr.Scheme freaks out and freezes up. we're wondering > what's going on? is there a reason for this. . . . > > (define (fib n) > (if (< n 3) > 1 > (+ (fib (- n 1)) (fib (- n 2))))) > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From clements at brinckerhoff.org Thu Jan 8 02:46:16 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:27 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: References: <468947.12674.qm@web32705.mail.mud.yahoo.com> Message-ID: <352FC121-2BA1-4501-8FEA-723C5FC8B482@brinckerhoff.org> On Jan 7, 2009, at 11:00 PM, Richard Cleis wrote: > (fib 100) is a big number for that function; it'll take awhile to > compute. Are you sure it is freezing? When you click the stop sign, > does the program stop? Actually, the problem is that you turned a linear computation into an exponential one. Here's one way to solve it: (require (planet dherman/memoize)) (define/memo (fib n) (if (< n 3) 1 (+ (fib (- n 1)) (fib (- n 2))))) (fib 100) => 354224848179261915075 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/20090107/a8ed1115/smime.bin From d.j.gurnell at gmail.com Thu Jan 8 04:49:19 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:27 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: <94332053-1677-45CE-BE55-44AA42DAAA74@ccs.neu.edu> References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <94332053-1677-45CE-BE55-44AA42DAAA74@ccs.neu.edu> Message-ID: Dave Herman wrote: > I have a PLaneT package for parsing, manipulating, and generating > Java: > > http://planet.plt-scheme.org/display.ss?package=java.plt&owner=dherman > > I haven't updated it in a while so it may need some tweaking, but > I'd be willing to update it if it satisfied a need. Dave, you're a star. That's exactly the kind of thing I was looking for. There's an AST in there, and given the existence of javascript.plt's renderer and mirrors.plt's JS syntax, it won't be hard to knock up something that does what I want it to. I'm not going to start on this immediately - there are other coding tasks I have to do first - but I will definitely take a look. Many thanks, -- Dave From jos.koot at telefonica.net Thu Jan 8 06:24:42 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:27 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <352FC121-2BA1-4501-8FEA-723C5FC8B482@brinckerhoff.org> Message-ID: Do you realize how many times your version of procedure fib is called for (fib 100)? Here is a version that is linear in n. (although for very large n, f1 and f2 become so large that (+ f0 f1) is going to take more time for each next step) #lang scheme (define (make-fib f0 f1) (define (fib n) (define (fib n f1 f2) (if (= n 2) f2 (fib (- n 1) f2 (+ f1 f2)))) (case n ((0) f0) ((1) f1) (else (fib n f1 (+ f0 f1))))) fib) (define fib (make-fib 1 1)) (time (fib 99)) (time (fib 100)) (time (fib 10000)) #| Welcome to DrScheme, version 4.1.3.8-svn6jan2009 [3m]. Language: Module; memory limit: 1000 megabytes. cpu time: 0 real time: 0 gc time: 0 354224848179261915075 cpu time: 0 real time: 0 gc time: 0 573147844013817084101 cpu time: 16 real time: 16 gc time: 0 54438373113565281338734260993750380135389184554695967026247715841208582865622349017083051547938960541173822675978026317384359584751116241439174702642959169925586334117906063048089793531476108466259072759367899150677960088306597966641965824937721800381441158841042480997984696487375337180028163763317781927941101369262750979509800713596718023814710669912644214775254478587674568963808002962265133111359929762726679441400101575800043510777465935805362502461707918059226414679005690752321895868142367849593880756423483754386342639635970733756260098962462668746112041739819404875062443709868654315626847186195620146126642232711815040367018825205314845875817193533529827837800351902529239517836689467661917953884712441028463935449484614450778762529520961887597272889220768537396475869543159172434537193611263743926337313005896167248051737986306368115003088396749587102619524631352447499505204198305187168321623283859794627245919771454628218399695789223798912199431775469705216131081096559950638297261253 84824200789710905475402843814961193046506186617012298328896435273375079278606944476185352514442107792804597990456129812942380915605503303233891960916223669875992278292319189668801771857555552099465332012844650237115371514174929091310489720345557750719664542523286202201950609148358522388271101670843305116994211577515125551025165593188816404834412955703882547752111157739578011586839707260256561482495646053870028033131186148539980539703155572752969339958607985038158144627643385882852953580342485084542644647168153100153318047956743639681565332615250957112748041192819602214884914828438912417852017450730553892871785792350941774338333150689823935442198880542933244037119486721554357654856549913451927109891980266518456492782782721295764924023550759555820564756936539487331765900020637312657064350970948264971003873351747771340331902810557566793178947002411880309460403436295347199746139227479154973035641263307423082405199999610154978466734045832685296038830112076562924599813625165234709396304973 4046445106365304163630823669242257761468288461791843224793434406079917883360676846711185597501 > |# Jos ----- Original Message ----- From: "John Clements" To: "Richard Cleis" Cc: ; Sent: Thursday, January 08, 2009 8:46 AM Subject: Re: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From jos.koot at telefonica.net Thu Jan 8 06:26:11 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:28 2009 Subject: [plt-scheme] identifier-binding question Message-ID: <02CEC0B31B064FF7B174E82B5B1C10CF@uw2b2dff239c4d> See below: #lang scheme (define-syntax (x stx) (syntax-case stx () ((_ y) (let ((x (identifier-binding #'y))) (cond ((list? x) #''module) ((not x) #''top) ((eq? x 'lexical) #''lexical) (else #''unexpected)))))) (x b) ; --> #f <== I expected `module' ??? (define b 3) (x b) ; --> module Thanks, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090108/0948a11d/attachment.html From mflatt at cs.utah.edu Thu Jan 8 08:04:40 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:28 2009 Subject: [plt-scheme] PLT projects waiting for contributors? In-Reply-To: <4964FA92.3050608@gmx.de> References: <4964FA92.3050608@gmx.de> Message-ID: <20090108130441.700846500A3@mail-svr1.cs.utah.edu> At Wed, 07 Jan 2009 19:55:14 +0100, Sigrid Keydana wrote: > So my question is, are there any PLT projects that need contributors > (and can afford taking in people who are not so experienced yet)? We could use some image-file libraries: * reading GIF files (we already have a library for writing) * reading and writing BMP files * reading and writing XPM & XBM files All of these format are currently built into MrEd using C code, but the code is ugly and we'd like to get rid of it. Also, these image formats are fairly simple. (In contrast, I would not recommend re-implementing JPEG or PNG processing in Scheme, because they're complex, and the existing C libraries work well.) Matthew From mflatt at cs.utah.edu Thu Jan 8 08:11:17 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:28 2009 Subject: [plt-scheme] identifier-binding question In-Reply-To: <02CEC0B31B064FF7B174E82B5B1C10CF@uw2b2dff239c4d> References: <02CEC0B31B064FF7B174E82B5B1C10CF@uw2b2dff239c4d> Message-ID: <20090108131119.831426500A3@mail-svr1.cs.utah.edu> At Thu, 8 Jan 2009 12:26:11 +0100, "Jos Koot" wrote: > #lang scheme > (define-syntax (x stx) > (syntax-case stx () > ((_ y) > (let ((x (identifier-binding #'y))) > (cond > ((list? x) #''module) > ((not x) #''top) > ((eq? x 'lexical) #''lexical) > (else #''unexpected)))))) > (x b) ; --> #f <== I expected `module' ??? > (define b 3) > (x b) ; --> module This has to do with the order of expansion. Within a module, top-level forms are partially expanded in order that they appear. The partial expansion goes far enough to determine whether the form is one of * `require' * `provide' * `define-syntax' * `define-for-syntax' * `define' * `begin' (body is spliced immediately) * a core expression form After the macro expander partially expands the module body, then all bindings are known and everything left is an expression, and they are expanded in a second pass. So, in the above example, at the point where the first use of `x' is being expanded, the `b' definition hasn't been seen, yet. In practice, when `x' is an expression form, the solution is to expand `(x b)' to `(#%expression (real-x b))', and put the real work in the `real-x' form. That way, partial expansion of `(x b)' will expose that it's an expression form without expanding the part that needs to have all bindings available. Matthew From sk at cs.brown.edu Thu Jan 8 08:24:33 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:28 2009 Subject: [plt-scheme] PLT projects waiting for contributors? In-Reply-To: <20090108130441.700846500A3@mail-svr1.cs.utah.edu> References: <4964FA92.3050608@gmx.de> <20090108130441.700846500A3@mail-svr1.cs.utah.edu> Message-ID: And audio! Yes? On Thu, Jan 8, 2009 at 8:04 AM, Matthew Flatt wrote: > At Wed, 07 Jan 2009 19:55:14 +0100, Sigrid Keydana wrote: >> So my question is, are there any PLT projects that need contributors >> (and can afford taking in people who are not so experienced yet)? > > We could use some image-file libraries: > > * reading GIF files (we already have a library for writing) > > * reading and writing BMP files > > * reading and writing XPM & XBM files > > All of these format are currently built into MrEd using C code, but the > code is ugly and we'd like to get rid of it. Also, these image formats > are fairly simple. > > (In contrast, I would not recommend re-implementing JPEG or PNG > processing in Scheme, because they're complex, and the existing C > libraries work well.) > > > Matthew > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From czhu at cs.utah.edu Thu Jan 8 08:42:26 2009 From: czhu at cs.utah.edu (Chongkai Zhu) Date: Thu Mar 26 02:37:28 2009 Subject: [plt-scheme] PLT projects waiting for contributors? In-Reply-To: <3D08F01C-1E9E-4386-9D71-33BC1F2E9FA1@brinckerhoff.org> References: <4964FA92.3050608@gmx.de> <3D08F01C-1E9E-4386-9D71-33BC1F2E9FA1@brinckerhoff.org> Message-ID: <496602C2.3030803@cs.utah.edu> John Clements wrote: > > I suppose that one thing that nearly every SRFI could use would be a > good test suite. There are a bunch of SRFI's that I've used (e.g. 19) > that have no test suite to speak of. In fact, you could even make that > part of the standards document, if you could agree on a format for > test cases... > If anyone would like to provide some SRFI test suits, I would be happy to check them in (for PLT. Each SRFI has a mail list that you should also post your test suite). Chongkai From dherman at ccs.neu.edu Thu Jan 8 08:51:07 2009 From: dherman at ccs.neu.edu (Dave Herman) Date: Thu Mar 26 02:37:29 2009 Subject: [plt-scheme] Generating Java source from Scheme In-Reply-To: References: <76A7058C-3179-4BB5-832F-9DE453F1BC50@gmail.com> <94332053-1677-45CE-BE55-44AA42DAAA74@ccs.neu.edu> Message-ID: <6D766531-7B89-4F24-A7AE-42B868A2DF8B@ccs.neu.edu> Great, glad to hear it fits the bill. Please feel free to email me and/ or (preferably and) file Trac tickets whenever you need. Dave On Jan 8, 2009, at 4:49 AM, Dave Gurnell wrote: > Dave Herman wrote: >> I have a PLaneT package for parsing, manipulating, and generating >> Java: >> >> http://planet.plt-scheme.org/display.ss? >> package=java.plt&owner=dherman >> >> I haven't updated it in a while so it may need some tweaking, but >> I'd be willing to update it if it satisfied a need. > > Dave, you're a star. That's exactly the kind of thing I was looking > for. There's an AST in there, and given the existence of > javascript.plt's renderer and mirrors.plt's JS syntax, it won't be > hard to knock up something that does what I want it to. > > I'm not going to start on this immediately - there are other coding > tasks I have to do first - but I will definitely take a look. > > Many thanks, > > -- Dave > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jos.koot at telefonica.net Thu Jan 8 08:55:28 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:29 2009 Subject: [plt-scheme] identifier-binding question References: <02CEC0B31B064FF7B174E82B5B1C10CF@uw2b2dff239c4d> <20090108131119.831426500A3@mail-svr1.cs.utah.edu> Message-ID: I expected that my question had to do with the order of expansion, but I did not think of #%expression as a way to escape too early expansion. Thanks for your clear answer, it works great. Jos ----- Original Message ----- From: "Matthew Flatt" To: "Jos Koot" Cc: Sent: Thursday, January 08, 2009 2:11 PM Subject: Re: [plt-scheme] identifier-binding question > At Thu, 8 Jan 2009 12:26:11 +0100, "Jos Koot" wrote: >> #lang scheme >> (define-syntax (x stx) >> (syntax-case stx () >> ((_ y) >> (let ((x (identifier-binding #'y))) >> (cond >> ((list? x) #''module) >> ((not x) #''top) >> ((eq? x 'lexical) #''lexical) >> (else #''unexpected)))))) >> (x b) ; --> #f <== I expected `module' ??? >> (define b 3) >> (x b) ; --> module > > This has to do with the order of expansion. Within a module, top-level > forms are partially expanded in order that they appear. The partial > expansion goes far enough to determine whether the form is one of > > * `require' > * `provide' > * `define-syntax' > * `define-for-syntax' > * `define' > * `begin' (body is spliced immediately) > * a core expression form > > After the macro expander partially expands the module body, then all > bindings are known and everything left is an expression, and they are > expanded in a second pass. > > So, in the above example, at the point where the first use of `x' is > being expanded, the `b' definition hasn't been seen, yet. > > In practice, when `x' is an expression form, the solution is to expand > `(x b)' to `(#%expression (real-x b))', and put the real work in the > `real-x' form. That way, partial expansion of `(x b)' will expose that > it's an expression form without expanding the part that needs to have > all bindings available. > > > Matthew > From mflatt at cs.utah.edu Thu Jan 8 08:55:54 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:29 2009 Subject: [plt-scheme] Slightly OT--How to print from DrScheme using CUPS In-Reply-To: <904774730901070750t15c2dd27kf28f8746896f860d@mail.gmail.com> References: <904774730901070750t15c2dd27kf28f8746896f860d@mail.gmail.com> Message-ID: <20090108135556.5ACB46500A8@mail-svr1.cs.utah.edu> At Wed, 7 Jan 2009 10:50:11 -0500, "Todd O'Bryan" wrote: > Could anybody tell me what print command or symbolic link trickery I > can use to get DrScheme to print using CUPS? > > Right now, we print to a file, open the file in Evince, and then > print. I've thought about allowing direct printing for a while, but > every time I look it up, I run out of time before I can find an > answer. On Linux/Unix? When you choose "Print" in DrScheme, you get a dialog with an option for "Printer", as opposed to "File" or "Preview", right? When you choose that option, DrScheme generates a temporary ".ps" file and runs the shell command "lpr .ps". Matthew From s.degabrielle at cs.ucl.ac.uk Thu Jan 8 09:22:55 2009 From: s.degabrielle at cs.ucl.ac.uk (Stephen De Gabrielle) Date: Thu Mar 26 02:37:29 2009 Subject: [plt-scheme] web-server/insta require the Browser tool to be enabled? Message-ID: <595b9ab20901080622x36a36677vcbe96c4139aea644@mail.gmail.com> Hi, Does "#lang web-server/insta" require the Browser tool to be enabled in DrScheme? It seems to be the case, but looking at the code for 'insta' doesn't indicate a requirement. (I get an odd error when I disable the browser tool) 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 sbloch at adelphi.edu Thu Jan 8 09:50:52 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:37:29 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: <468947.12674.qm@web32705.mail.mud.yahoo.com> References: <468947.12674.qm@web32705.mail.mud.yahoo.com> Message-ID: <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> On Jan 8, 2009, at 1:45 AM, laa laa wrote: > my son and i coded a program to compute fibonacci sequences. it > works fine for low numbers, but when you try to do something higher > like (fib 100) Dr.Scheme freaks out and freezes up. we're wondering > what's going on? is there a reason for this. . . . > > (define (fib n) > (if (< n 3) > 1 > (+ (fib (- n 1)) (fib (- n 2))))) This is one of my favorite (for classroom use) examples of algorithm (in)efficiency. It is obviously a "correct" definition, but think about how long it takes. The only number it actually knows is 1, and the only operation it does is +, and it never uses a computed result more than once, so if the right answer is (say) 350 quintillion, it has to do around 350 quintillion "+" operations to add up to that answer. At a billion operations per second, that's eleven thousand years. (Interestingly enough, it only requires a stack depth of 100, so stack overflow isn't a problem: if you can keep the computer running DrScheme for eleven thousand years without anybody tripping over the power cord or cosmic rays disrupting the RAM, it WILL produce the right answer.) John posted an alternative definition, using the technique of "memo- ization": in a nutshell, every time the function computes the answer to a question, it stores the answer in a table (indexed by the function input) so the next time it is asked the same question, it just re-uses the answer from the table rather than re-computing it. All of that is happening behind the scenes in the "memoize" package, although you could easily write your own memoized version of the function. With this simple transformation, the algorithm becomes linear-time in n, so it takes approximately 100 "+" operations rather than 350 quintillion. Here's another approach which doesn't require a look-up table. When you say "Fibonacci sequences", you're more right than you may realize: there is not ONE Fibonacci sequence but infinitely many, each sequence determined by a different first two elements. If you start with F(1)=1, F(2)=1, you get "the usual" Fibonacci sequence, but you can also start from F(1)=17, F(2)=-4 or any other starting place you wish. So we define ; fib : nat-num -> nat-num (check-expect (fib 1) 1) (check-expect (fib 2) 1) (check-expect (fib 3) 2) (check-expect (fib 4) 3) (check-expect (fib 5) 5) (check-expect (fib 6) 8) (define (fib n) (general-fib 1 1 n)) ; general-fib : num (prev2) num (prev1) nat-num(n) ; computes the n-th Fibonacci number in the sequence whose 1st and 2nd elements are prev2 and prev1 (check-expect (general-fib 17 -4 1) 17) (check-expect (general-fib 17 -4 2) -4) (check-expect (general-fib 17 -4 3) 13) (check-expect (general-fib 17 -4 4) 9) (check-expect (general-fib 17 -4 5) 22) Now, how to define this? Consider the sequence starting with the numbers x and y, then chop off the first number. You still have a Fibonacci sequence, but now it starts with y and x+y, and the nth element of the old sequence is the n-1-th element of the new sequence. This gives us a natural recursive definition: (define (general-fib prev2 prev1 n) (cond [(<= n 1) prev2] [(= n 2) prev1] [else (general-fib prev1 (+ prev2 prev1) (- n 1))])) This version turns out to be much more efficient (all times are in milliseconds): > (time (fib 10)) cpu time: 3 real time: 4 gc time: 0 55 > (time (fib 100)) cpu time: 4 real time: 5 gc time: 0 354224848179261915075 > (time (fib 1000)) cpu time: 34 real time: 49 gc time: 0 434665576869374564356885276750406258025646605173717804024817290895365554 179490518904038798400792551692959225930803226347752096896232398733224711 61642996440906533187938298969649928516003704476137795166849228875 Moral of the story: sometimes generalizing the problem makes it easier to solve. Stephen Bloch sbloch@adelphi.edu From farr at MIT.EDU Thu Jan 8 13:40:43 2009 From: farr at MIT.EDU (Will M Farr) Date: Thu Mar 26 02:37:29 2009 Subject: [plt-scheme] Profiling Information In-Reply-To: <932b2f1f0901072010k739f57a7mf2bf88711f53dab6@mail.gmail.com> References: <0A5676E6-97E0-4D7F-9B82-8DF5DEB8C33F@mit.edu> <932b2f1f0901072010k739f57a7mf2bf88711f53dab6@mail.gmail.com> Message-ID: Just an update on the suggestion by Robby: On Jan 7, 2009, at 11:10 PM, Robby Findler wrote: > For now, the easiest thing is probably to use the profiling directly > from mzscheme via the errortrace library. The relevant code in > drscheme is in plt/collects/drscheme/private/debug.ss, if you want to > try, but I'm working on that myself so patchs won't be that useful. > > Robby It worked perfectly! I've written up a little blog post about it (not that it's hard, but I don't think many people know about the existence of this---I certainly didn't). http://wmfarr.blogspot.com/2009/01/profiling-using-mzscheme-and-errortrace.html Thanks again, Robby. Will From keydana at gmx.de Thu Jan 8 16:21:20 2009 From: keydana at gmx.de (stelvio) Date: Thu Mar 26 02:37:29 2009 Subject: [plt-scheme] Re: PLT projects waiting for contributors? In-Reply-To: References: <4964FA92.3050608@gmx.de> <20090108130441.700846500A3@mail-svr1.cs.utah.edu> Message-ID: <8967c93d-b64d-42b7-b508-e4da40631b1c@l33g2000pri.googlegroups.com> Hi, thanks a lot for the many suggestions! With so many possibilities, it will be hard to choose :-) Still I think it might make sense to build on some preexisting knowledge - so perhaps the Scheme -> J2ME compiler would be a good candidate! Perhaps Shriram you could tell me a bit about what will be to do there, or send me some sample files of what is already implemented? Thanks again, Sigrid From jpc-ml at zenburn.net Thu Jan 8 18:53:00 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:37:30 2009 Subject: [plt-scheme] PLT projects waiting for contributors? In-Reply-To: References: <4964FA92.3050608@gmx.de> <20090108130441.700846500A3@mail-svr1.cs.utah.edu> Message-ID: <496691DC.9050608@zenburn.net> On 1/8/09 2:24 PM, Shriram Krishnamurthi wrote: > And audio! Yes? IMHO libsndfile is quite nice for accessing many (almost all) uncompressed audio formats and reimplementing mp3 would not be easier than reimplementing jpeg. That said, a nice FFI binding for libsndfile [1] and PortAudio [2] would be a good thing for PLT Scheme to have. And also good matrix/vector library, something like numpy for Python with vector&matrix operations (+ FFT) based on BLAS, LAPACK, netlib and fftw (the difficult numeric part is already done; what remains is some FFI magic and a nice API) [1]: http://www.mega-nerd.com/libsndfile/ [2]: http://www.portaudio.com/ -- regards, Jakub Piotr C?apa From jpc-ml at zenburn.net Thu Jan 8 18:57:58 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:37:30 2009 Subject: [plt-scheme] Arbitrary TTF fonts in MrEd In-Reply-To: <20090107140605.B3E4E6500AD@mail-svr1.cs.utah.edu> References: <4963F769.7080409@zenburn.net> <20090107140605.B3E4E6500AD@mail-svr1.cs.utah.edu> Message-ID: <49669306.8030901@zenburn.net> On 1/7/09 3:06 PM, Matthew Flatt wrote: > I don't know. > > My guess is that each platform provides a function that takes a > filename containing a TTF font, and it adds the font to the set > available for the application to use. If that's right, then maybe you > could use `scheme/foreign' to call the function, and then you could use > the font name as a "face" in the `font%' world. Thanks for the idea. From what I have found on the internets this seems to be the case (at least for OS X). I will try to find some time to play with this and (hopefully) reply with more concrete info. -- regards, Jakub Piotr C?apa From keydana at gmx.de Fri Jan 9 03:31:15 2009 From: keydana at gmx.de (stelvio) Date: Thu Mar 26 02:37:30 2009 Subject: [plt-scheme] Re: PLT projects waiting for contributors? In-Reply-To: References: <4964FA92.3050608@gmx.de> <20090108130441.700846500A3@mail-svr1.cs.utah.edu> Message-ID: <945936ac-668d-4789-b996-906e6e518deb@w24g2000prd.googlegroups.com> Hi, I'm not sure whether I'm nearly-duplicating my post from 12 hours ago, but as it has not appeared yet on Google where I normally view the list I'm not sure whether I really clicked the send button... I'd like to thank you all for your very interesting suggestions! It will be hard to choose with so many possibilities. At the moment, I think I'm especially interested in evaluation/ compilation things (as a self-taught Java and now - hopefully more and more - scheme programmer, this is not an "obligatory university course" but really a fascinating thing for me, and my main interest in doing SICP exercises), so of course the scheme->java compiler would be a good option, could I get some more information on what I'd have to do here? Secondly, I'd also be interested in learning to use the ffi - am I correct that the video/audio things would mean working with it? (Of course, the other suggestions are all very interesting too, I will have a look!) Thanks, Sigrid On 8 Jan., 14:24, "Shriram Krishnamurthi" wrote: > And audio! ?Yes? > > > > On Thu, Jan 8, 2009 at 8:04 AM, Matthew Flatt wrote: > > At Wed, 07 Jan 2009 19:55:14 +0100, Sigrid Keydana wrote: > >> So my question is, are there any PLT projects that need contributors > >> (and can afford taking in people who are not so experienced yet)? > > > We could use some image-file libraries: > > > ?* reading GIF files (we already have a library for writing) > > > ?* reading and writing BMP files > > > ?* reading and writing XPM & XBM files > > > All of these format are currently built into MrEd using C code, but the > > code is ugly and we'd like to get rid of it. Also, these image formats > > are fairly simple. > > > (In contrast, I would not recommend re-implementing JPEG or PNG > > processing in Scheme, because they're complex, and the existing C > > libraries work well.) > > > 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 geoff at knauth.org Fri Jan 9 10:21:55 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:37:30 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> Message-ID: <4ED9A8BA-191E-49EF-A144-117C940F08FA@knauth.org> On Jan 8, 2009, at 09:50, Stephen Bloch wrote: > On Jan 8, 2009, at 1:45 AM, laa laa wrote: >> (define (fib n) >> (if (< n 3) >> 1 >> (+ (fib (- n 1)) (fib (- n 2))))) > > This is one of my favorite (for classroom use) examples of algorithm > (in)efficiency. Shriram asked for sound-file support. Maybe we could hook up the sound of a turkey gobbling, and add a turkey to a crowd of turkeys gobbling every time `fib' was called not in tail position. Sound can leave an impression, like the sound of the Nazg?l in Lord of the Rings, or the Dementers in Harry Potter. From jos.koot at telefonica.net Fri Jan 9 10:47:11 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:31 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> Message-ID: <3FD0C42FA34E43728E046B4C52F74512@uw2b2dff239c4d> Fib cannot realy run in time O(n), because (+ n m) does not run in time O(1) for large values of n and m. With the function I posted yesterday (: very much like yours :) I find: (#lang scheme no debugging) (all time in milliseconds) (void (time (fib 100))) cpu time: 0 real time: 0 gc time: 0 (void (time (fib 1000))) cpu time: 0 real time: 0 gc time: 0 (void (time (fib 10000))) cpu time: 0 real time: 0 gc time: 0 (void (time (fib 100000))) cpu time: 1360 real time: 1391 gc time: 265 (void (time (fib 500000))) cpu time: 35641 real time: 36110 gc time: 7338 The last call takes about 26 times the time of the last but one call. If fib would run in time O(n), you would expect a factor 5. Jos ----- Original Message ----- From: "Stephen Bloch" To: Cc: Sent: Thursday, January 08, 2009 3:50 PM Subject: Re:[plt-scheme] Dr.Scheme freezes on (fib 100) recursion > > On Jan 8, 2009, at 1:45 AM, laa laa wrote: > >> my son and i coded a program to compute fibonacci sequences. it >> works fine for low numbers, but when you try to do something higher >> like (fib 100) Dr.Scheme freaks out and freezes up. we're wondering >> what's going on? is there a reason for this. . . . >> >> (define (fib n) >> (if (< n 3) >> 1 >> (+ (fib (- n 1)) (fib (- n 2))))) > > This is one of my favorite (for classroom use) examples of algorithm > (in)efficiency. It is obviously a "correct" definition, but think > about how long it takes. The only number it actually knows is 1, and > the only operation it does is +, and it never uses a computed result > more than once, so if the right answer is (say) 350 quintillion, it > has to do around 350 quintillion "+" operations to add up to that > answer. At a billion operations per second, that's eleven thousand > years. (Interestingly enough, it only requires a stack depth of 100, > so stack overflow isn't a problem: if you can keep the computer > running DrScheme for eleven thousand years without anybody tripping > over the power cord or cosmic rays disrupting the RAM, it WILL > produce the right answer.) > > John posted an alternative definition, using the technique of "memo- > ization": in a nutshell, every time the function computes the answer > to a question, it stores the answer in a table (indexed by the > function input) so the next time it is asked the same question, it > just re-uses the answer from the table rather than re-computing it. > All of that is happening behind the scenes in the "memoize" package, > although you could easily write your own memoized version of the > function. With this simple transformation, the algorithm becomes > linear-time in n, so it takes approximately 100 "+" operations rather > than 350 quintillion. > > Here's another approach which doesn't require a look-up table. When > you say "Fibonacci sequences", you're more right than you may > realize: there is not ONE Fibonacci sequence but infinitely many, > each sequence determined by a different first two elements. If you > start with F(1)=1, F(2)=1, you get "the usual" Fibonacci sequence, > but you can also start from F(1)=17, F(2)=-4 or any other starting > place you wish. So we define > > ; fib : nat-num -> nat-num > > (check-expect (fib 1) 1) > (check-expect (fib 2) 1) > (check-expect (fib 3) 2) > (check-expect (fib 4) 3) > (check-expect (fib 5) 5) > (check-expect (fib 6) 8) > > (define (fib n) > (general-fib 1 1 n)) > > ; general-fib : num (prev2) num (prev1) nat-num(n) > ; computes the n-th Fibonacci number in the sequence whose 1st and > 2nd elements are prev2 and prev1 > > (check-expect (general-fib 17 -4 1) 17) > (check-expect (general-fib 17 -4 2) -4) > (check-expect (general-fib 17 -4 3) 13) > (check-expect (general-fib 17 -4 4) 9) > (check-expect (general-fib 17 -4 5) 22) > > Now, how to define this? Consider the sequence starting with the > numbers x and y, then chop off the first number. You still have a > Fibonacci sequence, but now it starts with y and x+y, and the nth > element of the old sequence is the n-1-th element of the new > sequence. This gives us a natural recursive definition: > > (define (general-fib prev2 prev1 n) > (cond [(<= n 1) prev2] > [(= n 2) prev1] > [else (general-fib prev1 (+ prev2 prev1) (- n 1))])) > > This version turns out to be much more efficient (all times are in > milliseconds): > > (time (fib 10)) > cpu time: 3 real time: 4 gc time: 0 > 55 > > (time (fib 100)) > cpu time: 4 real time: 5 gc time: 0 > 354224848179261915075 > > (time (fib 1000)) > cpu time: 34 real time: 49 gc time: 0 > 434665576869374564356885276750406258025646605173717804024817290895365554 > 179490518904038798400792551692959225930803226347752096896232398733224711 > 61642996440906533187938298969649928516003704476137795166849228875 > > > Moral of the story: sometimes generalizing the problem makes it > easier to solve. > > Stephen Bloch > sbloch@adelphi.edu > > > > _________________________________________________ > 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/20090109/205c4562/attachment.htm From grettke at acm.org Fri Jan 9 11:01:16 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:31 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: <4ED9A8BA-191E-49EF-A144-117C940F08FA@knauth.org> References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <4ED9A8BA-191E-49EF-A144-117C940F08FA@knauth.org> Message-ID: <756daca50901090801y787cfa70kc5472adcc36289fb@mail.gmail.com> On Fri, Jan 9, 2009 at 9:21 AM, Geoffrey S. Knauth wrote: > Shriram asked for sound-file support. Maybe we could hook up the sound of a > turkey gobbling, and add a turkey to a crowd of turkeys gobbling every time > `fib' was called not in tail position. hahahahaha > Sound can leave an impression, like > the sound of the Nazg?l in Lord of the Rings, or the Dementers in Harry Potter. What impression might the sound of gobbling turkeys make? Whenever people write non-tail-recursive code, they will think of gobbling turkeys... From jadudm at gmail.com Fri Jan 9 11:20:21 2009 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:37:31 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: <756daca50901090801y787cfa70kc5472adcc36289fb@mail.gmail.com> References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <4ED9A8BA-191E-49EF-A144-117C940F08FA@knauth.org> <756daca50901090801y787cfa70kc5472adcc36289fb@mail.gmail.com> Message-ID: On Fri, Jan 9, 2009 at 11:01 AM, Grant Rettke wrote: > On Fri, Jan 9, 2009 at 9:21 AM, Geoffrey S. Knauth wrote: > What impression might the sound of gobbling turkeys make? Whenever > people write non-tail-recursive code, they will think of gobbling > turkeys... "CONS should not GOBBLE its arguments" Thank you, thank you. I'll be here every Friday. Cheers, Matt PS. I'm confident that this kind of post violates some kind of mailing list etiquette. Namely, the "no bad Scheme puns" rule... From noelwelsh at gmail.com Fri Jan 9 11:42:37 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:37:31 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <4ED9A8BA-191E-49EF-A144-117C940F08FA@knauth.org> <756daca50901090801y787cfa70kc5472adcc36289fb@mail.gmail.com> Message-ID: On Fri, Jan 9, 2009 at 4:20 PM, Matt Jadud wrote: > PS. I'm confident that this kind of post violates some kind of mailing > list etiquette. Namely, the "no bad Scheme puns" rule... Considering that the name Scheme itself is a bad pun (IIRC)... N. From anh at cs.rit.edu Fri Jan 9 12:03:38 2009 From: anh at cs.rit.edu (Arthur Nunes-Harwit) Date: Thu Mar 26 02:37:32 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: <3FD0C42FA34E43728E046B4C52F74512@uw2b2dff239c4d> References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <3FD0C42FA34E43728E046B4C52F74512@uw2b2dff239c4d> Message-ID: The following algorithm from SICP is better. (define (square x) (* x x)) (define (fib n) (fib-iter 1 0 0 1 n)) (define (fib-iter a b p q count) (cond ((= count 0) b) ((even? count) (fib-iter a b (+ (square p) (square q)) (+ (* 2 p q) (square q)) (/ count 2))) (else (fib-iter (+ (* b q) (* a q) (* a p)) (+ (* b p) (* a q)) p q (- count 1))))) Here are the timings. > (void (time (fib 1000000))) cpu time: 539 real time: 548 gc time: 0 > (void (time (fib 2000000))) cpu time: 1518 real time: 1541 gc time: 13 > (void (time (fib 3000000))) cpu time: 2741 real time: 2791 gc time: 0 > (void (time (fib 4000000))) cpu time: 4214 real time: 4292 gc time: 12 > (void (time (fib 5000000))) cpu time: 5250 real time: 5341 gc time: 11 -Arthur On Fri, 9 Jan 2009, Jos Koot wrote: > Fib cannot realy run in time O(n), because (+ n m) does not run in time O(1) for large values of n and m. With the function I posted yesterday (: very much like yours :) I find: (#lang scheme no debugging) (all time in milliseconds) > > (void (time (fib 100))) cpu time: 0 real time: 0 gc time: 0 > (void (time (fib 1000))) cpu time: 0 real time: 0 gc time: 0 > (void (time (fib 10000))) cpu time: 0 real time: 0 gc time: 0 > (void (time (fib 100000))) cpu time: 1360 real time: 1391 gc time: 265 > (void (time (fib 500000))) cpu time: 35641 real time: 36110 gc time: 7338 > > The last call takes about 26 times the time of the last but one call. If fib would run in time O(n), you would expect a factor 5. > > Jos > > > ----- Original Message ----- > From: "Stephen Bloch" > To: > Cc: > Sent: Thursday, January 08, 2009 3:50 PM > Subject: Re:[plt-scheme] Dr.Scheme freezes on (fib 100) recursion > > >> >> On Jan 8, 2009, at 1:45 AM, laa laa wrote: >> >>> my son and i coded a program to compute fibonacci sequences. it >>> works fine for low numbers, but when you try to do something higher >>> like (fib 100) Dr.Scheme freaks out and freezes up. we're wondering >>> what's going on? is there a reason for this. . . . >>> >>> (define (fib n) >>> (if (< n 3) >>> 1 >>> (+ (fib (- n 1)) (fib (- n 2))))) >> >> This is one of my favorite (for classroom use) examples of algorithm >> (in)efficiency. It is obviously a "correct" definition, but think >> about how long it takes. The only number it actually knows is 1, and >> the only operation it does is +, and it never uses a computed result >> more than once, so if the right answer is (say) 350 quintillion, it >> has to do around 350 quintillion "+" operations to add up to that >> answer. At a billion operations per second, that's eleven thousand >> years. (Interestingly enough, it only requires a stack depth of 100, >> so stack overflow isn't a problem: if you can keep the computer >> running DrScheme for eleven thousand years without anybody tripping >> over the power cord or cosmic rays disrupting the RAM, it WILL >> produce the right answer.) >> >> John posted an alternative definition, using the technique of "memo- >> ization": in a nutshell, every time the function computes the answer >> to a question, it stores the answer in a table (indexed by the >> function input) so the next time it is asked the same question, it >> just re-uses the answer from the table rather than re-computing it. >> All of that is happening behind the scenes in the "memoize" package, >> although you could easily write your own memoized version of the >> function. With this simple transformation, the algorithm becomes >> linear-time in n, so it takes approximately 100 "+" operations rather >> than 350 quintillion. >> >> Here's another approach which doesn't require a look-up table. When >> you say "Fibonacci sequences", you're more right than you may >> realize: there is not ONE Fibonacci sequence but infinitely many, >> each sequence determined by a different first two elements. If you >> start with F(1)=1, F(2)=1, you get "the usual" Fibonacci sequence, >> but you can also start from F(1)=17, F(2)=-4 or any other starting >> place you wish. So we define >> >> ; fib : nat-num -> nat-num >> >> (check-expect (fib 1) 1) >> (check-expect (fib 2) 1) >> (check-expect (fib 3) 2) >> (check-expect (fib 4) 3) >> (check-expect (fib 5) 5) >> (check-expect (fib 6) 8) >> >> (define (fib n) >> (general-fib 1 1 n)) >> >> ; general-fib : num (prev2) num (prev1) nat-num(n) >> ; computes the n-th Fibonacci number in the sequence whose 1st and >> 2nd elements are prev2 and prev1 >> >> (check-expect (general-fib 17 -4 1) 17) >> (check-expect (general-fib 17 -4 2) -4) >> (check-expect (general-fib 17 -4 3) 13) >> (check-expect (general-fib 17 -4 4) 9) >> (check-expect (general-fib 17 -4 5) 22) >> >> Now, how to define this? Consider the sequence starting with the >> numbers x and y, then chop off the first number. You still have a >> Fibonacci sequence, but now it starts with y and x+y, and the nth >> element of the old sequence is the n-1-th element of the new >> sequence. This gives us a natural recursive definition: >> >> (define (general-fib prev2 prev1 n) >> (cond [(<= n 1) prev2] >> [(= n 2) prev1] >> [else (general-fib prev1 (+ prev2 prev1) (- n 1))])) >> >> This version turns out to be much more efficient (all times are in >> milliseconds): >>> (time (fib 10)) >> cpu time: 3 real time: 4 gc time: 0 >> 55 >>> (time (fib 100)) >> cpu time: 4 real time: 5 gc time: 0 >> 354224848179261915075 >>> (time (fib 1000)) >> cpu time: 34 real time: 49 gc time: 0 >> 434665576869374564356885276750406258025646605173717804024817290895365554 >> 179490518904038798400792551692959225930803226347752096896232398733224711 >> 61642996440906533187938298969649928516003704476137795166849228875 >> >> >> Moral of the story: sometimes generalizing the problem makes it >> easier to solve. >> >> Stephen Bloch >> sbloch@adelphi.edu >> >> >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme From grettke at acm.org Fri Jan 9 12:48:51 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:32 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <4ED9A8BA-191E-49EF-A144-117C940F08FA@knauth.org> <756daca50901090801y787cfa70kc5472adcc36289fb@mail.gmail.com> Message-ID: <756daca50901090948g6e3b1bffn9779754ad0237ae6@mail.gmail.com> On Fri, Jan 9, 2009 at 10:20 AM, Matt Jadud wrote: > "CONS should not GOBBLE its arguments" That has all the makings of a wildly obscure and completely unknown Internet meme. From grettke at acm.org Fri Jan 9 12:53:15 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:32 2009 Subject: [plt-scheme] Re: PLT projects waiting for contributors? In-Reply-To: <945936ac-668d-4789-b996-906e6e518deb@w24g2000prd.googlegroups.com> References: <4964FA92.3050608@gmx.de> <20090108130441.700846500A3@mail-svr1.cs.utah.edu> <945936ac-668d-4789-b996-906e6e518deb@w24g2000prd.googlegroups.com> Message-ID: <756daca50901090953m62d18f8fq74ec7d533c153272@mail.gmail.com> On Fri, Jan 9, 2009 at 2:31 AM, stelvio wrote: > I'm not sure whether I'm nearly-duplicating my post from 12 hours ago, > but as it has not appeared yet on Google where I normally view the > list I'm not sure whether I really clicked the send button... You can also check here: http://list.cs.brown.edu/pipermail/plt-scheme/ From sbloch at adelphi.edu Fri Jan 9 13:24:51 2009 From: sbloch at adelphi.edu (Stephen Bloch) Date: Thu Mar 26 02:37:32 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion In-Reply-To: <3FD0C42FA34E43728E046B4C52F74512@uw2b2dff239c4d> References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <3FD0C42FA34E43728E046B4C52F74512@uw2b2dff239c4d> Message-ID: <2631BFFD-3A25-423E-9EEB-90E9ED28D6D8@adelphi.edu> On Jan 9, 2009, at 10:47 AM, Jos Koot wrote: > Fib cannot realy run in time O(n), because (+ n m) does not run in > time O(1) for large values of n and m. Quite true. I would assume that (+ n m) takes at most linear time in the lengths of n and m. Since the "right answer" to fib(n) is exponential in n, the lengths of the numbers being added are linear in n, which means the cost of addition should make (at most) the difference between O(n) and O(n^2) time. On a related subject that somebody mentioned off-list, Scheme's optimization of tail-recursion makes a multiplicative difference of approximately the depth of the recursion, i.e. the difference between O(n) and O(n^2) time -- about the same effect as the cost of addition. And, of course, replacing the double recursion of the naive algorithm with a single recursion makes the difference between O(n) or O(n^2) or O(n^3) and O(phi^n) time, a MUCH more noticeable difference. Arthur adds: > The following algorithm from SICP is better. > > (define (square x) (* x x)) > > (define (fib n) > (fib-iter 1 0 0 1 n)) > > (define (fib-iter a b p q count) > (cond ((= count 0) b) > ((even? count) > (fib-iter a > b > (+ (square p) (square q)) > (+ (* 2 p q) (square q)) > (/ count 2))) > (else (fib-iter (+ (* b q) (* a q) (* a p)) > (+ (* b p) (* a q)) > p > q > (- count 1))))) I hadn't seen this expressed in Scheme before; cute. For those who haven't seen the algorithm at all, it relies on the observation that the transformation from to is simply multiplication by the matrix +- -+ | 0 1 | | 1 1 | +- -+ Call this matrix F. Then multiplying by the matrix F^n effects a transformation from to ; in particular, it gets you from to . So if you can figure out how to exponentiate that remarkably simple matrix quickly, it allows you to compute fib(n) quickly. (In fact, you can compute F^n once, and then get the nth-number in ANY Fibonacci sequence, no matter what the starting numbers are, in constant time!) Raising something to the n- th power, of course, can be done in time O(logn) by repeated squaring (again ignoring the non-constant cost of primitive arithmetic operations when the numbers no longer fit into a machine word). So where the naive algorithm takes time O(phi^n) and the algorithm in my previous post takes time O(n) or O(n^2) (depending on whether you count the cost of primitive arithmetic operations), this one takes time O(logn) or O(n*logn) (ditto). However, nobody would come up with this algorithm who hadn't taken linear algebra. Stephen Bloch sbloch@adelphi.edu From yminsky at janestcapital.com Fri Jan 9 13:06:39 2009 From: yminsky at janestcapital.com (Yaron Minsky) Date: Thu Mar 26 02:37:32 2009 Subject: [plt-scheme] Jane Street is hiring functional programmers Message-ID: <1231524399.20057.21.camel@nyc-qws-007.delacy.com> Greetings all. I just wanted to remind people that Jane Street is still hiring. Despite the problems besetting much of the financial industry, we have grown strongly in the last few years in our people, our technology, the scope of our business and its profitability. We now have over 30 OCaml developers, and we are actively looking to hire more in Tokyo, London and New York. For someone who cares about functional programming, Jane Street is an interesting place to consider. Jane Street has invested deeply in OCaml, to the point where we now have the largest team of OCaml programmers in any industrial setting, and probably the world's largest OCaml codebase--almost a million lines. We really believe in functional programming, and use OCaml for everything from research to systems adminstration to trading systems. The atmosphere is informal and intellectual, with a focus on learning. The work itself is deeply challenging, and you get to see the practical impact of your efforts in quick and dramatic terms. Jane Street is also a small enough place that people have the freedom to get involved in many different areas of the business. Unlike many financial firms, software and technology are considered a core part of what we do, not some segmented-off cost center that the people who run the business don't think about. Jane Street is a place where people really care about the quality of the software, to the point that several of the most senior members of the firm, who do not have technology backgrounds, nonetheless review critical portions of the codebase before they can go into production. If you'd like to learn more, here are some links. First, here's a paper I wrote for the Monad Reader: http://www.haskell.org/sitewiki/images/0/03/TMR-Issue7.pdf We also have a technically-oriented blog: http://ocaml.janestreet.com For a (recruiting-oriented) overview of Jane Street, here's the firm website: http://janestreet.com If you're interested, send me a resume and cover letter. y From jos.koot at telefonica.net Fri Jan 9 13:35:13 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:33 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <3FD0C42FA34E43728E046B4C52F74512@uw2b2dff239c4d> Message-ID: <170B898F70AC4C4EA1614D0213534284@uw2b2dff239c4d> I assume you did use some more mathematical knowledge about fibs than I have. Nevertheless your posting confirms that choosing the right algorithm is very important. Your solution seems about time O(n), I admit that, even for very large n. When I said fib could not be realy O(n) for its time, I ment to refer to the simple layman solotion. Lesson learned: always keep looking further! Thanks for your correction, Jos. ----- Original Message ----- From: "Arthur Nunes-Harwit" To: "Jos Koot" Cc: "Stephen Bloch" ; ; Sent: Friday, January 09, 2009 6:03 PM Subject: Re: Re:[plt-scheme] Dr.Scheme freezes on (fib 100) recursion > The following algorithm from SICP is better. > > (define (square x) (* x x)) > > (define (fib n) > (fib-iter 1 0 0 1 n)) > > (define (fib-iter a b p q count) > (cond ((= count 0) b) > ((even? count) > (fib-iter a > b > (+ (square p) (square q)) > (+ (* 2 p q) (square q)) > (/ count 2))) > (else (fib-iter (+ (* b q) (* a q) (* a p)) > (+ (* b p) (* a q)) > p > q > (- count 1))))) > > Here are the timings. > >> (void (time (fib 1000000))) > cpu time: 539 real time: 548 gc time: 0 >> (void (time (fib 2000000))) > cpu time: 1518 real time: 1541 gc time: 13 >> (void (time (fib 3000000))) > cpu time: 2741 real time: 2791 gc time: 0 >> (void (time (fib 4000000))) > cpu time: 4214 real time: 4292 gc time: 12 >> (void (time (fib 5000000))) > cpu time: 5250 real time: 5341 gc time: 11 > > -Arthur > > On Fri, 9 Jan 2009, Jos Koot wrote: > >> Fib cannot realy run in time O(n), because (+ n m) does not run in time >> O(1) for large values of n and m. With the function I posted yesterday (: >> very much like yours :) I find: (#lang scheme no debugging) (all time in >> milliseconds) >> >> (void (time (fib 100))) cpu time: 0 real time: 0 gc time: 0 >> (void (time (fib 1000))) cpu time: 0 real time: 0 gc time: 0 >> (void (time (fib 10000))) cpu time: 0 real time: 0 gc time: 0 >> (void (time (fib 100000))) cpu time: 1360 real time: 1391 gc time: 265 >> (void (time (fib 500000))) cpu time: 35641 real time: 36110 gc time: 7338 >> >> The last call takes about 26 times the time of the last but one call. If >> fib would run in time O(n), you would expect a factor 5. >> >> Jos >> >> >> ----- Original Message ----- >> From: "Stephen Bloch" >> To: >> Cc: >> Sent: Thursday, January 08, 2009 3:50 PM >> Subject: Re:[plt-scheme] Dr.Scheme freezes on (fib 100) recursion >> >> >>> >>> On Jan 8, 2009, at 1:45 AM, laa laa wrote: >>> >>>> my son and i coded a program to compute fibonacci sequences. it >>>> works fine for low numbers, but when you try to do something higher >>>> like (fib 100) Dr.Scheme freaks out and freezes up. we're wondering >>>> what's going on? is there a reason for this. . . . >>>> >>>> (define (fib n) >>>> (if (< n 3) >>>> 1 >>>> (+ (fib (- n 1)) (fib (- n 2))))) >>> >>> This is one of my favorite (for classroom use) examples of algorithm >>> (in)efficiency. It is obviously a "correct" definition, but think >>> about how long it takes. The only number it actually knows is 1, and >>> the only operation it does is +, and it never uses a computed result >>> more than once, so if the right answer is (say) 350 quintillion, it >>> has to do around 350 quintillion "+" operations to add up to that >>> answer. At a billion operations per second, that's eleven thousand >>> years. (Interestingly enough, it only requires a stack depth of 100, >>> so stack overflow isn't a problem: if you can keep the computer >>> running DrScheme for eleven thousand years without anybody tripping >>> over the power cord or cosmic rays disrupting the RAM, it WILL >>> produce the right answer.) >>> >>> John posted an alternative definition, using the technique of "memo- >>> ization": in a nutshell, every time the function computes the answer >>> to a question, it stores the answer in a table (indexed by the >>> function input) so the next time it is asked the same question, it >>> just re-uses the answer from the table rather than re-computing it. >>> All of that is happening behind the scenes in the "memoize" package, >>> although you could easily write your own memoized version of the >>> function. With this simple transformation, the algorithm becomes >>> linear-time in n, so it takes approximately 100 "+" operations rather >>> than 350 quintillion. >>> >>> Here's another approach which doesn't require a look-up table. When >>> you say "Fibonacci sequences", you're more right than you may >>> realize: there is not ONE Fibonacci sequence but infinitely many, >>> each sequence determined by a different first two elements. If you >>> start with F(1)=1, F(2)=1, you get "the usual" Fibonacci sequence, >>> but you can also start from F(1)=17, F(2)=-4 or any other starting >>> place you wish. So we define >>> >>> ; fib : nat-num -> nat-num >>> >>> (check-expect (fib 1) 1) >>> (check-expect (fib 2) 1) >>> (check-expect (fib 3) 2) >>> (check-expect (fib 4) 3) >>> (check-expect (fib 5) 5) >>> (check-expect (fib 6) 8) >>> >>> (define (fib n) >>> (general-fib 1 1 n)) >>> >>> ; general-fib : num (prev2) num (prev1) nat-num(n) >>> ; computes the n-th Fibonacci number in the sequence whose 1st and >>> 2nd elements are prev2 and prev1 >>> >>> (check-expect (general-fib 17 -4 1) 17) >>> (check-expect (general-fib 17 -4 2) -4) >>> (check-expect (general-fib 17 -4 3) 13) >>> (check-expect (general-fib 17 -4 4) 9) >>> (check-expect (general-fib 17 -4 5) 22) >>> >>> Now, how to define this? Consider the sequence starting with the >>> numbers x and y, then chop off the first number. You still have a >>> Fibonacci sequence, but now it starts with y and x+y, and the nth >>> element of the old sequence is the n-1-th element of the new >>> sequence. This gives us a natural recursive definition: >>> >>> (define (general-fib prev2 prev1 n) >>> (cond [(<= n 1) prev2] >>> [(= n 2) prev1] >>> [else (general-fib prev1 (+ prev2 prev1) (- n 1))])) >>> >>> This version turns out to be much more efficient (all times are in >>> milliseconds): >>>> (time (fib 10)) >>> cpu time: 3 real time: 4 gc time: 0 >>> 55 >>>> (time (fib 100)) >>> cpu time: 4 real time: 5 gc time: 0 >>> 354224848179261915075 >>>> (time (fib 1000)) >>> cpu time: 34 real time: 49 gc time: 0 >>> 434665576869374564356885276750406258025646605173717804024817290895365554 >>> 179490518904038798400792551692959225930803226347752096896232398733224711 >>> 61642996440906533187938298969649928516003704476137795166849228875 >>> >>> >>> Moral of the story: sometimes generalizing the problem makes it >>> easier to solve. >>> >>> Stephen Bloch >>> sbloch@adelphi.edu >>> >>> >>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme From fredm at cs.uml.edu Fri Jan 9 13:53:29 2009 From: fredm at cs.uml.edu (Fred G. Martin) Date: Thu Mar 26 02:37:33 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> Message-ID: <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> Hi everyone, This is a belated reply to Eric Tanter and Shriram Krishnamurthi's questions about how I structured student projects in my last semester's junior-level PL course, which was based on Scheme and SICP. This was the first time that students were required to do projects in our undergrad PL course, and they were quite successful. Since I wrote last, I graded the projects. Broadly, I'd categorize them as 1/3 excellent, 1/3 decent, and 1/3 weak (I suppose that's a normal distribution of anything we do...). But that's still 2/3 of students really exercising ideas in Scheme and PLs (functional programming, map/filter, recursion) for their own purposes, which I think could be quite valuable in the long run. from Eric: > Can you tell us more about how the projects > were conceived? did they all pop up out of students' mind, if so, > under which guidelines if any? or did you have a pool of project ideas? I started out by telling them about the project on the first class meeting, letting students know that the project would be worth 25% of their overall grade (the final exam was only worth 20%!). Here's what I wrote in the syllabus: "In the final project, you will apply the ideas developed in the class in an original software implementation. You may thus connect the ideas of the class with your own interests?music, robotics, art, databases, the web, networking, gaming, etc. The learning goal of the project is to have you find some real-world relevance of the ideas in the class." Then, during the semester, I showed/mentioned real-world projects done in Scheme. I showed a movie of the real-time writing-scheme-code-as-a-musical-performance work done by the Impromtu team in Australia http://impromptu.moso.com.au/gallery.html. I discussed FP techniques practiced by Jane St. Capital, a Wall St trading firm, http://portal.acm.org/citation.cfm?id=1394798. In early November, I assigned preliminary work: students had to download and play with at least two different libraries from the PLaneT repository. I demonstrated in class the HTTP Get library. We also talked in class about project ideas, including the robotics, gaming, and networking concepts that ultimately students implemented (most networking stuff they did went far beyond any class discussions). Just before Thanksgiving, their project proposal was due. This was supposed to be based on the exploratory work they had already completed (and in many cases, it was). In giving them the guidelines for the proposal document, I also gave them the grading criteria for the final project. These were: * an explicit connection to ideas that were introduced in the course * an explicit connection to some outside piece of technology (e.g., images, sound, networking, database, etc) * an interesting overall concept * something that you personally are interested in and care about * a writeup that explains what you accomplished * a demo that lets people (or yourself) interact with your project They had 2.5 weeks after the Thanksgiving holiday to work on their projects for real. In class, I was covering the metacircular interpreter, and they had a problem set on this that was due 5 days AFTER the project deadline had passed. (This was a bit squeezed.) I used the final class meeting date for a project open-house, which was set up in our department's main lobby. I provided drinks and snacks for that, and we had a decent turnout, including several other faculty. To me, the best projects were ones where students really did connect Scheme and the course's ideas to something of personal interest. As I look back over the project list, I'd say that in more than half of the projects, students really did something they were interested in, and made explicit connections in their implementations to course material. (A number more did have the conceptual connections, but the thematic matter was not really something the student was passionate about.) As an example of a success story, there was a project where a student imported baseball stats from a public web site into Scheme via XML translation. A number of students did stuff with XML, but this one stood out because the student really cared about the baseball data. He was really excited that he was able to reveal data that the web site had collected, but did not make available in its standard web presentation. The project was not as advanced as some others, but because of the student's true interest in the material, it was quite well done. (All the projects are written up at http://www.cs.uml.edu/ecg/index.php/OrganizationProgrammingLanguagesFall2008/Project) Onto Shriram's questions: > - This is an impressive list of projects, but how much evaluation was > there of how well they did what they promised? At the public demo day, I visited each project and had a 5-minute conversation with each student, taking quick notes. Then students turned in their code, with additional documentation explaining it (e.g., drawing out the ways their code exemplified ideas in the class). (BTW - I didn't make them post the code and notes on their public project web pages.) I graded their projects based on the criteria previously discussed with them, with separate marks for: the quality of the proposal, explicit connection to course concepts, use of external technology, an innovation/creativity mark, the final writeup, and the quality of the live demonstration. I was lenient with the "did they do what they promised." In fact, I had told them that up front: if you end up getting stuck or otherwise needing to go in a different direction than you described in your proposal, that was fine. But I still used the same rubric for grading (I just didn't penalize if it was different than the proposal). > - How good is their code? What's the measure of goodness? Did they > get administered code-walks? This is a good/hard question. As I mentioned earlier, one of my star students commented that now he understood what people meant when they were talking about "elegant code," and that he wanted to go back and re-write code he had written in the past (code that was not written in Scheme). This was the person who built a hash table of lambda functions to process a variety of possible reply packets from a serially-connected hardware device. So, to answer -- no there wasn't an administered code-walk. That's a great idea -- I wish I had time for that. I did however read through all of their code, and sync'ing that with their documentation notes, was able to determine what kind of ideas they worked through in their implementations. This was the basis of the grading, particularly for the "connection to course concepts" category. One of the additional benefits of the project from my vantage point is that it gave me a brand-new window into my students' abilities. From quiz scores and class participation, I could tell that about 1/3 of the class was strong, and 1/3 was weak, but there was the middle band that I was mentally lumping with the "weak" category -- they didn't speak up in class, and their quiz scores were not great. But from the projects, a bunch of this middle band really shined, and I gained new appreciation for them. As it turned out, they *were* paying attention, and through the project, really engaged with the class material. So I'll definitely be running the projects again when I teach the course in the spring. I should be able to do a better job working through the main curriculum so that the metacircular material (which is clearly central) isn't so squeezed at the end. Hopefully too I'll be able to establish the value of the projects in my colleagues' eyes so they have a chance of living beyond my tenure with the course. There's one more Q&A below -- it's somewhat of a digression on integrating Scheme and C++, so I'll end this note here and leave it as a P.S. Thanks again everyone for your attention and encouragement. Fred from Shriram: > - Some of these remarks look a bit odd and unchallenged. Eg, the > Scheme-in-C-Game-Engine guy says, > > In my opinion, using Scheme (or at least MzScheme) as a game > scripting language has some key disadvantages to more conventional > choices (such as LUA). The first of which is the > much-less-than-trivial embedding process. Of course, LUA was > specifically constructed with integration with languages such as C > in mind. Another disadvantage is the complex organization and > parenthetical syntax. > > The first few remarks are perfectly reasonable, as is the last one, > but what does "complex organization" mean? He should either write > sufficiently clearly that a technically literate person can understand > and evaluate the remark, or elide it. (That is, the reader need not > agree with all his statements, nor should he be uncritical; but he > should be decipherable!) This project was one of several in which students attempted to connect Scheme with another language in a unified application. This student was the only one who was successful at this, and for two reasons: (1) he chose to embed Scheme in a C++ app (and not the other way around), and (2) he is a particularly strong coder. I asked the student to clarify this, here's what he said: > By "complex organization" I was referring to both the less-than-trivial > embedding process, as well as having to build up "statements", > "objects", and "methods" by first principles through Scheme in a way > that is somewhat slow and deliberate (in order to achieve a customized > effect) in comparison to other quick and dirty implementations of more > out-of-the-box scripting solutions. > I should point out that upon further messing around with the project in > the past week or so, I have grown more and more fond of the level of > customization that can be achieved with Scheme used as a scripting > language. The "complexities" I was referring to I now see as a valuable > trade-off to achieve thorough customization. There were several challenges to the embedding, but even after he was technically successful, passing data back and forth between the two language environments was hard. He ended up using a simplified, targeted representation of the game state that was constructed in C++ and handed off to Scheme. But there was no straightforward way for the two languages to share state. Two other students tried incorporating C++ methods into Scheme, and both failed to accomplish it on technical grounds. The embedding-Scheme-in-C++ seemed better, but still not as satisfying as one would like. I'd be interested in hearing feedback on this particular thing, to see whether to steer students away from this next time. From toddobryan at gmail.com Fri Jan 9 14:58:22 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Mar 26 02:37:33 2009 Subject: [plt-scheme] Slightly OT--How to print from DrScheme using CUPS In-Reply-To: <20090108135556.5ACB46500A8@mail-svr1.cs.utah.edu> References: <904774730901070750t15c2dd27kf28f8746896f860d@mail.gmail.com> <20090108135556.5ACB46500A8@mail-svr1.cs.utah.edu> Message-ID: <904774730901091158p2caa4327s9835f1e67f987189@mail.gmail.com> I'm an idiot. The problem is *not* that DrScheme doesn't print to the default printer, it's that I don't get a standard cups options dialog to do things like choose 2-up printing to save paper. Thanks for answering my stupid question, Matthew. Now, any idea how to answer the one I should have asked in the first place? :-) Todd On Thu, Jan 8, 2009 at 8:55 AM, Matthew Flatt wrote: > At Wed, 7 Jan 2009 10:50:11 -0500, "Todd O'Bryan" wrote: >> Could anybody tell me what print command or symbolic link trickery I >> can use to get DrScheme to print using CUPS? >> >> Right now, we print to a file, open the file in Evince, and then >> print. I've thought about allowing direct printing for a while, but >> every time I look it up, I run out of time before I can find an >> answer. > > On Linux/Unix? > > When you choose "Print" in DrScheme, you get a dialog with an option > for "Printer", as opposed to "File" or "Preview", right? > > When you choose that option, DrScheme generates a temporary ".ps" file > and runs the shell command "lpr .ps". > > > Matthew > > From jos.koot at telefonica.net Fri Jan 9 15:01:43 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:33 2009 Subject: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion References: <468947.12674.qm@web32705.mail.mud.yahoo.com> <297778CD-A1AF-461B-BAE8-1492F016ADA9@adelphi.edu> <3FD0C42FA34E43728E046B4C52F74512@uw2b2dff239c4d> <2631BFFD-3A25-423E-9EEB-90E9ED28D6D8@adelphi.edu> Message-ID: Thanks, that is a clear explanation of the code Arthur showed. It has been proven that there are limits to the power of programming languages (or formal systems in general), but again and again I am amazed how far we :(me not included): can move the limit further away, not only by faster hardware, but more importantly by more clever algorithms. Jos ----- Original Message ----- From: "Stephen Bloch" To: "Jos Koot" Cc: ; Sent: Friday, January 09, 2009 7:24 PM Subject: Re: [plt-scheme] Dr.Scheme freezes on (fib 100) recursion > > On Jan 9, 2009, at 10:47 AM, Jos Koot wrote: > >> Fib cannot realy run in time O(n), because (+ n m) does not run in time >> O(1) for large values of n and m. > > Quite true. I would assume that (+ n m) takes at most linear time in the > lengths of n and m. Since the "right answer" to fib(n) is exponential in > n, the lengths of the numbers being added are linear in n, which means > the cost of addition should make (at most) the difference between O(n) > and O(n^2) time. > > On a related subject that somebody mentioned off-list, Scheme's > optimization of tail-recursion makes a multiplicative difference of > approximately the depth of the recursion, i.e. the difference between > O(n) and O(n^2) time -- about the same effect as the cost of addition. > > And, of course, replacing the double recursion of the naive algorithm > with a single recursion makes the difference between O(n) or O(n^2) or > O(n^3) and O(phi^n) time, a MUCH more noticeable difference. > > Arthur adds: >> The following algorithm from SICP is better. >> >> (define (square x) (* x x)) >> >> (define (fib n) >> (fib-iter 1 0 0 1 n)) >> >> (define (fib-iter a b p q count) >> (cond ((= count 0) b) >> ((even? count) >> (fib-iter a >> b >> (+ (square p) (square q)) >> (+ (* 2 p q) (square q)) >> (/ count 2))) >> (else (fib-iter (+ (* b q) (* a q) (* a p)) >> (+ (* b p) (* a q)) >> p >> q >> (- count 1))))) > > > I hadn't seen this expressed in Scheme before; cute. > > For those who haven't seen the algorithm at all, it relies on the > observation that the transformation from to fib(r+2)> is simply multiplication by the matrix > +- -+ > | 0 1 | > | 1 1 | > +- -+ > Call this matrix F. Then multiplying by the matrix F^n effects a > transformation from to > ; in particular, it gets you from > to . So if you can figure out how to > exponentiate that remarkably simple matrix quickly, it allows you to > compute fib(n) quickly. (In fact, you can compute F^n once, and then get > the nth-number in ANY Fibonacci sequence, no matter what the starting > numbers are, in constant time!) Raising something to the n- th power, of > course, can be done in time O(logn) by repeated squaring (again ignoring > the non-constant cost of primitive arithmetic operations when the numbers > no longer fit into a machine word). > > So where the naive algorithm takes time O(phi^n) and the algorithm in my > previous post takes time O(n) or O(n^2) (depending on whether you count > the cost of primitive arithmetic operations), this one takes time O(logn) > or O(n*logn) (ditto). > > However, nobody would come up with this algorithm who hadn't taken linear > algebra. > > Stephen Bloch > sbloch@adelphi.edu From keydana at gmx.de Fri Jan 9 15:07:30 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:37:33 2009 Subject: [plt-scheme] plt calendar application with ical format Message-ID: <4967AE82.3070402@gmx.de> Hi, I wonder if there is any plt calendar application to use / build on that might run on a web server? The thing is, I might be allowed to use scheme at work (which would be far from self-evident ;-) ) to replace an old php script that based on an algorithm computes and inserts data into a given, indepentdently existing online calendar (up till now, part of a php cms). Now the requirements would be that the script operate on a file in ical format, which is also actively manipulated by different users. So the calendar application itself should run on some machine behind a web server, and after a first search it seemed like this was not a problem - install something like "phpicalendar" and that's it. But it turned out that "phpicalendar" can only show data and does not allow changes. Now building a calendar from scratch with scheme would certainly exceed the time allocated for this (minor and administrative only) task, so I'd like to know if there is already a graphical calendar tool which works with (or can be adjusted to work with) the ical format and could run behind a web server? (I saw the ical parsing library on Planet, but unfortunately I need the whole calendar now...) Thanks a lot in advance, Sigrid From clements at brinckerhoff.org Fri Jan 9 16:29:52 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:34 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> Message-ID: On Jan 9, 2009, at 10:53 AM, Fred G. Martin wrote: > Hi everyone, > > This is a belated reply to Eric Tanter and Shriram Krishnamurthi's > questions about how I structured student projects in my last > semester's junior-level PL course, which was based on Scheme and SICP. ... Excellent experience report, thanks! John Clements -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090109/6bead4a9/smime.bin From lunarc.lists at gmail.com Fri Jan 9 17:44:11 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:34 2009 Subject: [plt-scheme] Slightly OT--How to print from DrScheme using CUPS In-Reply-To: <904774730901091158p2caa4327s9835f1e67f987189@mail.gmail.com> References: <904774730901070750t15c2dd27kf28f8746896f860d@mail.gmail.com> <20090108135556.5ACB46500A8@mail-svr1.cs.utah.edu> <904774730901091158p2caa4327s9835f1e67f987189@mail.gmail.com> Message-ID: 2009/1/9 Todd O'Bryan : > I'm an idiot. The problem is *not* that DrScheme doesn't print to the > default printer, it's that I don't get a standard cups options dialog > to do things like choose 2-up printing to save paper. > > Thanks for answering my stupid question, Matthew. Now, any idea how to > answer the one I should have asked in the first place? :-) Sounds like what you really want to do is replace lpr with some standalone printing dialog, such as kprinter. Henk From fare at tunes.org Thu Jan 8 19:50:22 2009 From: fare at tunes.org (Francois-Rene Rideau) Date: Thu Mar 26 02:37:34 2009 Subject: [plt-scheme] 2009-01-26 Boston Lisp Meeting: David O'Toole on Common Lisp and Rogue-like Games Message-ID: <20090109005022.1A3E540C5@bespin.org> Next Boston Lisp Meeting: Monday January 26th 2009 at 1800 at MIT 34-401B David O'Toole on Common Lisp and Rogue-like Games David O'Toole will give a talk about Common Lisp and Rogue-like Games. The 1980 gaming classic "Rogue" and its descendants (NetHack and Angband, among many others) continue to thrill hard-core gamers, finding a new audience many years later. Part of the thrill comes from the high replayability factor brought about by the genres's randomized settings and endlessly variable play experiences; rogue-like games used "procedural content generation" a long time before it became a games-industry buzzword. These games have usually been written in C or C++, but a growing, seething mass of Lisp Rogue-likes have lurched ominously onto the scene. David will show how Rogue-like games present interesting challenges to the Lisp developer, and how he met those challenges with video demonstrations of his code in action. His software can be found at http://dto.github.com/notebook/rlx.html David O'Toole is a Lisp developer living in Central Massachusetts, USA, who works in Common Lisp and Emacs Lisp. His lifelong interest in video and computer games led him to study computer science and then to work at Irrational Games in Boston (now called 2K Boston). David is now a consultant and builds custom audio-oriented computers in his spare time. His website is at http://dto.github.com/notebook/ * The Lisp Meeting will take place on Monday January 26th 2009 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. * * Dinner: we don't yet have a sponsor this year for an after-meeting buffet, but the organizers will go someplace to have dinner and a drink not too far from the conference venue, and you'll be welcome to join us. * * * The previous Boston Lisp Meeting on November 24th had over 30 participants. Gregory Marton gave a very inspiring talk about the meanings of English words as programs, and how computers could learn such programs through various interactions. 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. From dblaheta at knox.edu Fri Jan 9 21:27:02 2009 From: dblaheta at knox.edu (Don Blaheta) Date: Thu Mar 26 02:37:34 2009 Subject: [plt-scheme] Exporting from an already-written module? Message-ID: <20090109202702.A17066@winter.phpwebhosting.com> Let's say I've got a bunch of Scheme files with some top-level definitions. (The files are written in htdp-beginner Scheme, at least at the moment.) How can I, without modifying those files, read them in, interpret them, and get at those definitions? Last time I was doing something like this I was able to simply load two files in a row from the command line (first the file with the top-level defines, then the file that accessed them), but under the new PLTv4 world order I can't seem to get that to work. The problem seems to be that under the new way of doing things, there's an implicit (module ...) around the htdp-beginner-language files, but no (provide ...) form inside them. So I'm not sure what to do here. Any pointers? -- -=-Don Blaheta-=-dblaheta@knox.edu-=-=--=- The world is coming to an end... save your buffers. From robby at eecs.northwestern.edu Fri Jan 9 23:16:17 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:35 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <20090109202702.A17066@winter.phpwebhosting.com> References: <20090109202702.A17066@winter.phpwebhosting.com> Message-ID: <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> You can cut the first three lines out of the file (by a script that just transforms an input port directly from the file into an input port that doesn't have those lines). But may I ask why you want to do this? Robby On Fri, Jan 9, 2009 at 8:27 PM, Don Blaheta wrote: > Let's say I've got a bunch of Scheme files with some top-level > definitions. (The files are written in htdp-beginner Scheme, at least > at the moment.) How can I, without modifying those files, read them in, > interpret them, and get at those definitions? Last time I was doing > something like this I was able to simply load two files in a row from > the command line (first the file with the top-level defines, then the > file that accessed them), but under the new PLTv4 world order I can't > seem to get that to work. > > The problem seems to be that under the new way of doing things, there's > an implicit (module ...) around the htdp-beginner-language files, but no > (provide ...) form inside them. So I'm not sure what to do here. Any > pointers? > > -- > -=-Don Blaheta-=-dblaheta@knox.edu-=-=--=- > The world is coming to an end... save your buffers. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From mflatt at cs.utah.edu Sat Jan 10 07:44:13 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:35 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <20090109202702.A17066@winter.phpwebhosting.com> References: <20090109202702.A17066@winter.phpwebhosting.com> Message-ID: <20090110124416.40D416500B1@mail-svr1.cs.utah.edu> At Fri, 9 Jan 2009 20:27:02 -0600, Don Blaheta wrote: > Let's say I've got a bunch of Scheme files with some top-level > definitions. (The files are written in htdp-beginner Scheme, at least > at the moment.) How can I, without modifying those files, read them in, > interpret them, and get at those definitions? Last time I was doing > something like this I was able to simply load two files in a row from > the command line (first the file with the top-level defines, then the > file that accessed them), but under the new PLTv4 world order I can't > seem to get that to work. > > The problem seems to be that under the new way of doing things, there's > an implicit (module ...) around the htdp-beginner-language files, but no > (provide ...) form inside them. So I'm not sure what to do here. Any > pointers? You could load the module and use `module->namespace' to get inside it. Matthew From toddobryan at gmail.com Sat Jan 10 10:49:29 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Mar 26 02:37:35 2009 Subject: [plt-scheme] Slightly OT--How to print from DrScheme using CUPS In-Reply-To: References: <904774730901070750t15c2dd27kf28f8746896f860d@mail.gmail.com> <20090108135556.5ACB46500A8@mail-svr1.cs.utah.edu> <904774730901091158p2caa4327s9835f1e67f987189@mail.gmail.com> Message-ID: <904774730901100749x112334c5j62df002bc7d95ee2@mail.gmail.com> The short version: ------------------------- Is there anyplace to set the default print and preview commands server-wide that get used in the File->Print Definitions... and File->Print Interactions dialogs or does each student need to set them individually? The long version (only read if you're bored): ------------------------------------------------------------- Actually, once you mentioned using kprinter, I looked for gpr. Such a thing does exist, but doesn't interface with CUPS, so when I tried to use it, I had a problem because /etc/printcap wasn't set up. But then I notice gtklp, which does exactly what I want, but the interface is a mess. And then it occurred to me, why not just set "evince" as the preview application and have students preview, then print from it. Thus, the question above. (I think I'm a pretty good teacher and programmer, even, but a sysadmin I am not. Ask me sometime about the hour I wasted trying to mount an NFS directory remotely. I even bothered a former student, because I couldn't figure out what was wrong. He tunneled into the server, only to tell me that I'd forgotten to install the nfs-common and portmap packages. :-\ ) Thanks a LOT, Todd On Fri, Jan 9, 2009 at 5:44 PM, Henk Boom wrote: > 2009/1/9 Todd O'Bryan : >> I'm an idiot. The problem is *not* that DrScheme doesn't print to the >> default printer, it's that I don't get a standard cups options dialog >> to do things like choose 2-up printing to save paper. >> >> Thanks for answering my stupid question, Matthew. Now, any idea how to >> answer the one I should have asked in the first place? :-) > > Sounds like what you really want to do is replace lpr with some > standalone printing dialog, such as kprinter. > > Henk > From d.j.gurnell at gmail.com Sat Jan 10 11:49:22 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:35 2009 Subject: [plt-scheme] web-server/insta require the Browser tool to be enabled? In-Reply-To: <595b9ab20901080622x36a36677vcbe96c4139aea644@mail.gmail.com> References: <595b9ab20901080622x36a36677vcbe96c4139aea644@mail.gmail.com> Message-ID: Stephen De Gabrielle wrote > Does "#lang web-server/insta" require the Browser tool to be enabled > in DrScheme? > > It seems to be the case, but looking at the code for 'insta' doesn't > indicate a requirement. > (I get an odd error when I disable the browser tool) I have that tool disabled and the following code works for me: #lang web-server/insta (define (start request) '(html (body (p "Hello!")))) Hope this helps, -- Dave From lordgeoffrey at optushome.com.au Sat Jan 10 14:09:26 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Thu Mar 26 02:37:35 2009 Subject: [plt-scheme] rename-in syntax difficulties (and bug) Message-ID: <4968F266.1060309@optushome.com.au> I am trying to do the following: #lang scheme (require (lib "13.ss" "srfi")) ; Strings (require (lib "69.ss" "srfi")) ; Basic hash tables The produces the error: module: identifier already imported from a different source in: string-hash (lib "69.ss" "srfi") (lib "13.ss" "srfi") Which makes sense. Though i am surprised it actually is a different source. I tried to used rename-in - but was unable to produce a syntax that was valid. Any suggestions on how to do the rename are appreciated, or possibly a better way to import so the clash doesn't happen at all. Thanks. PS: As a side not the editor highlights two libs and gives this error: unhighlight-range: range not found; start: 196 end: 216 color: (red: 255 green: 192 blue: 203) caret-space?: #f style: rectangle === context === /home/geoffrey/plt/collects/framework/private/text.ss:425:15: new-todo /home/geoffrey/plt/collects/framework/private/text.ss:444:21: todo /home/geoffrey/plt/collects/framework/private/text.ss:444:21: todo /home/geoffrey/plt/collects/framework/private/text.ss:352:4: after-edit-sequence method in ...work/private/text.ss:91:2 /home/geoffrey/plt/collects/framework/private/color.ss:397:4: colorer-callback method in ...ork/private/color.ss:58:2 From carl.eastlund at gmail.com Sat Jan 10 14:22:09 2009 From: carl.eastlund at gmail.com (Carl Eastlund) Date: Thu Mar 26 02:37:35 2009 Subject: [plt-scheme] rename-in syntax difficulties (and bug) In-Reply-To: <4968F266.1060309@optushome.com.au> References: <4968F266.1060309@optushome.com.au> Message-ID: <990e0c030901101122s65ffa07arf0f5428191b1183d@mail.gmail.com> The following worked for me (in DrScheme 4.1.3): #lang scheme (require (lib "13.ss" "srfi")) ; Strings (require (rename-in (lib "69.ss" "srfi") [string-hash basic-string-hash])) ; Basic hash tables Since you didn't post the code you tried with rename-in, I don't know what went wrong. You could also use prefix-in to give imports from either or both libraries a prefix (so you'd have string:string-hash and hash:string-hash, for instance), or except-in to simply exclude one of the redundant bindings. --Carl On Sat, Jan 10, 2009 at 2:09 PM, LordGeoffrey wrote: > I am trying to do the following: > #lang scheme > (require (lib "13.ss" "srfi")) ; Strings > (require (lib "69.ss" "srfi")) ; Basic hash tables > > The produces the error: > module: identifier already imported from a different source in: > string-hash > (lib "69.ss" "srfi") > (lib "13.ss" "srfi") > > Which makes sense. Though i am surprised it actually is a different source. > > I tried to used rename-in - but was unable to produce a syntax that was > valid. Any suggestions on how to do the rename are appreciated, or possibly > a better way to import so the clash doesn't happen at all. > > Thanks. From lordgeoffrey at optushome.com.au Sat Jan 10 14:50:56 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Thu Mar 26 02:37:35 2009 Subject: [plt-scheme] rename-in syntax difficulties (and bug) In-Reply-To: <990e0c030901101122s65ffa07arf0f5428191b1183d@mail.gmail.com> References: <4968F266.1060309@optushome.com.au> <990e0c030901101122s65ffa07arf0f5428191b1183d@mail.gmail.com> Message-ID: <4968FC20.3060603@optushome.com.au> Thanks Carl, that fixed it. I misread the plt spec where it says "[orig-id bind-id]" as being optional, not as (orig-id bind-id) Rule of thumb coding at 4:30 in the morning has its problems. Carl Eastlund wrote: > The following worked for me (in DrScheme 4.1.3): > > #lang scheme > (require (lib "13.ss" "srfi")) ; Strings > (require (rename-in (lib "69.ss" "srfi") [string-hash > basic-string-hash])) ; Basic hash tables > > Since you didn't post the code you tried with rename-in, I don't know > what went wrong. > > You could also use prefix-in to give imports from either or both > libraries a prefix (so you'd have string:string-hash and > hash:string-hash, for instance), or except-in to simply exclude one of > the redundant bindings. > > --Carl > > On Sat, Jan 10, 2009 at 2:09 PM, LordGeoffrey > wrote: > >> I am trying to do the following: >> #lang scheme >> (require (lib "13.ss" "srfi")) ; Strings >> (require (lib "69.ss" "srfi")) ; Basic hash tables >> >> The produces the error: >> module: identifier already imported from a different source in: >> string-hash >> (lib "69.ss" "srfi") >> (lib "13.ss" "srfi") >> >> Which makes sense. Though i am surprised it actually is a different source. >> >> I tried to used rename-in - but was unable to produce a syntax that was >> valid. Any suggestions on how to do the rename are appreciated, or possibly >> a better way to import so the clash doesn't happen at all. >> >> Thanks. >> > > From robby at eecs.northwestern.edu Sat Jan 10 14:53:54 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:36 2009 Subject: [plt-scheme] rename-in syntax difficulties (and bug) In-Reply-To: <4968F266.1060309@optushome.com.au> References: <4968F266.1060309@optushome.com.au> Message-ID: <932b2f1f0901101153t39089762u8f1eb0c163631099@mail.gmail.com> On Sat, Jan 10, 2009 at 1:09 PM, LordGeoffrey wrote: > I am trying to do the following: > #lang scheme > (require (lib "13.ss" "srfi")) ; Strings > (require (lib "69.ss" "srfi")) ; Basic hash tables > PS: As a side not the editor highlights two libs and gives this error: > unhighlight-range: range not found; start: 196 end: 216 color: (red: 255 > green: 192 blue: 203) caret-space?: #f style: rectangle > > === context === > /home/geoffrey/plt/collects/framework/private/text.ss:425:15: new-todo > /home/geoffrey/plt/collects/framework/private/text.ss:444:21: todo > /home/geoffrey/plt/collects/framework/private/text.ss:444:21: todo > /home/geoffrey/plt/collects/framework/private/text.ss:352:4: > after-edit-sequence method in ...work/private/text.ss:91:2 > /home/geoffrey/plt/collects/framework/private/color.ss:397:4: > colorer-callback method in ...ork/private/color.ss:58:2 When I run the above program, I don't see that error. I did fix some bugs along those lines a while back -- are you using the latest version? Or perhaps was there something else you had to do to trigger the error? Thanks, Robby From lordgeoffrey at optushome.com.au Sat Jan 10 15:09:43 2009 From: lordgeoffrey at optushome.com.au (LordGeoffrey) Date: Thu Mar 26 02:37:36 2009 Subject: [plt-scheme] rename-in syntax difficulties (and bug) In-Reply-To: <932b2f1f0901101153t39089762u8f1eb0c163631099@mail.gmail.com> References: <4968F266.1060309@optushome.com.au> <932b2f1f0901101153t39089762u8f1eb0c163631099@mail.gmail.com> Message-ID: <49690087.8090805@optushome.com.au> Thanks, not quite the latest, 4.1.1 time for me to upgrade. Robby Findler wrote: > On Sat, Jan 10, 2009 at 1:09 PM, LordGeoffrey > wrote: > >> I am trying to do the following: >> #lang scheme >> (require (lib "13.ss" "srfi")) ; Strings >> (require (lib "69.ss" "srfi")) ; Basic hash tables >> > > >> PS: As a side not the editor highlights two libs and gives this error: >> unhighlight-range: range not found; start: 196 end: 216 color: (red: 255 >> green: 192 blue: 203) caret-space?: #f style: rectangle >> >> === context === >> /home/geoffrey/plt/collects/framework/private/text.ss:425:15: new-todo >> /home/geoffrey/plt/collects/framework/private/text.ss:444:21: todo >> /home/geoffrey/plt/collects/framework/private/text.ss:444:21: todo >> /home/geoffrey/plt/collects/framework/private/text.ss:352:4: >> after-edit-sequence method in ...work/private/text.ss:91:2 >> /home/geoffrey/plt/collects/framework/private/color.ss:397:4: >> colorer-callback method in ...ork/private/color.ss:58:2 >> > > > When I run the above program, I don't see that error. I did fix some > bugs along those lines a while back -- are you using the latest > version? Or perhaps was there something else you had to do to trigger > the error? > > Thanks, > Robby > > From lunarc.lists at gmail.com Sat Jan 10 16:15:11 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:36 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: Message-ID: Has anyone else had any luck duplicating this? Henk From sk at cs.brown.edu Sat Jan 10 17:33:05 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:36 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> Message-ID: Hi Fred, Thanks for the great second report! As for codewalks, have you considered doing this by talking in class about some students' code, anonymously? I posted at some length about this on our plt-edu list; not sure if you're a member or caught that discussion. (I can re-post/re-write if there's interest.) I wonder if the students who had the data-sharing-with-C++ problem used the current FFI? Or were they trying to do things more manually? Finally, have you considered writing up a report about this for the Scheme and Functional Programming 2009 Workshop? I imagine the PC would be very interested in hearing this experience report! Shriram From sk at cs.brown.edu Sat Jan 10 18:18:16 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:36 2009 Subject: [plt-scheme] Re: PLT projects waiting for contributors? In-Reply-To: <8967c93d-b64d-42b7-b508-e4da40631b1c@l33g2000pri.googlegroups.com> References: <4964FA92.3050608@gmx.de> <20090108130441.700846500A3@mail-svr1.cs.utah.edu> <8967c93d-b64d-42b7-b508-e4da40631b1c@l33g2000pri.googlegroups.com> Message-ID: Hi Sigrid (and others), Danny and I will soon send a message to the list that outlines how people can contribute to the World->J2ME compiler. Incidentally, for those following along at home, the J2ME->Android bridge now appears to be working, so at least for now that is no longer an issue for us. Shriram On Thu, Jan 8, 2009 at 4:21 PM, stelvio wrote: > Hi, > > thanks a lot for the many suggestions! With so many possibilities, it > will be hard to choose :-) > > Still I think it might make sense to build on some preexisting > knowledge - so perhaps the Scheme -> J2ME compiler would be a good > candidate! > > Perhaps Shriram you could tell me a bit about what will be to do > there, or send me some sample files of what is already implemented? > > Thanks again, > Sigrid > From yinso.chen at gmail.com Sat Jan 10 22:58:27 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:37:37 2009 Subject: [plt-scheme] parsing windows path on linux? Message-ID: <779bf2730901101958k34dd6791y37909afaeee4dfc1@mail.gmail.com> Hi all - I try to parse windows path on linux with `file-name-from-path`, but while it works fine on windows, it doens't parse on Linux. ;; Windows Welcome to DrScheme, version 4.0 [3m]. Language: Module; memory limit: 128 megabytes. > (file-name-from-path "c:\\documents and settings\\test\\my file.txt") # ;; Linux Welcome to MzScheme v4.1.3 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. >> (file-name-from-path "c:\\documents and settings\\test\\my file.txt") # I tried to use bytes->path to generate a `windows-path`, but `file-name-from-path` doesn't appear to work with `windows-path`. This need comes out of IE sending a full path with file upload, so I need to parse out the file name of the path on the web server on Linux. What would be the best way to achieve this goal? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090110/a99112bd/attachment.htm From eli at barzilay.org Sat Jan 10 23:14:05 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:37:37 2009 Subject: [plt-scheme] parsing windows path on linux? In-Reply-To: <779bf2730901101958k34dd6791y37909afaeee4dfc1@mail.gmail.com> References: <779bf2730901101958k34dd6791y37909afaeee4dfc1@mail.gmail.com> Message-ID: <18793.29197.424388.44812@arabic.ccs.neu.edu> On Jan 10, YC wrote: > > I tried to use bytes->path to generate a `windows-path`, but > `file-name-from-path` doesn't appear to work with `windows-path`. It looks like the reason for this is that a non-default-platform path is not considered as a path in the `path?' sense -- so you get an error. But you can use `split-path' directly (which is what `file-name-from-path' is doing): (let-values ([(base file dir?) (split-path (bytes->path #"c:\\foo\\bar.txt" 'windows))]) file) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From yinso.chen at gmail.com Sun Jan 11 02:15:24 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:37:38 2009 Subject: [plt-scheme] parsing windows path on linux? In-Reply-To: <18793.29197.424388.44812@arabic.ccs.neu.edu> References: <779bf2730901101958k34dd6791y37909afaeee4dfc1@mail.gmail.com> <18793.29197.424388.44812@arabic.ccs.neu.edu> Message-ID: <779bf2730901102315x7fe842ep48b666a9e291c97e@mail.gmail.com> On Sat, Jan 10, 2009 at 8:14 PM, Eli Barzilay wrote: > > It looks like the reason for this is that a non-default-platform path > is not considered as a path in the `path?' sense -- so you get an > error. But you can use `split-path' directly (which is what > `file-name-from-path' is doing): > > (let-values ([(base file dir?) > (split-path (bytes->path #"c:\\foo\\bar.txt" 'windows))]) > file) > Thanks for the tip, Eli. It seems that windows-path cannot be directly manipulated except through a few path functions. It took me a while to figure out how to convert windows-path back to string: first use path->bytes and then bytes->string/utf-8. Are there thoughts to allow all path functions to manipulate the different path types? It seems the differences between these path types are not great. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090110/120b7094/attachment.html From tomasz.skutnik at gmail.com Sun Jan 11 04:39:13 2009 From: tomasz.skutnik at gmail.com (Tomasz Skutnik) Date: Thu Mar 26 02:37:38 2009 Subject: [plt-scheme] untyped/dispatch broken contract? Message-ID: <533c96720901110139s6ad75360xb442f2edf58bb10a@mail.gmail.com> Hi. I've been playing with PLT web server lately, and I've tried to use untyped/dispatch library. However I couldn't make it work the way I wanted. All servlet urls handled by untyped/dispatch library are served ok, but no static content is served from "htdocs" directory. Instead server reports broken contract exception. See http://paste.lisp.org/display/73415 for test case and and stack trace. I use PLT scheme 4.1.3 (binary download) and "planet show" reports untyped/dispatch library version 1.7. >From studying source of web-server/servlet-env and experimenting with #:servlet-regexp parameter I think this is a bug in untyped/dispatch. If i drop #:servlet-regexp only hompage controller is visible (login controller is not), but static content is accessible. Can someone hint me if it's my error or a bug in untyped/dispatch? Best regards. Tomasz From d.j.gurnell at gmail.com Sun Jan 11 08:39:07 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:39 2009 Subject: [plt-scheme] untyped/dispatch broken contract? In-Reply-To: <533c96720901110139s6ad75360xb442f2edf58bb10a@mail.gmail.com> References: <533c96720901110139s6ad75360xb442f2edf58bb10a@mail.gmail.com> Message-ID: <496CFC6A-DDCD-4E4E-9BA6-7E3278898D53@gmail.com> Hi there, The required-core-version field in Dispatch (the one that tells you what version of PLT you need) isn't quite correct. You actually need at least version 4.1.3.8(ish) for these new versions of Dispatch to run. This is basically my fault. I got the version wrong when I uploaded Dispatch 1.7. In my own defence, though, when I tried to update the package metadata I discovered that PLaneT only lets you specify the first three digits of the version number. Anyway. You should be able to fix things by updating to the latest SVN version of PLT. The only file that actually matters is: /collects/web-server/dispatchers/dispatch-servlets.ss You can try doing an "svn up" on just that file to test things out. Or, if you're not running out of SVN, you can try swapping in the attached copy of the file: -------------- next part -------------- A non-text attachment was scrubbed... Name: dispatch-servlets.ss Type: application/octet-stream Size: 3745 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090111/ea3e664a/dispatch-servlets.obj -------------- next part -------------- Hope this helps. Let me know how it goes. Cheers, -- Dave Tomasz Skutnik wrote: > Hi. > > I've been playing with PLT web server lately, and I've tried to use > untyped/dispatch library. However I couldn't make it work the way I > wanted. All servlet urls handled by untyped/dispatch library are > served ok, but no static content is served from "htdocs" directory. > Instead server reports broken contract exception. See > http://paste.lisp.org/display/73415 for test case and and stack trace. > > I use PLT scheme 4.1.3 (binary download) and "planet show" reports > untyped/dispatch library version 1.7. > >> From studying source of web-server/servlet-env and experimenting with > #:servlet-regexp parameter I think this is a bug in untyped/dispatch. > If i drop #:servlet-regexp only hompage controller is visible (login > controller is not), but static content is accessible. Can someone hint > me if it's my error or a bug in untyped/dispatch? > > Best regards. > > Tomasz From jadudm at gmail.com Sun Jan 11 09:41:40 2009 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:37:39 2009 Subject: [plt-scheme] untyped/dispatch broken contract? In-Reply-To: <496CFC6A-DDCD-4E4E-9BA6-7E3278898D53@gmail.com> References: <533c96720901110139s6ad75360xb442f2edf58bb10a@mail.gmail.com> <496CFC6A-DDCD-4E4E-9BA6-7E3278898D53@gmail.com> Message-ID: On Sun, Jan 11, 2009 at 8:39 AM, Dave Gurnell wrote: > I discovered that PLaneT only lets you specify the first three digits of the > version number. Given that most Untyped libraries run against the head of the SVN tree, and not the last "stable" release, this can be confusing for people. (That's more a statement than an indictment, really.) Another solution is to download and install a nightly build: http://pre.plt-scheme.org/installers/ Currently that's sitting at version 4.1.3.9, which will have the change Dave was talking about. You can safely have more than one PLT Scheme installed, although I usually get confused about which I need for what. Either way, that's another option, depending on your situation and savvy. Cheers, Matt From d.j.gurnell at gmail.com Sun Jan 11 09:46:43 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:39 2009 Subject: [plt-scheme] untyped/dispatch broken contract? In-Reply-To: References: <533c96720901110139s6ad75360xb442f2edf58bb10a@mail.gmail.com> <496CFC6A-DDCD-4E4E-9BA6-7E3278898D53@gmail.com> Message-ID: <61968C2F-E82C-4B0E-B724-962C8DE4047B@gmail.com> Matt Jadud wrote: > Dave Gurnell wrote: >> I discovered that PLaneT only lets you specify the first three >> digits of the >> version number. I was wrong about this... must've been a typo or something. The version number has been corrected (to 4.1.3.8) in Dispatch 1.8. -- Dave From mflatt at cs.utah.edu Sun Jan 11 09:49:05 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:39 2009 Subject: [plt-scheme] parsing windows path on linux? In-Reply-To: <779bf2730901102315x7fe842ep48b666a9e291c97e@mail.gmail.com> References: <779bf2730901101958k34dd6791y37909afaeee4dfc1@mail.gmail.com> <18793.29197.424388.44812@arabic.ccs.neu.edu> <779bf2730901102315x7fe842ep48b666a9e291c97e@mail.gmail.com> Message-ID: <20090111144907.2033F65009C@mail-svr1.cs.utah.edu> At Sat, 10 Jan 2009 23:15:24 -0800, YC wrote: > On Sat, Jan 10, 2009 at 8:14 PM, Eli Barzilay wrote: > > > > > It looks like the reason for this is that a non-default-platform path > > is not considered as a path in the `path?' sense -- so you get an > > error. But you can use `split-path' directly (which is what > > `file-name-from-path' is doing): > > > > (let-values ([(base file dir?) > > (split-path (bytes->path #"c:\\foo\\bar.txt" 'windows))]) > > file) > > > > Thanks for the tip, Eli. > > It seems that windows-path cannot be directly manipulated except through a > few path functions. It took me a while to figure out how to convert > windows-path back to string: first use path->bytes and then > bytes->string/utf-8. > > Are there thoughts to allow all path functions to manipulate the different > path types? It seems the differences between these path types are not > great. Since most of the functions provided by `scheme/path' manipulate paths without consulting the filesystem, I've changed them to work with paths of any kind. (The exceptions are `normalize-path' and `simple-form-path', which rely on the filesystem.) I'm less certain that it would be a good idea to change `string->path' and `path->string' to allow with paths for a different system kind. The problem is that string<->path conversions are inherently approximate; some paths cannot be represented as strings, and for Unix paths, the conversion depends on a locale-specific encoding. If you're manipulating paths for a different system and you're forced to start and end with strings, though, then UTF-8 is probably the right choice. So I've added `string->some-system-path' and `some-system-path->string' to `scheme/path'. Matthew From d.j.gurnell at gmail.com Sun Jan 11 09:57:01 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:39 2009 Subject: [plt-scheme] untyped/dispatch broken contract? In-Reply-To: References: <533c96720901110139s6ad75360xb442f2edf58bb10a@mail.gmail.com> <496CFC6A-DDCD-4E4E-9BA6-7E3278898D53@gmail.com> Message-ID: > Given that most Untyped libraries run against the head of the SVN > tree, and not the last "stable" release, this can be confusing for > people. (That's more a statement than an indictment, really.) It's true, though, and a couple of factors have made it more of an issue than normal. I've been playing some rapid catch-up over the Xmas break and it has led to a few packaging mistakes like this one. Anyway, apologies for these mishaps - things are settling down now - normal service should resume shortly :) -- Dave From yinso.chen at gmail.com Sun Jan 11 14:52:31 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:37:40 2009 Subject: [plt-scheme] parsing windows path on linux? In-Reply-To: <20090111144907.2033F65009C@mail-svr1.cs.utah.edu> References: <779bf2730901101958k34dd6791y37909afaeee4dfc1@mail.gmail.com> <18793.29197.424388.44812@arabic.ccs.neu.edu> <779bf2730901102315x7fe842ep48b666a9e291c97e@mail.gmail.com> <20090111144907.2033F65009C@mail-svr1.cs.utah.edu> Message-ID: <779bf2730901111152k6ffab8f8p71472b1a8ef3b173@mail.gmail.com> On Sun, Jan 11, 2009 at 6:49 AM, Matthew Flatt wrote: > > Since most of the functions provided by `scheme/path' manipulate paths > without consulting the filesystem, I've changed them to work with paths > of any kind. (The exceptions are `normalize-path' and > `simple-form-path', which rely on the filesystem.) > Thanks for the changes Matthew. > I'm less certain that it would be a good idea to change `string->path' > and `path->string' to allow with paths for a different system kind. The > problem is that string<->path conversions are inherently approximate; > some paths cannot be represented as strings I didn't realize that there are paths that cannot be written as strings. What types of paths are those (or do you happen to have a link)? > , and for Unix paths, the > conversion depends on a locale-specific encoding. If you're > manipulating paths for a different system and you're forced to start > and end with strings, though, then UTF-8 is probably the right choice. > So I've added `string->some-system-path' and `some-system-path->string' > to `scheme/path'. > That'll be great help. Thanks again, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090111/47bffb50/attachment.html From tomasz.skutnik at gmail.com Sun Jan 11 15:37:18 2009 From: tomasz.skutnik at gmail.com (Tomasz Skutnik) Date: Thu Mar 26 02:37:40 2009 Subject: [plt-scheme] untyped/dispatch broken contract? Message-ID: <533c96720901111237t45ae611y69cda13bcd9ee7f7@mail.gmail.com> > Hi there, > > The required-core-version field in Dispatch (the one that tells you > what version of PLT you need) isn't quite correct. You actually need > at least version 4.1.3.8(ish) for these new versions of Dispatch to run. > > This is basically my fault. I got the version wrong when I uploaded > Dispatch 1.7. In my own defence, though, when I tried to update the > package metadata I discovered that PLaneT only lets you specify the > first three digits of the version number. > > Anyway. You should be able to fix things by updating to the latest SVN > version of PLT. The only file that actually matters is: > > /collects/web-server/dispatchers/dispatch-servlets.ss > > You can try doing an "svn up" on just that file to test things out. > Or, if you're not running out of SVN, you can try swapping in the > attached copy of the file: > Hi. Thanks for answer. I recompiled plt-scheme from svn and everything worked ok. Tomasz. From chust at web.de Sun Jan 11 19:15:31 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:37:40 2009 Subject: [plt-scheme] Recently added PLaneT packages Message-ID: <496A8BA3.3050800@web.de> Hello, does someone around here know by what mechanism the RSS feed of recently added PLaneT packages is updated? I started checking the feed regularly to stay up to date about the available libraries, but I noticed that quite a few new packages were never listed there. I have also uploaded two packages myself that never showed up there. Not that it's a problem, but I'd like to understand whether I may be doing something wrong with the upload, whether somebody is picking only certain packages for the listing or whether some voodoo or random number generator is involved ;-) cu, Thomas From etanter at dcc.uchile.cl Mon Jan 12 08:24:09 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Thu Mar 26 02:37:40 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> Message-ID: Thanks Fred for these detailed answers, very interesting indeed. I like the focus on "connect to your own interests" as a way to foster deeper involvement. Shriram: since you suggest then yes, I'd be interested in reading about those anonymous code walks. -- ?ric On Jan 10, 2009, at 23:33 , Shriram Krishnamurthi wrote: > Hi Fred, > > Thanks for the great second report! > > As for codewalks, have you considered doing this by talking in class > about some students' code, anonymously? I posted at some length about > this on our plt-edu list; not sure if you're a member or caught that > discussion. (I can re-post/re-write if there's interest.) > > I wonder if the students who had the data-sharing-with-C++ problem > used the current FFI? Or were they trying to do things more manually? > > Finally, have you considered writing up a report about this for the > Scheme and Functional Programming 2009 Workshop? I imagine the PC > would be very interested in hearing this experience report! > > Shriram > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jacobm at cs.uchicago.edu Mon Jan 12 11:40:16 2009 From: jacobm at cs.uchicago.edu (Jacob Matthews) Date: Thu Mar 26 02:37:40 2009 Subject: [plt-scheme] Recently added PLaneT packages In-Reply-To: <496A8BA3.3050800@web.de> References: <496A8BA3.3050800@web.de> Message-ID: <46b603df0901120840r4711b605x81d2620e9349665f@mail.gmail.com> I'd guess you're looking that the RSS feed for the version 3xx repository but you'd really rather be looking at the v4.x repository. That would be understandable since it appears that the link pointing to the RSS feed on the planet home page points to that. It should probably be updated to point to the v4.x feed: http://planet.plt-scheme.org/4.x/planet.rss -jacob On Sun, Jan 11, 2009 at 4:15 PM, Thomas Chust wrote: > Hello, > > does someone around here know by what mechanism the RSS feed of recently > added PLaneT packages is updated? > > I started checking the feed regularly to stay up to date about the > available libraries, but I noticed that quite a few new packages were > never listed there. I have also uploaded two packages myself that never > showed up there. Not that it's a problem, but I'd like to understand > whether I may be doing something wrong with the upload, whether somebody > is picking only certain packages for the listing or whether some voodoo > or random number generator is involved ;-) > > cu, > Thomas > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jay.mccarthy at gmail.com Mon Jan 12 11:41:46 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:41 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: Message-ID: I can reproduce it. Essentially the problem is that when a connection dies, the server kills the threads associated with it. In this case, the killed threads were supposed to post to the semaphore when they were done, but they never finished. Basically, the limiting is not kill-safe [1]. Jay 1. http://www.cs.utah.edu/plt/kill-safe/ On Sat, Jan 10, 2009 at 2:15 PM, Henk Boom wrote: > Has anyone else had any luck duplicating this? > > Henk > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From robby at eecs.northwestern.edu Mon Jan 12 11:46:14 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:41 2009 Subject: [plt-scheme] Recently added PLaneT packages In-Reply-To: <46b603df0901120840r4711b605x81d2620e9349665f@mail.gmail.com> References: <496A8BA3.3050800@web.de> <46b603df0901120840r4711b605x81d2620e9349665f@mail.gmail.com> Message-ID: <932b2f1f0901120846i354139a1we991b7a6b5465c7c@mail.gmail.com> Thanks, Jacob! The link is now fixed. Robby On Mon, Jan 12, 2009 at 10:40 AM, Jacob Matthews wrote: > I'd guess you're looking that the RSS feed for the version 3xx > repository but you'd really rather be looking at the v4.x repository. > That would be understandable since it appears that the link pointing > to the RSS feed on the planet home page points to that. It should > probably be updated to point to the v4.x feed: > > http://planet.plt-scheme.org/4.x/planet.rss > > -jacob > > On Sun, Jan 11, 2009 at 4:15 PM, Thomas Chust wrote: >> Hello, >> >> does someone around here know by what mechanism the RSS feed of recently >> added PLaneT packages is updated? >> >> I started checking the feed regularly to stay up to date about the >> available libraries, but I noticed that quite a few new packages were >> never listed there. I have also uploaded two packages myself that never >> showed up there. Not that it's a problem, but I'd like to understand >> whether I may be doing something wrong with the upload, whether somebody >> is picking only certain packages for the listing or whether some voodoo >> or random number generator is involved ;-) >> >> cu, >> Thomas >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From robby at eecs.northwestern.edu Mon Jan 12 11:52:29 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:41 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: Message-ID: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> Do you think it can be made kill-safe with the current mz? Robby On Mon, Jan 12, 2009 at 10:41 AM, Jay McCarthy wrote: > I can reproduce it. Essentially the problem is that when a connection > dies, the server kills the threads associated with it. In this case, > the killed threads were supposed to post to the semaphore when they > were done, but they never finished. Basically, the limiting is not > kill-safe [1]. > > Jay > > 1. http://www.cs.utah.edu/plt/kill-safe/ > > On Sat, Jan 10, 2009 at 2:15 PM, Henk Boom wrote: >> Has anyone else had any luck duplicating this? >> >> Henk >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jay.mccarthy at gmail.com Mon Jan 12 11:57:50 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:41 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> Message-ID: Perhaps, I don't think I'm clever enough though. Here's a hack that "works": (define (make-limit-dispatcher num inner) (let ([sem (make-semaphore num)]) (lambda (conn req) (parameterize ([current-custodian (current-server-custodian)]) (thread (lambda () (call-with-semaphore sem (lambda () (inner conn req))))))))) Basically before going inside the limit, it changes the resource policy so that this connection's resources are charged to the whole server, so when the connection goes down, the thread doesn't get killed. If you do this, you won't get deadlocks, but you will get lots of errors, because the connection's ports will die and the thread will keep running. The obvious kill-safe strategy[1] has the same problem. 1. Create a "limit manager" thread at the server level, it receives requests from the dispatchers to do the work, but doesn't die. But if the connection died, I don't know how to communicate that back to the limit manager. This would serialize requests, so you'd need N of them, where N is the limit. Mz threads are cheap, but not as cheap as Erlang threads, so this might not be a great idea. Jay On Mon, Jan 12, 2009 at 9:52 AM, Robby Findler wrote: > Do you think it can be made kill-safe with the current mz? > > Robby > > On Mon, Jan 12, 2009 at 10:41 AM, Jay McCarthy wrote: >> I can reproduce it. Essentially the problem is that when a connection >> dies, the server kills the threads associated with it. In this case, >> the killed threads were supposed to post to the semaphore when they >> were done, but they never finished. Basically, the limiting is not >> kill-safe [1]. >> >> Jay >> >> 1. http://www.cs.utah.edu/plt/kill-safe/ >> >> On Sat, Jan 10, 2009 at 2:15 PM, Henk Boom wrote: >>> Has anyone else had any luck duplicating this? >>> >>> Henk >>> >> >> >> >> -- >> Jay McCarthy >> Assistant Professor / Brigham Young University >> http://teammccarthy.org/jay >> >> "The glory of God is Intelligence" - D&C 93 >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From robby at eecs.northwestern.edu Mon Jan 12 12:06:47 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:41 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> Message-ID: <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> I think you want one thread that just manages the limits (and perhaps runs with the dispatchers privs). Each connection would then send a message to that thread saying "can I go now?" and when it gets a response, it goes. The server thread would then track if its communication partners died or if they terminated normally and when below the limit and there are more waiting, it would reply to them, letting them go. You don't seem to need the full generality of kill-safety, since you have a custodian that you know never dies. Robby On Mon, Jan 12, 2009 at 10:57 AM, Jay McCarthy wrote: > Perhaps, I don't think I'm clever enough though. > > Here's a hack that "works": > > (define (make-limit-dispatcher num inner) > (let ([sem (make-semaphore num)]) > (lambda (conn req) > (parameterize ([current-custodian (current-server-custodian)]) > (thread > (lambda () > (call-with-semaphore > sem > (lambda () > (inner conn req))))))))) > > Basically before going inside the limit, it changes the resource > policy so that this connection's resources are charged to the whole > server, so when the connection goes down, the thread doesn't get > killed. If you do this, you won't get deadlocks, but you will get lots > of errors, because the connection's ports will die and the thread will > keep running. > > The obvious kill-safe strategy[1] has the same problem. > > 1. Create a "limit manager" thread at the server level, it receives > requests from the dispatchers to do the work, but doesn't die. But if > the connection died, I don't know how to communicate that back to the > limit manager. This would serialize requests, so you'd need N of them, > where N is the limit. Mz threads are cheap, but not as cheap as Erlang > threads, so this might not be a great idea. > > Jay > > On Mon, Jan 12, 2009 at 9:52 AM, Robby Findler > wrote: >> Do you think it can be made kill-safe with the current mz? >> >> Robby >> >> On Mon, Jan 12, 2009 at 10:41 AM, Jay McCarthy wrote: >>> I can reproduce it. Essentially the problem is that when a connection >>> dies, the server kills the threads associated with it. In this case, >>> the killed threads were supposed to post to the semaphore when they >>> were done, but they never finished. Basically, the limiting is not >>> kill-safe [1]. >>> >>> Jay >>> >>> 1. http://www.cs.utah.edu/plt/kill-safe/ >>> >>> On Sat, Jan 10, 2009 at 2:15 PM, Henk Boom wrote: >>>> Has anyone else had any luck duplicating this? >>>> >>>> Henk >>>> >>> >>> >>> >>> -- >>> Jay McCarthy >>> Assistant Professor / Brigham Young University >>> http://teammccarthy.org/jay >>> >>> "The glory of God is Intelligence" - D&C 93 >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > From jay.mccarthy at gmail.com Mon Jan 12 12:20:02 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:42 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> Message-ID: Ya, you're right. That works great. Henk, try this: (define (make-limit-dispatcher num inner) (define-struct in-req (partner reply-ch)) (define in-ch (make-channel)) (define-struct out-req (partner)) (define out-ch (make-channel)) (define limit-manager (thread (lambda () (let loop ([i 0] [partners empty]) (apply sync (if (< i num) (wrap-evt in-ch (lambda (req) (channel-put (in-req-reply-ch req) #t) (loop (add1 i) (list* (in-req-partner req) partners)))) never-evt) (wrap-evt out-ch (lambda (req) (loop (sub1 i) (remq (out-req-partner req) partners)))) (map (lambda (p) (wrap-evt (thread-dead-evt p) (lambda _ (loop (sub1 i) (remq p partners))))) partners)))))) (define (in) (define reply (make-channel)) (channel-put in-ch (make-in-req (current-thread) reply)) (channel-get reply)) (define (out) (channel-put out-ch (make-out-req (current-thread)))) (lambda (conn req) (dynamic-wind in (lambda () (inner conn req)) out))) On Mon, Jan 12, 2009 at 10:06 AM, Robby Findler wrote: > I think you want one thread that just manages the limits (and perhaps > runs with the dispatchers privs). Each connection would then send a > message to that thread saying "can I go now?" and when it gets a > response, it goes. The server thread would then track if its > communication partners died or if they terminated normally and when > below the limit and there are more waiting, it would reply to them, > letting them go. > > You don't seem to need the full generality of kill-safety, since you > have a custodian that you know never dies. > > Robby > > On Mon, Jan 12, 2009 at 10:57 AM, Jay McCarthy wrote: >> Perhaps, I don't think I'm clever enough though. >> >> Here's a hack that "works": >> >> (define (make-limit-dispatcher num inner) >> (let ([sem (make-semaphore num)]) >> (lambda (conn req) >> (parameterize ([current-custodian (current-server-custodian)]) >> (thread >> (lambda () >> (call-with-semaphore >> sem >> (lambda () >> (inner conn req))))))))) >> >> Basically before going inside the limit, it changes the resource >> policy so that this connection's resources are charged to the whole >> server, so when the connection goes down, the thread doesn't get >> killed. If you do this, you won't get deadlocks, but you will get lots >> of errors, because the connection's ports will die and the thread will >> keep running. >> >> The obvious kill-safe strategy[1] has the same problem. >> >> 1. Create a "limit manager" thread at the server level, it receives >> requests from the dispatchers to do the work, but doesn't die. But if >> the connection died, I don't know how to communicate that back to the >> limit manager. This would serialize requests, so you'd need N of them, >> where N is the limit. Mz threads are cheap, but not as cheap as Erlang >> threads, so this might not be a great idea. >> >> Jay >> >> On Mon, Jan 12, 2009 at 9:52 AM, Robby Findler >> wrote: >>> Do you think it can be made kill-safe with the current mz? >>> >>> Robby >>> >>> On Mon, Jan 12, 2009 at 10:41 AM, Jay McCarthy wrote: >>>> I can reproduce it. Essentially the problem is that when a connection >>>> dies, the server kills the threads associated with it. In this case, >>>> the killed threads were supposed to post to the semaphore when they >>>> were done, but they never finished. Basically, the limiting is not >>>> kill-safe [1]. >>>> >>>> Jay >>>> >>>> 1. http://www.cs.utah.edu/plt/kill-safe/ >>>> >>>> On Sat, Jan 10, 2009 at 2:15 PM, Henk Boom wrote: >>>>> Has anyone else had any luck duplicating this? >>>>> >>>>> Henk >>>>> >>>> >>>> >>>> >>>> -- >>>> Jay McCarthy >>>> Assistant Professor / Brigham Young University >>>> http://teammccarthy.org/jay >>>> >>>> "The glory of God is Intelligence" - D&C 93 >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>>> >>> >> >> >> >> -- >> Jay McCarthy >> Assistant Professor / Brigham Young University >> http://teammccarthy.org/jay >> >> "The glory of God is Intelligence" - D&C 93 >> > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From mflatt at cs.utah.edu Mon Jan 12 12:30:54 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:42 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> Message-ID: <20090112173054.81AE86500AD@mail-svr1.cs.utah.edu> At Mon, 12 Jan 2009 11:06:47 -0600, Robby Findler wrote: > You don't seem to need the full generality of kill-safety, since you > have a custodian that you know never dies. Nit-picking terminology: I would say that he needs a kill-safe abstraction, but that he doesn't necessariyl have to use `thread-resume' with a donated custodian. Matthew From mflatt at cs.utah.edu Mon Jan 12 12:30:58 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:42 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> Message-ID: <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> Be sure to use `handle-evt', not `wrap-evt', to make `loop' a loop. At Mon, 12 Jan 2009 10:20:02 -0700, "Jay McCarthy" wrote: > Ya, you're right. That works great. > > Henk, try this: > > (define (make-limit-dispatcher num inner) > (define-struct in-req (partner reply-ch)) > (define in-ch (make-channel)) > (define-struct out-req (partner)) > (define out-ch (make-channel)) > (define limit-manager > (thread > (lambda () > (let loop ([i 0] > [partners empty]) > (apply sync > (if (< i num) > (wrap-evt in-ch > (lambda (req) > (channel-put (in-req-reply-ch req) #t) > (loop (add1 i) > (list* (in-req-partner req) partners)))) > never-evt) > (wrap-evt out-ch > (lambda (req) > (loop (sub1 i) > (remq (out-req-partner req) partners)))) > (map (lambda (p) > (wrap-evt (thread-dead-evt p) > (lambda _ > (loop (sub1 i) (remq p partners))))) > partners)))))) > (define (in) > (define reply (make-channel)) > (channel-put in-ch (make-in-req (current-thread) reply)) > (channel-get reply)) > (define (out) > (channel-put out-ch (make-out-req (current-thread)))) > (lambda (conn req) > (dynamic-wind > in > (lambda () > (inner conn req)) > out))) > > On Mon, Jan 12, 2009 at 10:06 AM, Robby Findler > wrote: > > I think you want one thread that just manages the limits (and perhaps > > runs with the dispatchers privs). Each connection would then send a > > message to that thread saying "can I go now?" and when it gets a > > response, it goes. The server thread would then track if its > > communication partners died or if they terminated normally and when > > below the limit and there are more waiting, it would reply to them, > > letting them go. > > > > You don't seem to need the full generality of kill-safety, since you > > have a custodian that you know never dies. > > > > Robby > > > > On Mon, Jan 12, 2009 at 10:57 AM, Jay McCarthy > wrote: > >> Perhaps, I don't think I'm clever enough though. > >> > >> Here's a hack that "works": > >> > >> (define (make-limit-dispatcher num inner) > >> (let ([sem (make-semaphore num)]) > >> (lambda (conn req) > >> (parameterize ([current-custodian (current-server-custodian)]) > >> (thread > >> (lambda () > >> (call-with-semaphore > >> sem > >> (lambda () > >> (inner conn req))))))))) > >> > >> Basically before going inside the limit, it changes the resource > >> policy so that this connection's resources are charged to the whole > >> server, so when the connection goes down, the thread doesn't get > >> killed. If you do this, you won't get deadlocks, but you will get lots > >> of errors, because the connection's ports will die and the thread will > >> keep running. > >> > >> The obvious kill-safe strategy[1] has the same problem. > >> > >> 1. Create a "limit manager" thread at the server level, it receives > >> requests from the dispatchers to do the work, but doesn't die. But if > >> the connection died, I don't know how to communicate that back to the > >> limit manager. This would serialize requests, so you'd need N of them, > >> where N is the limit. Mz threads are cheap, but not as cheap as Erlang > >> threads, so this might not be a great idea. > >> > >> Jay > >> > >> On Mon, Jan 12, 2009 at 9:52 AM, Robby Findler > >> wrote: > >>> Do you think it can be made kill-safe with the current mz? > >>> > >>> Robby > >>> > >>> On Mon, Jan 12, 2009 at 10:41 AM, Jay McCarthy > wrote: > >>>> I can reproduce it. Essentially the problem is that when a connection > >>>> dies, the server kills the threads associated with it. In this case, > >>>> the killed threads were supposed to post to the semaphore when they > >>>> were done, but they never finished. Basically, the limiting is not > >>>> kill-safe [1]. > >>>> > >>>> Jay > >>>> > >>>> 1. http://www.cs.utah.edu/plt/kill-safe/ > >>>> > >>>> On Sat, Jan 10, 2009 at 2:15 PM, Henk Boom wrote: > >>>>> Has anyone else had any luck duplicating this? > >>>>> > >>>>> Henk > >>>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> Jay McCarthy > >>>> Assistant Professor / Brigham Young University > >>>> http://teammccarthy.org/jay > >>>> > >>>> "The glory of God is Intelligence" - D&C 93 > >>>> _________________________________________________ > >>>> For list-related administrative tasks: > >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > >>>> > >>>> > >>> > >> > >> > >> > >> -- > >> Jay McCarthy > >> Assistant Professor / Brigham Young University > >> http://teammccarthy.org/jay > >> > >> "The glory of God is Intelligence" - D&C 93 > >> > > > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From jay.mccarthy at gmail.com Mon Jan 12 12:44:17 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:42 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> Message-ID: Thanks for the catch. It's in SVN now. Jay On Mon, Jan 12, 2009 at 10:30 AM, Matthew Flatt wrote: > Be sure to use `handle-evt', not `wrap-evt', to make `loop' a loop. > > At Mon, 12 Jan 2009 10:20:02 -0700, "Jay McCarthy" wrote: >> Ya, you're right. That works great. >> >> Henk, try this: >> >> (define (make-limit-dispatcher num inner) >> (define-struct in-req (partner reply-ch)) >> (define in-ch (make-channel)) >> (define-struct out-req (partner)) >> (define out-ch (make-channel)) >> (define limit-manager >> (thread >> (lambda () >> (let loop ([i 0] >> [partners empty]) >> (apply sync >> (if (< i num) >> (wrap-evt in-ch >> (lambda (req) >> (channel-put (in-req-reply-ch req) #t) >> (loop (add1 i) >> (list* (in-req-partner req) partners)))) >> never-evt) >> (wrap-evt out-ch >> (lambda (req) >> (loop (sub1 i) >> (remq (out-req-partner req) partners)))) >> (map (lambda (p) >> (wrap-evt (thread-dead-evt p) >> (lambda _ >> (loop (sub1 i) (remq p partners))))) >> partners)))))) >> (define (in) >> (define reply (make-channel)) >> (channel-put in-ch (make-in-req (current-thread) reply)) >> (channel-get reply)) >> (define (out) >> (channel-put out-ch (make-out-req (current-thread)))) >> (lambda (conn req) >> (dynamic-wind >> in >> (lambda () >> (inner conn req)) >> out))) >> >> On Mon, Jan 12, 2009 at 10:06 AM, Robby Findler >> wrote: >> > I think you want one thread that just manages the limits (and perhaps >> > runs with the dispatchers privs). Each connection would then send a >> > message to that thread saying "can I go now?" and when it gets a >> > response, it goes. The server thread would then track if its >> > communication partners died or if they terminated normally and when >> > below the limit and there are more waiting, it would reply to them, >> > letting them go. >> > >> > You don't seem to need the full generality of kill-safety, since you >> > have a custodian that you know never dies. >> > >> > Robby >> > >> > On Mon, Jan 12, 2009 at 10:57 AM, Jay McCarthy >> wrote: >> >> Perhaps, I don't think I'm clever enough though. >> >> >> >> Here's a hack that "works": >> >> >> >> (define (make-limit-dispatcher num inner) >> >> (let ([sem (make-semaphore num)]) >> >> (lambda (conn req) >> >> (parameterize ([current-custodian (current-server-custodian)]) >> >> (thread >> >> (lambda () >> >> (call-with-semaphore >> >> sem >> >> (lambda () >> >> (inner conn req))))))))) >> >> >> >> Basically before going inside the limit, it changes the resource >> >> policy so that this connection's resources are charged to the whole >> >> server, so when the connection goes down, the thread doesn't get >> >> killed. If you do this, you won't get deadlocks, but you will get lots >> >> of errors, because the connection's ports will die and the thread will >> >> keep running. >> >> >> >> The obvious kill-safe strategy[1] has the same problem. >> >> >> >> 1. Create a "limit manager" thread at the server level, it receives >> >> requests from the dispatchers to do the work, but doesn't die. But if >> >> the connection died, I don't know how to communicate that back to the >> >> limit manager. This would serialize requests, so you'd need N of them, >> >> where N is the limit. Mz threads are cheap, but not as cheap as Erlang >> >> threads, so this might not be a great idea. >> >> >> >> Jay >> >> >> >> On Mon, Jan 12, 2009 at 9:52 AM, Robby Findler >> >> wrote: >> >>> Do you think it can be made kill-safe with the current mz? >> >>> >> >>> Robby >> >>> >> >>> On Mon, Jan 12, 2009 at 10:41 AM, Jay McCarthy >> wrote: >> >>>> I can reproduce it. Essentially the problem is that when a connection >> >>>> dies, the server kills the threads associated with it. In this case, >> >>>> the killed threads were supposed to post to the semaphore when they >> >>>> were done, but they never finished. Basically, the limiting is not >> >>>> kill-safe [1]. >> >>>> >> >>>> Jay >> >>>> >> >>>> 1. http://www.cs.utah.edu/plt/kill-safe/ >> >>>> >> >>>> On Sat, Jan 10, 2009 at 2:15 PM, Henk Boom wrote: >> >>>>> Has anyone else had any luck duplicating this? >> >>>>> >> >>>>> Henk >> >>>>> >> >>>> >> >>>> >> >>>> >> >>>> -- >> >>>> Jay McCarthy >> >>>> Assistant Professor / Brigham Young University >> >>>> http://teammccarthy.org/jay >> >>>> >> >>>> "The glory of God is Intelligence" - D&C 93 >> >>>> _________________________________________________ >> >>>> For list-related administrative tasks: >> >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >>>> >> >>>> >> >>> >> >> >> >> >> >> >> >> -- >> >> Jay McCarthy >> >> Assistant Professor / Brigham Young University >> >> http://teammccarthy.org/jay >> >> >> >> "The glory of God is Intelligence" - D&C 93 >> >> >> > >> >> >> >> -- >> Jay McCarthy >> Assistant Professor / Brigham Young University >> http://teammccarthy.org/jay >> >> "The glory of God is Intelligence" - D&C 93 >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From robby at eecs.northwestern.edu Mon Jan 12 13:03:11 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:42 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <20090112173054.81AE86500AD@mail-svr1.cs.utah.edu> References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173054.81AE86500AD@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0901121003g7fae47abo31322373a3af9b83@mail.gmail.com> On Mon, Jan 12, 2009 at 11:30 AM, Matthew Flatt wrote: > At Mon, 12 Jan 2009 11:06:47 -0600, Robby Findler wrote: >> You don't seem to need the full generality of kill-safety, since you >> have a custodian that you know never dies. > > Nit-picking terminology: I would say that he needs a kill-safe > abstraction, but that he doesn't necessariyl have to use > `thread-resume' with a donated custodian. Yes, right. Sorry -- that's a better use of the terms. Continuing on this dead horse down just one more block: if it were important, you could even build this abstraction directly into the servlets, since it doesn't require the more powerful custodian that the dispatchers seem to have (or if dispatchers can be killed, you can improve the abstraction to cope with that). Robby From jay.mccarthy at gmail.com Mon Jan 12 14:02:37 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:42 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901121003g7fae47abo31322373a3af9b83@mail.gmail.com> References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173054.81AE86500AD@mail-svr1.cs.utah.edu> <932b2f1f0901121003g7fae47abo31322373a3af9b83@mail.gmail.com> Message-ID: On Mon, Jan 12, 2009 at 11:03 AM, Robby Findler wrote: > Continuing on this dead horse down just one more block: if it were > important, you could even build this abstraction directly into the > servlets, since it doesn't require the more powerful custodian that > the dispatchers seem to have (or if dispatchers can be killed, you can > improve the abstraction to cope with that). I'm pretty sure it would work as written, actually. The custodians have this structure: (root (server (servlets servlet_1 ... servlet_n) (connections conn_1 ... conn_n))) The first request to a servlet starts off under the connections, but when the server realizes it is a servlet, it creates a new custodian with a different parent to evaluate the module in. If the module created the limit manager, then the subsequent conns would be able to communicate with it. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From robby at eecs.northwestern.edu Mon Jan 12 14:24:40 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:43 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173054.81AE86500AD@mail-svr1.cs.utah.edu> <932b2f1f0901121003g7fae47abo31322373a3af9b83@mail.gmail.com> Message-ID: <932b2f1f0901121124n57c06143l91a6746b658ca419@mail.gmail.com> On Mon, Jan 12, 2009 at 1:02 PM, Jay McCarthy wrote: > On Mon, Jan 12, 2009 at 11:03 AM, Robby Findler > wrote: >> Continuing on this dead horse down just one more block: if it were >> important, you could even build this abstraction directly into the >> servlets, since it doesn't require the more powerful custodian that >> the dispatchers seem to have (or if dispatchers can be killed, you can >> improve the abstraction to cope with that). > > I'm pretty sure it would work as written, actually. Right. Didn't mean to say it wouldn't. Only that you don't need a dispatcher (server?) custodian in order to do this. Maybe you don't care, tho. :) > The custodians have this structure: > > (root > (server (servlets servlet_1 ... servlet_n) > (connections conn_1 ... conn_n))) > > The first request to a servlet starts off under the connections, but > when the server realizes it is a servlet, it creates a new custodian > with a different parent to evaluate the module in. If the module > created the limit manager, then the subsequent conns would be able to > communicate with it. From sk at cs.brown.edu Mon Jan 12 14:47:03 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:43 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> Message-ID: > Shriram: since you suggest then yes, I'd be interested in reading about > those anonymous code walks. A bit stream-of-consciousness: There's a set of terms out there -- inspection, review, etc. -- that I don't really know. Whatever the terms, you can't do the one that has the programmers respond in a class period. It can be traumatic for them if you get critical; it's useless if you don't; and there may be some privacy issues as well. So the way I run them is do them in camera with nobody but course staff (in addition to the students) present. I warn them it will be hell, and I deliver on the promise. Since it can get exhausting (40 students = 20 teams = 10 hours of codewalks, sometimes done in just one day), I let my TAs take over for me after some time (eg, I do the first 10, then let them run one while I eat lunch, etc). Either way, I'm always in the room, and I assign the grade, not the TAs. But, there is an alternative, which is doing this in-class. Though I don't do it (because I can do the more personalized form), one of my colleagues does in his class. The idea is to remove any and all identifying traces, then print the code on transparencies (or these days use PPT or PDF -- but make sure it's easily readable!), and talk through it in class. Better still, of course, have the students critique it: get them started, then let them push through, then resume critiquing when they run out of things to say. This is a great way to lay down your law. Do it early in the semester -- even for a very rudimentary assignment -- so students understand what you think good programs are, starting all the way from elementary style (indentation, etc). This is even more important at a school where a particular language's culture isn't already in the air. Make sure you do 2-3 different projects, not just one. It keeps that one group from feeling singled out. It also gives you room to do one really good one, so students get positive examples in addition to negative ones. Plus, nobody can get too cocky -- thinking their project won't be "singled out" -- until the end, so reminding them of this keeps their classroom behavior a bit better controlled, too. Mix up the order so they can't just guess you're going from worst to best, so they have to stay on their toes. Etc. Shriram From dvanhorn at ccs.neu.edu Mon Jan 12 15:17:02 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:37:43 2009 Subject: [plt-scheme] Turn off auto-insert in ProfJ Message-ID: <496BA53E.1040807@ccs.neu.edu> Is there a way to turn off the auto-insertion of a right-paren after typing a left paren in ProfJ? If there is no way, could there be? (It drives me crazy). David From matthias at ccs.neu.edu Mon Jan 12 15:52:18 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:37:43 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> Message-ID: <5358A68D-8759-4885-9885-B51A7B6DFD8C@ccs.neu.edu> I don't do anonymous reviews but in-class IBM-style reviews where pairs present to a panel (1st reader, 2nd reader, secretary). The panel conducts the code walk and the class is called on when the panel fails to see obvious flaws. The goal is to review code in class and to show everyone what can go wrong. This is for a semester- long project that ends in 10-12Kloc of Java or 4K Scheme (free choice of language). I subject myself to this review, though w/o a partner. I use Scheme. These code walks greatly improve the students' sensitivity to design, rationale, and many real-world issues. There's nothing like public pressure to bring across such topics. I recommend it. -- Matthias On Jan 12, 2009, at 2:47 PM, Shriram Krishnamurthi wrote: >> Shriram: since you suggest then yes, I'd be interested in reading >> about >> those anonymous code walks. > > A bit stream-of-consciousness: > > There's a set of terms out there -- inspection, review, etc. -- that I > don't really know. Whatever the terms, you can't do the one that has > the programmers respond in a class period. It can be traumatic for > them if you get critical; it's useless if you don't; and there may be > some privacy issues as well. So the way I run them is do them in > camera with nobody but course staff (in addition to the students) > present. I warn them it will be hell, and I deliver on the promise. > > Since it can get exhausting (40 students = 20 teams = 10 hours of > codewalks, sometimes done in just one day), I let my TAs take over for > me after some time (eg, I do the first 10, then let them run one while > I eat lunch, etc). Either way, I'm always in the room, and I assign > the grade, not the TAs. > > But, there is an alternative, which is doing this in-class. Though I > don't do it (because I can do the more personalized form), one of my > colleagues does in his class. The idea is to remove any and all > identifying traces, then print the code on transparencies (or these > days use PPT or PDF -- but make sure it's easily readable!), and talk > through it in class. Better still, of course, have the students > critique it: get them started, then let them push through, then resume > critiquing when they run out of things to say. > > This is a great way to lay down your law. Do it early in the semester > -- even for a very rudimentary assignment -- so students understand > what you think good programs are, starting all the way from elementary > style (indentation, etc). This is even more important at a school > where a particular language's culture isn't already in the air. > > Make sure you do 2-3 different projects, not just one. It keeps that > one group from feeling singled out. It also gives you room to do one > really good one, so students get positive examples in addition to > negative ones. Plus, nobody can get too cocky -- thinking their > project won't be "singled out" -- until the end, so reminding them of > this keeps their classroom behavior a bit better controlled, too. Mix > up the order so they can't just guess you're going from worst to best, > so they have to stay on their toes. Etc. > > Shriram > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From chust at web.de Mon Jan 12 16:12:11 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:37:43 2009 Subject: [plt-scheme] Recently added PLaneT packages In-Reply-To: <46b603df0901120840r4711b605x81d2620e9349665f@mail.gmail.com> References: <496A8BA3.3050800@web.de> <46b603df0901120840r4711b605x81d2620e9349665f@mail.gmail.com> Message-ID: <496BB22B.2080902@web.de> Jacob Matthews wrote: > I'd guess you're looking that the RSS feed for the version 3xx > repository but you'd really rather be looking at the v4.x repository. > [...] Hello, that's indeed the problem. I hadn't even realized there were feeds for both versions of the repository since I had only seen one link :-( Thanks for pointing out my stupid mistake. cu, Thomas From neil at neilvandyke.org Mon Jan 12 16:30:21 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:43 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: <5358A68D-8759-4885-9885-B51A7B6DFD8C@ccs.neu.edu> References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> <5358A68D-8759-4885-9885-B51A7B6DFD8C@ccs.neu.edu> Message-ID: <496BB66D.7060408@neilvandyke.org> In the early '90s, the best writeup I recall of code reviews was in the 1989 edition of Yourdon's "Structured Walkthroughs" book. You can find used copies cheap on Amazon and "isbn.nu". (Yourdon was a methodologist known to write many books on topics with "Structured" prepended to their names, often drawing on other methodologists. DeMarco is another prolific name to look for. Though functional decomposition of Structured Analysis is not en vogue, and Structure Charts are silly today, there is still value to be found in that era of work. The work by other methodologists of that era on process of requirements analysis is especially valuable, even if you think since contemporary ad hoc participatory design works for you. And papers like on Harel's Statecharts are still worth reading in addition to whatever UML repackaging they have been given. Don't discount the wisdom some IBM-era people might have -- they worked through many problems from first principles and excruciating experience, in an environment that required more discipline than most of us modern developers have learned to exercise.) -- http://www.neilvandyke.org/ From sk at cs.brown.edu Mon Jan 12 16:36:05 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:43 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: <496BB66D.7060408@neilvandyke.org> References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> <5358A68D-8759-4885-9885-B51A7B6DFD8C@ccs.neu.edu> <496BB66D.7060408@neilvandyke.org> Message-ID: Yourdon cheapened himself by also dabbling in the politics of programmers and their location. Another person from that era w/ valuable insights into program structuring is Michael Jackson (various forms of the "Jackson method"), whose work was widely-used especially in Britain. Jackson is active and remains insightful and full of wisdom. Shriram From neil at neilvandyke.org Mon Jan 12 16:49:43 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:44 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> <5358A68D-8759-4885-9885-B51A7B6DFD8C@ccs.neu.edu> <496BB66D.7060408@neilvandyke.org> Message-ID: <496BBAF7.4030808@neilvandyke.org> Oh yeah, after all his methods work, Yourdon wrote "Decline and Fall of the American Programmer," warning against the evil army of genius Indian PhDs who would take all the American programming jobs at fry cook rates. :) Then we did have a period of outsourcing panic, due, I think, not to Yourdon's book but to the reality that overseas outsourcing was happening. I believe Yourdon backtracked eventually, but I'd moved on to research by then, so I don't recall ever reading past the "Decline and Fall" cliffhanger. Seconded on Michael Jackson. Shriram Krishnamurthi wrote at 01/12/2009 04:36 PM: > Yourdon cheapened himself by also dabbling in the politics of > programmers and their location. > > Another person from that era w/ valuable insights into program > structuring is Michael Jackson (various forms of the "Jackson > method"), whose work was widely-used especially in Britain. Jackson > is active and remains insightful and full of wisdom. > From praimon at gmail.com Mon Jan 12 23:41:15 2009 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:37:44 2009 Subject: [plt-scheme] linear update procedures in v4 Message-ID: <4acd8930901122041v4d526eeft2a78b9fea23bdc4@mail.gmail.com> hello, srfi 1 allows, but doesn't require, its linear update procedures to be destructive. So I was wondering, if I use append! in a version 4 #lang scheme module, is it 'silently' calling the non-destructive append instead? As you can see, I'm a bit confused about the mutation-related changes in the latest versions of plt-scheme. regards, praimon From rafkind at cs.utah.edu Mon Jan 12 23:48:35 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Thu Mar 26 02:37:44 2009 Subject: [plt-scheme] linear update procedures in v4 In-Reply-To: <4acd8930901122041v4d526eeft2a78b9fea23bdc4@mail.gmail.com> References: <4acd8930901122041v4d526eeft2a78b9fea23bdc4@mail.gmail.com> Message-ID: <496C1D23.6030608@cs.utah.edu> praimon wrote: > hello, > srfi 1 allows, but doesn't require, its linear update procedures to be > destructive. So I was wondering, if I use append! in a version 4 #lang scheme > module, is it 'silently' calling the non-destructive append instead? > yes > As you can see, I'm a bit confused about the mutation-related changes > in the latest versions of plt-scheme. > regards, > praimon > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From lunarc.lists at gmail.com Mon Jan 12 23:51:02 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:37:44 2009 Subject: [plt-scheme] linear update procedures in v4 In-Reply-To: <4acd8930901122041v4d526eeft2a78b9fea23bdc4@mail.gmail.com> References: <4acd8930901122041v4d526eeft2a78b9fea23bdc4@mail.gmail.com> Message-ID: 2009/1/12 praimon : > srfi 1 allows, but doesn't require, its linear update procedures to be > destructive. So I was wondering, if I use append! in a version 4 #lang scheme > module, is it 'silently' calling the non-destructive append instead? More info here. (Archives are useful!) http://list.cs.brown.edu/pipermail/plt-scheme/2008-December/029331.html Henk From praimon at gmail.com Tue Jan 13 00:05:01 2009 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:37:44 2009 Subject: [plt-scheme] linear update procedures in v4 In-Reply-To: References: <4acd8930901122041v4d526eeft2a78b9fea23bdc4@mail.gmail.com> Message-ID: <4acd8930901122105t757bad4bq7d59fb8eb9f49791@mail.gmail.com> thanks, I did google, but somehow missed that. regards, praimon On Mon, Jan 12, 2009 at 11:51 PM, Henk Boom wrote: > 2009/1/12 praimon : >> srfi 1 allows, but doesn't require, its linear update procedures to be >> destructive. So I was wondering, if I use append! in a version 4 #lang scheme >> module, is it 'silently' calling the non-destructive append instead? > > More info here. (Archives are useful!) > > http://list.cs.brown.edu/pipermail/plt-scheme/2008-December/029331.html > > Henk > From dblaheta at knox.edu Tue Jan 13 03:58:32 2009 From: dblaheta at knox.edu (Don Blaheta) Date: Thu Mar 26 02:37:45 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com>; from robby@eecs.northwestern.edu on Fri, Jan 09, 2009 at 10:16:17PM -0600 References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> Message-ID: <20090113025832.A20919@winter.phpwebhosting.com> Quoth Robby Findler: > You can cut the first three lines out of the file (by a script that > just transforms an input port directly from the file into an input > port that doesn't have those lines). Ah, this is promising (if crude), but now it doesn't seem to know about check-expect, which evidently is in htdp-beginner but not pretty-big...? > But may I ask why you want to do this? Scriptable testing of student code. I guess I should have asked for that more directly; surely someone has already done this. Basically I have my test cases in one file and I'd like to quickly run them on each student file, which may or may not itself also have test cases. -- -=-Don Blaheta-=-dblaheta@knox.edu-=-=--=- "Verbs don't work! Verbs don't work!" --Andrew McClain From robby at eecs.northwestern.edu Tue Jan 13 07:18:03 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:45 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <20090113025832.A20919@winter.phpwebhosting.com> References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> Message-ID: <932b2f1f0901130418s235966uf3472c342e499807@mail.gmail.com> On Tue, Jan 13, 2009 at 2:58 AM, Don Blaheta wrote: > Quoth Robby Findler: >> You can cut the first three lines out of the file (by a script that >> just transforms an input port directly from the file into an input >> port that doesn't have those lines). > > Ah, this is promising (if crude), but now it doesn't seem to know about > check-expect, which evidently is in htdp-beginner but not pretty-big...? That's right. check-expect is not in pretty-big. >> But may I ask why you want to do this? > > Scriptable testing of student code. I guess I should have asked for > that more directly; surely someone has already done this. Basically I > have my test cases in one file and I'd like to quickly run them on each > student file, which may or may not itself also have test cases. There is a handin server that Matthew wrote and Eli currently maintains that lets you do that (and more). I'll let them tell you about it, but I used it last quarter for my HtDP class and it worked great. Robby From jos.koot at telefonica.net Tue Jan 13 07:48:44 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:45 2009 Subject: [plt-scheme] #!rsrs/printvalues Message-ID: <6F59F1BD2F0C43C48FA22FAF2B97CBA0@uw2b2dff239c4d> #!r6rs or #lang r6rs does not wrap its module top level expressions as in (call-with-values (lambda () expression) print-values), like #lang scheme and most other languages do. Is it possible and desirable to change #!r6rs to do this wrapping? Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090113/c1b98831/attachment.htm From matthias at ccs.neu.edu Tue Jan 13 08:23:54 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:37:46 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <932b2f1f0901130418s235966uf3472c342e499807@mail.gmail.com> References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> <932b2f1f0901130418s235966uf3472c342e499807@mail.gmail.com> Message-ID: <5BF1783B-E180-4FCF-B2DF-FF8B053FAFC5@ccs.neu.edu> On Jan 13, 2009, at 7:18 AM, Robby Findler wrote: > On Tue, Jan 13, 2009 at 2:58 AM, Don Blaheta > wrote: >> Quoth Robby Findler: >>> You can cut the first three lines out of the file (by a script that >>> just transforms an input port directly from the file into an input >>> port that doesn't have those lines). >> >> Ah, this is promising (if crude), but now it doesn't seem to know >> about >> check-expect, which evidently is in htdp-beginner but not pretty- >> big...? > > That's right. check-expect is not in pretty-big. #lang scheme (require htdp/testing) ... (generate-report) ;; the end is close enough. -- Matthias >>> But may I ask why you want to do this? >> >> Scriptable testing of student code. I guess I should have asked for >> that more directly; surely someone has already done this. >> Basically I >> have my test cases in one file and I'd like to quickly run them on >> each >> student file, which may or may not itself also have test cases. > > There is a handin server that Matthew wrote and Eli currently > maintains that lets you do that (and more). I'll let them tell you > about it, but I used it last quarter for my HtDP class and it worked > great. > > Robby > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From anton at appsolutions.com Tue Jan 13 20:27:44 2009 From: anton at appsolutions.com (Anton van Straaten) Date: Thu Mar 26 02:37:46 2009 Subject: [plt-scheme] Scheme projects in my undergrad CS course In-Reply-To: <496BBAF7.4030808@neilvandyke.org> References: <72ef860f0812111839o4f4f4b63w7721febe00479fd5@mail.gmail.com> <72ef860f0901091053l25109c7cy87f1c70b91467f7b@mail.gmail.com> <5358A68D-8759-4885-9885-B51A7B6DFD8C@ccs.neu.edu> <496BB66D.7060408@neilvandyke.org> <496BBAF7.4030808@neilvandyke.org> Message-ID: <496D3F90.6070903@appsolutions.com> Neil Van Dyke wrote: > Oh yeah, after all his methods work, Yourdon wrote "Decline and Fall of > the American Programmer," warning against the evil army of genius Indian > PhDs who would take all the American programming jobs at fry cook rates. > :) Then we did have a period of outsourcing panic, due, I think, not to > Yourdon's book but to the reality that overseas outsourcing was > happening. I believe Yourdon backtracked eventually, but I'd moved on > to research by then, so I don't recall ever reading past the "Decline > and Fall" cliffhanger. Yes, just three years later he wrote "Rise & Resurrection of the American Programmer". Amazing how quickly these things can reverse themselves! The official summary is a masterpiece of spin, although still a tad hard to swallow: "Ed Yourdon warned the American programmer in his award-winning, controversial bestseller "Decline and Fall of the American Programmer" that if they did not change, the industry would migrate to countries that were more productive. The software industry has responded to this challenge, and Yourdon shows how in this long-awaited international bestseller." Anton From neil at neilvandyke.org Tue Jan 13 22:15:32 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:46 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment Message-ID: <496D58D4.7050704@neilvandyke.org> If one has a system that uses PLaneT packages, and for security reasons we absolutely do not want the deployed system fetching anything from a public PLaneT repository, what's the best way to manage that? One question I'm debating is whether to: (1) have "planet" "require" specs in the code and to supply those packages in vetted form to a deployed system (via, e.g., a pre-constructed ".plt-scheme/planet/" cache); or (2) pull versions of PLaneT packages into normal collections in our configuration management system, and use non-"planet" "require" specs for them. Our system does *not* need multiple versions of the same package, if that matters. We'd also want to disable access to the PLaneT repository, such as by setting an environment variable or a Scheme parameter. Any thoughts appreciated. (There's a chance I asked this months ago, but I can't find it.) -- http://www.neilvandyke.org/ From jay.mccarthy at gmail.com Tue Jan 13 22:20:22 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:46 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: <496D58D4.7050704@neilvandyke.org> References: <496D58D4.7050704@neilvandyke.org> Message-ID: On Tue, Jan 13, 2009 at 8:15 PM, Neil Van Dyke wrote: > If one has a system that uses PLaneT packages, and for security reasons we > absolutely do not want the deployed system fetching anything from a public > PLaneT repository, what's the best way to manage that? > > One question I'm debating is whether to: (1) have "planet" "require" specs > in the code and to supply those packages in vetted form to a deployed system > (via, e.g., a pre-constructed ".plt-scheme/planet/" cache); I've done this before. > or (2) pull > versions of PLaneT packages into normal collections in our configuration > management system, and use non-"planet" "require" specs for them. > > Our system does *not* need multiple versions of the same package, if that > matters. You can use technique (1) even if you do need multiple version. > We'd also want to disable access to the PLaneT repository, such as by > setting an environment variable or a Scheme parameter. You can turn off access to PLaneT by editing the config.ss file and giving it bogus URLs for the lookup. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From grettke at acm.org Tue Jan 13 22:42:44 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:46 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: <496D58D4.7050704@neilvandyke.org> References: <496D58D4.7050704@neilvandyke.org> Message-ID: <756daca50901131942j14aaf6c3v15802b3d61fb0d92@mail.gmail.com> On Tue, Jan 13, 2009 at 9:15 PM, Neil Van Dyke wrote: > One question I'm debating is whether to: (1) have "planet" "require" specs > in the code and to supply those packages in vetted form to a deployed system > (via, e.g., a pre-constructed ".plt-scheme/planet/" cache); or (2) pull > versions of PLaneT packages into normal collections in our configuration > management system, and use non-"planet" "require" specs for them. You could do #1 and store it in the CMS. From neil at neilvandyke.org Tue Jan 13 22:45:08 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:47 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: References: <496D58D4.7050704@neilvandyke.org> Message-ID: <496D5FC4.405@neilvandyke.org> Thanks, Jay. A few followup questions... >> One question I'm debating is whether to: (1) have "planet" "require" specs >> in the code and to supply those packages in vetted form to a deployed system >> (via, e.g., a pre-constructed ".plt-scheme/planet/" cache); >> If we do it this way, on our development workstations, can we simply make ".plt-scheme/planet/300/packages/" be a symlink to a directory checked out from out CM system, and then selectively commit some packages normally cached by PLaneT to CM? And if so, is there a simple and reliable way to have the corresponding ".plt-scheme/planet/300//" directory built from ".plt-scheme/planet/300/packages/" all at once? Also if so, can we set an environment variable or something to specify a directory other than "~/.plt-scheme"? > You can turn off access to PLaneT by editing the config.ss file and > giving it bogus URLs for the lookup. > We really don't want to be changing the PLT install tree. Any other place to do this? Or do we just override DNS for that domain name or firewall the IP address? Neil From jay.mccarthy at gmail.com Tue Jan 13 22:50:21 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:47 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: <496D5FC4.405@neilvandyke.org> References: <496D58D4.7050704@neilvandyke.org> <496D5FC4.405@neilvandyke.org> Message-ID: On Tue, Jan 13, 2009 at 8:45 PM, Neil Van Dyke wrote: >>> One question I'm debating is whether to: (1) have "planet" "require" >>> specs >>> in the code and to supply those packages in vetted form to a deployed >>> system >>> (via, e.g., a pre-constructed ".plt-scheme/planet/" cache); >>> > > If we do it this way, on our development workstations, can we simply make > ".plt-scheme/planet/300/packages/" be a symlink to a directory checked out > from out CM system, and then selectively commit some packages normally > cached by PLaneT to CM? > > And if so, is there a simple and reliable way to have the corresponding > ".plt-scheme/planet/300//" directory built from > ".plt-scheme/planet/300/packages/" all at once? What I've done in the past is used PLaneT's development link functionality. That way you don't have to mess around with changing the symlinks when you have to make new versions of the packages. > Also if so, can we set an environment variable or something to specify a > directory other than "~/.plt-scheme"? Yes, it is called PLTPLANETDIR. >> You can turn off access to PLaneT by editing the config.ss file and >> giving it bogus URLs for the lookup. >> > > We really don't want to be changing the PLT install tree. Any other place > to do this? Or do we just override DNS for that domain name or firewall the > IP address? They are actually parameters, so you should be able to set them in your mzscheme startup script in ~/.plt-scheme. Look at collects/planet/config.ss for the different options. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From neil at neilvandyke.org Tue Jan 13 22:57:38 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:47 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: References: <496D58D4.7050704@neilvandyke.org> <496D5FC4.405@neilvandyke.org> Message-ID: <496D62B2.3090903@neilvandyke.org> Thanks, Jay. One more question... :) If we decide to go with converting PLaneT package versions to subdirectories of our application's collections directory, are there any gotchas other than that we'd have to fix up any "planet" "require" forms within each collection so converted, to be non-"planet"? From robby at eecs.northwestern.edu Tue Jan 13 23:00:12 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:47 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: <496D62B2.3090903@neilvandyke.org> References: <496D58D4.7050704@neilvandyke.org> <496D5FC4.405@neilvandyke.org> <496D62B2.3090903@neilvandyke.org> Message-ID: <932b2f1f0901132000q261de099p373d135b8be5fe60@mail.gmail.com> It wouldn't work to use development links? Robby On Tue, Jan 13, 2009 at 9:57 PM, Neil Van Dyke wrote: > Thanks, Jay. One more question... :) > > If we decide to go with converting PLaneT package versions to subdirectories > of our application's collections directory, are there any gotchas other than > that we'd have to fix up any "planet" "require" forms within each collection > so converted, to be non-"planet"? > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From jay.mccarthy at gmail.com Tue Jan 13 23:00:46 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:47 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: <496D62B2.3090903@neilvandyke.org> References: <496D58D4.7050704@neilvandyke.org> <496D5FC4.405@neilvandyke.org> <496D62B2.3090903@neilvandyke.org> Message-ID: The only thing I can think of is that you won't be able to run multiple versions at the same time, but you already said that is not a problem. I did this sort of thing for the Continue server. I had a mix of static PLaneT packages and internal libraries. It was a pain to manage and I was much happier with the internal collects, but I went through it to be able to share them. Jay On Tue, Jan 13, 2009 at 8:57 PM, Neil Van Dyke wrote: > Thanks, Jay. One more question... :) > > If we decide to go with converting PLaneT package versions to subdirectories > of our application's collections directory, are there any gotchas other than > that we'd have to fix up any "planet" "require" forms within each collection > so converted, to be non-"planet"? > > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From neil at neilvandyke.org Tue Jan 13 23:13:10 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:47 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: <932b2f1f0901132000q261de099p373d135b8be5fe60@mail.gmail.com> References: <496D58D4.7050704@neilvandyke.org> <496D5FC4.405@neilvandyke.org> <496D62B2.3090903@neilvandyke.org> <932b2f1f0901132000q261de099p373d135b8be5fe60@mail.gmail.com> Message-ID: <496D6656.9070606@neilvandyke.org> PLaneT development links would work, but it's looking like using fake PLaneT will be more work and potential for error than using plain collections (which our install is already set up to support). I'm speaking only of deployment of one particular application, of course. PLaneT is generally a big win. Robby Findler wrote at 01/13/2009 11:00 PM: > It wouldn't work to use development links? > > Robby > > On Tue, Jan 13, 2009 at 9:57 PM, Neil Van Dyke wrote: > >> Thanks, Jay. One more question... :) >> >> If we decide to go with converting PLaneT package versions to subdirectories >> of our application's collections directory, are there any gotchas other than >> that we'd have to fix up any "planet" "require" forms within each collection >> so converted, to be non-"planet"? >> From rafkind at cs.utah.edu Tue Jan 13 23:53:31 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Thu Mar 26 02:37:48 2009 Subject: [plt-scheme] scheme in the wild Message-ID: <496D6FCB.3020009@cs.utah.edu> http://philosecurity.org/2009/01/12/interview-with-an-adware-author Scheme, yay! Adware, boo! From sk at cs.brown.edu Wed Jan 14 08:05:32 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:48 2009 Subject: [plt-scheme] scheme in the wild In-Reply-To: <496D6FCB.3020009@cs.utah.edu> References: <496D6FCB.3020009@cs.utah.edu> Message-ID: Thereby resolving an old paradox: the irresistable force (Scheme) and the immovable object (adware) are one and the same! This is awesome. Now we just a reference like this in some financial accounting scandal -- S: You faked numbers that ruined lives. You bastard. M: [sheepishly] Yes, I did. I got to write half of it in Scheme, making full use of its impressive numeric tower to get the bad sums exactly right, which probably means that I explored more Scheme runtime than anybody else on the planet. -- and Scheme will take control of both Main Street and Wall Street. Shriram From robby at eecs.northwestern.edu Wed Jan 14 08:25:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:48 2009 Subject: [plt-scheme] Using PLaneT Packages in a Production Environment In-Reply-To: <496D6656.9070606@neilvandyke.org> References: <496D58D4.7050704@neilvandyke.org> <496D5FC4.405@neilvandyke.org> <496D62B2.3090903@neilvandyke.org> <932b2f1f0901132000q261de099p373d135b8be5fe60@mail.gmail.com> <496D6656.9070606@neilvandyke.org> Message-ID: <932b2f1f0901140525n2c3915d6gfa584f95a9a7c16f@mail.gmail.com> Perhaps something like the "Create Executable" menu item in drscheme is what you want (or maybe the lower-level, programmable interface to it)? Robby On 1/13/09, Neil Van Dyke wrote: > PLaneT development links would work, but it's looking like using fake > PLaneT will be more work and potential for error than using plain > collections (which our install is already set up to support). > > I'm speaking only of deployment of one particular application, of > course. PLaneT is generally a big win. > > > Robby Findler wrote at 01/13/2009 11:00 PM: >> It wouldn't work to use development links? >> >> Robby >> >> On Tue, Jan 13, 2009 at 9:57 PM, Neil Van Dyke >> wrote: >> >>> Thanks, Jay. One more question... :) >>> >>> If we decide to go with converting PLaneT package versions to >>> subdirectories >>> of our application's collections directory, are there any gotchas other >>> than >>> that we'd have to fix up any "planet" "require" forms within each >>> collection >>> so converted, to be non-"planet"? >>> > > From troelskn at gmail.com Wed Jan 14 11:16:16 2009 From: troelskn at gmail.com (troels knak-nielsen) Date: Thu Mar 26 02:37:48 2009 Subject: [plt-scheme] silex vs. ffi Message-ID: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> Just saw this post on reeddit, and wondered if anybody have written something similar for plt? http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=292963&cmonth=1&cyear=2009 -- troels From edharcourt at stlawu.edu Wed Jan 14 11:26:53 2009 From: edharcourt at stlawu.edu (Ed Harcourt) Date: Thu Mar 26 02:37:48 2009 Subject: [plt-scheme] interactions pane slow in HTDP Message-ID: <496E124D.8010708@stlawu.edu> This is probably a FAQ but I can't find it. When I have DrScheme's language set to HTDP Advanced Student the interactions pane is painfully slow. It takes almost 8 seconds for the prompt to reappear after I hit enter at the prompt. This does not happen if I have the language set to R5RS. I don't recall it being this slow in previous versions of DrScheme. I've played with various preferences but to no avail. Any thoughts? Ed -- ------------------------------------------------------- Ed Harcourt Dept of Mathematics, Computer Science, and Statistics St. Lawrence University Canton, NY 13617 mailto: edharcourt@stlawu.edu Phone: 315-229-5444 ------------------------------------------------------- From robby at eecs.northwestern.edu Wed Jan 14 11:58:45 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:48 2009 Subject: [plt-scheme] interactions pane slow in HTDP In-Reply-To: <496E124D.8010708@stlawu.edu> References: <496E124D.8010708@stlawu.edu> Message-ID: <932b2f1f0901140858o74335dg947d4857886f5837@mail.gmail.com> That is probably the test coverage. I've noticed a similar thing. I assume your program is not completely tested when you observe this behavior? Robby On Wed, Jan 14, 2009 at 10:26 AM, Ed Harcourt wrote: > This is probably a FAQ but I can't find it. When I have DrScheme's language > set to HTDP Advanced Student the interactions pane is painfully slow. It > takes almost 8 seconds for the prompt to reappear after I hit enter at the > prompt. > > This does not happen if I have the language set to R5RS. I don't recall it > being this slow in previous versions of DrScheme. > > I've played with various preferences but to no avail. > > Any thoughts? > > Ed > > -- > ------------------------------------------------------- > Ed Harcourt > Dept of Mathematics, Computer Science, and Statistics > St. Lawrence University > Canton, NY 13617 > mailto: edharcourt@stlawu.edu > Phone: 315-229-5444 > ------------------------------------------------------- > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From edharcourt at stlawu.edu Wed Jan 14 12:04:25 2009 From: edharcourt at stlawu.edu (Ed Harcourt) Date: Thu Mar 26 02:37:48 2009 Subject: [plt-scheme] interactions pane slow in HTDP In-Reply-To: <932b2f1f0901140858o74335dg947d4857886f5837@mail.gmail.com> References: <496E124D.8010708@stlawu.edu> <932b2f1f0901140858o74335dg947d4857886f5837@mail.gmail.com> Message-ID: <496E1B19.40304@stlawu.edu> Yes, and I thought that might be the case. I've been trying to figure out how to turn it off. I've unchecked a box under Preferences->Warnings that says "Ask About Clearing Test Coverage" and under Preferences->Tools I've asked that the "Test engine" be skipped. But to no avail. Can't seem to find any other settings related to test coverage. Thanks, Ed Robby Findler wrote: > That is probably the test coverage. I've noticed a similar thing. I > assume your program is not completely tested when you observe this > behavior? > > Robby From noelwelsh at gmail.com Wed Jan 14 12:06:46 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:37:49 2009 Subject: [plt-scheme] silex vs. ffi In-Reply-To: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> References: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> Message-ID: There is a lexer distributed with PLT. Search for lexer in the PLT help and you'll find it. Otherwise silex might work with PLT. Source is here: http://www.iro.umontreal.ca/~dube/ N. On Wed, Jan 14, 2009 at 4:16 PM, troels knak-nielsen wrote: > Just saw this post on reeddit, and wondered if anybody have written > something similar for plt? > > http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=292963&cmonth=1&cyear=2009 > > -- > troels From robby at eecs.northwestern.edu Wed Jan 14 12:13:24 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:49 2009 Subject: [plt-scheme] interactions pane slow in HTDP In-Reply-To: <496E1B19.40304@stlawu.edu> References: <496E124D.8010708@stlawu.edu> <932b2f1f0901140858o74335dg947d4857886f5837@mail.gmail.com> <496E1B19.40304@stlawu.edu> Message-ID: <932b2f1f0901140913i911146fhb46a180c65728a10@mail.gmail.com> It isn't possible to disable it in the teaching languages. You can use the module language with advanced as the language of the module, eg: (module tmp lang/htdp-advanced (define y 2) (define (f x) (begin (set! y 3) x))) but this won't have the reader settings properly set (eg, if you put "1.5" it will be exact, unlike in the teaching languages). Robby On Wed, Jan 14, 2009 at 11:04 AM, Ed Harcourt wrote: > Yes, and I thought that might be the case. I've been trying to figure out > how to turn it off. I've unchecked a box under Preferences->Warnings that > says "Ask About Clearing Test Coverage" and under Preferences->Tools I've > asked that the "Test engine" be skipped. But to no avail. Can't seem to find > any other settings related to test coverage. > > Thanks, > > Ed > > Robby Findler wrote: >> >> That is probably the test coverage. I've noticed a similar thing. I >> assume your program is not completely tested when you observe this >> behavior? >> >> Robby > From jay.mccarthy at gmail.com Wed Jan 14 12:19:41 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:37:49 2009 Subject: [plt-scheme] silex vs. ffi In-Reply-To: References: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> Message-ID: The lexer documentation is here: http://docs.plt-scheme.org/parser-tools/ Jay On Wed, Jan 14, 2009 at 10:06 AM, Noel Welsh wrote: > There is a lexer distributed with PLT. Search for lexer in the PLT > help and you'll find it. Otherwise silex might work with PLT. Source > is here: > > http://www.iro.umontreal.ca/~dube/ > > N. > > On Wed, Jan 14, 2009 at 4:16 PM, troels knak-nielsen wrote: >> Just saw this post on reeddit, and wondered if anybody have written >> something similar for plt? >> >> http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=292963&cmonth=1&cyear=2009 >> >> -- >> troels > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From troelskn at gmail.com Wed Jan 14 12:30:46 2009 From: troelskn at gmail.com (troels knak-nielsen) Date: Thu Mar 26 02:37:49 2009 Subject: [plt-scheme] silex vs. ffi In-Reply-To: References: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> Message-ID: <98b8086f0901140930k7de811c6lc8b6444eda31d25@mail.gmail.com> On Wed, Jan 14, 2009 at 6:06 PM, Noel Welsh wrote: > There is a lexer distributed with PLT. Search for lexer in the PLT > help and you'll find it. Otherwise silex might work with PLT. Source > is here: I mostly thought about the application of the lexer, as a way to automate generation of ffi bindings. -- troels From clements at brinckerhoff.org Wed Jan 14 12:42:06 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:50 2009 Subject: [plt-scheme] silex vs. ffi In-Reply-To: <98b8086f0901140930k7de811c6lc8b6444eda31d25@mail.gmail.com> References: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> <98b8086f0901140930k7de811c6lc8b6444eda31d25@mail.gmail.com> Message-ID: On Jan 14, 2009, at 9:30 AM, troels knak-nielsen wrote: > On Wed, Jan 14, 2009 at 6:06 PM, Noel Welsh > wrote: >> There is a lexer distributed with PLT. Search for lexer in the PLT >> help and you'll find it. Otherwise silex might work with PLT. >> Source >> is here: > > I mostly thought about the application of the lexer, as a way to > automate generation of ffi bindings. I believe there are a bunch of threads on roughly this topic contained in this list's archives. I would search the list archives for some combination of the following: FFI header SWIG eli 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/20090114/ff027601/smime.bin From eli at barzilay.org Wed Jan 14 12:45:44 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:37:50 2009 Subject: [plt-scheme] silex vs. ffi In-Reply-To: References: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> <98b8086f0901140930k7de811c6lc8b6444eda31d25@mail.gmail.com> Message-ID: <18798.9416.572952.243515@arabic.ccs.neu.edu> On Jan 14, John Clements wrote: > > On Jan 14, 2009, at 9:30 AM, troels knak-nielsen wrote: > > > On Wed, Jan 14, 2009 at 6:06 PM, Noel Welsh > > wrote: > >> There is a lexer distributed with PLT. Search for lexer in the PLT > >> help and you'll find it. Otherwise silex might work with PLT. > >> Source > >> is here: > > > > I mostly thought about the application of the lexer, as a way to > > automate generation of ffi bindings. > > I believe there are a bunch of threads on roughly this topic contained > in this list's archives. I would search the list archives for some > combination of the following: > > FFI header SWIG eli To save you the trouble: what you want is *much* more than a simple lexer. It just might happen that you get some file (a header file, a man page, etc) that is formatted well enough to be useful with a bunch of regexps. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From neil at neilvandyke.org Wed Jan 14 13:38:10 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:50 2009 Subject: [plt-scheme] silex vs. ffi In-Reply-To: <18798.9416.572952.243515@arabic.ccs.neu.edu> References: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> <98b8086f0901140930k7de811c6lc8b6444eda31d25@mail.gmail.com> <18798.9416.572952.243515@arabic.ccs.neu.edu> Message-ID: <496E3112.1010603@neilvandyke.org> An imprecise parser for arbitrary C header files (which are usually just C type and extern declarations, sprinkled with preprocessor gunk) has two uses that I see: 1. Starting point for manually-crafted FFI bindings, in most cases. 2. Complete FFI bindings in a small number of cases. The difficulty is not so much parsing C (which is a nightmare of tracking type info and deciding how to interpret the preprocessor pass while retaining pre-preprocessing information), but that the header files often don't have enough semantic information to derive practical FFI bindings. For a simple example of this, if an argument to a C function is treated as an in/out parameter, which is quite common, the header file doesn't tell you. Even if it told you, you might need a human decision on a reasonable way to translate that to Scheme. The header file also doesn't tell you preconditions of C functions, whether is returns or passes back allocations that must be freed, whether the C code retains allocations passed to it, etc. You also might have to make human decisions about performance considerations. Naive bindings might do lots more copying than is necessary for safety, for example. -- http://www.neilvandyke.org/ From neil at neilvandyke.org Wed Jan 14 13:48:47 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:37:50 2009 Subject: [plt-scheme] silex vs. ffi In-Reply-To: <496E3112.1010603@neilvandyke.org> References: <98b8086f0901140816l4fdc755eoa6a80ef8e87f46f6@mail.gmail.com> <98b8086f0901140930k7de811c6lc8b6444eda31d25@mail.gmail.com> <18798.9416.572952.243515@arabic.ccs.neu.edu> <496E3112.1010603@neilvandyke.org> Message-ID: <496E338F.9020409@neilvandyke.org> Oh yeah, a parser-based tool becomes more useful for generating a starting-point for bindings if you're dealing with a *large* API, and can specialize your tool for the conventions of that API. For example, you might know as human knowledge that a certain application-specific type, or one prefixed with a certain CPP macro, should always be passed in a certain way. So you can hard-code that application-specific special case into your generator. From marek at xivilization.net Wed Jan 14 16:52:17 2009 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:37:50 2009 Subject: [plt-scheme] HtDP lectures? Message-ID: <20090114225217.57bc5a07@halmanfloyd.lan.local> Hi, As I understand HtDP was created to adress some issues people had with SICP. I'm currently watching the SICP video lectures and indeed, they focus more on math that I'd like to furthermore they are quite old and of poor audio/video quality. To put things short: are there any HtDP lectures as there are for SICP? As far as I understand HtDP is used for teaching, so maybe there are recordings of the lecures available somewhere? regards, Marek From toddobryan at gmail.com Wed Jan 14 17:13:20 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Mar 26 02:37:50 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <20090114225217.57bc5a07@halmanfloyd.lan.local> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> Message-ID: <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> This suggestion comes up every once in a while, but the master teachers in the group aren't sure they could replicate the interactive nature of the class in a good way. Todd On Wed, Jan 14, 2009 at 4:52 PM, Marek Kubica wrote: > Hi, > > As I understand HtDP was created to adress some issues people had with > SICP. I'm currently watching the SICP video lectures and indeed, they > focus more on math that I'd like to furthermore they are quite old and > of poor audio/video quality. > > To put things short: are there any HtDP lectures as there are for SICP? > As far as I understand HtDP is used for teaching, so maybe there are > recordings of the lecures available somewhere? > > regards, > Marek > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From matthias at ccs.neu.edu Wed Jan 14 17:16:31 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:37:51 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> Message-ID: Amen. On Jan 14, 2009, at 5:13 PM, Todd O'Bryan wrote: > This suggestion comes up every once in a while, but the master > teachers in the group aren't sure they could replicate the interactive > nature of the class in a good way. > > Todd > > On Wed, Jan 14, 2009 at 4:52 PM, Marek Kubica > wrote: >> Hi, >> >> As I understand HtDP was created to adress some issues people had >> with >> SICP. I'm currently watching the SICP video lectures and indeed, they >> focus more on math that I'd like to furthermore they are quite old >> and >> of poor audio/video quality. >> >> To put things short: are there any HtDP lectures as there are for >> SICP? >> As far as I understand HtDP is used for teaching, so maybe there are >> recordings of the lecures available somewhere? >> >> regards, >> Marek >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From morazanm at gmail.com Wed Jan 14 22:31:43 2009 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:37:51 2009 Subject: [plt-scheme] Re: HTDP12.4.2 In-Reply-To: <681593.22949.qm@web31407.mail.mud.yahoo.com> References: <77452.8407.qm@web31408.mail.mud.yahoo.com> <9b1fff280901141907k750f01a0qd962fa1f5419522b@mail.gmail.com> <681593.22949.qm@web31407.mail.mud.yahoo.com> Message-ID: <9b1fff280901141931j2a4e8995i3351135c152ef57f@mail.gmail.com> On Wed, Jan 14, 2009 at 10:09 PM, runyon avenue soldier wrote: > ;;arrangements: a word-->a list of words > ;;produces a list of all possible arrangements of a word > ;;example--> (arrangements (list 'a 'b 'c)-->(list (list > > (define (arrangements word) > (cond > ((empty? word) (list empty)) > (else > (insert (first word) (arrangements (rest word)))))) > Hmmm.....your example is not finished. It is quite important to clearly state examples to solve this problem. > ;;insert: a symbol and a list of words-->a list of words > ;;to produce a list of words with the symbol inserted btwn all letters of > the words in the list and at the beginning and end of the words. > ;;example-->(list (list 'e 'r) (list 'r 'e))-->(list (list 'd 'e 'r) (list > 'e 'd 'r) (list 'e 'r 'd) (list 'd 'r 'e) (list 'r 'd 'e) (list 'r 'e 'd)) > (define (insert n alow) > (cond > ((empty? alow) null) > (else > (append (ins n (first alow)) (insert n (rest alow)))))) > Your examples are incomplete. What are you inserting into (list (list 'e 'r) (list 'r 'e))? Is it 'd? If so, the result looks promising. > > ;;ins: a symbol and a word-->a list of words > ;;produces a list of words from the single word with the symbol inserted at > all points in the word > ;;example-->(ins n ('b 'c))--> (list (list 'n 'b 'c) (list 'b 'n 'c) (list > 'b 'c 'n)) What is ('b 'c)? Do you mean '(b c) ? > ;;example-->(ins n ( 'w 'x 'y 'z))-->(list (list n w x y z) (list w n x y z) > (list w x n y z) (list w x y n z) (list w x y z n)) > What is ( 'w 'x 'y 'z) ? Do you mean '(w x y z) ? > (define (ins n word) > (cond > ((empty? word) (list n )) > (else > (......n (first word) > (ins n (rest word)))))) > ive not been able to complete this last fnx because as i recur one letter > gets losts. > The general idea for the results in your examples looks good. Let me ask you a few questions: 1. What should the result be of evaluating (ins n (rest word)) ? 2. What is missing from every word in the result returned by (ins n (rest word)) ? What do you need to do to add what is missing? Remember that if the result is of arbitrary size, you need an auxiliary function. 3. What is missing from the result obtained from question 2? How do you add what is missing? I suggest you answer the above questions with examples first, before trying to write any code. Let us know if you need more help. Enjoy the problem! > ________________________________ > From: Marco Morazan > To: runyon avenue soldier > Sent: Thursday, January 15, 2009 3:07:29 AM > Subject: Re: HTDP12.4.2 > > Sure, what have you done to solve the problem? Show us your work so far. > > On Wed, Jan 14, 2009 at 9:40 PM, runyon avenue soldier > wrote: >> pls am a newbie in programming and am using HTDP but am stuck with >> exercise >> 12.4.2. I was wodering whether you could give me a hand. >> >> > > > > -- > > Cheers, > > Marco > > -- Cheers, Marco From keydana at gmx.de Thu Jan 15 03:56:22 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:37:51 2009 Subject: [plt-scheme] module access from test cases file Message-ID: <496EFA36.6010605@gmx.de> Hi, I would like to keep my test cases in a file separate from the main application, but this seems to mean I have to export all tested functions from the module (with provide), which I don't need/want to otherwise. Is there a possibility to export functions to one other file only, or even have two files share the same module (I must admit I'm thinking of something like package access in Java which is handy for the test classes)? Thanks a lot for your help, Sigrid From noelwelsh at gmail.com Thu Jan 15 05:07:30 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:37:51 2009 Subject: [plt-scheme] module access from test cases file In-Reply-To: <496EFA36.6010605@gmx.de> References: <496EFA36.6010605@gmx.de> Message-ID: See require/expose in SchemeUnit. Or just provide all the definitions you want. People will only program to the documented API so really it isn't worth worrying about. N. On Thu, Jan 15, 2009 at 8:56 AM, Sigrid Keydana wrote: > Hi, > > I would like to keep my test cases in a file separate from the main > application, but this seems to mean I have to export all tested > functions from the module (with provide), which I don't need/want to > otherwise. > ... From keydana at gmx.de Thu Jan 15 04:30:46 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:37:51 2009 Subject: [plt-scheme] why local? (just curious) Message-ID: <496F0246.7040302@gmx.de> Hi, sorry for writing such an unimportant question (please ignore it if it's too unimportant ), but I'm just curious about something: I remember having seen the "local" form in HDTP, but I'd thought it was for learning purposes only. Now I see it's used in the Continue Guide I'm working through and it's part of standard (PLT) scheme. I just wonder why it's necessary (or even "nice-to-have") - why not simply use let or letrec? For example, in the Continue guide, wouldn't it be much easier just to use let: (define (start request) (local ((define a-blog (cond ((can-parse-post? (request-bindings request)) (cons (parse-post (request-bindings request)) BLOG)) (else BLOG)))) (render-blog-page a-blog request))) Thanks in advance, Sigrid From ebellani at gmail.com Thu Jan 15 05:54:12 2009 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:37:52 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> Message-ID: <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Speaking as a guy who is recommending HTDP to a lot of friends who are curious about my job and life, and agreeing that the SICP lectures could use a update into the HTDP world specifically addressing all the issues mentioned at the SICSC. My perception is that it would be a hit so +1 on the idea. On Wed, Jan 14, 2009 at 11:16 PM, Matthias Felleisen wrote: > > Amen. > > > On Jan 14, 2009, at 5:13 PM, Todd O'Bryan wrote: > >> This suggestion comes up every once in a while, but the master >> teachers in the group aren't sure they could replicate the interactive >> nature of the class in a good way. >> >> Todd >> >> On Wed, Jan 14, 2009 at 4:52 PM, Marek Kubica >> wrote: >>> >>> Hi, >>> >>> As I understand HtDP was created to adress some issues people had with >>> SICP. I'm currently watching the SICP video lectures and indeed, they >>> focus more on math that I'd like to furthermore they are quite old and >>> of poor audio/video quality. >>> >>> To put things short: are there any HtDP lectures as there are for SICP? >>> As far as I understand HtDP is used for teaching, so maybe there are >>> recordings of the lecures available somewhere? >>> >>> regards, >>> Marek >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > _________________________________________________ > 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 chust at web.de Thu Jan 15 06:02:43 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:37:52 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F0246.7040302@gmx.de> References: <496F0246.7040302@gmx.de> Message-ID: <496F17D3.8090800@web.de> Sigrid Keydana wrote: > [...] > I remember having seen the "local" form in HDTP, but I'd thought it was > for learning purposes only. Now I see it's used in the Continue Guide > I'm working through and it's part of standard (PLT) scheme. I just > wonder why it's necessary (or even "nice-to-have") - why not simply use > let or letrec? > [...] Hello, the local form is handy if you want to define a set of local functions that are mutually recursive. You can write those with the same syntax as on the module level inside local. In addition to define, the forms define-syntax and define-struct are also valid inside local. Of course you can always use a combination of letrec and let-syntax to the same effect as local, but the syntax is more verbose. It's really a matter of taste which you like better. cu, Thomas From grettke at acm.org Thu Jan 15 06:05:45 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:52 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F0246.7040302@gmx.de> References: <496F0246.7040302@gmx.de> Message-ID: <756daca50901150305g74ee3ab0gf078801c2d5ec60c@mail.gmail.com> On Thu, Jan 15, 2009 at 3:30 AM, Sigrid Keydana wrote: > I just wonder why [local is] necessary (or even "nice-to-have") - why not simply use > let or letrec? The documentation for it says: "Like letrec, except that the bindings are expressed in the same way as in the top-level or in a module body: using define, define-values, define-syntax, define-struct, etc." So to Thomas's point, it seems like it is a matter of personal taste. From spdegabrielle at gmail.com Thu Jan 15 06:28:11 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:37:52 2009 Subject: [plt-scheme] is the DrScheme site/brand(!) being deprecated? Message-ID: <595b9ab20901150328o53cf5a2fo9341e748555ec9b7@mail.gmail.com> Hi, I just navigated to the website via the 'help->related web sites->drscheme' menu item and it seems to be little more than a placeholder. http://www.drscheme.org/ Is the DrScheme site/brand(!) being deprecated? Cheers, Stephen From sk at cs.brown.edu Thu Jan 15 08:06:53 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:52 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F0246.7040302@gmx.de> References: <496F0246.7040302@gmx.de> Message-ID: Hi Sigrid -- If you want to wish you'd never asked (-:, see this old thread on comp.lang.scheme: http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/4ec029086bf56a61/e3fe547c1a98e4be?lnk=st&q=comp+lang+scheme+shriram+local+letrec Shriram From sk at cs.brown.edu Thu Jan 15 09:43:03 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:52 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: Okay, so what part of Todd's and Matthias's responses didn't make sense? It feels like you quoted a message as if to respond to it, but instead ended up completely ignoring it. Also, the SICP videos were (I believe) originally made for a corporate sponsor, HP. Any of you willing to sponsor? Finally, we live in a much more IP-restricted and privacy-conscious era. It would be interesting, but not necessarily in a positive way, to hear how Brown feels about having one of their professors (IP) and classes (privacy) videotaped and then broadcast for free (IP) over the Internet (privacy). Shriram On Thu, Jan 15, 2009 at 5:54 AM, Eduardo Bellani wrote: > Speaking as a guy who is recommending HTDP to a lot of friends who are > curious about my job and > life, and agreeing that the SICP > lectures could use a update into the HTDP world specifically > addressing all the issues mentioned at the SICSC. > My perception is that it would be a hit so +1 on the idea. > > On Wed, Jan 14, 2009 at 11:16 PM, Matthias Felleisen > wrote: >> >> Amen. >> >> >> On Jan 14, 2009, at 5:13 PM, Todd O'Bryan wrote: >> >>> This suggestion comes up every once in a while, but the master >>> teachers in the group aren't sure they could replicate the interactive >>> nature of the class in a good way. >>> >>> Todd >>> >>> On Wed, Jan 14, 2009 at 4:52 PM, Marek Kubica >>> wrote: >>>> >>>> Hi, >>>> >>>> As I understand HtDP was created to adress some issues people had with >>>> SICP. I'm currently watching the SICP video lectures and indeed, they >>>> focus more on math that I'd like to furthermore they are quite old and >>>> of poor audio/video quality. >>>> >>>> To put things short: are there any HtDP lectures as there are for SICP? >>>> As far as I understand HtDP is used for teaching, so maybe there are >>>> recordings of the lecures available somewhere? >>>> >>>> regards, >>>> Marek >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>> >>> _________________________________________________ >>> For list-related administrative tasks: >>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> 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 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From keydana at gmx.de Thu Jan 15 09:11:22 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:37:53 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: References: <496F0246.7040302@gmx.de> Message-ID: <496F440A.60206@gmx.de> Hi, thank you all for your helpful replies. Shriram, I just looked at the old thread you pointed me to and really, towards the end of it I even found my "last" remaining question answered: >> Yes, but... *Letrec* *doesn't* provide for sequential assignment like let*, >> so what do you do when you need *both*? One answer: Use nested "*letrec*"s. >> But that doesn't provide *mutual* recursion. Now I just have no idea of when I might need sequential assignment in addition to the mutual recursion of letrec... But that's lack of experience of course :-( What I also wouldn't have thought of, but find very convincing, is the point regarding the possibility of developing on the top level first. This sounds real useful. Ciao, Sigrid Shriram Krishnamurthi schrieb: > Hi Sigrid -- > > If you want to wish you'd never asked (-:, see this old thread on > comp.lang.scheme: > > http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/4ec029086bf56a61/e3fe547c1a98e4be?lnk=st&q=comp+lang+scheme+shriram+local+letrec > > Shriram > > From sk at cs.brown.edu Thu Jan 15 10:28:15 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:53 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F440A.60206@gmx.de> References: <496F0246.7040302@gmx.de> <496F440A.60206@gmx.de> Message-ID: Hi Sigrid -- Sequential assignment corresponds to a more traditional programming style (let x = , let y = , ...) and sometimes it really is useful to have the later assignment refer to the previous one. For instance, (let ([b^2 (square b)] [4ac (* 4 a c)] [b^2-4ac (- b^2 4ac)]) ...) Note how the third refers to the previous two. These are NOT *mutually* recursive: there is a strict ordering. Shriram From sk at cs.brown.edu Thu Jan 15 10:29:05 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:53 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: References: <496F0246.7040302@gmx.de> <496F440A.60206@gmx.de> Message-ID: Sorry -- I should have said "later BINDING", not later ASSIGNMENT. These are bindings, not assignments. S. From dyoo at cs.wpi.edu Thu Jan 15 10:34:35 2009 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Thu Mar 26 02:37:53 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F0246.7040302@gmx.de> References: <496F0246.7040302@gmx.de> Message-ID: On Thu, Jan 15, 2009 at 4:30 AM, Sigrid Keydana wrote: > Hi, > > sorry for writing such an unimportant question (please ignore it if it's > too unimportant ), but I'm just curious about something: > I remember having seen the "local" form in HDTP, but I'd thought it was > for learning purposes only. Now I see it's used in the Continue Guide > I'm working through and it's part of standard (PLT) scheme. I just > wonder why it's necessary (or even "nice-to-have") - why not simply use > let or letrec? Hi Sigrid, Ah! The primary reason we used local for those examples was to avoid the use of lambda for the the internal function definitions. We wanted to make the tutorial easy for newcomers to read. From d.j.gurnell at gmail.com Thu Jan 15 11:16:28 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:53 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: > Finally, we live in a much more IP-restricted and privacy-conscious > era. It would be interesting, but not necessarily in a positive way, > to hear how Brown feels about having one of their professors (IP) and > classes (privacy) videotaped and then broadcast for free (IP) over the > Internet (privacy). I see your point about cost, but as far as IP and privacy are concerned, aren't MIT and some other Unis already doing this kind of thing (iTunes U etc)? How do they justify it? Is it just a street cred thing? -- Dave From d.j.gurnell at gmail.com Thu Jan 15 11:17:40 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:37:53 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: <24F1EF91-34FC-4DD3-A3ED-434403977246@gmail.com> > How do they justify it? Is it just a street cred thing? Sorry - I phrased this badly. I mean as in... "we'll take the hit in terms of IP and privacy, because it raises our public profile". -- Dave From sk at cs.brown.edu Thu Jan 15 11:24:46 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:54 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: Yeah, it's definitely street cred. They might also be getting their students to sign waivers of some sort. I don't know. But the bottom line is that doing *quality* video is darn expensive. It may even require multiple takes with a willing audience. That's not cheap. And putting out poor video is not, I think, consistent with our general preference. Shriram From matthias at ccs.neu.edu Thu Jan 15 11:54:48 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:37:54 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> Promise: if anyone here comes up with the sponsor money, we will make videos that bring across HtDP/2e in full life format. One of our PhD students, a former MIT student, figures it's entire semester's worth of work. -- Matthias From etanter at dcc.uchile.cl Thu Jan 15 12:11:51 2009 From: etanter at dcc.uchile.cl (Eric Tanter) Date: Thu Mar 26 02:37:54 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> Message-ID: <976EB1A3-749D-48DA-BA64-4C596CC2502F@dcc.uchile.cl> How much does this represent? maybe we can organize a PLT-thon ;-) -- ?ric On Jan 15, 2009, at 17:54 , Matthias Felleisen wrote: > > Promise: if anyone here comes up with the sponsor money, we will > make videos that bring across HtDP/2e in full life format. One of > our PhD students, a former MIT student, figures it's entire > semester's worth of work. -- Matthias > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From ifl2009 at shu.edu Thu Jan 15 12:09:08 2009 From: ifl2009 at shu.edu (IFL 2009) Date: Thu Mar 26 02:37:55 2009 Subject: [plt-scheme] IFL 2009: Call for Papers Message-ID: Call for Papers IFL 2009 Seton Hall University SOUTH ORANGE, NJ, USA http://tltc.shu.edu/blogs/projects/IFL2009/ The 21st IFL symposium, IFL 2009, will be held for the first time in the USA. The hosting institution is Seton Hall University in South Orange, NJ, USA and the symposium dates are September 23-25, 2009. It is our goal to make IFL a regular event held in the USA. The goal of the IFL symposia is to bring together researchers actively engaged in the implementation and application of functional and function-based programming languages. IFL 2009 will be a venue for researchers to present and discuss new ideas and concepts, work in progress, and publication-ripe results related to the implementation and application of functional languages and function-based programming. Following the IFL tradition, IFL 2009 will use a post-symposium review process to produce a formal proceedings which we expect to be published by Springer in the Lecture Notes in Computer Science series. All participants in IFL 2009 are invited to submit either a draft paper or and extended abstract describing work to be presented at the symposium. These submissions will be screened by the program committee chair to make sure they are within the scope of IFL and will appear in the draft proceedings distributed at the symposium. Submissions appearing in the draft proceedings are not peer-reviewed publications. After the symposium, authors will be given the opportunity to incorporate the feedback from discussions at the symposium and will be invited to submit a revised full arcticle for the formal review process. These revised submissions will be reviewed by the program committee using prevailing academic standards to select the best articles that will appear in the formal proceedings. TOPICS IFL welcomes submissions describing practical and theoretical as well as submissions describing applications and tools. If you are not sure if your work is appropriate for IFL 2009, please contact the PC chair at ifl2009@shu.edu. Topics of interest include, but are not limited to: language concepts type checking contracts compilation techniques staged compilation runtime function specialization runtime code generation partial evaluation (abstract) interpretation generic programming techniques automatic program generation array processing concurrent/parallel programming concurrent/parallel program execution functional programming and embedded systems functional programming and web applications functional programming and security novel memory management techniques runtime profiling and performance measurements debugging and tracing virtual/abstract machine architectures validation and verification of functional programs tools and programming techniques PAPER SUBMISSIONS Prospective authors are encouraged to submit papers or extended abstracts to be published in the draft proceedings and to present them at the symposium. All contributions must be written in English, conform to the Springer-Verlag LNCS series format and not exceed 16 pages. The draft proceedings will appear as a technical report of the Department of Mathematics and Computer Science of Seton Hall University. IMPORTANT DATES Registration deadline August 15, 2009 Presentation submission deadline August 15, 2009 IFL 2009 Symposium September 23-25, 2009 Submission for review process deadline November 1, 2009 Notification Accept/Reject December 22, 2009 Camera ready version January 15, 2010 PROGRAM COMMITTEE Peter Achten University of Nijmegen, The Netherlands Jost Berthold Philipps-Universit?t Marburg, Germany Andrew Butterfield University of Dublin, Ireland Robby Findler Northwestern University, USA Kathleen Fisher AT&T Research, USA Cormac Flanagan University of California at Santa Cruz, USA Matthew Flatt University of Utah, USA Matthew Fluet Toyota Technological Institute at Chicago, USA Daniel Friedman Indiana University, USA Andy Gill University of Kansas, USA Clemens Grelck University of Amsterdam/Hertfordshire, The Netherlands/UK Jurriaan Hage Utrecht University, The Netherlands Ralf Hinze Oxford University, UK Paul Hudak Yale University, USA John Hughes Chalmers University of Technology, Sweden Patricia Johann University of Strathclyde, UK Yukiyoshi Kameyama University of Tsukuba, Japan Marco T. Moraz?n (Chair) Seton Hall University, USA Rex Page University of Oklahoma, USA Fernando Rubio Universidad Complutense de Madrid, Spain Sven-Bodo Scholz University of Hertfordshire, UK Manuel Serrano INRIA Sophia-Antipolis, France Chung-chieh Shan Rutgers University, USA David Walker Princeton University, USA Vikt?ria Zs?k E?tv?s Lor?nd University, Hungary PETER LANDIN PRIZE The Peter Landin Prize is awarded to the best paper presented at the symposium every year. The honored article is selected by the program committee based on the submissions received for the formal review process. The prize carries a cash award equivalent to 150 euros. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090115/ebb4e44d/attachment.htm From robby at eecs.northwestern.edu Thu Jan 15 12:38:47 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:37:55 2009 Subject: [plt-scheme] IFL 2009: call for papers Message-ID: <932b2f1f0901150938x6215528q453ec9a662601ea5@mail.gmail.com> Call for Papers IFL 2009 Seton Hall University SOUTH ORANGE, NJ, USA http://tltc.shu.edu/blogs/projects/IFL2009/ The 21st IFL symposium, IFL 2009, will be held for the first time in the USA. The hosting institution is Seton Hall University in South Orange, NJ, USA and the symposium dates are September 23-25, 2009. It is our goal to make IFL a regular event held in the USA. The goal of the IFL symposia is to bring together researchers actively engaged in the implementation and application of functional and function-based programming languages. IFL 2009 will be a venue for researchers to present and discuss new ideas and concepts, work in progress, and publication-ripe results related to the implementation and application of functional languages and function-based programming. Following the IFL tradition, IFL 2009 will use a post-symposium review process to produce a formal proceedings which we expect to be published by Springer in the Lecture Notes in Computer Science series. All participants in IFL 2009 are invited to submit either a draft paper or and extended abstract describing work to be presented at the symposium. These submissions will be screened by the program committee chair to make sure they are within the scope of IFL and will appear in the draft proceedings distributed at the symposium. Submissions appearing in the draft proceedings are not peer-reviewed publications. After the symposium, authors will be given the opportunity to incorporate the feedback from discussions at the symposium and will be invited to submit a revised full arcticle for the formal review process. These revised submissions will be reviewed by the program committee using prevailing academic standards to select the best articles that will appear in the formal proceedings. TOPICS IFL welcomes submissions describing practical and theoretical as well as submissions describing applications and tools. If you are not sure if your work is appropriate for IFL 2009, please contact the PC chair at ifl2009@shu.edu. Topics of interest include, but are not limited to: language concepts type checking contracts compilation techniques staged compilation runtime function specialization runtime code generation partial evaluation (abstract) interpretation generic programming techniques automatic program generation array processing concurrent/parallel programming concurrent/parallel program execution functional programming and embedded systems functional programming and web applications functional programming and security novel memory management techniques runtime profiling and performance measurements debugging and tracing virtual/abstract machine architectures validation and verification of functional programs tools and programming techniques PAPER SUBMISSIONS Prospective authors are encouraged to submit papers or extended abstracts to be published in the draft proceedings and to present them at the symposium. All contributions must be written in English, conform to the Springer-Verlag LNCS series format and not exceed 16 pages. The draft proceedings will appear as a technical report of the Department of Mathematics and Computer Science of Seton Hall University. IMPORTANT DATES Registration deadline August 15, 2009 Presentation submission deadline August 15, 2009 IFL 2009 Symposium September 23-25, 2009 Submission for review process deadline November 1, 2009 Notification Accept/Reject December 22, 2009 Camera ready version January 15, 2010 PROGRAM COMMITTEE Peter Achten University of Nijmegen, The Netherlands Jost Berthold Philipps-Universit?t Marburg, Germany Andrew Butterfield University of Dublin, Ireland Robby Findler Northwestern University, USA Kathleen Fisher AT&T Research, USA Cormac Flanagan University of California at Santa Cruz, USA Matthew Flatt University of Utah, USA Matthew Fluet Toyota Technological Institute at Chicago, USA Daniel Friedman Indiana University, USA Andy Gill University of Kansas, USA Clemens Grelck University of Amsterdam/Hertfordshire, The Netherlands/UK Jurriaan Hage Utrecht University, The Netherlands Ralf Hinze Oxford University, UK Paul Hudak Yale University, USA John Hughes Chalmers University of Technology, Sweden Patricia Johann University of Strathclyde, UK Yukiyoshi Kameyama University of Tsukuba, Japan Marco T. Moraz?n (Chair) Seton Hall University, USA Rex Page University of Oklahoma, USA Fernando Rubio Universidad Complutense de Madrid, Spain Sven-Bodo Scholz University of Hertfordshire, UK Manuel Serrano INRIA Sophia-Antipolis, France Chung-chieh Shan Rutgers University, USA David Walker Princeton University, USA Vikt?ria Zs?k E?tv?s Lor?nd University, Hungary PETER LANDIN PRIZE The Peter Landin Prize is awarded to the best paper presented at the symposium every year. The honored article is selected by the program committee based on the submissions received for the formal review process. The prize carries a cash award equivalent to 150 euros. From jos.koot at telefonica.net Thu Jan 15 12:40:36 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:56 2009 Subject: [plt-scheme] attempt to discern applications from syntactic forms fails Message-ID: <508100EB46F143C9BC81E1D3CD7CD233@uw2b2dff239c4d> My question is at the <===== in the following code: (define-syntax (x stx) (syntax-case stx () ((_ x) (let ((y (expand-once #'x))) (printf "~s~n" (syntax->datum y)) (syntax-case y (#%app) ((#%app . z) #''app) (_ #''no-app)))))) (x (let ((a 1)) a)) ; printed: (let-values (((a) 1)) a) ; value: no-app, ok (x (list 1 2 3)) ; printed (#%app list 1 2 3) ; value: no-app, why??? <===== I expected app (x list) ; printed: list ; value: no-app, ok Thanks, Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090115/d1ae0420/attachment.html From mflatt at cs.utah.edu Thu Jan 15 12:57:00 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:37:56 2009 Subject: [plt-scheme] attempt to discern applications from syntactic forms fails In-Reply-To: <508100EB46F143C9BC81E1D3CD7CD233@uw2b2dff239c4d> References: <508100EB46F143C9BC81E1D3CD7CD233@uw2b2dff239c4d> Message-ID: <20090115175700.8A47165010F@mail-svr1.cs.utah.edu> At Thu, 15 Jan 2009 18:40:36 +0100, "Jos Koot" wrote: > My question is at the <===== in the following code: > > (define-syntax (x stx) > (syntax-case stx () > ((_ x) > (let ((y (expand-once #'x))) > (printf "~s~n" (syntax->datum y)) > (syntax-case y (#%app) > ((#%app . z) #''app) > (_ #''no-app)))))) > > [...] > (x (list 1 2 3)) > ; printed (#%app list 1 2 3) > ; value: no-app, why??? <===== I expected app The `expand-once' is working at phase 1, while `syntax-case' is comparing identifiers at phase 0. Furthermore, the `#%app' of `scheme/base' is being expanded to `#%plain-app'. Confusingly, in the scope of the `#%app' definition, `#%plain-app' is called `#%app', so the expansion prints as `#%app' So, you would have gotten the expected results with (syntax-case* y (#%plain-app) free-transformer-identifier=? ((#%plain-app . z) #''app) (_ #''no-app)) I doubt that this is what you really intended, though. I think it's more likely that you wanted to use `local-expand' (which will expand the given expression at phase 0) and use `#%app' as one of the stop forms, in which case the `syntax-case' match would work as you expect. Actually, depending on the context, it's probably better to use `#%plain-app' as a stop form, in which case you'll match on `#%plain-app'. That works with macros defined in a language other than `scheme/base', since `#%plain-app' is the primitive application form. Matthew From dyoo at cs.wpi.edu Thu Jan 15 13:07:07 2009 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Thu Mar 26 02:37:56 2009 Subject: [plt-scheme] Volunteers: help with Moby! Message-ID: As Shriram mentioned, we are working on a compiler from World programs written in Beginner Scheme to mobile platforms. Our working prototype enables the programs in HtDW (world.cs.brown.edu) to run on J2ME and, using bridge classes, Android. The sources are here: http://svn.plt-scheme.org/usr/dyoo/moby/trunk/ The README describes the project and how to run Moby's regression and unit test suites. What we'd love volunteer help with: http://svn.plt-scheme.org/usr/dyoo/moby/trunk/doc/TODO A quick-and-easy task is to implement some of the remaining primitives listed in the TODO. The TODO also lists other, more sophisticated tasks. (But whichever you choose, do coordinate with Shriram and me, so we avoid duplicating effort.) Thanks for your help! We are excited about making Scheme one of the first reactive scripting languages for mobile phones. From keydana at gmx.de Thu Jan 15 12:12:04 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:37:56 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: References: <496F0246.7040302@gmx.de> <496F440A.60206@gmx.de> Message-ID: <496F6E64.4060202@gmx.de> Hi Shriram, thanks for your patience :-) . In fact I'm not asking about sequential assignment per se (I have been using let* for that), but in which situation I would need this in combination with the mutual recursion provided by letrec. Now I've tried to think up an example myself in which both is present - as I can't get at anything sensible, I just put some sequential assignment in the beginning of the classic even-odd-letrec-example: (define test (lambda (n) (letrec ((start-value n) (zero (- start-value start-value)) (even? (lambda (n) (if (= n zero) #t (odd? (- n 1))))) (odd? (lambda (n) (if (= n zero) #f (even? (- n 1)))))) (odd? n)))) (test 333) The stupid example at least seems to show that with letrec, I get the sequential assignment too... - or do I miss something here? Ciao, Sigrid Shriram Krishnamurthi schrieb: > Sorry -- I should have said "later BINDING", not later ASSIGNMENT. > These are bindings, not assignments. > > S. > > From clements at brinckerhoff.org Thu Jan 15 13:16:32 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:37:57 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F6E64.4060202@gmx.de> References: <496F0246.7040302@gmx.de> <496F440A.60206@gmx.de> <496F6E64.4060202@gmx.de> Message-ID: <05ECAE94-88D1-40B0-BFD6-129C01A270D8@brinckerhoff.org> On Jan 15, 2009, at 9:12 AM, Sigrid Keydana wrote: > :Hi Shriram, > > thanks for your patience :-) . In fact I'm not asking about sequential > assignment per se (I have been using let* for that), but in which > situation I would need this in combination with the mutual recursion > provided by letrec. > > Now I've tried to think up an example myself in which both is > present - > as I can't get at anything sensible, I just put some sequential > assignment in the beginning of the classic even-odd-letrec-example: > > (define test > (lambda (n) > (letrec ((start-value n) > (zero (- start-value start-value)) > (even? (lambda (n) (if (= n zero) #t (odd? (- n 1))))) > (odd? (lambda (n) (if (= n zero) #f (even? (- n 1)))))) > (odd? n)))) > > (test 333) > > > The stupid example at least seems to show that with letrec, I get the > sequential assignment too... - or do I miss something here? I'm not doing due diligence here, but I believe that RnRS[*] does not guarantee (or even permit?) this behavior, but that PLT scheme does, and has, for at least five to ten years. Feel free to correct me. John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090115/3c9f8ee2/smime.bin From sk at cs.brown.edu Thu Jan 15 13:27:30 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:37:57 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F6E64.4060202@gmx.de> References: <496F0246.7040302@gmx.de> <496F440A.60206@gmx.de> <496F6E64.4060202@gmx.de> Message-ID: > Now I've tried to think up an example myself in which both is present - > as I can't get at anything sensible, I just put some sequential > assignment in the beginning of the classic even-odd-letrec-example: > > (define test > (lambda (n) > (letrec ((start-value n) > (zero (- start-value start-value)) > (even? (lambda (n) (if (= n zero) #t (odd? (- n 1))))) > (odd? (lambda (n) (if (= n zero) #f (even? (- n 1)))))) > (odd? n)))) > > (test 333) The meaning of this program is undefined according to RnRS for n < 6. Which means: In some implementations, it produces the answer you expect. In other implementations, it yields an error. In still other implementations, it might produce a different answer (or undefined, or error) depending on the phase of the moon. Shriram From geoff at knauth.org Thu Jan 15 13:49:18 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:37:57 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <976EB1A3-749D-48DA-BA64-4C596CC2502F@dcc.uchile.cl> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> <976EB1A3-749D-48DA-BA64-4C596CC2502F@dcc.uchile.cl> Message-ID: On Jan 15, 2009, at 12:11, Eric Tanter wrote: > How much does this represent? maybe we can organize a PLT-thon ;-) > On Jan 15, 2009, at 17:54 , Matthias Felleisen wrote: >> Promise: if anyone here comes up with the sponsor money, we will >> make videos that bring across HtDP/2e in full life format. One of >> our PhD students, a former MIT student, figures it's entire >> semester's worth of work. I'd be happy to pledge $100 for something like this, maybe more. How big is the PLT community? From raould at gmail.com Thu Jan 15 14:16:14 2009 From: raould at gmail.com (Raoul Duke) Date: Thu Mar 26 02:37:57 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: <91a2ba3e0901151116l70333687yc8a7dcec734181ba@mail.gmail.com> > But the bottom line is that doing *quality* video is darn expensive. > It may even require multiple takes with a willing audience. That's > not cheap. And putting out poor video is not, I think, consistent > with our general preference. ratholing/ot: i've been wondering about that in general recently since there are so many inexpensive and moderate-quality video recorders now. i am not an a/v engineer but... :-) seems like with all the cheaper digital video cameras these days, one could set up a ton of them in the room to capture more than e.g. just one camera manually operated would. matrix-y. so then it would come down to paying for somebody good to take all that footage and edit it together. From keydana at gmx.de Thu Jan 15 13:23:24 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:37:57 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: References: <496F0246.7040302@gmx.de> <496F440A.60206@gmx.de> <496F6E64.4060202@gmx.de> Message-ID: <496F7F1C.5060806@gmx.de> Sorry but... why for n < 6? Shriram Krishnamurthi schrieb: >> Now I've tried to think up an example myself in which both is present - >> as I can't get at anything sensible, I just put some sequential >> assignment in the beginning of the classic even-odd-letrec-example: >> >> (define test >> (lambda (n) >> (letrec ((start-value n) >> (zero (- start-value start-value)) >> (even? (lambda (n) (if (= n zero) #t (odd? (- n 1))))) >> (odd? (lambda (n) (if (= n zero) #f (even? (- n 1)))))) >> (odd? n)))) >> >> (test 333) >> > > The meaning of this program is undefined according to RnRS for n < 6. > Which means: In some implementations, it produces the answer you > expect. In other implementations, it yields an error. In still other > implementations, it might produce a different answer (or undefined, or > error) depending on the phase of the moon. > > Shriram > > From jos.koot at telefonica.net Thu Jan 15 14:26:05 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:58 2009 Subject: [plt-scheme] attempt to discern applications from syntactic formsfails References: <508100EB46F143C9BC81E1D3CD7CD233@uw2b2dff239c4d> <20090115175700.8A47165010F@mail-svr1.cs.utah.edu> Message-ID: <0E877AD4BEF6474FB68FA98D754E1765@uw2b2dff239c4d> Thanks, that works, I think. With your clear explanation and some more browsing in the docs I surely will find out why. What I am working on, is a macro that lazily evaluates lambda-terms, but includes a form that escapes from curried and lazy evaluation and that sees all bindings from which the currying/lazy macro is called. I also want a macro that embeds a form in a predefined environment. Combining these two requirements is my problem. I have two versions that work well, but none that satisfies both conditions. I am coming close now! Thanks, Jos ----- Original Message ----- From: "Matthew Flatt" To: "Jos Koot" Cc: Sent: Thursday, January 15, 2009 6:57 PM Subject: Re: [plt-scheme] attempt to discern applications from syntactic formsfails > At Thu, 15 Jan 2009 18:40:36 +0100, "Jos Koot" wrote: >> My question is at the <===== in the following code: >> >> (define-syntax (x stx) >> (syntax-case stx () >> ((_ x) >> (let ((y (expand-once #'x))) >> (printf "~s~n" (syntax->datum y)) >> (syntax-case y (#%app) >> ((#%app . z) #''app) >> (_ #''no-app)))))) >> >> [...] >> (x (list 1 2 3)) >> ; printed (#%app list 1 2 3) >> ; value: no-app, why??? <===== I expected app > > The `expand-once' is working at phase 1, while `syntax-case' is > comparing identifiers at phase 0. > > Furthermore, the `#%app' of `scheme/base' is being expanded to > `#%plain-app'. Confusingly, in the scope of the `#%app' definition, > `#%plain-app' is called `#%app', so the expansion prints as `#%app' > > So, you would have gotten the expected results with > > (syntax-case* y (#%plain-app) free-transformer-identifier=? > ((#%plain-app . z) #''app) > (_ #''no-app)) > > > I doubt that this is what you really intended, though. I think it's > more likely that you wanted to use `local-expand' (which will expand > the given expression at phase 0) and use `#%app' as one of the stop > forms, in which case the `syntax-case' match would work as you expect. > > Actually, depending on the context, it's probably better to use > `#%plain-app' as a stop form, in which case you'll match on > `#%plain-app'. That works with macros defined in a language other than > `scheme/base', since `#%plain-app' is the primitive application form. > > > Matthew > From eli at barzilay.org Thu Jan 15 14:26:40 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:37:58 2009 Subject: [plt-scheme] is the DrScheme site/brand(!) being deprecated? In-Reply-To: <595b9ab20901150328o53cf5a2fo9341e748555ec9b7@mail.gmail.com> References: <595b9ab20901150328o53cf5a2fo9341e748555ec9b7@mail.gmail.com> Message-ID: <18799.36336.347790.409932@arabic.ccs.neu.edu> On Jan 15, Stephen De Gabrielle wrote: > Hi, > > I just navigated to the website via the 'help->related web > sites->drscheme' menu item and it seems to be little more than a > placeholder. > > http://www.drscheme.org/ Yes, this was due to be changed -- and it's finally done. It should be updated shortly to forward to plt-scheme.org. > Is the DrScheme site/brand(!) being deprecated? No -- we're trying to clarify the names: DrScheme is part of PLT Scheme, so if you want it, you need to download and install PLT Scheme. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Thu Jan 15 14:27:33 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:58 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> <976EB1A3-749D-48DA-BA64-4C596CC2502F@dcc.uchile.cl> Message-ID: <756daca50901151127y4eeee6f5q5dad4b4139ffcf8e@mail.gmail.com> On Thu, Jan 15, 2009 at 12:49 PM, Geoffrey S. Knauth wrote: > On Jan 15, 2009, at 17:54 , Matthias Felleisen wrote: >> Promise: if anyone here comes up with the sponsor money, we will make >> videos that bring across HtDP/2e in full life format. One of our PhD >> students, a former MIT student, figures it's entire semester's worth of >> work. > > I'd be happy to pledge $100 for something like this, maybe more. How big is > the PLT community? How much would it cost to pay for an entire semester's worth of work? From grettke at acm.org Thu Jan 15 14:28:08 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:58 2009 Subject: [plt-scheme] is the DrScheme site/brand(!) being deprecated? In-Reply-To: <18799.36336.347790.409932@arabic.ccs.neu.edu> References: <595b9ab20901150328o53cf5a2fo9341e748555ec9b7@mail.gmail.com> <18799.36336.347790.409932@arabic.ccs.neu.edu> Message-ID: <756daca50901151128r77342c53n31260988e056e542@mail.gmail.com> On Thu, Jan 15, 2009 at 1:26 PM, Eli Barzilay wrote: >> Is the DrScheme site/brand(!) being deprecated? > > No -- we're trying to clarify the names: DrScheme is part of PLT > Scheme, so if you want it, you need to download and install PLT > Scheme. It is a good clarification. From grettke at acm.org Thu Jan 15 14:28:33 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:37:58 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: <496F7F1C.5060806@gmx.de> References: <496F0246.7040302@gmx.de> <496F440A.60206@gmx.de> <496F6E64.4060202@gmx.de> <496F7F1C.5060806@gmx.de> Message-ID: <756daca50901151128q152fb74dlb2864b784b1bdc2a@mail.gmail.com> > Sorry but... why for n < 6? R6RS Scheme versus R5RS and below. From ebellani at gmail.com Thu Jan 15 16:39:17 2009 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:37:58 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: <184222e50901151339g63c5ab67t26ca989f4c127163@mail.gmail.com> > Okay, so what part of Todd's and Matthias's responses didn't make > sense? It feels like you quoted a message as if to respond to it, but > instead ended up completely ignoring it. Hmm, I don't think I've completely understood your message mate, but I'll take it as a request for me to pay attention to Todd's reply. I think I got his point that the professors don't feel secure that they could replicate what they do in class in a different media (video). I was just pointing out my opinion that I, and some other people that I recommended you guys work to, would find it very valuable not just to the PLT community, but perhaps a lot more who are interested in CS but lack, for different reasons, the capacity to go to a college or university. > Also, the SICP videos were (I believe) originally made for a corporate > sponsor, HP. Any of you willing to sponsor? Yup, it was HP. I don't particularly know how to solve this question, perhaps a solution could be to find a sponsor in the same form as Abelson and Sussman did, but frankly I'm way out of my league here. But hey, if someone sets a found I'll gladly donate to it. > Finally, we live in a much more IP-restricted and privacy-conscious > era. It would be interesting, but not necessarily in a positive way, > to hear how Brown feels about having one of their professors (IP) and > classes (privacy) videotaped and then broadcast for free (IP) over the > Internet (privacy). Hmmm, as someone else pointed out, MIT, Boston and others are doing the same, but that is a matter for the university alone. I know that both Sussman and Albeson were very conscious about the value of sharing information, as demonstrated here: "Sussman and Abelson also have been an important part of the Free Software Movement, including serving on the Board of Directors of the Free Software Foundation, and releasing MIT/GNU Scheme as free software even before the Free Software Foundation existed."[1] So they probably pushed for the free (as in speech) format. Again, that is a matter for you guys and your department. Like someone else pointed out, the price of the task for both the hardware and the software involved in the task has dropped, and I would say exponentially since then, so the cost would be way cheaper. Perhaps the university could be convinced that the publicity generated would worth the effort, hech, from my point of view it would be worth the effort. Anyway, it was just a +1 to the idea ;) [1] - http://en.wikipedia.org/wiki/Gerald_Jay_Sussman On Thu, Jan 15, 2009 at 3:43 PM, Shriram Krishnamurthi wrote: > > Also, the SICP videos were (I believe) originally made for a corporate > sponsor, HP. Any of you willing to sponsor? > > Finally, we live in a much more IP-restricted and privacy-conscious > era. It would be interesting, but not necessarily in a positive way, > to hear how Brown feels about having one of their professors (IP) and > classes (privacy) videotaped and then broadcast for free (IP) over the > Internet (privacy). > > Shriram > > On Thu, Jan 15, 2009 at 5:54 AM, Eduardo Bellani wrote: >> Speaking as a guy who is recommending HTDP to a lot of friends who are >> curious about my job and >> life, and agreeing that the SICP >> lectures could use a update into the HTDP world specifically >> addressing all the issues mentioned at the SICSC. >> My perception is that it would be a hit so +1 on the idea. >> >> On Wed, Jan 14, 2009 at 11:16 PM, Matthias Felleisen >> wrote: >>> >>> Amen. >>> >>> >>> On Jan 14, 2009, at 5:13 PM, Todd O'Bryan wrote: >>> >>>> This suggestion comes up every once in a while, but the master >>>> teachers in the group aren't sure they could replicate the interactive >>>> nature of the class in a good way. >>>> >>>> Todd >>>> >>>> On Wed, Jan 14, 2009 at 4:52 PM, Marek Kubica >>>> wrote: >>>>> >>>>> Hi, >>>>> >>>>> As I understand HtDP was created to adress some issues people had with >>>>> SICP. I'm currently watching the SICP video lectures and indeed, they >>>>> focus more on math that I'd like to furthermore they are quite old and >>>>> of poor audio/video quality. >>>>> >>>>> To put things short: are there any HtDP lectures as there are for SICP? >>>>> As far as I understand HtDP is used for teaching, so maybe there are >>>>> recordings of the lecures available somewhere? >>>>> >>>>> regards, >>>>> Marek >>>>> _________________________________________________ >>>>> For list-related administrative tasks: >>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>>>> >>>> _________________________________________________ >>>> For list-related administrative tasks: >>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >>> >>> _________________________________________________ >>> 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 >> _________________________________________________ >> 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 ebellani at gmail.com Thu Jan 15 17:10:31 2009 From: ebellani at gmail.com (Eduardo Bellani) Date: Thu Mar 26 02:37:58 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <184222e50901151339g63c5ab67t26ca989f4c127163@mail.gmail.com> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> <184222e50901151339g63c5ab67t26ca989f4c127163@mail.gmail.com> Message-ID: <184222e50901151410u71bbb4c7y740598b391c2c0c6@mail.gmail.com> On a IP related note: http://www.mysanantonio.com/news/MYSA18_01C_hendricks0318_768fcaac_html29138.html Hugs everyone From eli at barzilay.org Thu Jan 15 17:27:55 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:37:59 2009 Subject: [plt-scheme] module access from test cases file In-Reply-To: References: <496EFA36.6010605@gmx.de> Message-ID: <18799.47211.129450.522613@arabic.ccs.neu.edu> On Jan 15, Noel Welsh wrote: > > On Thu, Jan 15, 2009 at 8:56 AM, Sigrid Keydana wrote: > > I would like to keep my test cases in a file separate from the > > main application, but this seems to mean I have to export all > > tested functions from the module (with provide), which I don't > > need/want to otherwise. > > See require/expose in SchemeUnit. Or just provide all the > definitions you want. People will only program to the documented > API so really it isn't worth worrying about. Even better for test cases is to use the sandbox library. For example: (require scheme/sandbox) (define e (make-module-evaluator (string->path "...your file..."))) (e '...some-expression...) Some notes: * `make-module-evaluator' is suited for cases where you have some code that is a module, and you want to get an evaluator in that context. The result is an evaluator function that is very similar to a drscheme repl in the `Module' language. * The reason for the `string->path' is that giving it a string will try to evaluate the string as containing the source for a module. * The sandbox is very secure by default -- it is intended to be convenient for running random code. So in the above, the module code will not be allowed to access the filesystem, the network, and a number of other restriction. It is also common to want a sandbox for trusted code -- especially in testing code you usually will want the convenience of the sandboxed evaluator, but without the restrictions. In the current svn version (which will turn to a new release shortly) there is a convenient utility for this: (define e (call-with-trusted-sandbox-configuration (lambda () (make-module-evaluator (string->path "...your file..."))))) * Finally, you can go to an even less sandboxed environment using `module->namespace'. For example: (require (file "...your file...")) (define e (let ([ns (module->namespace '(file "...your file..."))]) (lambda (expr) (eval expr ns)))) (e '...some-expression...) This is, very roughly, the core of the sandbox library -- which takes care of a bunch of other considerations. (It is also how the `require/expose' form that Noel mentioned works.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jos.koot at telefonica.net Thu Jan 15 17:48:42 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:37:59 2009 Subject: [plt-scheme] HtDP lectures? References: <20090114225217.57bc5a07@halmanfloyd.lan.local><904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com><184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com><184222e50901151339g63c5ab67t26ca989f4c127163@mail.gmail.com> <184222e50901151410u71bbb4c7y740598b391c2c0c6@mail.gmail.com> Message-ID: <3ABB33EFF2AB43E69161638E6E21F3B5@uw2b2dff239c4d> How is this related to ideas produced by tax payed people in working time? My personal view is that everyone in every thinkable circumstance should be given the credit for their bringing up new ideas. My personal experience is also that civil services as well as commercial companies don't care about such awarding. Employers, both commercial and civil, seem to think (assuming they have the ability to think at all) that what is produced in time they pay for is their property without any oblige for credit to the original author, by which I mean an individual or a small group of individuals. Jos ----- Original Message ----- From: "Eduardo Bellani" To: "Shriram Krishnamurthi" Cc: ; "Matthias Felleisen" ; "Marek Kubica" Sent: Thursday, January 15, 2009 11:10 PM Subject: Re: [plt-scheme] HtDP lectures? > On a IP related note: > http://www.mysanantonio.com/news/MYSA18_01C_hendricks0318_768fcaac_html29138.html > Hugs everyone > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From marek at xivilization.net Thu Jan 15 18:33:58 2009 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:37:59 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> Message-ID: <20090116003358.7b73f422@halmanfloyd.lan.local> On Thu, 15 Jan 2009 09:43:03 -0500 "Shriram Krishnamurthi" wrote: > Also, the SICP videos were (I believe) originally made for a corporate > sponsor, HP. Any of you willing to sponsor? Yes, I also kind of remember that SICP lectures were sponsored by HP, no idea where I read about it. But I don't really understand why you are so upset - I was just watching SICP lectures so I thought I might ask around whether there are any HtDP videos, not even neccesarily by Brown (see below for longer explanation). > Finally, we live in a much more IP-restricted and privacy-conscious > era. It would be interesting, but not necessarily in a positive way, > to hear how Brown feels about having one of their professors (IP) and > classes (privacy) videotaped and then broadcast for free (IP) over the > Internet (privacy). I guess I'll need to justify my initial question. As I was surfing the internet lately I found numerous video lectures including MIT-SICP and, more recently SICP lectures by Brian Harvey at UC Berkeley (CS 61A) as well as many well done videotaped version of Standford courses (which are really impressive since in multiple formats, with transscripts and slides and everything which is probably because Stanford has enough money to stepnd for this, admittedly). But also at my university we have videos at some of our lectures (sometimes with fancy features like slides + video synced in two separate windows) some of those are for students only and some can be freely downloaded. So I was curious whether there is something similar for HtDP. I did not demand to produce such videos and a simple "no, sorry there aren't any that we're know about" would have been enough (or a "oh, yeah, sure, they were produced in YYYY at UUU University, take a look at http://someurl"). regards, Marek From marek at xivilization.net Thu Jan 15 18:37:04 2009 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:37:59 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <756daca50901151127y4eeee6f5q5dad4b4139ffcf8e@mail.gmail.com> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <904774730901141413t64221792y8b12f7e8cea65ac0@mail.gmail.com> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> <976EB1A3-749D-48DA-BA64-4C596CC2502F@dcc.uchile.cl> <756daca50901151127y4eeee6f5q5dad4b4139ffcf8e@mail.gmail.com> Message-ID: <20090116003704.684a947f@halmanfloyd.lan.local> On Thu, 15 Jan 2009 13:27:33 -0600 "Grant Rettke" wrote: > On Thu, Jan 15, 2009 at 12:49 PM, Geoffrey S. Knauth > wrote: > > On Jan 15, 2009, at 17:54 , Matthias Felleisen wrote: > >> Promise: if anyone here comes up with the sponsor money, we will > >> make videos that bring across HtDP/2e in full life format. One of > >> our PhD students, a former MIT student, figures it's entire > >> semester's worth of work. > > > > I'd be happy to pledge $100 for something like this, maybe more. > > How big is the PLT community? > > How much would it cost to pay for an entire semester's worth of work? My financial possibilities are limited, but I would certainly donate some money for a PLT-thon. regards, Marek From spdegabrielle at gmail.com Thu Jan 15 19:15:48 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:38:00 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <20090116003704.684a947f@halmanfloyd.lan.local> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> <976EB1A3-749D-48DA-BA64-4C596CC2502F@dcc.uchile.cl> <756daca50901151127y4eeee6f5q5dad4b4139ffcf8e@mail.gmail.com> <20090116003704.684a947f@halmanfloyd.lan.local> Message-ID: <595b9ab20901151615w5cee8953g8af68c7a71ee2ddd@mail.gmail.com> Hi, assuming a plt-a-thon could raise the funds (10's of thousands) to do a quality job, it's probably worth asking if video is the right medium. If you would spend money, you want to get the best value for it. I'm sure pretty great documentation/tutorials like the getting started section of the manual eg 'Continue' represent much better value for money. Perhaps something like the ELM-ART lisp tutor: http://apsymac33.uni-trier.de:8080/Lisp-Course (This was my first taste of a lisp.) Cheers, Stephen - -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/a5dd618f/attachment.html From geoff at knauth.org Thu Jan 15 19:58:37 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:00 2009 Subject: [plt-scheme] HtDP lectures? In-Reply-To: <595b9ab20901151615w5cee8953g8af68c7a71ee2ddd@mail.gmail.com> References: <20090114225217.57bc5a07@halmanfloyd.lan.local> <184222e50901150254v1836121bq7637299c2f9263d6@mail.gmail.com> <96ED4E4B-4A2D-44C2-91F1-8CE6B3CB16B9@ccs.neu.edu> <976EB1A3-749D-48DA-BA64-4C596CC2502F@dcc.uchile.cl> <756daca50901151127y4eeee6f5q5dad4b4139ffcf8e@mail.gmail.com> <20090116003704.684a947f@halmanfloyd.lan.local> <595b9ab20901151615w5cee8953g8af68c7a71ee2ddd@mail.gmail.com> Message-ID: <9E42C93F-1F91-48E1-BE93-A2B375A5A486@knauth.org> On Jan 15, 2009, at 19:15, Stephen De Gabrielle wrote: > assuming a plt-a-thon could raise the funds (10's of thousands) to > do a quality job, it's probably worth asking if video is the right > medium. If you would spend money, you want to get the best value for > it. > > I'm sure pretty great documentation/tutorials like the getting > started section of the manual eg 'Continue' represent much better > value for money. > > Perhaps something like the ELM-ART lisp tutor: > http://apsymac33.uni-trier.de:8080/Lisp-Course I would donate $ to both approaches. From kumar_lista at mac.com Thu Jan 15 20:45:49 2009 From: kumar_lista at mac.com (kumar_lista@mac.com) Date: Thu Mar 26 02:38:00 2009 Subject: [plt-scheme] why local? (just curious) References: <737D2AFD-0DF4-433B-8DB2-AF0DE396FE44@mac.com> Message-ID: > Ah! The primary reason we used local for those examples was to avoid > the use of lambda for the the internal function definitions. We > wanted to make the tutorial easy for newcomers to read. > Why not just permit (define ...) expressions anywhere with mutually recursive bindings possible in the same scope, so you don't have to use local in the first place? Rewriting Sigrid's example - (define (test n) (define start-value n) (define zero (- start-value start-value) (define (even? n) (if (= n zero) #t (odd? (- n 1)))) (define (odd? n) (if (= n zero) #f (even? (- n 1)))) (odd? n)) -Kumar From sk at cs.brown.edu Thu Jan 15 20:58:30 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:38:00 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: References: <737D2AFD-0DF4-433B-8DB2-AF0DE396FE44@mac.com> Message-ID: If you mean a different semantics for this than Scheme's internal define, then you're going to create confusion. If you mean the same semantics as Scheme's internal define, kindly refer to the comp.lang.scheme thread I pointed you to. Shriram On Thu, Jan 15, 2009 at 8:45 PM, wrote: >> Ah! The primary reason we used local for those examples was to avoid >> the use of lambda for the the internal function definitions. We >> wanted to make the tutorial easy for newcomers to read. >> > > Why not just permit (define ...) expressions anywhere with > mutually recursive bindings possible in the same scope, > so you don't have to use local in the first place? > > Rewriting Sigrid's example - > > (define (test n) > (define start-value n) > (define zero (- start-value start-value) > (define (even? n) (if (= n zero) #t (odd? (- n 1)))) > (define (odd? n) (if (= n zero) #f (even? (- n 1)))) > (odd? n)) > > -Kumar > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From kumar_lista at mac.com Thu Jan 15 21:31:34 2009 From: kumar_lista at mac.com (kumar) Date: Thu Mar 26 02:38:00 2009 Subject: [plt-scheme] why local? (just curious) In-Reply-To: References: <737D2AFD-0DF4-433B-8DB2-AF0DE396FE44@mac.com> Message-ID: Sorry I missed that one. Its clearer now. I came across local first in the web app tutorial and I both liked it and at the same time felt it was redundant. I just looked into the code for local (local.ss). It looks like the difference from begin lies in the line - ... [expand-context (generate-expand-context)] ... It looks like the whole things is expanded in a nested context which begin doesn't. Am I right? -Kumar On 16 Jan 2009, at 9:58 AM, Shriram Krishnamurthi wrote: > If you mean a different semantics for this than Scheme's internal > define, then you're going to create confusion. > > If you mean the same semantics as Scheme's internal define, kindly > refer to the comp.lang.scheme thread I pointed you to. > > Shriram > > On Thu, Jan 15, 2009 at 8:45 PM, wrote: >>> Ah! The primary reason we used local for those examples was to >>> avoid >>> the use of lambda for the the internal function definitions. We >>> wanted to make the tutorial easy for newcomers to read. >>> >> >> Why not just permit (define ...) expressions anywhere with >> mutually recursive bindings possible in the same scope, >> so you don't have to use local in the first place? >> >> Rewriting Sigrid's example - >> >> (define (test n) >> (define start-value n) >> (define zero (- start-value start-value) >> (define (even? n) (if (= n zero) #t (odd? (- n 1)))) >> (define (odd? n) (if (= n zero) #f (even? (- n 1)))) >> (odd? n)) >> >> -Kumar >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> From yinso.chen at gmail.com Thu Jan 15 21:55:58 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:01 2009 Subject: [plt-scheme] re-open a bytes/string port? Message-ID: <779bf2730901151855t2c2e7cbal35f9cacee28a7e6a@mail.gmail.com> Hi all - is there a way to *re-open* a bytes/string port? With a file port, I can look at the object-name to obtain its path, and use that to open another port reading from the file, but it appears there isn't an equivalent mechanism for bytes/string unless I happen to have a handle of the original source. Any tip is appreciated, thanks. yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090115/f43ba56e/attachment.htm From gaddam.1987 at gmail.com Thu Jan 15 22:31:00 2009 From: gaddam.1987 at gmail.com (gaddam reddy) Date: Thu Mar 26 02:38:02 2009 Subject: [plt-scheme] hi Message-ID: <72227ec00901151931k3b2e4bdfoe8224092ac40e87c@mail.gmail.com> what should i send , u r asking send to mailing list -- naresh -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/36cc1f49/attachment.html From lunarc.lists at gmail.com Fri Jan 16 01:23:03 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:38:02 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> Message-ID: 2009/1/12 Jay McCarthy : > Thanks for the catch. It's in SVN now. Thanks for implementing this! I tried it in one of the nightly builds, and it seems to maintain the concurrency limit properly. I've noticed, though, that threads belonging to cancelled connections are no longer dropped, though, so if I hit refresh 10 times in firefox with a concurrency limit of 1, it actually does the full calculations for all of the responses one at a time before I get the final response. I can't tell why this happens though, from looking at the above code. Maybe it's because channel-put/get share the property of 'sleep' that prevents the thread from being terminated? (What is that reason, by the way?) Henk From geoff at knauth.org Fri Jan 16 05:02:28 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:02 2009 Subject: [plt-scheme] web-server/insta require the Browser tool to be enabled? In-Reply-To: References: <595b9ab20901080622x36a36677vcbe96c4139aea644@mail.gmail.com> Message-ID: <7963CE7F-DDC2-4A13-AF15-A4CF4E679A94@knauth.org> On Jan 10, 2009, at 11:49, Dave Gurnell wrote: > #lang web-server/insta > > (define (start request) > '(html (body (p "Hello!")))) I put just that little bit of code into tiny-servlet.ss, typed mzscheme tiny-servlet.ss at the [OS X] command line, and my browser popped up with the working servlet. Wow was that easy! $ mzscheme tiny-servlet.ss Your Web application is running at http://localhost:8000/servlets/standalone.ss . Click 'Stop' at any time to terminate the Web Server. C-c C-c Web Server stopped. $ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/c898dcb0/attachment.htm From eli at barzilay.org Fri Jan 16 07:06:32 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:03 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <20090113025832.A20919@winter.phpwebhosting.com> References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> Message-ID: <18800.30792.436062.917137@arabic.ccs.neu.edu> On Jan 13, Don Blaheta wrote: > Quoth Robby Findler: > > But may I ask why you want to do this? > > Scriptable testing of student code. I guess I should have asked for > that more directly; surely someone has already done this. Basically > I have my test cases in one file and I'd like to quickly run them on > each student file, which may or may not itself also have test cases. See also the reply I sent last evening describing how the sandbox library can be used for such things. (Given that you already have a bunch of files and only want to script checking them, the sandbox library is what you really need, not the handin server.) -- ((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 Jan 16 08:06:17 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:38:03 2009 Subject: [plt-scheme] Keybinding question Message-ID: <2411C300-C31D-452A-AEC1-3B718458D9C6@gmail.com> Hi all, I'm trying to set up an alternative keybinding for the "collapse- space" command (it defaults to "ESC;space" on OSX - I'd like to have a single press). So far I've got the code below. I think it doesn't work because "collapse-space" isn't a registered function in the keymap: (module mykeys (lib "keybinding-lang.ss" "framework") (require drscheme/tool-lib) (keybinding ":f2" (lambda (editor event) (message-box "Hi" (format "~a" (send (send editor get-keymap) get-chained-keymaps))) (raise #f) (send (send editor get-keymap) call-function "collapse-space" editor event #t)))) I imagine I'm probably going about this the wrong way. I've tried a couple of approaches and I always fall at the getting-hold-of-collapse- space hurdle. Can anyone help? Many thanks, -- Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/75945b54/attachment.html From jay.mccarthy at gmail.com Fri Jan 16 08:47:09 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:04 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> Message-ID: On Thu, Jan 15, 2009 at 11:23 PM, Henk Boom wrote: > I tried it in one of the nightly builds, and it seems to maintain the > concurrency limit properly. I've noticed, though, that threads > belonging to cancelled connections are no longer dropped, though, so > if I hit refresh 10 times in firefox with a concurrency limit of 1, it > actually does the full calculations for all of the responses one at a > time before I get the final response. > > I can't tell why this happens though, from looking at the above code. > Maybe it's because channel-put/get share the property of 'sleep' that > prevents the thread from being terminated? (What is that reason, by > the way?) The 'lock' will be released when it is yield or when the thread dies. The thread will die in a few different ways: completion (but this will cause a yield), exceptions (but this will cause a yield, from dynamic-wind), calling `exit' (no yield), or being shutdown by its custodian (no yield). It is unlikely that your code is calling `exit', so the most common way for the thread to die unnaturally is when its custodian is shutdown. There are a few conditions when the custodian for a connection (and thus its handler) is shut-down: 1. Timeout 2. Connection is HTTP/1.0 and first request is received 3. Error outputting the response 4. Error reading the request 5. The request handler is the servlet dispatcher and the servlet calls exit If the client closes the connection, then there is probably going to be an error in #3 or #4, because the port will be written/read and it will fail. You'll have to see what your browser is actually doing though, because it could be starting a new connection without killing the old (leading to #1); it could be using an HTTP/1.1 connection and sending a new request along in sequence with the first request, so they are all serviced; etc. You could do a wireshark and see what actually happens to the TCP connections. (Or just email a dump to me.) Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From mflatt at cs.utah.edu Fri Jan 16 08:53:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:04 2009 Subject: [plt-scheme] re-open a bytes/string port? In-Reply-To: <779bf2730901151855t2c2e7cbal35f9cacee28a7e6a@mail.gmail.com> References: <779bf2730901151855t2c2e7cbal35f9cacee28a7e6a@mail.gmail.com> Message-ID: <20090116135335.B4DBD6500E1@mail-svr1.cs.utah.edu> At Thu, 15 Jan 2009 18:55:58 -0800, YC wrote: > is there a way to *re-open* a bytes/string port? With a file port, I can > look at the object-name to obtain its path, and use that to open another > port reading from the file, but it appears there isn't an equivalent > mechanism for bytes/string unless I happen to have a handle of the original > source. There's no way to re-open the port. If the port is still open, you can rewind to the beginning by using the (badly named) `file-position' function. Matthew From robby at eecs.northwestern.edu Fri Jan 16 09:57:17 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:04 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> Perhaps I misunderstood, but I think Henk was looking for a different behavior, ie when there are too many connections in session that the webserver would just close and forget about the other connections. Robby On Fri, Jan 16, 2009 at 7:47 AM, Jay McCarthy wrote: > On Thu, Jan 15, 2009 at 11:23 PM, Henk Boom wrote: >> I tried it in one of the nightly builds, and it seems to maintain the >> concurrency limit properly. I've noticed, though, that threads >> belonging to cancelled connections are no longer dropped, though, so >> if I hit refresh 10 times in firefox with a concurrency limit of 1, it >> actually does the full calculations for all of the responses one at a >> time before I get the final response. >> >> I can't tell why this happens though, from looking at the above code. >> Maybe it's because channel-put/get share the property of 'sleep' that >> prevents the thread from being terminated? (What is that reason, by >> the way?) > > The 'lock' will be released when it is yield or when the thread dies. > The thread will die in a few different ways: completion (but this will > cause a yield), exceptions (but this will cause a yield, from > dynamic-wind), calling `exit' (no yield), or being shutdown by its > custodian (no yield). > > It is unlikely that your code is calling `exit', so the most common > way for the thread to die unnaturally is when its custodian is > shutdown. There are a few conditions when the custodian for a > connection (and thus its handler) is shut-down: > > 1. Timeout > 2. Connection is HTTP/1.0 and first request is received > 3. Error outputting the response > 4. Error reading the request > 5. The request handler is the servlet dispatcher and the servlet calls exit > > If the client closes the connection, then there is probably going to > be an error in #3 or #4, because the port will be written/read and it > will fail. You'll have to see what your browser is actually doing > though, because it could be starting a new connection without killing > the old (leading to #1); it could be using an HTTP/1.1 connection and > sending a new request along in sequence with the first request, so > they are all serviced; etc. > > You could do a wireshark and see what actually happens to the TCP > connections. (Or just email a dump to me.) > > Jay > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From lunarc.lists at gmail.com Fri Jan 16 10:02:39 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:38:04 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> References: <932b2f1f0901120852v5d445aaatde79392fc6eb020c@mail.gmail.com> <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> Message-ID: 2009/1/16 Robby Findler : > Perhaps I misunderstood, but I think Henk was looking for a different > behavior, ie when there are too many connections in session that the > webserver would just close and forget about the other connections. I think Jay got it right. =) It's not that I want to drop all connections after the first 5, it's just that if the connection is cancelled by the other party after it queues up, there's no point in letting it start. Henk From jay.mccarthy at gmail.com Fri Jan 16 10:17:07 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:04 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> Message-ID: On Fri, Jan 16, 2009 at 8:02 AM, Henk Boom wrote: > 2009/1/16 Robby Findler : >> Perhaps I misunderstood, but I think Henk was looking for a different >> behavior, ie when there are too many connections in session that the >> webserver would just close and forget about the other connections. I'm not sure how to do this... with semaphores I could use semaphore-try-wait?, but I don't know how to recreate that with the manager. > It's not that I want to drop all connections after the first 5, it's > just that if the connection is cancelled by the other party after it > queues up, there's no point in letting it start. One implication of the release rules I wrote earlier, is that a problem with the connection won't be noticed until it is written to, which is /after/ the work has been done. I'm not sure how (or if I'd want to) have another thread monitoring the connection port to see if it is active, it doesn't look like there is anything in scheme/tcp that does that. Jay -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From lunarc.lists at gmail.com Fri Jan 16 10:23:48 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:38:04 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> Message-ID: 2009/1/16 Jay McCarthy : > On Fri, Jan 16, 2009 at 8:02 AM, Henk Boom wrote: >> It's not that I want to drop all connections after the first 5, it's >> just that if the connection is cancelled by the other party after it >> queues up, there's no point in letting it start. > > One implication of the release rules I wrote earlier, is that a > problem with the connection won't be noticed until it is written to, > which is /after/ the work has been done. I'm not sure how (or if I'd > want to) have another thread monitoring the connection port to see if > it is active, it doesn't look like there is anything in scheme/tcp > that does that. I see what you mean. This could even be seen as a feature, for requests which result in side effects. Henk From robby at eecs.northwestern.edu Fri Jan 16 10:33:29 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:05 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> References: <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> Message-ID: <932b2f1f0901160733k1d117101w6263dd858ffba4fd@mail.gmail.com> On Fri, Jan 16, 2009 at 9:30 AM, Robby Findler wrote: > On Fri, Jan 16, 2009 at 9:17 AM, Jay McCarthy wrote: >> On Fri, Jan 16, 2009 at 8:02 AM, Henk Boom wrote: >>> 2009/1/16 Robby Findler : >>>> Perhaps I misunderstood, but I think Henk was looking for a different >>>> behavior, ie when there are too many connections in session that the >>>> webserver would just close and forget about the other connections. >> >> I'm not sure how to do this... with semaphores I could use >> semaphore-try-wait?, but I don't know how to recreate that with the >> manager. > > Oh, I was thinking of something where you'd hold onto a few > connections (like you're doing), but after some limit there, the > manager thread would just respond immediately with "close the > connection" and the thread that got the connection wouldn't block, but > would instead just shutdown the ports and die. Something like that. Actually, it may be better to hold onto the newer connections and start dropping older ones. So you'd have a buffer of some N pending connections and when the pending connection limit is exceeded, you'd start dropping older pending connections in favor of newer pending connections. (This is one of the great things about CML that we inherit -- you can design whatever useful protocol you want and they are easy to get right.) Robby From keydana at gmx.de Fri Jan 16 09:32:15 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:38:05 2009 Subject: [plt-scheme] Volunteers: help with Moby! Message-ID: <49709A6F.20005@gmx.de> Hi Danny, I'd be glad to help out. I suppose the most suitable might be the translation of primitive functions, to get into the project, if you agree. Also, would it be possible to get some more background information? I checked out the project, ran the test suite, read the README etc., but I'm still a bit unclear about the general purpose: Why a source-to-source compiler? mzc already compiles to bytecode, why not simply use this (plainly asked ;-) ) Then, about the source translation itself, are the essentials of how the translation to Java is done described somewhere - perhaps in some scientific publication you could mail me? And is this translation based on some other, preexisting scheme->java compiler, or is it independent? In fact this lets me clarify my question from above - I should have thought there must be quite some scheme->java compilers already? Perhaps this assumption was totally wrong - or perhaps most directly compile to bytecode, and the speciality of this project is exactly the translation to Java source? (Please don't get angry on my plain questions ;-) , I just want to "get" the main things about the application) [[[As an example of why I'd like some background on the compiler implementation, I just played around a bit and entered (program->java-string '(+ 2 3)) in drscheme, and the output "static { org.plt.Kernel.identity(org.plt.Kernel._plus_); }\nstatic { org.plt.Kernel.identity((new org.plt.types.Rational(2, 1))); }\nstatic { org.plt.Kernel.identity((new org.plt.types.Rational(3, 1))); }\n" is not too clear to me...]]] Thanks Sigrid From jay.mccarthy at gmail.com Fri Jan 16 10:33:29 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:05 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> References: <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> Message-ID: Hmm, I see. So, now I have (if (< i num) (wrap-evt in-ch (lambda (req) (channel-put (in-req-reply-ch req) #t) (loop (add1 i) (list* (in-req-partner req) partners)))) never-evt) but you are suggesting something like: (if (< i num) (wrap-evt in-ch (lambda (req) (channel-put (in-req-reply-ch req) #t) (loop (add1 i) (list* (in-req-partner req) partners)))) (wrap-evt in-ch (lambda (req) (channel-put (in-req-reply-ch req) #f) (loop i partners)))) where if the requester gets #f, then they error, and thus close the connection? That makes sense. Perhaps I will make it an option... Jay On Fri, Jan 16, 2009 at 8:30 AM, Robby Findler wrote: > On Fri, Jan 16, 2009 at 9:17 AM, Jay McCarthy wrote: >> On Fri, Jan 16, 2009 at 8:02 AM, Henk Boom wrote: >>> 2009/1/16 Robby Findler : >>>> Perhaps I misunderstood, but I think Henk was looking for a different >>>> behavior, ie when there are too many connections in session that the >>>> webserver would just close and forget about the other connections. >> >> I'm not sure how to do this... with semaphores I could use >> semaphore-try-wait?, but I don't know how to recreate that with the >> manager. > > Oh, I was thinking of something where you'd hold onto a few > connections (like you're doing), but after some limit there, the > manager thread would just respond immediately with "close the > connection" and the thread that got the connection wouldn't block, but > would instead just shutdown the ports and die. Something like that. > > Robby > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From robby at eecs.northwestern.edu Fri Jan 16 10:30:53 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:05 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> Message-ID: <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> On Fri, Jan 16, 2009 at 9:17 AM, Jay McCarthy wrote: > On Fri, Jan 16, 2009 at 8:02 AM, Henk Boom wrote: >> 2009/1/16 Robby Findler : >>> Perhaps I misunderstood, but I think Henk was looking for a different >>> behavior, ie when there are too many connections in session that the >>> webserver would just close and forget about the other connections. > > I'm not sure how to do this... with semaphores I could use > semaphore-try-wait?, but I don't know how to recreate that with the > manager. Oh, I was thinking of something where you'd hold onto a few connections (like you're doing), but after some limit there, the manager thread would just respond immediately with "close the connection" and the thread that got the connection wouldn't block, but would instead just shutdown the ports and die. Something like that. Robby From mflatt at cs.utah.edu Fri Jan 16 11:03:21 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:05 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> Message-ID: <20090116160322.430EE6500C7@mail-svr1.cs.utah.edu> At Fri, 16 Jan 2009 08:33:29 -0700, Jay McCarthy wrote: > (if (< i num) > (wrap-evt in-ch > (lambda (req) > (channel-put (in-req-reply-ch req) #t) > (loop (add1 i) > (list* (in-req-partner req) partners)))) > never-evt) A detail that I didn't catch before: if the process that sends the request terminates just before the `channel-put', then the lock server can get get stuck trying to send a reply to a thread that isn't there anymore. The simplest solution is to send the reply asynchronously: (wrap-evt in-ch (lambda (req) (thread (lambda () (channel-put (in-req-reply-ch req) #t))) (loop (add1 i) (list* (in-req-partner req) partners)))) Another solution is to sync on a combination of the thread and a channel-put evt: (lambda (req) (sync (handle-evt (channel-put-evt (in-req-reply-ch req) #t) (lambda () ;; notification accepted (loop (add1 i) (list* (in-req-partner req) partners)))) (handle-evt (in-req-partner req) (lambda () ;; other thread died first (loop i partners))))) Since your lock server already cleans up for partners that disappear, though, the asynchronous reply is probably better. If a thread can get suspended, and if you're using the latter solution, then you'd want to go even further, and have the reply lifted up to the main `sync' (because a suspended thread doesn't receive on a channel but also isn't dead). I don't think that case applies in the web server, though --- and the asynchronous reply covers that case, too. From jay.mccarthy at gmail.com Fri Jan 16 11:25:30 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:05 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <20090116160322.430EE6500C7@mail-svr1.cs.utah.edu> References: <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> <20090116160322.430EE6500C7@mail-svr1.cs.utah.edu> Message-ID: Thanks for the catch Matthew. I've done the asynchronous reply technique. I've also added an 'over-limit' keyword. It has three options: 'block, 'kill-new, and 'kill-old. From the new documentation: If there are no additional spaces inside the limit and a new request is received, the over-limit option determines what is done. The default ('block) causes the new request to block until an old request is finished handling. If over-limit is 'kill-new, then the new request handler is killed ? a form of load-shedding. If over-limit is 'kill-old, then the oldest request handler is killed ? prioritizing new connections over old. (This setting is a little dangerous because requests might never finish if there is constant load.) Jay On Fri, Jan 16, 2009 at 9:03 AM, Matthew Flatt wrote: > At Fri, 16 Jan 2009 08:33:29 -0700, Jay McCarthy wrote: >> (if (< i num) >> (wrap-evt in-ch >> (lambda (req) >> (channel-put (in-req-reply-ch req) #t) >> (loop (add1 i) >> (list* (in-req-partner req) partners)))) >> never-evt) > > A detail that I didn't catch before: if the process that sends the > request terminates just before the `channel-put', then the lock server > can get get stuck trying to send a reply to a thread that isn't there > anymore. > > The simplest solution is to send the reply asynchronously: > > (wrap-evt in-ch > (lambda (req) > (thread (lambda () > (channel-put (in-req-reply-ch req) #t))) > (loop (add1 i) > (list* (in-req-partner req) partners)))) > > Another solution is to sync on a combination of the thread and a > channel-put evt: > > (lambda (req) > (sync > (handle-evt (channel-put-evt (in-req-reply-ch req) #t) > (lambda () > ;; notification accepted > (loop (add1 i) > (list* (in-req-partner req) partners)))) > (handle-evt (in-req-partner req) > (lambda () > ;; other thread died first > (loop i partners))))) > > Since your lock server already cleans up for partners that disappear, > though, the asynchronous reply is probably better. > > If a thread can get suspended, and if you're using the latter solution, > then you'd want to go even further, and have the reply lifted up to the > main `sync' (because a suspended thread doesn't receive on a channel > but also isn't dead). I don't think that case applies in the web > server, though --- and the asynchronous reply covers that case, too. > > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From matthias at ccs.neu.edu Fri Jan 16 11:57:43 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:38:06 2009 Subject: [plt-scheme] Volunteers: help with Moby! In-Reply-To: <49709A6F.20005@gmx.de> References: <49709A6F.20005@gmx.de> Message-ID: <63847EDE-4EDB-4AA7-B4B7-203E3A41F65C@ccs.neu.edu> On Jan 16, 2009, at 9:32 AM, Sigrid Keydana wrote: > (program->java-string '(+ 2 3)) in drscheme's teaching languages has the following meaning: add the rational 2 to the rational 3 > in drscheme, and the output > > "static { org.plt.Kernel.identity(org.plt.Kernel._plus_); }\nstatic { > org.plt.Kernel.identity((new org.plt.types.Rational(2, 1))); } > \nstatic { > org.plt.Kernel.identity((new org.plt.types.Rational(3, 1))); }\n" Now read this as a sequence of static blocks to be added to a class's static init protocol: new org.plt.types.Rational(2, 1) // makes the rational # 2 (rationals are two integers) new org.plt.types.Rational(3, 1) // 3 org.plt.Kernel._plus_ // a command for adding Now you can ask the precise questions: -- what are the identity methods doing here -- how do the numeric constants and the plus operation get hooked up. From keydana at gmx.de Fri Jan 16 11:40:13 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:38:06 2009 Subject: [plt-scheme] Volunteers: help with Moby! In-Reply-To: <63847EDE-4EDB-4AA7-B4B7-203E3A41F65C@ccs.neu.edu> References: <49709A6F.20005@gmx.de> <63847EDE-4EDB-4AA7-B4B7-203E3A41F65C@ccs.neu.edu> Message-ID: <4970B86D.6030202@gmx.de> Thanks Then I am asking these precise questions now :-) ciao, Sigrid Matthias Felleisen schrieb: > > On Jan 16, 2009, at 9:32 AM, Sigrid Keydana wrote: > >> (program->java-string '(+ 2 3)) > > > in drscheme's teaching languages has the following meaning: > > add the rational 2 to the rational 3 > > >> in drscheme, and the output >> >> "static { org.plt.Kernel.identity(org.plt.Kernel._plus_); }\nstatic { >> org.plt.Kernel.identity((new org.plt.types.Rational(2, 1))); }\nstatic { >> org.plt.Kernel.identity((new org.plt.types.Rational(3, 1))); }\n" > > Now read this as a sequence of static blocks to be added to a class's > static init protocol: > > new org.plt.types.Rational(2, 1) // makes the rational # 2 (rationals > are two integers) > new org.plt.types.Rational(3, 1) // 3 > org.plt.Kernel._plus_ // a command for adding > > Now you can ask the precise questions: > > -- what are the identity methods doing here > -- how do the numeric constants and the plus operation get hooked up. > > From yinso.chen at gmail.com Fri Jan 16 13:40:52 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:06 2009 Subject: [plt-scheme] re-open a bytes/string port? In-Reply-To: <20090116135335.B4DBD6500E1@mail-svr1.cs.utah.edu> References: <779bf2730901151855t2c2e7cbal35f9cacee28a7e6a@mail.gmail.com> <20090116135335.B4DBD6500E1@mail-svr1.cs.utah.edu> Message-ID: <779bf2730901161040u513b1cdic2a8899ef7671cfb@mail.gmail.com> On Fri, Jan 16, 2009 at 5:53 AM, Matthew Flatt wrote: > > There's no way to re-open the port. If the port is still open, you can > rewind to the beginning by using the (badly named) `file-position' > function. > I think I can probably get around this issue by creating my own port struct to hold the bytes and the opened byte port for pass through. Something like: (define-struct byte-port (bytes port) #:property prop:input-port 1) Are there any issues (cost, synchronization, etc) with using port structs this way that I need to think about? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/7467afb2/attachment.htm From grettke at acm.org Fri Jan 16 14:24:57 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:38:07 2009 Subject: [plt-scheme] Keybinding question In-Reply-To: <2411C300-C31D-452A-AEC1-3B718458D9C6@gmail.com> References: <2411C300-C31D-452A-AEC1-3B718458D9C6@gmail.com> Message-ID: <756daca50901161124x4d3213afx77d1c394f1441e87@mail.gmail.com> Hi Dave, > I'm trying to set up an alternative keybinding for the "collapse-space" I tried you code and it didn't work as you wanted, but I widdled it down to this: (module dave-keys (lib "keybinding-lang.ss" "framework") (define (test editor event) (send (send editor get-keymap) call-function "collapse-space" editor event #t)) (keybinding ":f2" test)) and found that it did work on 4.1.2. I did try setting try-chain? to #f to check if any exceptions were thrown, and in the process found that DrScheme responds better to changes in the keymap by restarting completely rather than just adding and removing the keymap after each change. That sounds like what you experienced. From hendrik at topoi.pooq.com Sat Jan 17 08:29:06 2009 From: hendrik at topoi.pooq.com (hendrik@topoi.pooq.com) Date: Thu Mar 26 02:38:07 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: References: <932b2f1f0901120906u65b77c6al103850949b2f3225@mail.gmail.com> <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> Message-ID: <20090117132906.GA23114@topoi.pooq.com> On Fri, Jan 16, 2009 at 10:23:48AM -0500, Henk Boom wrote: > 2009/1/16 Jay McCarthy : > > On Fri, Jan 16, 2009 at 8:02 AM, Henk Boom wrote: > >> It's not that I want to drop all connections after the first 5, it's > >> just that if the connection is cancelled by the other party after it > >> queues up, there's no point in letting it start. > > > > One implication of the release rules I wrote earlier, is that a > > problem with the connection won't be noticed until it is written to, > > which is /after/ the work has been done. I'm not sure how (or if I'd > > want to) have another thread monitoring the connection port to see if > > it is active, it doesn't look like there is anything in scheme/tcp > > that does that. > > I see what you mean. This could even be seen as a feature, for > requests which result in side effects. in which case you'd want all of the side effects top be performed, or none of them, but not just some? -- hendrik From robby at eecs.northwestern.edu Fri Jan 16 14:38:29 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:07 2009 Subject: [plt-scheme] Keybinding question In-Reply-To: <756daca50901161124x4d3213afx77d1c394f1441e87@mail.gmail.com> References: <2411C300-C31D-452A-AEC1-3B718458D9C6@gmail.com> <756daca50901161124x4d3213afx77d1c394f1441e87@mail.gmail.com> Message-ID: <932b2f1f0901161138x5de192fi8258918caa9fdd36@mail.gmail.com> Yes, unfotunately, DrScheme doesn't do a good job of removing and re-adding keybindings when you change the file. Best to just restart Drscheme. I've added a note about this to the docs. Thanks, Robby On Fri, Jan 16, 2009 at 1:24 PM, Grant Rettke wrote: > Hi Dave, > >> I'm trying to set up an alternative keybinding for the "collapse-space" > > I tried you code and it didn't work as you wanted, but I widdled it > down to this: > > (module dave-keys (lib "keybinding-lang.ss" "framework") > > (define (test editor event) > (send (send editor get-keymap) call-function "collapse-space" > editor event #t)) > > (keybinding ":f2" test)) > > and found that it did work on 4.1.2. > > I did try setting try-chain? to #f to check if any exceptions were > thrown, and in the process found that DrScheme responds better to > changes in the keymap by restarting completely rather than just adding > and removing the keymap after each change. That sounds like what you > experienced. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From grettke at acm.org Fri Jan 16 14:50:08 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:38:07 2009 Subject: [plt-scheme] Volunteers: help with Moby! In-Reply-To: References: Message-ID: <756daca50901161150u24b6e40ala4eb913335e0adeb@mail.gmail.com> How much do potential contributors need to read on 'How To Design Worlds' and Functional Reactive Programming to fully appreicate that to which they may contribute? From sk at cs.brown.edu Fri Jan 16 14:55:49 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:38:07 2009 Subject: [plt-scheme] Volunteers: help with Moby! In-Reply-To: <756daca50901161150u24b6e40ala4eb913335e0adeb@mail.gmail.com> References: <756daca50901161150u24b6e40ala4eb913335e0adeb@mail.gmail.com> Message-ID: None, especially not FRP. Dive in and start hacking. [Seriously. Danny and I spent several days to try to make it easy to do so. If the documents aren't clear enough, we'd like to know so we can add/subtract/improve so people *can* dive in.] Shriram On Fri, Jan 16, 2009 at 2:50 PM, Grant Rettke wrote: > How much do potential contributors need to read on 'How To Design > Worlds' and Functional Reactive Programming to fully appreicate that > to which they may contribute? From cwbowron at gmail.com Fri Jan 16 14:56:57 2009 From: cwbowron at gmail.com (Christopher Bowron) Date: Thu Mar 26 02:38:08 2009 Subject: [plt-scheme] Error in Reference Guide (Parameters 10.3.2) Message-ID: <114e756c0901161156t457f47e4w45906ff24b8de624@mail.gmail.com> The documentation for make-derived-parameter appears incorrect. It is at least somewhat misleading http://docs.plt-scheme.org/reference/parameters.html#(def._((quote._~23~25kernel)._make-derived-parameter)) The docs say that the arguments to make-derived-parameter are: v: any/c guard: ... wrap: ... which makes it looks like its an extended version of make-parameter, when in fact its real arguments appear to be: p: parameter? guard: ... wrap: ... The first argument is a parameter not the initial value for a parameter. -- 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/20090116/8efe58c0/attachment.html From mflatt at cs.utah.edu Fri Jan 16 15:04:01 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:08 2009 Subject: [plt-scheme] Error in Reference Guide (Parameters 10.3.2) In-Reply-To: <114e756c0901161156t457f47e4w45906ff24b8de624@mail.gmail.com> References: <114e756c0901161156t457f47e4w45906ff24b8de624@mail.gmail.com> Message-ID: <20090116200403.0E0E16500E7@mail-svr1.cs.utah.edu> This is fixed for the next doc build --- thanks! At Fri, 16 Jan 2009 14:56:57 -0500, Christopher Bowron wrote: > The documentation for make-derived-parameter appears incorrect. It is at > least somewhat misleading > > http://docs.plt- > scheme.org/reference/parameters.html#(def._((quote._~23~25kernel)._make- > derived-parameter)) > > The docs say that the arguments to make-derived-parameter are: > > v: any/c > guard: ... > wrap: ... > > which makes it looks like its an extended version of make-parameter, when in > fact its real arguments appear to be: > > p: parameter? > guard: ... > wrap: ... > > The first argument is a parameter not the initial value for a parameter. > > -- > 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 mflatt at cs.utah.edu Fri Jan 16 15:06:00 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:08 2009 Subject: [plt-scheme] re-open a bytes/string port? In-Reply-To: <779bf2730901161040u513b1cdic2a8899ef7671cfb@mail.gmail.com> References: <779bf2730901151855t2c2e7cbal35f9cacee28a7e6a@mail.gmail.com> <20090116135335.B4DBD6500E1@mail-svr1.cs.utah.edu> <779bf2730901161040u513b1cdic2a8899ef7671cfb@mail.gmail.com> Message-ID: <20090116200602.36EC36500E7@mail-svr1.cs.utah.edu> At Fri, 16 Jan 2009 10:40:52 -0800, YC wrote: > On Fri, Jan 16, 2009 at 5:53 AM, Matthew Flatt wrote: > > > > > There's no way to re-open the port. If the port is still open, you can > > rewind to the beginning by using the (badly named) `file-position' > > function. > > > > I think I can probably get around this issue by creating my own port struct > to hold the bytes and the opened byte port for pass through. Something > like: > > (define-struct byte-port (bytes port) #:property prop:input-port 1) > > Are there any issues (cost, synchronization, etc) with using port structs > this way that I need to think about? No --- that should work well. There is an overhead in using the wrapped port, but it's small compared to most any operation on the port. Matthew From geoff at knauth.org Fri Jan 16 15:31:07 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:08 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <932b2f1f0901160733k1d117101w6263dd858ffba4fd@mail.gmail.com> References: <20090112173058.E34256500AD@mail-svr1.cs.utah.edu> <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> <932b2f1f0901160733k1d117101w6263dd858ffba4fd@mail.gmail.com> Message-ID: <8DD80449-6A2B-4ABC-8540-53ABB772832B@knauth.org> On Jan 16, 2009, at 10:33, Robby Findler wrote: > (This is one of the great things about CML that we inherit -- you > can design whatever useful protocol you want and they are easy to > get right.) CML == Concurrent ML ? From yinso.chen at gmail.com Fri Jan 16 15:44:26 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:09 2009 Subject: [plt-scheme] re-open a bytes/string port? In-Reply-To: <20090116200602.36EC36500E7@mail-svr1.cs.utah.edu> References: <779bf2730901151855t2c2e7cbal35f9cacee28a7e6a@mail.gmail.com> <20090116135335.B4DBD6500E1@mail-svr1.cs.utah.edu> <779bf2730901161040u513b1cdic2a8899ef7671cfb@mail.gmail.com> <20090116200602.36EC36500E7@mail-svr1.cs.utah.edu> Message-ID: <779bf2730901161244x42d8381eq42d8694a6ecedf7f@mail.gmail.com> On Fri, Jan 16, 2009 at 12:06 PM, Matthew Flatt wrote: > > > (define-struct byte-port (bytes port) #:property prop:input-port 1) > > > > Are there any issues (cost, synchronization, etc) with using port structs > > this way that I need to think about? > > No --- that should work well. There is an overhead in using the wrapped > port, but it's small compared to most any operation on the port. > Thanks for verifying, Matthew. I did a quick test and found that the overhead is minimal. I also compared against `substring` as reference, and found that regular string port still has a bit of overhead above substring. Is the overhead due to synchronization primitives? Thanks, yc (define s "this is a string that we are going to read and peek from") (define-struct wport (inner port) #:property prop:input-port 1) (define (open-input-wport s) (make-wport s ((cond ((string? s) open-input-string) ((bytes? s) open-input-bytes) (else (error 'open-input-wport "Unknown type: ~a" s))) s))) (define (test-port in count) (for ((i (in-range 0 count))) (read-bytes 50 in) (file-position in 0))) (define (test-string s count) (for ((i (in-range 0 count))) (substring s 0 50))) (define (test count) (let ((in1 (open-input-string s)) (in2 (open-input-wport s))) (time (test-port in1 count)) (time (test-port in2 count)) (time (test-string s count)) )) (test 500) ;; cpu time: 0 real time: 0 gc time: 0 ;; string port ;; cpu time: 1 real time: 1 gc time: 0 ;; wrapped port ;; cpu time: 0 real time: 0 gc time: 0 ;; substring (test 5000) ;; cpu time: 3 real time: 4 gc time: 0 ;; cpu time: 36 real time: 35 gc time: 31 ;; cpu time: 2 real time: 2 gc time: 0 (test 50000) ;; cpu time: 30 real time: 30 gc time: 0 ;; cpu time: 43 real time: 43 gc time: 1 ;; cpu time: 14 real time: 14 gc time: 0 (test 500000) ;; cpu time: 195 real time: 195 gc time: 4 ;; cpu time: 291 real time: 291 gc time: 4 ;; cpu time: 134 real time: 134 gc time: 7 (test 5000000) ;; cpu time: 1982 real time: 1982 gc time: 64 ;; cpu time: 3081 real time: 3080 gc time: 69 ;; cpu time: 1464 real time: 1465 gc time: 205 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/b8016ff2/attachment.htm From yinso.chen at gmail.com Fri Jan 16 15:57:48 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:10 2009 Subject: [plt-scheme] re-open a bytes/string port? In-Reply-To: <779bf2730901161244x42d8381eq42d8694a6ecedf7f@mail.gmail.com> References: <779bf2730901151855t2c2e7cbal35f9cacee28a7e6a@mail.gmail.com> <20090116135335.B4DBD6500E1@mail-svr1.cs.utah.edu> <779bf2730901161040u513b1cdic2a8899ef7671cfb@mail.gmail.com> <20090116200602.36EC36500E7@mail-svr1.cs.utah.edu> <779bf2730901161244x42d8381eq42d8694a6ecedf7f@mail.gmail.com> Message-ID: <779bf2730901161257h3e23d467p498c36ef2c50a26e@mail.gmail.com> On Fri, Jan 16, 2009 at 12:44 PM, YC wrote: > > Thanks for verifying, Matthew. I did a quick test and found that the > overhead is minimal. I also compared against `substring` as reference, and > found that regular string port still has a bit of overhead above substring. > Is the overhead due to synchronization primitives? > > Thanks, > yc > I just realized that I double counted on `test-port` as I did two separate operation - `read-bytes` & `file-position`. By changing it to `peek-bytes` the test is now fairer to the ports. A slight overhead of bytes port still exists over substring though. And the wrapped port's overhead is smaller as well. Thanks, yc (define (test-port in count) (for ((i (in-range 0 count))) (peek-bytes 50 0 in ))) (test 500) ;; cpu time: 1 real time: 0 gc time: 0 ;; cpu time: 0 real time: 1 gc time: 0 ;; cpu time: 0 real time: 0 gc time: 0 (test 5000) ;; cpu time: 3 real time: 3 gc time: 0 ;; cpu time: 34 real time: 35 gc time: 31 ;; cpu time: 2 real time: 2 gc time: 0 (test 50000) ;; cpu time: 24 real time: 24 gc time: 0 ;; cpu time: 27 real time: 27 gc time: 1 ;; cpu time: 19 real time: 20 gc time: 2 (test 500000) ;; cpu time: 163 real time: 163 gc time: 3 ;; cpu time: 173 real time: 173 gc time: 2 ;; cpu time: 135 real time: 135 gc time: 9 (test 5000000) ;; cpu time: 1594 real time: 1598 gc time: 63 ;; cpu time: 1761 real time: 1760 gc time: 61 ;; cpu time: 1456 real time: 1456 gc time: 208 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/49b45998/attachment.html From robby at eecs.northwestern.edu Fri Jan 16 16:50:14 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:10 2009 Subject: [plt-scheme] Limiting Concurrent Connections to Web Server In-Reply-To: <8DD80449-6A2B-4ABC-8540-53ABB772832B@knauth.org> References: <932b2f1f0901160657g19fee75bp7afb306ec3e14237@mail.gmail.com> <932b2f1f0901160730r38d4d46ey7e57c081492f972e@mail.gmail.com> <932b2f1f0901160733k1d117101w6263dd858ffba4fd@mail.gmail.com> <8DD80449-6A2B-4ABC-8540-53ABB772832B@knauth.org> Message-ID: <932b2f1f0901161350s1dc038a6u66c2a4ed5a6a0d2a@mail.gmail.com> On Fri, Jan 16, 2009 at 2:31 PM, Geoffrey S. Knauth wrote: > CML == Concurrent ML ? Yes. Robby From yinso.chen at gmail.com Fri Jan 16 17:33:47 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:11 2009 Subject: [plt-scheme] composing syntax-case macros? Message-ID: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> Hi all - I am running into issues composing a couple of syntax-case macros, and not sure where things go wrong. When I try to write a `cond-it` using an working `if-it` and `when-it`, I was unable to capture `it` within `cond-it`. ;; the working if-it & when-it (define-syntax (if-it stx) (syntax-case stx () ((if-it test? then else) (with-syntax ((it (datum->syntax #'if-it 'it))) #'(let ((it test?)) (if it then else)))))) (define-syntax (when-it stx) (syntax-case stx () ((~ test? exp exp2 ...) (with-syntax ((it (datum->syntax #'~ 'it))) #'(let ((it test?)) (when it exp exp2 ...)))))) ;; the non-working cond-it (define-syntax (cond-it stx) (syntax-case stx (else) ((cond-it (else exp exp2 ...)) #'(begin exp exp2 ...)) ((cond-it (test? exp exp2 ...)) #'(when-it test? exp exp2 ...)) ((cond-it (test? exp exp2 ...) cond1 cond2 ...) #'(if-it test? (begin exp exp2 ...) (cond-it cond1 cond2 ...))))) I tried to capture the `it` binding as well - but it still doesn't work. (define-syntax (cond-it stx) (syntax-case stx (else) ((cond-it (else exp exp2 ...)) #'(begin exp exp2 ...)) ((cond-it (test? exp exp2 ...)) (with-syntax ((it (datum->syntax #'cond-it 'it))) #'(when-it test? exp exp2 ...))) ((cond-it (test? exp exp2 ...) cond1 cond2 ...) (with-syntax ((it (datum->syntax #'cond-it 'it))) #'(if-it test? (begin exp exp2 ...) (cond-it cond1 cond2 ...)))))) When I finally write `cond-it` without using `if-it` and `when-it`, it worked. (define-syntax (cond-it stx) (syntax-case stx (else) ((cond-it (else exp exp2 ...)) #'(begin exp exp2 ...)) ((cond-it (test? exp exp2 ...)) (with-syntax ((it (datum->syntax #'cond-it 'it))) #'(let ((it test?)) (when it exp exp2 ...)))) ((cond-it (test? exp exp2 ...) cond cond2 ...) (with-syntax ((it (datum->syntax #'cond-it 'it))) #'(let ((it test?)) (if it (begin exp exp2 ...) (cond-it cond cond2 ...))))))) What am I missing here? How can `cond-it` be composed of `if-it` and `when-it`? Any tips are appreciated. Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/36fda0f4/attachment.htm From ryanc at ccs.neu.edu Fri Jan 16 18:52:30 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:38:11 2009 Subject: [plt-scheme] composing syntax-case macros? In-Reply-To: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> References: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> Message-ID: <678CB5B6-FA01-4129-A91B-240DB2315569@ccs.neu.edu> On Jan 16, 2009, at 5:33 PM, YC wrote: > Hi all - > > I am running into issues composing a couple of syntax-case macros, > and not sure where things go wrong. When I try to write a `cond-it` > using an working `if-it` and `when-it`, I was unable to capture `it` > within `cond-it`. It is difficult to write macros that expand into unhygienic macros. More below... > ;; the working if-it & when-it > > (define-syntax (if-it stx) > (syntax-case stx () > ((if-it test? then else) > (with-syntax ((it (datum->syntax #'if-it 'it))) > #'(let ((it test?)) > (if it then else)))))) Note: the lexical context of the introduced 'it' variable comes from the 'if-it' macro keyword. If the 'if-it' identifier and the references to 'it' in the branch expressions are both part of the original program, then they have the same lexical context and the introduced 'it' captures the references to 'it'. > (define-syntax (when-it stx) > (syntax-case stx () > ((~ test? exp exp2 ...) > (with-syntax ((it (datum->syntax #'~ 'it))) > #'(let ((it test?)) (when it exp exp2 ...)))))) > > ;; the non-working cond-it > (define-syntax (cond-it stx) > (syntax-case stx (else) > ((cond-it (else exp exp2 ...)) > #'(begin exp exp2 ...)) > ((cond-it (test? exp exp2 ...)) > #'(when-it test? exp exp2 ...)) > ((cond-it (test? exp exp2 ...) cond1 cond2 ...) > #'(if-it test? (begin exp exp2 ...) > (cond-it cond1 cond2 ...))))) When 'cond-it' expands and produces an 'if-it' expression, the 'if-it' is marked by the macro expander as coming from a macro. That means its lexical context is different from the 'it' variables in the branches. That means that the 'it' variable binding produced by 'if-it' does not capture the 'it' references in the branches. The macro stepper will show you this using colors. Try an example. The original code is in black. The parts introduced by 'cond-it' are in a different color (like red or blue). > I tried to capture the `it` binding as well - but it still doesn't > work. > > > (define-syntax (cond-it stx) > (syntax-case stx (else) > ((cond-it (else exp exp2 ...)) > #'(begin exp exp2 ...)) > ((cond-it (test? exp exp2 ...)) > (with-syntax ((it (datum->syntax #'cond-it 'it))) > #'(when-it test? exp exp2 ...))) > ((cond-it (test? exp exp2 ...) cond1 cond2 ...) > (with-syntax ((it (datum->syntax #'cond-it 'it))) > #'(if-it test? (begin exp exp2 ...) > (cond-it cond1 cond2 ...)))))) The 'it' pattern variable above isn't used in the syntax template. It has no effect on the code you produce. One thing you could do is put in the code to patch one 'it' into the other 'it'. Here's the code. (I've also simplified the patterns a little). (define-syntax (cond-it stx) (syntax-case stx (else) ((cond-it) #'(void)) ((cond-it (else exp exp1 ...)) #'(begin exp exp1 ...)) ((cond-it (test? exp ...) cond1 ...) (with-syntax ((original-it (datum->syntax #'cond-it 'it))) #'(if-it test? (let ([original-it it]) (begin (void) exp ...)) (cond-it cond1 ...)))))) I recommend using the macro stepper to see why this works. The problem is, this is really fragile. Try changing the occurrences of 'cond-it' in the syntax patterns to '_' instead, and watch it break. > When I finally write `cond-it` without using `if-it` and `when-it`, > it worked. > > (define-syntax (cond-it stx) > (syntax-case stx (else) > ((cond-it (else exp exp2 ...)) > #'(begin exp exp2 ...)) > ((cond-it (test? exp exp2 ...)) > (with-syntax ((it (datum->syntax #'cond-it 'it))) > #'(let ((it test?)) (when it exp exp2 ...)))) > ((cond-it (test? exp exp2 ...) cond cond2 ...) > (with-syntax ((it (datum->syntax #'cond-it 'it))) > #'(let ((it test?)) > (if it (begin exp exp2 ...) > (cond-it cond cond2 ...))))))) > > What am I missing here? How can `cond-it` be composed of `if-it` > and `when-it`? The problem comes from having macros introduce unhygienic bindings of 'it'. A better way to do it would be to bind 'it' to a syntax parameter and update the meaning of 'it' in the expansion of an 'if- it' expression (using 'syntax-parameterize'). Here's the code: ;; Warning: entering PLT-specific macrology zone :) #lang scheme (require scheme/stxparam) (define-syntax-parameter it (lambda (stx) (raise-syntax-error #f "illegal use" stx))) (define-syntax if-it (syntax-rules () [(if-it test then else) (let ([temp test]) (syntax-parameterize ([it (make-rename-transformer #'temp)]) (if temp then else)))])) (define-syntax cond-it (syntax-rules (else) ((cond-it) (void)) ((cond-it (else exp exp1 ...)) (begin exp exp1 ...)) ((cond-it (test? exp ...) cond1 ...) (if-it test? (begin (void) exp ...) (cond-it cond1 ...))))) Ryan > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From yinso.chen at gmail.com Fri Jan 16 19:36:57 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:11 2009 Subject: [plt-scheme] composing syntax-case macros? In-Reply-To: <678CB5B6-FA01-4129-A91B-240DB2315569@ccs.neu.edu> References: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> <678CB5B6-FA01-4129-A91B-240DB2315569@ccs.neu.edu> Message-ID: <779bf2730901161636l36a25334n933eb7ffe39089e6@mail.gmail.com> On Fri, Jan 16, 2009 at 3:52 PM, Ryan Culpepper wrote: > > ;; the non-working cond-it >> (define-syntax (cond-it stx) >> (syntax-case stx (else) >> ((cond-it (else exp exp2 ...)) >> #'(begin exp exp2 ...)) >> ((cond-it (test? exp exp2 ...)) >> #'(when-it test? exp exp2 ...)) >> ((cond-it (test? exp exp2 ...) cond1 cond2 ...) >> #'(if-it test? (begin exp exp2 ...) >> (cond-it cond1 cond2 ...))))) >> > > When 'cond-it' expands and produces an 'if-it' expression, the 'if-it' is > marked by the macro expander as coming from a macro. That means its lexical > context is different from the 'it' variables in the branches. That means > that the 'it' variable binding produced by 'if-it' does not capture the 'it' > references in the branches. > I see - based on this I tried to see if I can mark `if-it` to be the same lexical context but i get a compiler warning instead... (define-syntax (cond-it stx) (syntax-case stx (else) ((~) #'(void)) ((~ (else exp exp2 ...)) #'(begin exp exp2 ...)) ((~ (test? exp exp2 ...) cond1 ...) (with-syntax ((if-it (datum->syntax #'~ 'if-it))) #'(if-it test? (begin exp exp2 ...) (cond-it cond1 ...)))))) > (cond-it (#f 'hello) ("test me" it) (else 'nothing)) compile: identifier used out of context in: if-it I guess the app position cannot not be "captured" this way? The macro stepper will show you this using colors. Try an example. The > original code is in black. The parts introduced by 'cond-it' are in a > different color (like red or blue). > I'm working in emacs so I don't have macro stepper handy at the moment - is there a way to call macro stepper (a cmdline or repl version) from mzscheme? The problem comes from having macros introduce unhygienic bindings of 'it'. > A better way to do it would be to bind 'it' to a syntax parameter and update > the meaning of 'it' in the expansion of an 'if-it' expression (using > 'syntax-parameterize'). This is macro voodoo! ;) I'll have to learn more about syntax parameters and transformers. Is there some sort of guide docs that talks about how and why (usages) on these capabilites? Thansks for demonstrating the cool technique and the clear explanation. yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/4c9fe155/attachment.html From dyoo at cs.wpi.edu Fri Jan 16 20:06:02 2009 From: dyoo at cs.wpi.edu (Danny Yoo) Date: Thu Mar 26 02:38:12 2009 Subject: Fwd: [plt-scheme] Volunteers: help with Moby! In-Reply-To: References: <49709A6F.20005@gmx.de> Message-ID: >> I'd be glad to help out. I suppose the most suitable might be the >> translation of primitive functions, to get into the project, if you >> agree. >> >> Also, would it be possible to get some more background information? >> I checked out the project, ran the test suite, read the README >> etc., but I'm still a bit unclear about the general purpose: Why a >> source-to-source compiler? mzc already compiles to bytecode, why >> not simply use this (plainly asked ;-) ) Hi Sigrid, We're emitting Java source because it's fairly simple, and the approach interacts more compatible with the components of our toolchain. i.e. the Android virtual machine uses bytecodes altogether different from mzscheme's (and from the JDK, for that matter!). One other point against bytecode translation is that mzscheme's bytecodes are a moving target, and as far as I can tell, Android's bytecodes are undocumented and subject to change at whim. Our approach, to translate to a single output language (Java), is simpler than writing translators between different bytecodes whose definition languages have a good chance of changing on us. The other restriction we're up against is J2ME, whose API is more restrictive than the full Java J2SE API. Existing Scheme to Java compilers assume they've got all of J2SE; we don't, since we're targeting mobile devices. We're also a bit specialized because our applications will be based on the World paradigm. >> Then, about the source translation itself, are the essentials of >> how the translation to Java is done described somewhere - perhaps >> in some scientific publication you could mail me? The translation is dumber than you might expect. :) src/beginner-to-java.ss does as standard pattern matching against the Beginner Level scheme grammar. The techniques are well known; you can learn more about them from a book like PLAI: http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ >> And is this translation based on some other, preexisting >> scheme->java compiler, or is it independent? In fact this lets me >> clarify my question from above - I should have thought there must >> be quite some scheme->java compilers already? Independent. There are existing scheme->java translators out there; I know of Bigloo off the top of my head, and I'm aware of Kawa as well. Both of these introduce dependencies to their respective runtimes and J2SE primitives, and might not fit into the constraints of the mobile platforms we're aiming at. In any event, even if it did fit J2ME, a JVM bytecode approach isn't amendable with the Android toolchain, which requires Java source to process to its proprietary format. Since we're working with a restricted subset of the Java API, we wanted full control of how that translation worked. If it turns out that we can reuse an existing translator, with fine-grained control over how that translation works, we can swap that component out. But this is a secondary concern. Your next question brings up the primary one: >> Perhaps this assumption was totally wrong - or perhaps most >> directly compile to bytecode, and the speciality of this project is >> exactly the translation to Java source? The focus of our work isn't actually about the Scheme->Java stuff: the more interesting stuff will be: how do we naturally expose features that are specific to cell-phones and other mobile devices? Things like handling the accelerometer, or the location service, or touchscreens, those will be the avenues that we'll be working on in the immediate future. >> (Please don't get angry on my plain questions ;-) , I just want to >> "get" the main things about the application) No problem! >> [[[As an example of why I'd like some background on the compiler >> implementation, I just played around a bit and entered >> >> (program->java-string '(+ 2 3)) Oh! There's a comment in src/beginner-to-java.ss that should explain what happened. ;; A program is a (listof (or/c defn? expr?)) The input that you gave isn't either of those. :) To do what you really wanted: (program->java-string '((+ 2 3))) would be it. >> in drscheme, and the output >> >> "static { org.plt.Kernel.identity(org.plt.Kernel._plus_); }\nstatic { >> org.plt.Kernel.identity((new org.plt.types.Rational(2, 1))); }\nstatic { >> org.plt.Kernel.identity((new org.plt.types.Rational(3, 1))); }\n" >> >> is not too clear to me...]]] It's garbage in, garbage out. You should have gotten a contract error here, if not for my lax contracts. It serves me right for not putting the right contracts on those functions. I'll fix this tonight. If you have more questions, please feel free to ask! From lunarc.lists at gmail.com Fri Jan 16 20:59:37 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:38:12 2009 Subject: [plt-scheme] call/cc puzzle Message-ID: I wonder if anyone else will have fun figuring out what this does: ((call/cc call/cc) (call/cc call/cc)) Henk From ryanc at ccs.neu.edu Fri Jan 16 21:12:39 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:38:12 2009 Subject: [plt-scheme] composing syntax-case macros? In-Reply-To: <779bf2730901161636l36a25334n933eb7ffe39089e6@mail.gmail.com> References: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> <678CB5B6-FA01-4129-A91B-240DB2315569@ccs.neu.edu> <779bf2730901161636l36a25334n933eb7ffe39089e6@mail.gmail.com> Message-ID: <49713E97.7040500@ccs.neu.edu> YC wrote: > On Fri, Jan 16, 2009 at 3:52 PM, Ryan Culpepper wrote: > >> ;; the non-working cond-it >>> (define-syntax (cond-it stx) >>> (syntax-case stx (else) >>> ((cond-it (else exp exp2 ...)) >>> #'(begin exp exp2 ...)) >>> ((cond-it (test? exp exp2 ...)) >>> #'(when-it test? exp exp2 ...)) >>> ((cond-it (test? exp exp2 ...) cond1 cond2 ...) >>> #'(if-it test? (begin exp exp2 ...) >>> (cond-it cond1 cond2 ...))))) >>> >> When 'cond-it' expands and produces an 'if-it' expression, the 'if-it' is >> marked by the macro expander as coming from a macro. That means its lexical >> context is different from the 'it' variables in the branches. That means >> that the 'it' variable binding produced by 'if-it' does not capture the 'it' >> references in the branches. >> > > I see - based on this I tried to see if I can mark `if-it` to be the same > lexical context but i get a compiler warning instead... > > (define-syntax (cond-it stx) > (syntax-case stx (else) > ((~) #'(void)) > ((~ (else exp exp2 ...)) > #'(begin exp exp2 ...)) > ((~ (test? exp exp2 ...) cond1 ...) > (with-syntax ((if-it (datum->syntax #'~ 'if-it))) > #'(if-it test? (begin exp exp2 ...) > (cond-it cond1 ...)))))) > >> (cond-it (#f 'hello) ("test me" it) (else 'nothing)) > compile: identifier used out of context in: if-it > > I guess the app position cannot not be "captured" this way? That approach has a flaw that has nothing to do with the error you got. Suppose that you write a module that imports just 'cond-it', not 'if-it'. Or suppose that your module renames them or prefixes their names when you import them. Then when your macro creates the 'if-it' identifier, it will have the context of that module, where 'if-it' isn't bound. You're trying to use 'if-it' to carry the lexical context for the 'it' binding it introduces, but its lexical context is already doing work---it tells the macro expander where to look up the 'if-it' macro. This is why macros like 'if-it' are much more problematic than macros like 'define-struct', which is also unhygienic. The 'define-struct' macro also creates bindings of names it generates with 'datum->syntax'; for example, (define-struct circle (radius color)) defines 'make-circle', 'circle-radius', etc. But the lexical context for those names comes from the struct name ('circle'), which isn't acting as a reference. If the lexical context for the introduced names came from the 'define-struct' keyword instead, it would have all the same problems as 'if-it'. > The macro stepper will show you this using colors. Try an example. The >> original code is in black. The parts introduced by 'cond-it' are in a >> different color (like red or blue). >> > > I'm working in emacs so I don't have macro stepper handy at the moment - is > there a way to call macro stepper (a cmdline or repl version) from mzscheme? Yes, although it's not nearly as nice as the one in DrScheme. Search the help desk for 'expand/step-text'. > The problem comes from having macros introduce unhygienic bindings of 'it'. >> A better way to do it would be to bind 'it' to a syntax parameter and update >> the meaning of 'it' in the expansion of an 'if-it' expression (using >> 'syntax-parameterize'). > > > This is macro voodoo! ;) I'll have to learn more about syntax parameters > and transformers. Is there some sort of guide docs that talks about how and > why (usages) on these capabilites? I wrote a blog post about syntax parameters a couple years ago: http://macrologist.blogspot.com/2006/04/macros-parameters-binding-and.html Other than that, the Guide and the Reference. I'm also working on a collection of macro techniques and design patterns. I hope to post a draft of it sometime in the near future. > Thansks for demonstrating the cool technique and the clear explanation. Glad to help. Ryan From eli at barzilay.org Fri Jan 16 21:45:47 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:12 2009 Subject: [plt-scheme] composing syntax-case macros? In-Reply-To: <49713E97.7040500@ccs.neu.edu> References: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> <678CB5B6-FA01-4129-A91B-240DB2315569@ccs.neu.edu> <779bf2730901161636l36a25334n933eb7ffe39089e6@mail.gmail.com> <49713E97.7040500@ccs.neu.edu> Message-ID: <18801.18011.304300.796460@arabic.ccs.neu.edu> On Jan 16, Ryan Culpepper wrote: > YC wrote: > > On Fri, Jan 16, 2009 at 3:52 PM, Ryan Culpepper wrote: > >> The problem comes from having macros introduce unhygienic > >> bindings of 'it'. A better way to do it would be to bind 'it' to > >> a syntax parameter and update the meaning of 'it' in the > >> expansion of an 'if-it' expression (using 'syntax-parameterize'). > > > > This is macro voodoo! ;) I'll have to learn more about syntax > > parameters and transformers. Is there some sort of guide docs > > that talks about how and why (usages) on these capabilites? > > I wrote a blog post about syntax parameters a couple years ago: > http://macrologist.blogspot.com/2006/04/macros-parameters-binding-and.html You can also see http://blog.plt-scheme.org/2008/02/dirty-looking-hygiene.html which is explaining exactly an if-it variant. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From yinso.chen at gmail.com Sat Jan 17 02:05:03 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:13 2009 Subject: [plt-scheme] composing syntax-case macros? In-Reply-To: <49713E97.7040500@ccs.neu.edu> References: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> <678CB5B6-FA01-4129-A91B-240DB2315569@ccs.neu.edu> <779bf2730901161636l36a25334n933eb7ffe39089e6@mail.gmail.com> <49713E97.7040500@ccs.neu.edu> Message-ID: <779bf2730901162305r5a75e2dbl4cfc6987f67f7764@mail.gmail.com> On Fri, Jan 16, 2009 at 6:12 PM, Ryan Culpepper wrote: > > That approach has a flaw that has nothing to do with the error you got. > Suppose that you write a module that imports just 'cond-it', not 'if-it'. Or > suppose that your module renames them or prefixes their names when you > import them. Then when your macro creates the 'if-it' identifier, it will > have the context of that module, where 'if-it' isn't bound. You're trying to > use 'if-it' to carry the lexical context for the 'it' binding it introduces, > but its lexical context is already doing work---it tells the macro expander > where to look up the 'if-it' macro. > I see. Thanks. I wrote a blog post about syntax parameters a couple years ago: > http://macrologist.blogspot.com/2006/04/macros-parameters-binding-and.html > > Other than that, the Guide and the Reference. > > I'm also working on a collection of macro techniques and design patterns. I > hope to post a draft of it sometime in the near future. Thanks for the link - looking forward to your draft! Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/87ab61c8/attachment.htm From yinso.chen at gmail.com Sat Jan 17 02:06:38 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:13 2009 Subject: [plt-scheme] composing syntax-case macros? In-Reply-To: <18801.18011.304300.796460@arabic.ccs.neu.edu> References: <779bf2730901161433jc7f92c5qd75432226821ed3c@mail.gmail.com> <678CB5B6-FA01-4129-A91B-240DB2315569@ccs.neu.edu> <779bf2730901161636l36a25334n933eb7ffe39089e6@mail.gmail.com> <49713E97.7040500@ccs.neu.edu> <18801.18011.304300.796460@arabic.ccs.neu.edu> Message-ID: <779bf2730901162306s6310c5dem400f80b75d2dee82@mail.gmail.com> On Fri, Jan 16, 2009 at 6:45 PM, Eli Barzilay wrote: > You can also see > > http://blog.plt-scheme.org/2008/02/dirty-looking-hygiene.html > > which is explaining exactly an if-it variant. > Thanks Eli - the defmacro is also quite cool! yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090116/ed5df4ae/attachment.html From keydana at gmx.de Sat Jan 17 01:57:20 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:38:13 2009 Subject: Fwd: [plt-scheme] Volunteers: help with Moby! In-Reply-To: References: <49709A6F.20005@gmx.de> Message-ID: <49718150.1070606@gmx.de> Hi Danny, thanks a lot for the detailed explanations! That helped a lot. I will also definitely read the PLAI book, in fact it's exactly something I've been looking for! [At the moment I'm in the middle of "Design Concepts in Programming Languages", which I like a lot - even though it's been hard to get into at first when you've never been a student of computer science but just a self-taught career-changer and have never heard of "denotational semantics" before -, it's very fascinating but what I was searching for was also something more practical about parsing and compiling. Which was why I just now started the Aho Compiler book in-between which at least in the new edition seems more practical, but here I'm already missing all the scheme/functional stuff I'm used to/addicted to since SICP... So I'll definitely read this now!] Have a nice weekend and thanks again, Sigrid Danny Yoo schrieb: >>> I'd be glad to help out. I suppose the most suitable might be the >>> translation of primitive functions, to get into the project, if you >>> agree. >>> >>> Also, would it be possible to get some more background information? >>> I checked out the project, ran the test suite, read the README >>> etc., but I'm still a bit unclear about the general purpose: Why a >>> source-to-source compiler? mzc already compiles to bytecode, why >>> not simply use this (plainly asked ;-) ) >>> > > Hi Sigrid, > > We're emitting Java source because it's fairly simple, and the > approach interacts more compatible with the components of our > toolchain. i.e. the Android virtual machine uses bytecodes altogether > different from mzscheme's (and from the JDK, for that matter!). > > One other point against bytecode translation is that mzscheme's > bytecodes are a moving target, and as far as I can tell, Android's > bytecodes are undocumented and subject to change at whim. Our > approach, to translate to a single output language (Java), is simpler > than writing translators between different bytecodes whose definition > languages have a good chance of changing on us. > > The other restriction we're up against is J2ME, whose API is more > restrictive than the full Java J2SE API. Existing Scheme to Java > compilers assume they've got all of J2SE; we don't, since we're > targeting mobile devices. We're also a bit specialized because our > applications will be based on the World paradigm. > > > > >>> Then, about the source translation itself, are the essentials of >>> how the translation to Java is done described somewhere - perhaps >>> in some scientific publication you could mail me? >>> > > The translation is dumber than you might expect. :) > src/beginner-to-java.ss does as standard pattern matching against the > Beginner Level scheme grammar. The techniques are well known; you can > learn more about them from a book like PLAI: > > http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/ > > > > >>> And is this translation based on some other, preexisting >>> scheme->java compiler, or is it independent? In fact this lets me >>> clarify my question from above - I should have thought there must >>> be quite some scheme->java compilers already? >>> > > Independent. There are existing scheme->java translators out there; I > know of Bigloo off the top of my head, and I'm aware of Kawa as > well. Both of these introduce dependencies to their respective > runtimes and J2SE primitives, and might not fit into the constraints > of the mobile platforms we're aiming at. In any event, even if it did > fit J2ME, a JVM bytecode approach isn't amendable with the Android > toolchain, which requires Java source to process to its proprietary > format. > > Since we're working with a restricted subset of the Java API, we > wanted full control of how that translation worked. If it turns out > that we can reuse an existing translator, with fine-grained control > over how that translation works, we can swap that component out. But > this is a secondary concern. Your next question brings up the primary > one: > > > >>> Perhaps this assumption was totally wrong - or perhaps most >>> directly compile to bytecode, and the speciality of this project is >>> exactly the translation to Java source? >>> > > The focus of our work isn't actually about the Scheme->Java stuff: the > more interesting stuff will be: how do we naturally expose features > that are specific to cell-phones and other mobile devices? Things > like handling the accelerometer, or the location service, or > touchscreens, those will be the avenues that we'll be working on in > the immediate future. > > > > >>> (Please don't get angry on my plain questions ;-) , I just want to >>> "get" the main things about the application) >>> > > No problem! > > > > >>> [[[As an example of why I'd like some background on the compiler >>> implementation, I just played around a bit and entered >>> >>> (program->java-string '(+ 2 3)) >>> > > > Oh! There's a comment in src/beginner-to-java.ss that should explain > what happened. > > ;; A program is a (listof (or/c defn? expr?)) > > The input that you gave isn't either of those. :) To do what you > really wanted: > > (program->java-string '((+ 2 3))) > > would be it. > > > > >>> in drscheme, and the output >>> >>> "static { org.plt.Kernel.identity(org.plt.Kernel._plus_); }\nstatic { >>> org.plt.Kernel.identity((new org.plt.types.Rational(2, 1))); }\nstatic { >>> org.plt.Kernel.identity((new org.plt.types.Rational(3, 1))); }\n" >>> >>> is not too clear to me...]]] >>> > > It's garbage in, garbage out. You should have gotten a contract error > here, if not for my lax contracts. It serves me right for not putting > the right contracts on those functions. I'll fix this tonight. > > > If you have more questions, please feel free to ask! > > From geoff at knauth.org Sat Jan 17 03:26:49 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:14 2009 Subject: [plt-scheme] Volunteers: help with Moby! In-Reply-To: References: <49709A6F.20005@gmx.de> Message-ID: <0225DB0B-E499-4BBE-82C5-C971652C03B9@knauth.org> Thanks Sigrid for your questions and Danny for your code and your answers! Two years ago I had an inexperienced beginning CS student who came up with a project idea to write a Java app for his mobile phone. I didn't encourage him to pursue it that semester because it seemed like way too much work in the first couple of months of CS1. But now, with your Moby project, a student with a bright idea like that has a workable option. Geoff From jos.koot at telefonica.net Sat Jan 17 04:43:27 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:14 2009 Subject: [plt-scheme] call/cc puzzle References: Message-ID: Is that a quation or just a nice gesture? Jos ----- Original Message ----- From: "Henk Boom" To: "Scheme PLT" Sent: Saturday, January 17, 2009 2:59 AM Subject: [plt-scheme] call/cc puzzle >I wonder if anyone else will have fun figuring out what this does: > > ((call/cc call/cc) (call/cc call/cc)) > > Henk > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From lunarc.lists at gmail.com Sat Jan 17 09:14:52 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:38:14 2009 Subject: [plt-scheme] call/cc puzzle In-Reply-To: References: Message-ID: 2009/1/17 Jos Koot : > Is that a quation or just a nice gesture? > Jos The latter. I had fun coming up with it and figuring out why it did what it did, and I thought maybe other people would as well. =) Henk From jcoglan at googlemail.com Sat Jan 17 09:42:02 2009 From: jcoglan at googlemail.com (James Coglan) Date: Thu Mar 26 02:38:15 2009 Subject: [plt-scheme] Lazy evaluation and tail calls Message-ID: Hi there, My apologies if this is the wrong place to be asking this, but I'm new to Scheme and am not sure where I can get this question answered. If you know a better place to ask this, please point me in the right direction. Basically, I'm learning Scheme by implementing it in Ruby while reading SICP. I've added tail calls and also an optional lazy (normal-order) evaluation mode, but I can't get the two to play together. I have a factorial function that runs iteratively in eager mode, but it blows up the stack in lazy mode. I was wondering whether it's possible to have tail call optimisation when using normal order. I don't want to bang my head against the wall trying to make it happen if it can't be done. -- James Coglan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090117/cc695bc5/attachment.htm From vinay.sachdev at gmail.com Sat Jan 17 10:30:24 2009 From: vinay.sachdev at gmail.com (Vinay Sachdev) Date: Thu Mar 26 02:38:15 2009 Subject: [plt-scheme] Issue in ver-4.0 with mutable pairs Message-ID: Hi, I am reading SICP and i am at the start of chap-3. I am using PLT-Scheme ver-4.0 .I ran into problem with mutable pairs. it was giving error. So instead of using set-car! i used set-mcar!, but then even to create list i have to create mutable list. I have an older version also(ver-3.71). Is it a bad idea to install older version or is there any other way out? My main purpose is to do read SICP and do its exercise. One more question, is there any other issues with PLT-Scheme in later chapters of SICP? Please help. -- Thanks and Regards Vinay Sachdev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090117/3790bda8/attachment.html From jensaxel at soegaard.net Sat Jan 17 10:39:57 2009 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:38:16 2009 Subject: [plt-scheme] Issue in ver-4.0 with mutable pairs In-Reply-To: References: Message-ID: <4971FBCD.4050906@soegaard.net> Vinay Sachdev skrev: > Hi, > I am reading SICP and i am at the start of chap-3. > I am using PLT-Scheme ver-4.0 .I ran into problem with > mutable pairs. it was giving error. So instead of using > set-car! i used set-mcar!, but then even to create list > i have to create mutable list. > I have an older version also(ver-3.71). Is it a bad idea to > install older version or is there any other way out? In the module language, try this: #lang r5rs (let ((p (cons 1 2))) (set-car! p 4) (display p)) It prints (4 . 2). > My main purpose is to do read SICP and do its exercise. > One more question, is there any other issues with > PLT-Scheme in later chapters of SICP? When you come to the picture language, use this PLaneT package: http://planet.plt-scheme.org/package-source/soegaard/sicp.plt/2/1/planet-docs/sicp-manual/index.html /Jens Axel From jos.koot at telefonica.net Sat Jan 17 10:50:39 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:16 2009 Subject: [plt-scheme] Lazy evaluation and tail calls References: Message-ID: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> There is an important difference between normal order and lazy order. But let's assume you really mean lazy order. In that case you need to use syntax `lazy', not `delay' (see srfi 45, immediately available in PLT's scheme/base) When using delay, you may easily create deeply nested promises. For example, when you implement promises simply as: (define-syntax delay (syntax-rules () ((_ x) (lambda () x)))) (define (force x) (x)) you are going to have problems. You need a more subtle type of promises (those like srfi 45) In normal order ((lambda (x) (cons x x)) (begin (write 'foo) 'foo)) writes `foo' twice, in lazy order once only. You might check for that. If you implemented normal order rather than lazy order, the problem does not surprise me. You may also want to look into srfi 41 (streams) which implements and shows many examples of lazy order evaluation. I have two implementations that allow mixing lazy and eager evaluation, but I am not yet satisfied about them and therefore do not yet want to present them to this list. If you are interested, let me know. Last but not least, did you look in the lazy scheme of PLT? Very instructive. Jos ----- Original Message ----- From: James Coglan To: PLT Scheme ML Sent: Saturday, January 17, 2009 3:42 PM Subject: [plt-scheme] Lazy evaluation and tail calls Hi there, My apologies if this is the wrong place to be asking this, but I'm new to Scheme and am not sure where I can get this question answered. If you know a better place to ask this, please point me in the right direction. Basically, I'm learning Scheme by implementing it in Ruby while reading SICP. I've added tail calls and also an optional lazy (normal-order) evaluation mode, but I can't get the two to play together. I have a factorial function that runs iteratively in eager mode, but it blows up the stack in lazy mode. I was wondering whether it's possible to have tail call optimisation when using normal order. I don't want to bang my head against the wall trying to make it happen if it can't be done. -- James Coglan ------------------------------------------------------------------------------ _________________________________________________ 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/20090117/facc269c/attachment.htm From jos.koot at telefonica.net Sat Jan 17 10:57:35 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:17 2009 Subject: [plt-scheme] attempt to discern applications from syntactic formsfails References: <508100EB46F143C9BC81E1D3CD7CD233@uw2b2dff239c4d> <20090115175700.8A47165010F@mail-svr1.cs.utah.edu> Message-ID: Thanks Matthew, with your help I concocted the following: ; (macro-id? id-stx) (identifier? . -> . boolean?) ; For use in a transformer only. ; Returns #t if the id-stx has a syntactic binding in the syntax local context of the run-time environment. ; If not, returns #f including when id-stx is not bound at all. (define (macro-id? id) (let/ec ec (call-with-exception-handler (lambda (exn) (ec #t)) (lambda () (syntax-case* (local-expand #`(#,id) (syntax-local-context) '()) (#%plain-app) free-transformer-identifier=? ((#%plain-app . z) #f) (_ #t)))))) Jos ----- Original Message ----- From: "Matthew Flatt" To: "Jos Koot" Cc: Sent: Thursday, January 15, 2009 6:57 PM Subject: Re: [plt-scheme] attempt to discern applications from syntactic formsfails > At Thu, 15 Jan 2009 18:40:36 +0100, "Jos Koot" wrote: >> My question is at the <===== in the following code: >> >> (define-syntax (x stx) >> (syntax-case stx () >> ((_ x) >> (let ((y (expand-once #'x))) >> (printf "~s~n" (syntax->datum y)) >> (syntax-case y (#%app) >> ((#%app . z) #''app) >> (_ #''no-app)))))) >> >> [...] >> (x (list 1 2 3)) >> ; printed (#%app list 1 2 3) >> ; value: no-app, why??? <===== I expected app > > The `expand-once' is working at phase 1, while `syntax-case' is > comparing identifiers at phase 0. > > Furthermore, the `#%app' of `scheme/base' is being expanded to > `#%plain-app'. Confusingly, in the scope of the `#%app' definition, > `#%plain-app' is called `#%app', so the expansion prints as `#%app' > > So, you would have gotten the expected results with > > (syntax-case* y (#%plain-app) free-transformer-identifier=? > ((#%plain-app . z) #''app) > (_ #''no-app)) > > > I doubt that this is what you really intended, though. I think it's > more likely that you wanted to use `local-expand' (which will expand > the given expression at phase 0) and use `#%app' as one of the stop > forms, in which case the `syntax-case' match would work as you expect. > > Actually, depending on the context, it's probably better to use > `#%plain-app' as a stop form, in which case you'll match on > `#%plain-app'. That works with macros defined in a language other than > `scheme/base', since `#%plain-app' is the primitive application form. > > > Matthew > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090117/59e58d24/attachment.html From grettke at acm.org Sat Jan 17 11:42:31 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:38:17 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: Message-ID: <756daca50901170842s1fd3ed6eh6ec140ec9654c4c9@mail.gmail.com> On Sat, Jan 17, 2009 at 8:42 AM, James Coglan wrote: > I have a factorial function that runs iteratively in eager mode, but it blows up the stack in lazy mode. > I was wondering whether it's possible to have tail call optimisation when using normal order. Do you want to add a construct to allow for the programmer to specify that something be eagerly evaluated in lazy mode, or you want the interpreter to perform that step automically? I think that Haskell and Lazy Scheme offer the former but I'm not any more familiar than that. From jcoglan at googlemail.com Sat Jan 17 12:23:32 2009 From: jcoglan at googlemail.com (James Coglan) Date: Thu Mar 26 02:38:18 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> Message-ID: > There is an important difference between normal order and lazy order. But > let's assume you really mean lazy order. > > In normal order ((lambda (x) (cons x x)) (begin (write 'foo) 'foo)) writes > `foo' twice, in lazy order once only. You might check for that. > At the moment, it's lazy. In the above expression, x would be assigned the expression "(begin (write 'foo) 'foo)" (rather than the value of the expression), in the appropriate binding. My bound expressions are memoized so the expression is only evalled once, though if you take out the memoization you get normal order behaviour. Right now, I've got a very bare bones Scheme and I'm more interested in algorithms for optimising stuff rather than tools in a specific language. (Also I've just started learning Scheme, and while my current implementation is in Ruby I imagine it will flesh out so I can do more stuff in Scheme directly.) My runtime just lets you start it up in lazy or eager mode; there's no provision in the language itself for delaying execution. To try to figure this out I've logged the call stack in lazy and eager mode to watch what happens when I run the following code. Turns out lazy mode does tail-recurse, but when (= y 0) is finally true, we eval "acc", which is bound to the expression "(* y acc)", which expands to (* 1 (* 2 (* 3 (* 4 1)))), which is not tail recursive. So I suppose the next question would be: is it possible in principle to construct an interpreter than can expand any given lazily bound expression in eager order, without using recursion and blowing up the stack? Alternatively, is it possible to formulate a tail recursive factorial function in normal-order Scheme? (define (fact x) (begin (define (rec y acc) (cond ((= y 0) acc) (else (rec (- y 1) (* y acc))))) (rec x 1))) (fact 4) Stack logs are here: http://gist.github.com/48360. -- James Coglan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090117/01fad0f6/attachment.htm From jcoglan at googlemail.com Sat Jan 17 12:24:53 2009 From: jcoglan at googlemail.com (James Coglan) Date: Thu Mar 26 02:38:19 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> Message-ID: > Right now, I've got a very bare bones Scheme and I'm more interested in > algorithms for optimising stuff rather than tools in a specific language. > (Also I've just started learning Scheme, and while my current implementation > is in Ruby I imagine it will flesh out so I can do more stuff in Scheme > directly.) My runtime just lets you start it up in lazy or eager mode; > there's no provision in the language itself for delaying execution. > By the way, in case it's of any interest at all, my project is on Github at http://github.com/jcoglan/heist. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090117/34cfe8e9/attachment.html From jmarshall at alum.mit.edu Sat Jan 17 12:26:47 2009 From: jmarshall at alum.mit.edu (Joe Marshall) Date: Thu Mar 26 02:38:19 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: Message-ID: On Sat, Jan 17, 2009 at 6:42 AM, James Coglan wrote: > > I was wondering whether it's possible to have tail call optimisation when > using normal order. I don't want to bang my head against the wall trying to > make it happen if it can't be done. To answer your question directly: it isn't easy and it might not be possible at all. If anyone *really* knows the answer, it is Will Clinger. I might be a bit behind the times here, but I believe it is still an open question the way you have phrased it. I'll go out on a limb and suggest that a good explanation is worthy of a degree. There are a couple major obstacles to understanding. First is a formal definition of tail-recursion in a call-by-name or call-by-need language. It took about 20 years for a good formal definition of tail-recursion to be developed for plain old call-by-value Scheme. Clinger identified a hierarchy of six space complexity classes that a program and implementation may exhibit, and showed that the intuitive notion of tail-recursion involved the implementations actual space usage as compared against the necessary space usage as defined by the space complexity. Unfortunately it is very difficult to reason about space usage in a call-by-need or call-by-name language, even on an informal level. So your first task would be to figure out how to determine the space usage (preferrably statically!). The second task would be to identify a number of space complexity classes. I suspect that you'd find about the same number as in call-by-value, but I could easily believe that you'd find a few more or a few less. Or perhaps *many* *many* more, seeing as it is hard to understand. Then you'd have to judge whether an implementation (asymptotically) uses more storage than the complexity class warrants. *Then* you should figure out how to get the implementation to avoid using the excess storage. I think this would be quite a project. But perhaps someone has already done most of the heavy lifting. I'm not entirely sure, but if Will is reading, maybe he can offer some corrections. -- ~jrm From cce at ccs.neu.edu Sat Jan 17 12:45:01 2009 From: cce at ccs.neu.edu (Carl Eastlund) Date: Thu Mar 26 02:38:19 2009 Subject: [plt-scheme] Dracula 7.1 release Message-ID: <990e0c030901170945n2767f392o96a06aaa16bac0dc@mail.gmail.com> I have just released version 7.1 of Dracula, the ACL2 language level for DrScheme. This version includes four primary improvements over version 6.0: - A complete overhaul of the graphical user interface. - Two separate manuals: a Guide introducing the primary features and a Reference manual for technical details. - Improved compatibility with ACL2. Dracula is no longer limited to specific distributions. - A revamped Modular ACL2 language, now fully documented and integrated with the theorem prover interface. Details on obtaining and installing Dracula can be found here: http://www.ccs.neu.edu/home/cce/acl2/ An online copy of the Guide can be found here: http://planet.plt-scheme.org/package-source/cce/dracula.plt/7/1/planet-docs/guide/index.html An online copy of the Reference can be found here: http://planet.plt-scheme.org/package-source/cce/dracula.plt/7/1/planet-docs/reference/index.html At the moment, online copies of the documentation are browseable, but some cross-references and search features are disabled. The Dracula package includes an offline copy of the documentation, including working links and search functionality. Thanks to Sky O'Mara and Ken McGrady for their contributions to the new user interface and documentation. -- Carl Eastlund From matthias at ccs.neu.edu Sat Jan 17 13:43:16 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:38:20 2009 Subject: [plt-scheme] call/cc puzzle In-Reply-To: References: Message-ID: <7E7CF89E-212E-4A24-ABEE-708D02FE4A3F@ccs.neu.edu> Exercise: design, implement, and test the smallest Redex model that shows why the answer is what it is. -- Matthias http://redex.plt-scheme.org/ On Jan 17, 2009, at 9:14 AM, Henk Boom wrote: > 2009/1/17 Jos Koot : >> Is that a quation or just a nice gesture? >> Jos > > The latter. I had fun coming up with it and figuring out why it did > what it did, and I thought maybe other people would as well. =) > > Henk > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From rafkind at cs.utah.edu Sat Jan 17 14:22:00 2009 From: rafkind at cs.utah.edu (Jon Rafkind) Date: Thu Mar 26 02:38:20 2009 Subject: [plt-scheme] call/cc puzzle In-Reply-To: References: Message-ID: <49722FD8.7050107@cs.utah.edu> Henk Boom wrote: > 2009/1/17 Jos Koot : > >> Is that a quation or just a nice gesture? >> Jos >> > > The latter. I had fun coming up with it and figuring out why it did > what it did, and I thought maybe other people would as well. =) > > I think I figured out at least part of it. Hope I don't spoil it for others.. (let ([f (call/cc1 call/cc2)]) (printf "f is ~a\n" f) (f (lambda (x) (printf "x is ~a\n" x)))) I wrote call/cc1 and call/cc2 to mean call/cc but so I could identify them in the explanation. The result of this prints f is # f is # x is # The flow is this: call/cc1 passes its continuation to call/cc2 which invokes the first continuation with the second. So f is now equal to the continuation of call/cc2 and it prints # as expected. Now f is invoked with the continuation of call/cc2 with (lambda (x) ...) which starts the computation at (let ([f ...]) ...) so f is now bound to (lambda (x) ...). Printing this results in , and then the f [which is now (lambda (x) ...)] is applied to (lambda (x) ...) which prints # again. So at the end it does ((lambda (x) (printf "x is ~a\n" x)) (lambda (x) (printf "x is ~a\n" x))). Maybe this is obvious to some people but it took me at least 15 minutes to figure out. From sk at cs.brown.edu Sat Jan 17 14:38:20 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:38:20 2009 Subject: [plt-scheme] call/cc puzzle In-Reply-To: <49722FD8.7050107@cs.utah.edu> References: <49722FD8.7050107@cs.utah.edu> Message-ID: Just remember that putting a use of call/cc in a context changes the meaning of that use... On Jan 17, 2009 2:22 PM, "Jon Rafkind" wrote: Henk Boom wrote: > > 2009/1/17 Jos Koot : > >> >> Is that a quation or ju... I think I figured out at least part of it. Hope I don't spoil it for others.. (let ([f (call/cc1 call/cc2)]) (printf "f is ~a\n" f) (f (lambda (x) (printf "x is ~a\n" x)))) I wrote call/cc1 and call/cc2 to mean call/cc but so I could identify them in the explanation. The result of this prints f is # f is # x is # The flow is this: call/cc1 passes its continuation to call/cc2 which invokes the first continuation with the second. So f is now equal to the continuation of call/cc2 and it prints # as expected. Now f is invoked with the continuation of call/cc2 with (lambda (x) ...) which starts the computation at (let ([f ...]) ...) so f is now bound to (lambda (x) ...). Printing this results in , and then the f [which is now (lambda (x) ...)] is applied to (lambda (x) ...) which prints # again. So at the end it does ((lambda (x) (printf "x is ~a\n" x)) (lambda (x) (printf "x is ~a\n" x))). Maybe this is obvious to some people but it took me at least 15 minutes to figure out. _________________________________________________ For list-related administrative tasks: http://l... -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090117/1ed746df/attachment.htm From maxigas at anargeek.net Sat Jan 17 17:28:09 2009 From: maxigas at anargeek.net (maxigas) Date: Thu Mar 26 02:38:21 2009 Subject: [plt-scheme] inverse regexp Message-ID: <20090117.232809.19932462.maxigas@anargeek.net> hi! i am writing an application using dispatch (as you suggested earlier) which would process all URLs, but i want to exclude the htdocs directory to serve static files. i understand that serve/servlet's #:servlet-regexp key controls which URLs are passed to start, but i couldn't find out how to write a regexp which excludes "htdocs". so what i want is to match everything that is NOT #rx"^/htdocs/.*" i have something like this in my web server config section: (serve/servlet start #:servlet-path "/" #:servlet-regexp #rx".*tag1.*" #:launch-browser? #f #:port 8080 #:file-not-found-responder file-not-found #:command-line? #f) From chust at web.de Sat Jan 17 17:52:50 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:38:21 2009 Subject: [plt-scheme] inverse regexp In-Reply-To: <20090117.232809.19932462.maxigas@anargeek.net> References: <20090117.232809.19932462.maxigas@anargeek.net> Message-ID: <49726142.9080409@web.de> maxigas wrote: > [...] > so what i want is to match everything that is NOT #rx"^/htdocs/.*" > [...] Hello, I would suggest using negative lookahead: #rx"^(?!/htdocs/)" cu, Thomas From jensaxel at soegaard.net Sat Jan 17 18:04:49 2009 From: jensaxel at soegaard.net (Jens Axel Soegaard) Date: Thu Mar 26 02:38:21 2009 Subject: [plt-scheme] call/cc puzzle In-Reply-To: References: Message-ID: <49726411.1080306@soegaard.net> Henk Boom wrote: > 2009/1/17 Jos Koot : >> Is that a quation or just a nice gesture? >> Jos > > The latter. I had fun coming up with it and figuring out why it did > what it did, and I thought maybe other people would as well. =) Now you are warm, try Eugene Kohlbecker's mind-bender called Mondo Bizarro. It is a Scheme classic. ;;; Mondo Bizarro ; What does the following program print? ; Why? (define program (lambda () (let ((y (call-with-current-continuation (lambda (c) c)))) (display 1) (call-with-current-continuation (lambda (c) (y c))) (display 2) (call-with-current-continuation (lambda (c) (y c))) (display 3)))) (program) -- Jens Axel S?gaard From jay.mccarthy at gmail.com Sat Jan 17 20:19:26 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:21 2009 Subject: [plt-scheme] inverse regexp In-Reply-To: <49726142.9080409@web.de> References: <20090117.232809.19932462.maxigas@anargeek.net> <49726142.9080409@web.de> Message-ID: Another option is to have your servlet call (next-dispatcher) from web-server/dispatchers/dispatch when it doesn't want to handle any particular request. Jay On Sat, Jan 17, 2009 at 3:52 PM, Thomas Chust wrote: > maxigas wrote: >> [...] >> so what i want is to match everything that is NOT #rx"^/htdocs/.*" >> [...] > > Hello, > > I would suggest using negative lookahead: #rx"^(?!/htdocs/)" > > cu, > Thomas > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From eli at barzilay.org Sat Jan 17 21:51:51 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:21 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> Message-ID: <18802.39239.86637.164585@arabic.ccs.neu.edu> On Jan 17, James Coglan wrote: > > Right now, I've got a very bare bones Scheme and I'm more interested > in algorithms for optimising stuff rather than tools in a specific > language. The `lazy' promises that Jos mentioned are not just tools: they are essentially a way to implement delayed evaluation in a way that is still safe for space. You describe how your evaluator is holding an expression with the appropriate bindings -- and this is essentially a promise value. The promises that are implemented in PLT's scheme/promise library are therefore very relevant, and a solution (to some degree) to your problem is what that code is doing. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From chust at web.de Sat Jan 17 22:09:11 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:38:21 2009 Subject: [plt-scheme] Progress information from PLaneT Message-ID: <49729D57.2000606@web.de> Hello, I wonder whether it is possible to get any progress display or messages that show what is happening from the long running PLaneT commands. When adding some larger package with a bunch of dependencies to a fresh PLT Scheme installation with planet install, one can wait for several minutes for the command to complete and not a single line of output is generated. In the documentation, the help output from the command line utility and by experimentation I haven't found a way to enable any kind of more verbose output than this total silence, except in case of errors :-( >From a package manager I would expect that it at least prints out which packages are being installed, preferrably together with counts of packages already processed and remaining to be installed to give the user an idea how long the setup may take. cu, Thomas From robby at eecs.northwestern.edu Sat Jan 17 22:27:20 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:21 2009 Subject: [plt-scheme] Progress information from PLaneT In-Reply-To: <49729D57.2000606@web.de> References: <49729D57.2000606@web.de> Message-ID: <932b2f1f0901171927j4aa7d81eh2b401e082036f9a8@mail.gmail.com> There should be a mode where it prints something, I agree. But just so it is clear, the ordinary 'require' mode doesn't and shouldn't print anything because it is just an ordinary require and so it shouldn't produce extra (observable) effects. It has been suggested that, when a require from planet happens inside drscheme, drscheme should show you the progress. That should be doable, but I haven't had a chance to actually do it yet. Robby On Sat, Jan 17, 2009 at 9:09 PM, Thomas Chust wrote: > Hello, > > I wonder whether it is possible to get any progress display or messages > that show what is happening from the long running PLaneT commands. > > When adding some larger package with a bunch of dependencies to a fresh > PLT Scheme installation with planet install, one can wait for several > minutes for the command to complete and not a single line of output is > generated. In the documentation, the help output from the command line > utility and by experimentation I haven't found a way to enable any kind > of more verbose output than this total silence, except in case of errors :-( > > >From a package manager I would expect that it at least prints out which > packages are being installed, preferrably together with counts of > packages already processed and remaining to be installed to give the > user an idea how long the setup may take. > > cu, > Thomas > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From ikentobi at yahoo.com Sun Jan 18 08:39:02 2009 From: ikentobi at yahoo.com (Luka Stojanovic) Date: Thu Mar 26 02:38:22 2009 Subject: [plt-scheme] question about rnrs/enums-6 Message-ID: <493503.79740.qm@web55808.mail.re3.yahoo.com> Hi everyone! I am learning Scheme for a few week or so, and recently I've tried to make enumerated type: #lang/scheme (require rnrs/enums-6) (define my-enum1 (make-enumeration '(a b c))) ; will cause: make-enumeration: expected argument of type ; given (a b c) (define my-enum1 (make-enumeration (a b c))) ; will cause (expectedly): reference to an identifier before its definition: a (define-enumeration my-enum2 (a b c) my-enum-set) ; work as advertised Am I missing something obvious here, or is this some sort of incompatibility between Module and R6RS? Anyway, I'll probably forget enums, because order doesn't make difference to me. I could use symbols, with possibility to check things like this: (define (my-enum? e) (or (eq? e 'a) (eq? e 'b) (eq? e 'c))) What would be "the proper", most idiomatic way to handle this situation anyway? From mflatt at cs.utah.edu Sun Jan 18 09:09:06 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:22 2009 Subject: [plt-scheme] question about rnrs/enums-6 In-Reply-To: <493503.79740.qm@web55808.mail.re3.yahoo.com> References: <493503.79740.qm@web55808.mail.re3.yahoo.com> Message-ID: <20090118140908.4AA3D6500A3@mail-svr1.cs.utah.edu> At Sun, 18 Jan 2009 05:39:02 -0800 (PST), Luka Stojanovic wrote: > I am learning Scheme for a few week or so, and recently I've tried to make > enumerated type: > > #lang/scheme > (require rnrs/enums-6) > > (define my-enum1 (make-enumeration '(a b c))) > ; will cause: make-enumeration: expected argument of type symbols>; given (a b c) This is a mismatch between the `scheme' language and the `r6rs' language, which have different notions of "list". The `r6rs' variant is mutable while the `scheme' variant is immutable. The `rnrs/enums-6' library is designed to work with `r6rs'. If you want to use it in a `scheme' module, you can bridge the two kinds of lists by using the `scheme/mpair' library: #lang scheme (require rnrs/enums-6 scheme/mpair) (define my-enum1 (make-enumeration (list->mlist '(a b c)))) > Anyway, I'll probably forget enums, because order doesn't make difference to > me. I could use symbols, with possibility to check things like this: > > (define (my-enum? e) (or (eq? e 'a) (eq? e 'b) (eq? e 'c))) > > What would be "the proper", most idiomatic way to handle this > situation anyway? I'd write (define (my-enum? e) (memq e '(a b c))) Matthew From robby at eecs.northwestern.edu Sun Jan 18 09:16:26 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:22 2009 Subject: [plt-scheme] question about rnrs/enums-6 In-Reply-To: <20090118140908.4AA3D6500A3@mail-svr1.cs.utah.edu> References: <493503.79740.qm@web55808.mail.re3.yahoo.com> <20090118140908.4AA3D6500A3@mail-svr1.cs.utah.edu> Message-ID: <932b2f1f0901180616j85f2d99k4c175249b97cd27e@mail.gmail.com> On Sun, Jan 18, 2009 at 8:09 AM, Matthew Flatt wrote: >> Anyway, I'll probably forget enums, because order doesn't make difference to >> me. I could use symbols, with possibility to check things like this: >> >> (define (my-enum? e) (or (eq? e 'a) (eq? e 'b) (eq? e 'c))) >> >> What would be "the proper", most idiomatic way to handle this >> situation anyway? > > I'd write > > (define (my-enum? e) (memq e '(a b c))) Or, if you are only using it in a error check somewhere, you might consider contracts, where you can write: (or/c 'a 'b 'c) Robby From chust at web.de Sun Jan 18 09:19:25 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:38:22 2009 Subject: [plt-scheme] question about rnrs/enums-6 In-Reply-To: <493503.79740.qm@web55808.mail.re3.yahoo.com> References: <493503.79740.qm@web55808.mail.re3.yahoo.com> Message-ID: <49733A6D.40404@web.de> Luka Stojanovic wrote: > [...] > #lang/scheme > (require rnrs/enums-6) > > (define my-enum1 (make-enumeration '(a b c))) > ; will cause: make-enumeration: expected argument of type ; given (a b c) > [...] Hello, this is another case where one is unexpectedly bitten by PLT Scheme's recent change to immutable pairs (and hence lists) in the default Scheme dialect while the RnRS dialects continue to use mutable pairs (and hence lists). To make your code work, you have to pass a mutable list to make-enumeration instead of an immutable one. For example you can do the following: #lang scheme (require scheme/mpair rnrs/enums-6) (define my-enum1 (make-enumeration (mlist 'a 'b 'c))) > [...] > What would be "the proper", most idiomatic way to handle this situation anyway? > [...] Scheme is a weakly typed language, so using symbols instead of instances of some special enumerated type is stylistically ok, I think. You can find many places where this is done -- for example in keyword arguments to the PLT standard library functions opening files. However it is practical to be able to check whether the symbols belong to a certain predefined set. In the default dialect of PLT Scheme I would recommend using contracts for this purpose, like this: (define (my-function sym) (case sym [(symbol-a) ... do something ...] [(symbol-b) ... do something ...] [(symbol-c) ... do something ...])) (provide/contract [my-function ((one-of/c 'symbol-a 'symbol-b 'symbol-c) . -> . any)]) To check the membership of a symbol in a set yourself, I would recommend to use hash tables: (define my-symbol-set #hasheq((symbol-a . #t) (symbol-b . #t) (symbol-c . #t))) (define (in-my-symbol-set? sym) (hash-ref my-symbol-set sym #f)) If you need or wish to use full blown enumerated types with many more features than the R6RS enumerations, there is a PLaneT package providing you with the necessary tools: (require (planet dvanhorn/finite-types:1:1/finite-types)) (define-enumerated-type color :color color? colors color-name color-index (red green blue black white)) I hope this helps you solve your problem :-) cu, Thomas From jcoglan at googlemail.com Sun Jan 18 10:07:15 2009 From: jcoglan at googlemail.com (James Coglan) Date: Thu Mar 26 02:38:23 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: <18802.39239.86637.164585@arabic.ccs.neu.edu> References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> <18802.39239.86637.164585@arabic.ccs.neu.edu> Message-ID: 2009/1/18 Eli Barzilay > On Jan 17, James Coglan wrote: > > > > Right now, I've got a very bare bones Scheme and I'm more interested > > in algorithms for optimising stuff rather than tools in a specific > > language. > > The `lazy' promises that Jos mentioned are not just tools: they are > essentially a way to implement delayed evaluation in a way that is > still safe for space. You describe how your evaluator is holding an > expression with the appropriate bindings -- and this is essentially a > promise value. The promises that are implemented in PLT's > scheme/promise library are therefore very relevant, and a solution (to > some degree) to your problem is what that code is doing. Sorry for the misunderstanding: I just meant to emphasise that I was more after a language-neutral discussion of algorithms for the problem I was trying to solve. I imagine at some point I will want to implement delay/force in my Scheme, but for now I want a way to make Scheme transparently lazy. This is mostly because I'm reading "To Mock a Mockingbird" and doing some lambda calculus, which requires normal order evaluation in order to be directly expressed in Scheme. Joe, Jos: sadly I'm not equipped to provide any formal reasoning at this stage -- Scheme and SICP are really my first foray into any formal study of computer science. All I can tell is that it looks like you'd need to somehow evaluate the promises from the inside out iteratively and have the result propagate into the binding of the next outer promise before evaluating it, so you'd be able to evaluate the promises in the some order as you would in call-by-value. This would involve every promise storing references to any promises that need its value, which would use extra storage space, and you'd need to flatten the tree of promise dependencies without using recursion in the host language. I'll let you know if I figure something out. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090118/cdf700d3/attachment.html From jos.koot at telefonica.net Sun Jan 18 10:51:13 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:23 2009 Subject: [plt-scheme] Lazy evaluation and tail calls References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d><18802.39239.86637.164585@arabic.ccs.neu.edu> Message-ID: ----- Original Message ----- From: James Coglan To: Eli Barzilay Cc: PLT Scheme ML Sent: Sunday, January 18, 2009 4:07 PM Subject: Re: [plt-scheme] Lazy evaluation and tail calls 2009/1/18 Eli Barzilay On Jan 17, James Coglan wrote: > > Right now, I've got a very bare bones Scheme and I'm more interested > in algorithms for optimising stuff rather than tools in a specific > language. The `lazy' promises that Jos mentioned are not just tools: they are essentially a way to implement delayed evaluation in a way that is still safe for space. You describe how your evaluator is holding an expression with the appropriate bindings -- and this is essentially a promise value. The promises that are implemented in PLT's scheme/promise library are therefore very relevant, and a solution (to some degree) to your problem is what that code is doing. Sorry for the misunderstanding: I just meant to emphasise that I was more after a language-neutral discussion of algorithms for the problem I was trying to solve. I imagine at some point I will want to implement delay/force in my Scheme, but for now I want a way to make Scheme transparently lazy. This is mostly because I'm reading "To Mock a Mockingbird" and doing some lambda calculus, which requires normal order evaluation in order to be directly expressed in Scheme. Joe, Jos: sadly I'm not equipped to provide any formal reasoning at this stage -- Scheme and SICP are really my first foray into any formal study of computer science. All I can tell is that it looks like you'd need to somehow evaluate the promises from the inside out iteratively and have the result propagate into the binding of the next outer promise before evaluating it, so you'd be able to evaluate the promises in the some order as you would in call-by-value. This would involve every promise storing references to any promises that need its value, which would use extra storage space, and you'd need to flatten the tree of promise dependencies without using recursion in the host language. I'll let you know if I figure something out. Exactly, you are on the right track, I think. As I earlier wrote in a private email, you should, I think, first find out about self lifting promises as referred to by Eli (and very well and very generally implemented in PLT (Thanks Eli)). Then, there is a way to transform a tail recursive procedure into a space safe reference to an element of a stream. An interesting idea, thanks. In fact PLT's lazy scheme (thanks again Eli) does that (or at least comes very close) Using lazy Scheme, you can write a laymans implementation of `equal-fringe?' and have it operate without any superfluous generation of the parts of the fringes that are not relevant. That is the inequality should be detected before the remainder of the two fringes have been formed that follow two inequal elements. Just an example, but a good one, I think. Another nice example of how laziness can go wrong is described in SRFI 40 (by Phil Bewig). It is called the times3 problem. It has been adequately been solved in srfi 45 (Andre van Tonder) and used in srfi 41 (Phil Bewig) Jos ------------------------------------------------------------------------------ _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090118/95fa94c7/attachment.htm From eli at barzilay.org Sun Jan 18 12:20:36 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:24 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> <18802.39239.86637.164585@arabic.ccs.neu.edu> Message-ID: <18803.25828.976648.493811@arabic.ccs.neu.edu> On Jan 18, James Coglan wrote: > 2009/1/18 Eli Barzilay > > > The `lazy' promises that Jos mentioned are not just tools: they > > are essentially a way to implement delayed evaluation in a way > > that is still safe for space. You describe how your evaluator is > > holding an expression with the appropriate bindings -- and this is > > essentially a promise value. The promises that are implemented in > > PLT's scheme/promise library are therefore very relevant, and a > > solution (to some degree) to your problem is what that code is > > doing. > > Sorry for the misunderstanding: I just meant to emphasise that I was > more after a language-neutral discussion of algorithms for the > problem I was trying to solve. Right: the problem that those kind of promises solve is unrelated to the language. Take it as a datatype and an algorithm that force promises in a particular way that allows more tail calls. (And I'm using "promises" here in a generic sense, unrelated to whatever you see from a particular implementation.) By the way, the language itself that you're using to implement this has a role in this too. For example, say that you have this code: (let* ([x (foo)] [y (bar x)]) (baz y)) When you get to evaluate the body form, you have `x' and `y' bound in the environment, but `x' is no longer needed. A good language implementation will dump the reference to `x' from the environment. This looks like a kind of a semi-sophisticated optimization that you can worry about later -- but especially in the case of a lazy language not doing so can lead to memory leaks (that are very hard to find). -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jcoglan at googlemail.com Sun Jan 18 14:53:24 2009 From: jcoglan at googlemail.com (James Coglan) Date: Thu Mar 26 02:38:24 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> <18802.39239.86637.164585@arabic.ccs.neu.edu> Message-ID: > > Exactly, you are on the right track, I think. As I earlier wrote in a > private email, you should, I think, first find out about self lifting > promises as referred to by Eli (and very well and very generally implemented > in PLT (Thanks Eli)). Then, there is a way to transform a tail recursive > procedure into a space safe reference to an element of a stream. An > interesting idea, thanks. In fact PLT's lazy scheme (thanks again Eli) does > that (or at least comes very close) > I've managed to rig together a system whereby, when a new promise is formed, it inspects the symbols it contains to find out if they point to other promises. That way a tree of dependencies/dependents is built up. When you force a promise, I iteratively flatten the dependency tree and use that to eval the promises in the same order as you'd get in eager mode. Each promise sends its value to those that depend on it, allowing you to invert the call order and keep the stack flat. Unfortunately, while this runs with a flat stack, it's extremely slow and probably eats memory as I need two-way references between lots of promises. Still, I'm only using lazy mode for lambda calculus right now, not sliging lots of data around with it so maybe this optimisation isn't worth it. Anyway, obviously I need to get beyond the first chapter of SICP so I actually have some idea of what I'm dealing with! Thanks for all the advice so far. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090118/34b2f4b2/attachment.html From eli at barzilay.org Sun Jan 18 15:01:09 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:24 2009 Subject: [plt-scheme] Lazy evaluation and tail calls In-Reply-To: References: <7FD3A430A8CB4FBA8E4791385F4FD37A@uw2b2dff239c4d> <18802.39239.86637.164585@arabic.ccs.neu.edu> Message-ID: <18803.35461.403577.235006@arabic.ccs.neu.edu> On Jan 18, James Coglan wrote: > > I've managed to rig together a system whereby, when a new promise is > formed, it inspects the symbols it contains to find out if they > point to other promises. That way a tree of dependencies/dependents > is built up. When you force a promise, I iteratively flatten the > dependency tree and use that to eval the promises in the same order > as you'd get in eager mode. Each promise sends its value to those > that depend on it, allowing you to invert the call order and keep > the stack flat. > > Unfortunately, while this runs with a flat stack, it's extremely > slow and probably eats memory as I need two-way references between > lots of promises. Still, I'm only using lazy mode for lambda > calculus right now, not sliging lots of data around with it so maybe > this optimisation isn't worth it. You *should* definitely look into what scheme/promise is doing. Here's a link to make it easier: http://svn.plt-scheme.org/plt/trunk/collects/scheme/promise.ss It's the `force' and `force-proc' functions near the end. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From m.douglas.williams at gmail.com Sun Jan 18 15:22:08 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:38:25 2009 Subject: [plt-scheme] Question about Shortcuts on Checkable Menu Items Message-ID: I am trying to use a shortcut for a checkable menu item and I don't understand the behavior. Consider the following trivial gui program. #lang scheme/gui (define the-frame (instantiate frame% ("Test") (min-width 100) (min-height 100))) (define the-menu-bar (instantiate menu-bar% (the-frame))) (define the-test-menu (instantiate menu% ("&Test" the-menu-bar))) (define the-checkable-menu-item (instantiate checkable-menu-item% ("&Check" the-test-menu) (callback (lambda (checkable-menu-item event) (printf "is-checked? = ~a~n" (send checkable-menu-item is-checked?)))) (shortcut #\C))) (send the-frame show #t) If I select the check menu item with the mouse or with the alt keys (alt-T, alt-C in this case), it toggles and prints as expected. If I select it using the shortcut key (cntl-C in this case), the callback runs but the value isn't toggled. Is this the 'correct' behavior? [If so, I assume I need to check the event type and toggle the check myself.] I'm running Version 4.1.3.900 (4.1.4 prerelease candidate) on Windows XP. Thanks, Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090118/c2dbe1f1/attachment.htm From m.douglas.williams at gmail.com Sun Jan 18 19:38:51 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:38:26 2009 Subject: [plt-scheme] Re: Question about Shortcuts on Checkable Menu Items In-Reply-To: References: Message-ID: I also tested the code on Mac OS X and Linux (Ubuntu AMD64) and got the same result. On Sun, Jan 18, 2009 at 1:22 PM, Doug Williams wrote: > I am trying to use a shortcut for a checkable menu item and I don't > understand the behavior. Consider the following trivial gui program. > > #lang scheme/gui > > (define the-frame > (instantiate frame% > ("Test") > (min-width 100) > (min-height 100))) > > (define the-menu-bar > (instantiate menu-bar% > (the-frame))) > > (define the-test-menu > (instantiate menu% > ("&Test" the-menu-bar))) > > (define the-checkable-menu-item > (instantiate checkable-menu-item% > ("&Check" the-test-menu) > (callback > (lambda (checkable-menu-item event) > (printf "is-checked? = ~a~n" > (send checkable-menu-item is-checked?)))) > (shortcut #\C))) > > (send the-frame show #t) > > If I select the check menu item with the mouse or with the alt keys (alt-T, > alt-C in this case), it toggles and prints as expected. If I select it using > the shortcut key (cntl-C in this case), the callback runs but the value > isn't toggled. Is this the 'correct' behavior? [If so, I assume I need to > check the event type and toggle the check myself.] > > I'm running Version 4.1.3.900 (4.1.4 prerelease candidate) on Windows XP. > > Thanks, > Doug > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090118/cbc28040/attachment.html From dblaheta at knox.edu Mon Jan 19 02:22:09 2009 From: dblaheta at knox.edu (Don Blaheta) Date: Thu Mar 26 02:38:26 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <5BF1783B-E180-4FCF-B2DF-FF8B053FAFC5@ccs.neu.edu>; from matthias@ccs.neu.edu on Tue, Jan 13, 2009 at 08:23:54AM -0500 References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> <18800.30792.436062.917137@arabic.ccs.neu.edu> <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> <932b2f1f0901130418s235966uf3472c342e499807@mail.gmail.com> <5BF1783B-E180-4FCF-B2DF-FF8B053FAFC5@ccs.neu.edu> Message-ID: <20090119012209.A22737@winter.phpwebhosting.com> Quoth Eli Barzilay: > See also the reply I sent last evening describing how the sandbox > library can be used for such things. (Given that you already have a > bunch of files and only want to script checking them, the sandbox > library is what you really need, not the handin server.) Yes, this is almost exactly what I was looking for (and for those reading this via archive, the relevant post is in the thread "module access from test cases file", partially quoted below). I did have a problem with the suggested incantation: > (require scheme/sandbox) > (define e (make-module-evaluator (string->path "...your file..."))) > (e '...some-expression...) when I did this, I got some errors from open-input-file claiming that it lacked read permission (though the file was in the current directory and readable); reading the doc for make-module-evaluator suggested that it could take a port instead, so I tried (define e (make-module-evaluator (open-input-file (string->path "...your file...")))) explicitly and this worked; I can now evaluate expressions in the context of my students' definitions. I'm still not sure why the first version failed, though. Now I'm on to actually writing the test cases. Is there any way to force a local on the evaluator? That is, if I do (e '(define 'foo 3)) then this definition is permanent, and I'm not seeing a way to roll this back short of making a new evaluator. Is there a way? (On reflection, I don't really need this for the test cases I'll be doing, but I'm still curious if it can be done.) Relatedly, since the evaluator is now "in" one of the HtDP languages, I don't have access to e.g. namespace-defined?, and the student code can in any case crash or not work, and this appears to take down the whole program, sandboxing notwithstanding. For instance, if I (e '(/ 1 0)) (printf "Testing.~n") the printf never executes. Am I misunderstanding the role of the sandbox here? I think I can work around this the same way I used to, with a with-handlers clause that catches exn:fail?, but I suppose I was expecting that the sandbox would take care of some of that for me. Finally, I tried poking around with the new HtDP-style test cases, per Matthias's suggestion: Quoth Matthias Felleisen: > #lang scheme > (require htdp/testing) > > ... > > (generate-report) > ;; the end > > is close enough. This was somewhat helpful, although I can't find any documentation on it. I did find a post from Kathy Gray from last September that mentioned that htdp/testing was deprecated, apparently in favour of test-engine/scheme-tests, which also seems to work; but I can't find any docs on that either.... It looks like it won't be quite what I want, because check-expect seems to need to be at the top-level, but I'm not sure if there's a workaround. -- -=-Don Blaheta-=-dblaheta@knox.edu-=-=--=- "I used to think that the brain was the most wonderful organ in my body. Then I realized who was telling me this." --Emo Phillips From eli at barzilay.org Mon Jan 19 03:29:05 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:26 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <20090119012209.A22737@winter.phpwebhosting.com> References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> <18800.30792.436062.917137@arabic.ccs.neu.edu> <932b2f1f0901130418s235966uf3472c342e499807@mail.gmail.com> <5BF1783B-E180-4FCF-B2DF-FF8B053FAFC5@ccs.neu.edu> <20090119012209.A22737@winter.phpwebhosting.com> Message-ID: <18804.14801.804854.57717@arabic.ccs.neu.edu> On Jan 19, Don Blaheta wrote: > Quoth Eli Barzilay: > > See also the reply I sent last evening describing how the sandbox > > library can be used for such things. (Given that you already have a > > bunch of files and only want to script checking them, the sandbox > > library is what you really need, not the handin server.) > > Yes, this is almost exactly what I was looking for (and for those > reading this via archive, the relevant post is in the thread "module > access from test cases file", partially quoted below). I did have a > problem with the suggested incantation: > > > (require scheme/sandbox) > > (define e (make-module-evaluator (string->path "...your file..."))) > > (e '...some-expression...) > > when I did this, I got some errors from open-input-file claiming > that it lacked read permission (though the file was in the current > directory and readable); Ah yes, I forgot that this was one of the things that I fixed after 4.1.3 came out. It will work fine with 4.1.4 which will be out shortly. (The problem is not with the file being readable to you, it's about the sandboxed environment being very limited in what it can access. The fix I did was to allow it to read the specified path when one was specified as the source of a module-based sandbox.) > reading the doc for make-module-evaluator suggested that it could > take a port instead, so I tried > > (define e (make-module-evaluator (open-input-file (string->path "...your file...")))) > > explicitly and this worked; [That's a good workaround for now.] > I can now evaluate expressions in the context of my students' > definitions. I'm still not sure why the first version failed, > though. I hope that the above clarifies it. Generally speaking, the safe sandbox is especially important in a case like checking homework submissions, since you can never tell when some student learns enough stuff to hack your system. (For example, back in the very early days of the code, a student could submit code with something like: (error (file->string "/etc/passwd")) to the handin server, which would happily report the error back to the submitting client...) > Now I'm on to actually writing the test cases. Is there any way to > force a local on the evaluator? That is, if I do > > (e '(define 'foo 3)) > > then this definition is permanent, and I'm not seeing a way to roll this > back short of making a new evaluator. Is there a way? (On reflection, > I don't really need this for the test cases I'll be doing, but I'm still > curious if it can be done.) I'm not sure exactly what you're trying to do here... In general, these evaluations happen just like they do on a repl, so the above is similar to entering the exact expression in the repl, which -- with the way Scheme reads a quote -- simply redefines `quote' as a function. I suspect that you want to define your own binding for some value that comes from the student code. You can then use `quasiquote' and `unquote' to use these values. For example, say that the student file looks like (I'm using the `scheme' language for simplicity): #lang scheme (define foo (* 123 456)) (define (add x y) (+ x y)) Then you can bind your own `x' to the twice the value of the student's `foo': (define x (* 2 (e 'foo))) and use this value with the student's `add' function: (e `(add foo ,x)) Using the sandbox environment is very convenient, because it provides a clear separation between what happens inside the student code and in your testing code. > Relatedly, since the evaluator is now "in" one of the HtDP > languages, I don't have access to e.g. namespace-defined?, This problem is unrelated to the below. You basically want to check that a name is defined in the student's code, so you want to use `namespace-defined?' in the sandbox -- but you can't do so for the obvious reason. That's a good thing, since you don't want the htdp languages carrying a bunch of such functions just to be able to test the code. In any case, the solution for this is a new `call-in-sandbox-context' function which will run an arbitrary thunk (*your* code) inside the sandbox environment. For example, to check if a name is defined using that function, you can do this: (require mzlib/etc) (call-in-sandbox-context e (lambda () (namespace-defined? 'foo))) (This is also one of the new additions, so you'll need a nightly build until v4.1.4 comes out.) > and the student code can in any case crash or not work, and this > appears to take down the whole program, sandboxing notwithstanding. > For instance, if I > > (e '(/ 1 0)) > (printf "Testing.~n") > > the printf never executes. Am I misunderstanding the role of the > sandbox here? I think I can work around this the same way I used > to, with a with-handlers clause that catches exn:fail?, but I > suppose I was expecting that the sandbox would take care of some of > that for me. Well, the sandbox detects the error and it needs to do something with it. The obvious thing to do is to simply propagate the error up to the calling code, and let you catch it with a `with-handlers'. Otherwise, it would need to somehow give you back a different kind of a value to indicate a raised exception. The same holds for multiple values -- given a sandbox with a `values' binding (like testing code in the `scheme' language), a test like: (equal? 123 (e '(blah))) might throw an error if `blah' returns multiple values -- the same kind of error you'd get with (equal? 123 (values 1 2)) Therefore, uses of sandboxes almost always need to catch all exceptions from the sandbox, and be aware of multiple values. But you do get a lot of help in that *all* errors are just exceptions. For example, entering any of these will create errors that are hard to catch otherwise: ) that's not a typo -- this should be a read error. (if (< 1 2)) you won't be able to put this in a test expression, since the expression would not compile right -- you'd get a syntax error in the test itself. (letrec ([loop (lambda () (loop))]) (loop)) this will not work right in a simple test for the obvious reason. (kill-thread (current-thread)) (exit) these won't be something you can test since the expression will just kill the whole thread or exit mzscheme. Having said that, perhaps it makes sense to provide some wrapper that returns one of (list 'values ) (list 'raise ) I didn't do that since it seems like a trivial thing to setup. (By the way, note that there can be anything in the second form, since you can call `raise' directly on any value, not just an exception.) > Finally, I tried poking around with the new HtDP-style test cases, per > Matthias's suggestion: > > Quoth Matthias Felleisen: > > #lang scheme > > (require htdp/testing) > > > > ... > > > > (generate-report) > > ;; the end > > > > is close enough. > > This was somewhat helpful, although I can't find any documentation > on it. I did find a post from Kathy Gray from last September that > mentioned that htdp/testing was deprecated, apparently in favour of > test-engine/scheme-tests, which also seems to work; but I can't find > any docs on that either.... It looks like it won't be quite what I > want, because check-expect seems to need to be at the top-level, but > I'm not sure if there's a workaround. I can't help with this, since I'm not sure about the details. I do remember some issues with the teaching languages tests when it comes to automating things with the sandbox, but I don't remember if there was some simple solution. (It involves some obscure details that make doing the right thing outside of DrScheme very difficult.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From geoff at knauth.org Mon Jan 19 05:04:58 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:27 2009 Subject: [plt-scheme] Re: Question about Shortcuts on Checkable Menu Items In-Reply-To: References: Message-ID: On Jan 18, 2009, at 19:38, Doug Williams wrote: > I also tested the code on Mac OS X and Linux (Ubuntu AMD64) and got > the same result. When I tested your code on OS X, I kept getting is-checked? = #f in response to Cmd-C, and I wondered if OS X or DrScheme was treating it differently because it usually means Copy. I typed Cmd-C because that was the shortcut indicated in the menu. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090119/736c2de0/attachment.htm From geoff at knauth.org Mon Jan 19 05:11:13 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:28 2009 Subject: [plt-scheme] Re: Question about Shortcuts on Checkable Menu Items In-Reply-To: References: Message-ID: On Jan 19, 2009, at 05:04, Geoffrey S. Knauth wrote: > On Jan 18, 2009, at 19:38, Doug Williams wrote: >> I also tested the code on Mac OS X and Linux (Ubuntu AMD64) and got >> the same result. > > When I tested your code on OS X, I kept getting is-checked? = #f in > response to Cmd-C, and I wondered if OS X or DrScheme was treating > it differently because it usually means Copy. I typed Cmd-C because > that was the shortcut indicated in the menu. Correction: On OS X, when I press Cmd-C, I continue to get is- checked? = #t if the menu item is already checked, and is-checked? = #f if it is not. So yes, I am seeing what you are seeing. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090119/df634edb/attachment.html From mflatt at cs.utah.edu Mon Jan 19 07:29:08 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:28 2009 Subject: [plt-scheme] Question about Shortcuts on Checkable Menu Items In-Reply-To: References: Message-ID: <20090119122910.481C26500AA@mail-svr1.cs.utah.edu> Sorry for the delay --- this is now fixed in SVN. At Sun, 18 Jan 2009 13:22:08 -0700, "Doug Williams" wrote: > I am trying to use a shortcut for a checkable menu item and I don't > understand the behavior. Consider the following trivial gui program. > > #lang scheme/gui > > (define the-frame > (instantiate frame% > ("Test") > (min-width 100) > (min-height 100))) > > (define the-menu-bar > (instantiate menu-bar% > (the-frame))) > > (define the-test-menu > (instantiate menu% > ("&Test" the-menu-bar))) > > (define the-checkable-menu-item > (instantiate checkable-menu-item% > ("&Check" the-test-menu) > (callback > (lambda (checkable-menu-item event) > (printf "is-checked? = ~a~n" > (send checkable-menu-item is-checked?)))) > (shortcut #\C))) > > (send the-frame show #t) > > If I select the check menu item with the mouse or with the alt keys (alt-T, > alt-C in this case), it toggles and prints as expected. If I select it using > the shortcut key (cntl-C in this case), the callback runs but the value > isn't toggled. Is this the 'correct' behavior? [If so, I assume I need to > check the event type and toggle the check myself.] > > I'm running Version 4.1.3.900 (4.1.4 prerelease candidate) on Windows XP. > > Thanks, > Doug > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From toddobryan at gmail.com Mon Jan 19 08:37:44 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Mar 26 02:38:28 2009 Subject: [plt-scheme] Scopes and closures Message-ID: <904774730901190537w620a166kf40acddd6cd69ae1@mail.gmail.com> Hey all! As a fun project (read that as "frustrating time sink that's driving me crazy"), I've been implementing a version of Scheme in Python. Like all good naive implementers of programming languages, I managed to implement dynamic scope accidentally and so I'm now trying to fix that. I have a few clarifying questions to ask so that I can make sure I really understand what I'm doing. 1. Is the following program in HtDP Beginning Student sufficient to show the difference between dynamic and static scope? ----------- (define n 5) (define (f x) (+ x n)) (define (g n) (f 3)) ----------- If I'm reasoning correctly, with static scope, f is saved with its closure, so n is forever bound to 5 and g applied to anything will always return 8. In dynamic scope, n would get its value from the argument passed into g. So, (g 7) --> 8 = static scoping (g 7) --> 10 = dynamic scoping Is that right? If not, is there a Beginning Student program that would differentiate between dynamic and static scope? 2. In creating a closure, it's really only necessary to save values that the function uses, rather than the whole context. I did notice a difference in the way that's implemented (maybe). In the HtDP languages, a program like ------------- (define (f x) (+ x n)) ------------- throws an error when you click run, saying that n is not defined. In R5RS, you don't get an error until you try to use f. On the other hand, it's not just checking in order, because if I add (define n 5) *after* the definition of f, it works fine in both the HtDP languages and R5RS. So, my question is, do you read in all the functions and then create the closures, or do you keep a list of undefined names as you're going through and then report errors if any are left by the time you get to the end of the definitions, or is there something more subtle going on? I guess I'm asking where the source code that handles this is defined so I can take a look at it. 3. How is type checking usually integrated with this? Do most implementations check type safety as they're figuring out closures, do it as an add-on step after, or even--I guess this is possible--check the type safety before trying to create the closure? Thanks for any insight, Todd From d.j.gurnell at gmail.com Mon Jan 19 09:13:59 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:38:28 2009 Subject: [plt-scheme] Keybinding question In-Reply-To: <932b2f1f0901161138x5de192fi8258918caa9fdd36@mail.gmail.com> References: <2411C300-C31D-452A-AEC1-3B718458D9C6@gmail.com> <756daca50901161124x4d3213afx77d1c394f1441e87@mail.gmail.com> <932b2f1f0901161138x5de192fi8258918caa9fdd36@mail.gmail.com> Message-ID: <8B9609F5-3867-40FB-AC19-389CC34098D6@gmail.com> Grant wrote: > [Try] this code: > > (module dave-keys (lib "keybinding-lang.ss" "framework") > > (define (test editor event) > (send (send editor get-keymap) call-function "collapse-space" > editor event #t)) > > (keybinding ":f2" test)) Robby wrote: > Yes, unfotunately, DrScheme doesn't do a good job of removing and re- > adding keybindings when you change the file. Best to just restart > Drscheme. I've added a note about this to the docs. Sorry for the late response, guys. Thanks very much for your help. Grant's code works a treat. FYI - I originally wanted to bind Alt-Space to collapse-space. Ironically, I noticed after I made my post about this that Alt Space is already the default binding for the command. The keystroke works under Linux but in OS X it inserts a space instead. Anyway, I'm okay now because I've adapted Grant's code to give me Ctrl Space instead. Perhaps it's an oddity of OS X? Just thought I'd let you know. Cheers, -- Dave From jcoglan at googlemail.com Mon Jan 19 09:23:40 2009 From: jcoglan at googlemail.com (James Coglan) Date: Thu Mar 26 02:38:29 2009 Subject: [plt-scheme] Scopes and closures In-Reply-To: <904774730901190537w620a166kf40acddd6cd69ae1@mail.gmail.com> References: <904774730901190537w620a166kf40acddd6cd69ae1@mail.gmail.com> Message-ID: > 1. Is the following program in HtDP Beginning Student sufficient to > show the difference between dynamic and static scope? > ----------- > (define n 5) > > (define (f x) > (+ x n)) > > (define (g n) > (f 3)) > ----------- > If I'm reasoning correctly, with static scope, f is saved with its > closure, so n is forever bound to 5 and g applied to anything will > always return 8. In dynamic scope, n would get its value from the > argument passed into g. So, > > (g 7) --> 8 = static scoping > (g 7) --> 10 = dynamic scoping Yes that's right. Static scope means that functions defer to their lexical context to find free variables (variables not in the function's parameter list), whereas dynamic scope means they defer to the context in which they are called. 2. In creating a closure, it's really only necessary to save values > that the function uses, rather than the whole context I'd be interested to know if you can in general do static checking on closures to free up memory. I'm doing an implementation in Ruby, having only just started learning Scheme. Right now, each function call creates a symbol table that inherits from the scope in which the function is defined, and definitions retain a reference to the current scope. That way, returning a lambda from a function keeps a reference to the symbol table in use inside the outer function, but I'm not doing any clean-up on it right now as I don't know what errors that might cause further down the line. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090119/27ed2c13/attachment.htm From sk at cs.brown.edu Mon Jan 19 09:33:33 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:38:29 2009 Subject: [plt-scheme] Scopes and closures In-Reply-To: References: <904774730901190537w620a166kf40acddd6cd69ae1@mail.gmail.com> Message-ID: My favorite reference for these kinds of questions is Andrew Appel's "Compiling with Continuations". If you ignore the slightly intimidating title, just about every question along these lines is answered -- by the author of the Standard ML compiler. It is, I believe, a vast improvement over its successor, the Tiger book. Shriram From filcab at gmail.com Mon Jan 19 10:39:31 2009 From: filcab at gmail.com (Filipe Cabecinhas) Date: Thu Mar 26 02:38:29 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality Message-ID: <49749EB3.4040105@gmail.com> Hi all, I've made a small MysterX patch to add GetActiveObject functionality. With this patch, if you want to get hold of an Excel.Application object (for example), you don't have to go to the trouble to create one of those objects if Excel is running (and it will take a small fraction of the time). I'm using MysterX to automate AutoCAD through MzScheme and AutoCAD takes around 1 minute (or more) to start using cci/coclass. For what I'm doing, I can just take the running AutoCAD application, and that (with GetActiveObject) will take only 0.5 seconds ;-) This patch adds two functions: com-get-active-object-from-coclass and its short name: cgao/coclass I can live without the short name, I just thought about abbreviating it like cci/coclass. Regards, F -------------- next part -------------- Index: collects/mysterx/mysterx.ss =================================================================== --- collects/mysterx/mysterx.ss (revision 13203) +++ collects/mysterx/mysterx.ss (working copy) @@ -54,6 +54,8 @@ cci/coclass cocreate-instance-from-progid cci/progid + com-get-active-object-from-coclass + gao/coclass coclass progid set-coclass! @@ -111,6 +113,8 @@ (define cci/coclass cocreate-instance-from-coclass) (define cocreate-instance-from-progid mxprims:cocreate-instance-from-progid) (define cci/progid cocreate-instance-from-progid) + (define com-get-active-object-from-coclass mxprims:com-get-active-object-from-coclass) + (define gao/coclass com-get-active-object-from-coclass) (define coclass mxprims:coclass) (define progid mxprims:progid) (define set-coclass! mxprims:set-coclass!) Index: collects/mysterx/private/mxmain.ss =================================================================== --- collects/mysterx/private/mxmain.ss (revision 13203) +++ collects/mysterx/private/mxmain.ss (working copy) @@ -39,6 +39,7 @@ progid->html cocreate-instance-from-coclass cocreate-instance-from-progid + com-get-active-object-from-coclass coclass progid set-coclass! @@ -324,6 +325,7 @@ (define progid->html #f) (define cocreate-instance-from-coclass #f) (define cocreate-instance-from-progid #f) + (define com-get-active-object-from-coclass #f) (define coclass #f) (define progid #f) (define set-coclass! #f) Index: src/mysterx/mysterx.cxx =================================================================== --- src/mysterx/mysterx.cxx (revision 13203) +++ src/mysterx/mysterx.cxx (working copy) @@ -151,6 +151,7 @@ { mx_com_release_object,"com-release-object",1,1 }, { mx_com_add_ref,"com-add-ref",1,1 }, { mx_com_ref_count,"com-ref-count",1,1 }, + { mx_com_get_active_object_from_coclass,"com-get-active-object-from-coclass",1,1 }, // browsers @@ -901,6 +902,64 @@ location, machine); } +Scheme_Object *do_get_active_object(CLSID clsId, LPCTSTR name) +{ + HRESULT hr; + IUnknown *pUnk; + IDispatch *pIDispatch; + MX_COM_Object *com_object; + + hr = GetActiveObject(clsId, NULL, &pUnk); + + if (hr != ERROR_SUCCESS) { + char errBuff[2048]; + sprintf(errBuff, + "com-get-active-object-from-coclass: " + "Unable to get instance of %s", + name); + codedComError(errBuff, hr); + } + + hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pIDispatch); + + if (hr != ERROR_SUCCESS) { + char errBuff[2048]; + sprintf(errBuff, + "com-get-active-object-from-coclass: " + "Unable to get instance of %s", + name); + codedComError(errBuff, hr); + } + + com_object = (MX_COM_Object *)scheme_malloc_tagged(sizeof(MX_COM_Object)); + + com_object->so.type = mx_com_object_type; + com_object->pIDispatch = pIDispatch; + com_object->pITypeInfo = NULL; + com_object->clsId = clsId; + com_object->pEventTypeInfo = NULL; + com_object->pIConnectionPoint = NULL; + com_object->pISink = NULL; + com_object->connectionCookie = (DWORD)0; + com_object->released = FALSE; + com_object->types = NULL; + + mx_register_com_object((Scheme_Object *)com_object, pIDispatch); + + return (Scheme_Object *)com_object; +} + +Scheme_Object *mx_com_get_active_object_from_coclass(int argc, Scheme_Object **argv) +{ + LPCTSTR coclass; + + GUARANTEE_STRSYM("com-get-active-object-from-coclass", 0); + + coclass = schemeToText(argv[0]); + + return do_get_active_object(getCLSIDFromCoClass(coclass), coclass); +} + Scheme_Object *mx_set_coclass(int argc, Scheme_Object **argv) { CLSID clsId; @@ -4211,7 +4270,8 @@ retval = retvalVariantToSchemeObject(&retvalVa); // all pointers are 32 bits, choose arbitrary one - if (retvalVa.vt != VT_VOID) + if (retvalVa.vt != VT_VOID && + retvalVa.vt != VT_HRESULT) free(retvalVa.pullVal); return retval; Index: src/mysterx/mysterx.h =================================================================== --- src/mysterx/mysterx.h (revision 13203) +++ src/mysterx/mysterx.h (working copy) @@ -343,6 +343,7 @@ MX_PRIM_DECL(mx_com_event_type); MX_PRIM_DECL(mx_cocreate_instance_from_coclass); MX_PRIM_DECL(mx_cocreate_instance_from_progid); +MX_PRIM_DECL(mx_com_get_active_object_from_coclass); MX_PRIM_DECL(mx_coclass); MX_PRIM_DECL(mx_progid); MX_PRIM_DECL(mx_set_coclass); From mflatt at cs.utah.edu Mon Jan 19 10:49:21 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:29 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: <49749EB3.4040105@gmail.com> References: <49749EB3.4040105@gmail.com> Message-ID: <20090119154923.23F9E65009E@mail-svr1.cs.utah.edu> I've applied this patch and also added documentation in SVN. I didn't try running or compiling anything (other than docs), so let me know if it's not ok. Thanks for the patch! Matthew At Mon, 19 Jan 2009 15:39:31 +0000, Filipe Cabecinhas wrote: > Hi all, > > I've made a small MysterX patch to add GetActiveObject functionality. > With this patch, if you want to get hold of an Excel.Application object > (for example), you don't have to go to the trouble to create one of > those objects if Excel is running (and it will take a small fraction of > the time). > > I'm using MysterX to automate AutoCAD through MzScheme and AutoCAD takes > around 1 minute (or more) to start using cci/coclass. For what I'm > doing, I can just take the running AutoCAD application, and that (with > GetActiveObject) will take only 0.5 seconds ;-) > > This patch adds two functions: > com-get-active-object-from-coclass > and its short name: cgao/coclass > I can live without the short name, I just thought about abbreviating it > like cci/coclass. > > Regards, > > F > Index: collects/mysterx/mysterx.ss > =================================================================== > --- collects/mysterx/mysterx.ss (revision 13203) > +++ collects/mysterx/mysterx.ss (working copy) > @@ -54,6 +54,8 @@ > cci/coclass > cocreate-instance-from-progid > cci/progid > + com-get-active-object-from-coclass > + gao/coclass > coclass > progid > set-coclass! > @@ -111,6 +113,8 @@ > (define cci/coclass cocreate-instance-from-coclass) > (define cocreate-instance-from-progid mxprims:cocreate-instance-from-progid) > (define cci/progid cocreate-instance-from-progid) > + (define com-get-active-object-from-coclass mxprims:com-get-active-object- > from-coclass) > + (define gao/coclass com-get-active-object-from-coclass) > (define coclass mxprims:coclass) > (define progid mxprims:progid) > (define set-coclass! mxprims:set-coclass!) > Index: collects/mysterx/private/mxmain.ss > =================================================================== > --- collects/mysterx/private/mxmain.ss (revision 13203) > +++ collects/mysterx/private/mxmain.ss (working copy) > @@ -39,6 +39,7 @@ > progid->html > cocreate-instance-from-coclass > cocreate-instance-from-progid > + com-get-active-object-from-coclass > coclass > progid > set-coclass! > @@ -324,6 +325,7 @@ > (define progid->html #f) > (define cocreate-instance-from-coclass #f) > (define cocreate-instance-from-progid #f) > + (define com-get-active-object-from-coclass #f) > (define coclass #f) > (define progid #f) > (define set-coclass! #f) > Index: src/mysterx/mysterx.cxx > =================================================================== > --- src/mysterx/mysterx.cxx (revision 13203) > +++ src/mysterx/mysterx.cxx (working copy) > @@ -151,6 +151,7 @@ > { mx_com_release_object,"com-release-object",1,1 }, > { mx_com_add_ref,"com-add-ref",1,1 }, > { mx_com_ref_count,"com-ref-count",1,1 }, > + { mx_com_get_active_object_from_coclass,"com-get-active-object-from- > coclass",1,1 }, > > // browsers > > @@ -901,6 +902,64 @@ > location, machine); > } > > +Scheme_Object *do_get_active_object(CLSID clsId, LPCTSTR name) > +{ > + HRESULT hr; > + IUnknown *pUnk; > + IDispatch *pIDispatch; > + MX_COM_Object *com_object; > + > + hr = GetActiveObject(clsId, NULL, &pUnk); > + > + if (hr != ERROR_SUCCESS) { > + char errBuff[2048]; > + sprintf(errBuff, > + "com-get-active-object-from-coclass: " > + "Unable to get instance of %s", > + name); > + codedComError(errBuff, hr); > + } > + > + hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pIDispatch); > + > + if (hr != ERROR_SUCCESS) { > + char errBuff[2048]; > + sprintf(errBuff, > + "com-get-active-object-from-coclass: " > + "Unable to get instance of %s", > + name); > + codedComError(errBuff, hr); > + } > + > + com_object = (MX_COM_Object *)scheme_malloc_tagged(sizeof(MX_COM_Object)); > + > + com_object->so.type = mx_com_object_type; > + com_object->pIDispatch = pIDispatch; > + com_object->pITypeInfo = NULL; > + com_object->clsId = clsId; > + com_object->pEventTypeInfo = NULL; > + com_object->pIConnectionPoint = NULL; > + com_object->pISink = NULL; > + com_object->connectionCookie = (DWORD)0; > + com_object->released = FALSE; > + com_object->types = NULL; > + > + mx_register_com_object((Scheme_Object *)com_object, pIDispatch); > + > + return (Scheme_Object *)com_object; > +} > + > +Scheme_Object *mx_com_get_active_object_from_coclass(int argc, Scheme_Object > **argv) > +{ > + LPCTSTR coclass; > + > + GUARANTEE_STRSYM("com-get-active-object-from-coclass", 0); > + > + coclass = schemeToText(argv[0]); > + > + return do_get_active_object(getCLSIDFromCoClass(coclass), coclass); > +} > + > Scheme_Object *mx_set_coclass(int argc, Scheme_Object **argv) > { > CLSID clsId; > @@ -4211,7 +4270,8 @@ > retval = retvalVariantToSchemeObject(&retvalVa); > > // all pointers are 32 bits, choose arbitrary one > - if (retvalVa.vt != VT_VOID) > + if (retvalVa.vt != VT_VOID && > + retvalVa.vt != VT_HRESULT) > free(retvalVa.pullVal); > > return retval; > Index: src/mysterx/mysterx.h > =================================================================== > --- src/mysterx/mysterx.h (revision 13203) > +++ src/mysterx/mysterx.h (working copy) > @@ -343,6 +343,7 @@ > MX_PRIM_DECL(mx_com_event_type); > MX_PRIM_DECL(mx_cocreate_instance_from_coclass); > MX_PRIM_DECL(mx_cocreate_instance_from_progid); > +MX_PRIM_DECL(mx_com_get_active_object_from_coclass); > MX_PRIM_DECL(mx_coclass); > MX_PRIM_DECL(mx_progid); > MX_PRIM_DECL(mx_set_coclass); > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From sk at cs.brown.edu Mon Jan 19 10:59:24 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:38:29 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: <49749EB3.4040105@gmail.com> References: <49749EB3.4040105@gmail.com> Message-ID: Oh, thank you! I similarly use MysterX to access iTunes; this too would benefit from this patch. Shriram From jos.koot at telefonica.net Mon Jan 19 11:03:56 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:30 2009 Subject: [plt-scheme] call/cc puzzle References: <49722FD8.7050107@cs.utah.edu> Message-ID: <4BB06EF570D14193B59B1FEBFDE17EB9@uw2b2dff239c4d> My explanation of ((call/cc call/cc) (call/cc call/cc)). Read this in CPS (continuation passing style) For this purpose think in terms of meta-procedures EXEC and APPLY. (EXEC code cont) ; cont=continuation. Executes the code and passes the result to the cont. (APPLY op rand cont) ; op is procedure/operator, rand is argument/operand. Calls the op with the rand for its arg and passes the result to the cont. Notice that (APPLY call/cc A B) --> (APPLY A B B). Write ((call/cc call/cc) (call/cc call/cc)) as ((cc1 cc2) (cc3 cc4)). Let `finish' be the continuation of the top form, for instance the PLRE of a REPL (read-eval-print-loop), but as we shall see the finish is never reached, hence `finish' is irrelevant. Notation: #i=x introduces #i# as short for x. First a WRONG explanation: (EXEC ((cc1 cc2) (cc3 cc4)) finish) = (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand finish))))) (APPLY cc2 #0# #0#) (APPLY #0# #0# #0#) = (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) (APPLY cc4 #1# #1#) (APPLY #1# #1# #1#) (APPLY #0# #1# finish) (EXEC (cc3 cc4) #2=(? (rand) (APPLY #1# rand finish))) = (APPLY cc4 #2# #2#) (APPLY #2# #2# #2#) (APPLY #1# #2# finish) (APPLY #0# #2# finish) (EXEC (cc3 cc4) #3=(? (rand) (APPLY #2# finish))) = (APPLY cc4 #3# #3#) (APPLY #2# #3# finish) (APPLY #1# #3# finish) (APPLY #0# #3# finish) (EXEC (cc3 cc4) #4=(? (rand) (APPLY #3# rand finish))) = (APPLY cc4 #4# #4#) (APPLY #4# #4# #4#) (APPLY #3# #4# finish) (APPLY #2# #4# finish) (APPLY #1# #4# finish) (APPLY #0# #4# finish) (EXEC (cc3 cc4) #5=(? (rand) (APPLY #4# rand finish))) = etc. This suggests that ((call/cc call/cc) (call/cc call/cc)) would not run in bound space. However, it does, as on my small system can easily be verified by letting it run for some minutes. Apparently Scheme's designers and implementors ar more clever than shown above. I try again: (EXEC ((cc1 cc2) (cc3 cc4)) finish) = (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand finish))))) (APPLY cc2 #0# #0#) (APPLY #0# #0# #0#) #999=(EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) (APPLY cc4 #1# #1#) (APPLY #1# #1# #1#) (APPLY #0# #1# finish) (EXEC (cc3 cc4) #2=(? (newrand) (APPLY #1# newrand finish))) = (EXEC (cc3 cc4) (? (newrand) (APPLY (? (rand) (APPLY #0# rand finish)) newrand finish))) = ; Contract the continuation. (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) = (EXEC (cc3 cc4) #1#) = #999# ; Space bound loop! Is this a correct interpretation? It strikes me that DrScheme's Debug shows the WRONG behaviour. That may be due to the fact that debug has to extend each continuation such as to move its arrow and to display results and therefore cannot collaps the continuations. Correct? Jos ----- Original Message ----- From: Shriram Krishnamurthi To: rafkind@cs.utah.edu Cc: Scheme PLT Sent: Saturday, January 17, 2009 8:38 PM Subject: Re: [plt-scheme] call/cc puzzle Just remember that putting a use of call/cc in a context changes the meaning of that use... snip -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090119/f8a9d89a/attachment.html From filcab at gmail.com Mon Jan 19 11:28:17 2009 From: filcab at gmail.com (Filipe Cabecinhas) Date: Thu Mar 26 02:38:30 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: References: <49749EB3.4040105@gmail.com> Message-ID: <4974AA21.2040402@gmail.com> Nice :D Shriram Krishnamurthi wrote: > Oh, thank you! I similarly use MysterX to access iTunes; this too > would benefit from this patch. > > Shriram Could you share that "with the class"? :-) Or tell us more details (is it a webserver that will control iTunes, etc) And thanks, Matthew ;-) Regards, F From emekamicro at gmail.com Mon Jan 19 12:33:30 2009 From: emekamicro at gmail.com (Emeka) Date: Thu Mar 26 02:38:31 2009 Subject: [plt-scheme] New Here Message-ID: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> All, I would want to know where to start. I have the Drscheme and SICP. However, I guess I need more materials and links. I need all you support in order to up quick and kicking. Thank you all. Emeka -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090119/70d4d6fb/attachment.htm From jos.koot at telefonica.net Mon Jan 19 12:50:03 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:32 2009 Subject: [plt-scheme] New Here References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> Message-ID: <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> Seen HtDP already? Or learning scheme in fixnum days. There is a lot of stuff for free. Google a little bit. This list takes questions of students and auto didacting people serious, so is my experience. Welcome to this list (although I am just a plain subscriber of this list) Dont't stick to one introduction only. I have good experience with reading several introductions in parallel (in IT and other studies) Things depend on your goals, of course: - do you know any other programming language already? - what is your mathematical background? - Do you want to learn programming or to learn about theories on programming? May be both (as I would suggest) SICP is a great book, but whether or not it is a good starting point depends on your goals and foreknowledge. Jos. ----- Original Message ----- From: Emeka To: plt-scheme@list.cs.brown.edu Sent: Monday, January 19, 2009 6:33 PM Subject: [plt-scheme] New Here All, I would want to know where to start. I have the Drscheme and SICP. However, I guess I need more materials and links. I need all you support in order to up quick and kicking. Thank you all. Emeka ------------------------------------------------------------------------------ _________________________________________________ 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/20090119/e268a25c/attachment.html From robby at eecs.northwestern.edu Mon Jan 19 12:51:50 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:32 2009 Subject: [plt-scheme] New Here In-Reply-To: <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> Message-ID: <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> Also on the list belongs Quick, More, and Continue from here: http://docs.plt-scheme.org/ Robby On Mon, Jan 19, 2009 at 11:50 AM, Jos Koot wrote: > Seen HtDP already? > Or learning scheme in fixnum days. > There is a lot of stuff for free. Google a little bit. > This list takes questions of students and auto didacting people serious, so > is my experience. > Welcome to this list (although I am just a plain subscriber of this list) > Dont't stick to one introduction only. I have good experience with reading > several introductions in parallel (in IT and other studies) > Things depend on your goals, of course: > - do you know any other programming language already? > - what is your mathematical background? > - Do you want to learn programming or to learn about theories on > programming? May be both (as I would suggest) > SICP is a great book, but whether or not it is a good starting point depends > on your goals and foreknowledge. > Jos. > > > ----- Original Message ----- > From: Emeka > To: plt-scheme@list.cs.brown.edu > Sent: Monday, January 19, 2009 6:33 PM > Subject: [plt-scheme] New Here > All, > > I would want to know where to start. I have the Drscheme and SICP. However, > I guess I need more materials and links. > I need all you support in order to up quick and kicking. > > Thank you all. > > Emeka > > ________________________________ > > _________________________________________________ > 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 Mon Jan 19 13:04:19 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:32 2009 Subject: [plt-scheme] New Here References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> Message-ID: <5369EC14AF1E4518BC5ACD1CDD2FBFE3@uw2b2dff239c4d> Right, I should have mentioned these too. Thanks Robby. Jos ----- Original Message ----- From: "Robby Findler" To: "Jos Koot" Cc: "Emeka" ; Sent: Monday, January 19, 2009 6:51 PM Subject: Re: [plt-scheme] New Here > Also on the list belongs Quick, More, and Continue from here: > > http://docs.plt-scheme.org/ > > Robby > > On Mon, Jan 19, 2009 at 11:50 AM, Jos Koot > wrote: >> Seen HtDP already? >> Or learning scheme in fixnum days. >> There is a lot of stuff for free. Google a little bit. >> This list takes questions of students and auto didacting people serious, >> so >> is my experience. >> Welcome to this list (although I am just a plain subscriber of this list) >> Dont't stick to one introduction only. I have good experience with >> reading >> several introductions in parallel (in IT and other studies) >> Things depend on your goals, of course: >> - do you know any other programming language already? >> - what is your mathematical background? >> - Do you want to learn programming or to learn about theories on >> programming? May be both (as I would suggest) >> SICP is a great book, but whether or not it is a good starting point >> depends >> on your goals and foreknowledge. >> Jos. >> >> >> ----- Original Message ----- >> From: Emeka >> To: plt-scheme@list.cs.brown.edu >> Sent: Monday, January 19, 2009 6:33 PM >> Subject: [plt-scheme] New Here >> All, >> >> I would want to know where to start. I have the Drscheme and SICP. >> However, >> I guess I need more materials and links. >> I need all you support in order to up quick and kicking. >> >> Thank you all. >> >> Emeka >> >> ________________________________ >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> >> From robby at eecs.northwestern.edu Mon Jan 19 13:07:02 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:32 2009 Subject: [plt-scheme] New Here In-Reply-To: <5369EC14AF1E4518BC5ACD1CDD2FBFE3@uw2b2dff239c4d> References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> <5369EC14AF1E4518BC5ACD1CDD2FBFE3@uw2b2dff239c4d> Message-ID: <932b2f1f0901191007u7125d089g8e46210e71e10020@mail.gmail.com> Thanks Yoda, apparently. Robby On Mon, Jan 19, 2009 at 12:04 PM, Jos Koot wrote: > Right, I should have mentioned these too. > Thanks Robby. > Jos > > ----- Original Message ----- From: "Robby Findler" > > To: "Jos Koot" > Cc: "Emeka" ; > Sent: Monday, January 19, 2009 6:51 PM > Subject: Re: [plt-scheme] New Here > > >> Also on the list belongs Quick, More, and Continue from here: >> >> http://docs.plt-scheme.org/ >> >> Robby >> >> On Mon, Jan 19, 2009 at 11:50 AM, Jos Koot >> wrote: >>> >>> Seen HtDP already? >>> Or learning scheme in fixnum days. >>> There is a lot of stuff for free. Google a little bit. >>> This list takes questions of students and auto didacting people serious, >>> so >>> is my experience. >>> Welcome to this list (although I am just a plain subscriber of this list) >>> Dont't stick to one introduction only. I have good experience with >>> reading >>> several introductions in parallel (in IT and other studies) >>> Things depend on your goals, of course: >>> - do you know any other programming language already? >>> - what is your mathematical background? >>> - Do you want to learn programming or to learn about theories on >>> programming? May be both (as I would suggest) >>> SICP is a great book, but whether or not it is a good starting point >>> depends >>> on your goals and foreknowledge. >>> Jos. >>> >>> >>> ----- Original Message ----- >>> From: Emeka >>> To: plt-scheme@list.cs.brown.edu >>> Sent: Monday, January 19, 2009 6:33 PM >>> Subject: [plt-scheme] New Here >>> All, >>> >>> I would want to know where to start. I have the Drscheme and SICP. >>> However, >>> I guess I need more materials and links. >>> I need all you support in order to up quick and kicking. >>> >>> Thank you all. >>> >>> Emeka >>> >>> ________________________________ >>> >>> _________________________________________________ >>> 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 jadudm at gmail.com Mon Jan 19 13:50:52 2009 From: jadudm at gmail.com (Matt Jadud) Date: Thu Mar 26 02:38:32 2009 Subject: [plt-scheme] New Here In-Reply-To: <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> Message-ID: On Mon, Jan 19, 2009 at 12:51 PM, Robby Findler wrote: > Also on the list belongs Quick, More, and Continue from here: > > http://docs.plt-scheme.org/ Huh. I hadn't seen "Quick" before. (Of course, saying I haven't seen something in the PLT documentation is like saying I haven't seen something in the V&A, no matter how many times you go back.) Of course, I'm not trying to say that the PLT documentation is like a warehouse of plundered goods from the countries of the world... but just that there's a lot of stuff in there. I like the use of slideshow. That makes a nice environment for the introduction of first-class functions at the end of the week. Thanks, Matt From filcab at gmail.com Mon Jan 19 13:54:46 2009 From: filcab at gmail.com (Filipe Cabecinhas) Date: Thu Mar 26 02:38:33 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: <20090119154923.23F9E65009E@mail-svr1.cs.utah.edu> References: <49749EB3.4040105@gmail.com> <20090119154923.23F9E65009E@mail-svr1.cs.utah.edu> Message-ID: <4974CC76.2080602@gmail.com> Thanks, it works over here :-) F Matthew Flatt wrote: > I've applied this patch and also added documentation in SVN. I didn't > try running or compiling anything (other than docs), so let me know if > it's not ok. > > Thanks for the patch! > Matthew > > At Mon, 19 Jan 2009 15:39:31 +0000, Filipe Cabecinhas wrote: >> Hi all, >> >> I've made a small MysterX patch to add GetActiveObject functionality. >> With this patch, if you want to get hold of an Excel.Application object >> (for example), you don't have to go to the trouble to create one of >> those objects if Excel is running (and it will take a small fraction of >> the time). >> >> I'm using MysterX to automate AutoCAD through MzScheme and AutoCAD takes >> around 1 minute (or more) to start using cci/coclass. For what I'm >> doing, I can just take the running AutoCAD application, and that (with >> GetActiveObject) will take only 0.5 seconds ;-) >> >> This patch adds two functions: >> com-get-active-object-from-coclass >> and its short name: cgao/coclass >> I can live without the short name, I just thought about abbreviating it >> like cci/coclass. >> >> Regards, >> >> F >> Index: collects/mysterx/mysterx.ss >> =================================================================== >> --- collects/mysterx/mysterx.ss (revision 13203) >> +++ collects/mysterx/mysterx.ss (working copy) >> @@ -54,6 +54,8 @@ >> cci/coclass >> cocreate-instance-from-progid >> cci/progid >> + com-get-active-object-from-coclass >> + gao/coclass >> coclass >> progid >> set-coclass! >> @@ -111,6 +113,8 @@ >> (define cci/coclass cocreate-instance-from-coclass) >> (define cocreate-instance-from-progid mxprims:cocreate-instance-from-progid) >> (define cci/progid cocreate-instance-from-progid) >> + (define com-get-active-object-from-coclass mxprims:com-get-active-object- >> from-coclass) >> + (define gao/coclass com-get-active-object-from-coclass) >> (define coclass mxprims:coclass) >> (define progid mxprims:progid) >> (define set-coclass! mxprims:set-coclass!) >> Index: collects/mysterx/private/mxmain.ss >> =================================================================== >> --- collects/mysterx/private/mxmain.ss (revision 13203) >> +++ collects/mysterx/private/mxmain.ss (working copy) >> @@ -39,6 +39,7 @@ >> progid->html >> cocreate-instance-from-coclass >> cocreate-instance-from-progid >> + com-get-active-object-from-coclass >> coclass >> progid >> set-coclass! >> @@ -324,6 +325,7 @@ >> (define progid->html #f) >> (define cocreate-instance-from-coclass #f) >> (define cocreate-instance-from-progid #f) >> + (define com-get-active-object-from-coclass #f) >> (define coclass #f) >> (define progid #f) >> (define set-coclass! #f) >> Index: src/mysterx/mysterx.cxx >> =================================================================== >> --- src/mysterx/mysterx.cxx (revision 13203) >> +++ src/mysterx/mysterx.cxx (working copy) >> @@ -151,6 +151,7 @@ >> { mx_com_release_object,"com-release-object",1,1 }, >> { mx_com_add_ref,"com-add-ref",1,1 }, >> { mx_com_ref_count,"com-ref-count",1,1 }, >> + { mx_com_get_active_object_from_coclass,"com-get-active-object-from- >> coclass",1,1 }, >> >> // browsers >> >> @@ -901,6 +902,64 @@ >> location, machine); >> } >> >> +Scheme_Object *do_get_active_object(CLSID clsId, LPCTSTR name) >> +{ >> + HRESULT hr; >> + IUnknown *pUnk; >> + IDispatch *pIDispatch; >> + MX_COM_Object *com_object; >> + >> + hr = GetActiveObject(clsId, NULL, &pUnk); >> + >> + if (hr != ERROR_SUCCESS) { >> + char errBuff[2048]; >> + sprintf(errBuff, >> + "com-get-active-object-from-coclass: " >> + "Unable to get instance of %s", >> + name); >> + codedComError(errBuff, hr); >> + } >> + >> + hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pIDispatch); >> + >> + if (hr != ERROR_SUCCESS) { >> + char errBuff[2048]; >> + sprintf(errBuff, >> + "com-get-active-object-from-coclass: " >> + "Unable to get instance of %s", >> + name); >> + codedComError(errBuff, hr); >> + } >> + >> + com_object = (MX_COM_Object *)scheme_malloc_tagged(sizeof(MX_COM_Object)); >> + >> + com_object->so.type = mx_com_object_type; >> + com_object->pIDispatch = pIDispatch; >> + com_object->pITypeInfo = NULL; >> + com_object->clsId = clsId; >> + com_object->pEventTypeInfo = NULL; >> + com_object->pIConnectionPoint = NULL; >> + com_object->pISink = NULL; >> + com_object->connectionCookie = (DWORD)0; >> + com_object->released = FALSE; >> + com_object->types = NULL; >> + >> + mx_register_com_object((Scheme_Object *)com_object, pIDispatch); >> + >> + return (Scheme_Object *)com_object; >> +} >> + >> +Scheme_Object *mx_com_get_active_object_from_coclass(int argc, Scheme_Object >> **argv) >> +{ >> + LPCTSTR coclass; >> + >> + GUARANTEE_STRSYM("com-get-active-object-from-coclass", 0); >> + >> + coclass = schemeToText(argv[0]); >> + >> + return do_get_active_object(getCLSIDFromCoClass(coclass), coclass); >> +} >> + >> Scheme_Object *mx_set_coclass(int argc, Scheme_Object **argv) >> { >> CLSID clsId; >> @@ -4211,7 +4270,8 @@ >> retval = retvalVariantToSchemeObject(&retvalVa); >> >> // all pointers are 32 bits, choose arbitrary one >> - if (retvalVa.vt != VT_VOID) >> + if (retvalVa.vt != VT_VOID && >> + retvalVa.vt != VT_HRESULT) >> free(retvalVa.pullVal); >> >> return retval; >> Index: src/mysterx/mysterx.h >> =================================================================== >> --- src/mysterx/mysterx.h (revision 13203) >> +++ src/mysterx/mysterx.h (working copy) >> @@ -343,6 +343,7 @@ >> MX_PRIM_DECL(mx_com_event_type); >> MX_PRIM_DECL(mx_cocreate_instance_from_coclass); >> MX_PRIM_DECL(mx_cocreate_instance_from_progid); >> +MX_PRIM_DECL(mx_com_get_active_object_from_coclass); >> MX_PRIM_DECL(mx_coclass); >> MX_PRIM_DECL(mx_progid); >> MX_PRIM_DECL(mx_set_coclass); >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme From clements at brinckerhoff.org Mon Jan 19 13:55:52 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:38:33 2009 Subject: [plt-scheme] New Here In-Reply-To: References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> Message-ID: On Jan 19, 2009, at 10:50 AM, Matt Jadud wrote: > On Mon, Jan 19, 2009 at 12:51 PM, Robby Findler > wrote: >> Also on the list belongs Quick, More, and Continue from here: >> >> http://docs.plt-scheme.org/ > > Huh. I hadn't seen "Quick" before. (Of course, saying I haven't seen > something in the PLT documentation is like saying I haven't seen > something in the V&A, no matter how many times you go back.) Of > course, I'm not trying to say that the PLT documentation is like a > warehouse of plundered goods from the countries of the world... but > just that there's a lot of stuff in there. Coming soon to the PLT Documentation: "Magnificence of the Tsars." John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090119/270a101e/smime.bin From robby at eecs.northwestern.edu Mon Jan 19 14:22:59 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:33 2009 Subject: [plt-scheme] call/cc puzzle In-Reply-To: <4BB06EF570D14193B59B1FEBFDE17EB9@uw2b2dff239c4d> References: <49722FD8.7050107@cs.utah.edu> <4BB06EF570D14193B59B1FEBFDE17EB9@uw2b2dff239c4d> Message-ID: <932b2f1f0901191122r605c171fve9c21647c991a164@mail.gmail.com> As far as I am able to tell, when you evaluate left-to-right, ((call/cc call/cc) (call/cc call/cc)) should be a non-tail-recursive loop (right-to-left requires constant space). Perhaps Matthew has done something fancy to mzscheme to be able to optimize something somehow to make it tail recursive, or perhaps it is a bug. Robby On Mon, Jan 19, 2009 at 10:03 AM, Jos Koot wrote: > My explanation of ((call/cc call/cc) (call/cc call/cc)). > > Read this in CPS (continuation passing style) > For this purpose think in terms of meta-procedures EXEC and APPLY. > > (EXEC code cont) ; cont=continuation. > Executes the code and passes the result to the cont. > > (APPLY op rand cont) ; op is procedure/operator, rand is argument/operand. > Calls the op with the rand for its arg and passes the result to the cont. > > Notice that (APPLY call/cc A B) --> (APPLY A B B). > Write ((call/cc call/cc) (call/cc call/cc)) as ((cc1 cc2) (cc3 cc4)). > Let `finish' be the continuation of the top form, > for instance the PLRE of a REPL (read-eval-print-loop), > but as we shall see the finish is never reached, > hence `finish' is irrelevant. > Notation: #i=x introduces #i# as short for x. > > First a WRONG explanation: > > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand > finish))))) > (APPLY cc2 #0# #0#) > (APPLY #0# #0# #0#) = > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) > (APPLY cc4 #1# #1#) > (APPLY #1# #1# #1#) > (APPLY #0# #1# finish) > (EXEC (cc3 cc4) #2=(? (rand) (APPLY #1# rand finish))) = > (APPLY cc4 #2# #2#) > (APPLY #2# #2# #2#) > (APPLY #1# #2# finish) > (APPLY #0# #2# finish) > (EXEC (cc3 cc4) #3=(? (rand) (APPLY #2# finish))) = > (APPLY cc4 #3# #3#) > (APPLY #2# #3# finish) > (APPLY #1# #3# finish) > (APPLY #0# #3# finish) > (EXEC (cc3 cc4) #4=(? (rand) (APPLY #3# rand finish))) = > (APPLY cc4 #4# #4#) > (APPLY #4# #4# #4#) > (APPLY #3# #4# finish) > (APPLY #2# #4# finish) > (APPLY #1# #4# finish) > (APPLY #0# #4# finish) > (EXEC (cc3 cc4) #5=(? (rand) (APPLY #4# rand finish))) = > etc. > > This suggests that ((call/cc call/cc) (call/cc call/cc)) would not run in > bound space. However, it does, as on my small system can easily be verified > by letting it run for some minutes. Apparently Scheme's designers and > implementors ar more clever than shown above. I try again: > > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand > finish))))) > (APPLY cc2 #0# #0#) > (APPLY #0# #0# #0#) > #999=(EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) > (APPLY cc4 #1# #1#) > (APPLY #1# #1# #1#) > (APPLY #0# #1# finish) > (EXEC (cc3 cc4) #2=(? (newrand) (APPLY #1# newrand finish))) = > (EXEC (cc3 cc4) > (? (newrand) > (APPLY (? (rand) (APPLY #0# rand finish)) newrand finish))) = > ; Contract the continuation. > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) = > (EXEC (cc3 cc4) #1#) = #999# ; Space bound loop! > > Is this a correct interpretation? It strikes me that DrScheme's Debug shows > the WRONG behaviour. That may be due to the fact that debug has to extend > each continuation such as to move its arrow and to display results and > therefore cannot collaps the continuations. Correct? > > Jos > > > > ----- Original Message ----- > From: Shriram Krishnamurthi > To: rafkind@cs.utah.edu > Cc: Scheme PLT > Sent: Saturday, January 17, 2009 8:38 PM > Subject: Re: [plt-scheme] call/cc puzzle > > Just remember that putting a use of call/cc in a context changes the meaning > of that use... > > snip > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From morazanm at gmail.com Mon Jan 19 14:23:43 2009 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:38:34 2009 Subject: [plt-scheme] Help Desk not responding Message-ID: <9b1fff280901191123x6324b67bw83a59aec2b616895@mail.gmail.com> Dear All, I have a student that can not access the Help Desk. Every time she clicks on Help Desk, DrScheme freezes up. No error message is reported. She has uninstalled and reinstalled DrScheme to no avail. The version she just installed is 4.1.3[3m]. Any suggestions? Thanks in advance. -- Cheers, Marco From neil at neilvandyke.org Mon Jan 19 14:35:20 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:38:34 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP Message-ID: <4974D5F8.6020109@neilvandyke.org> PLTers... I think one of the first sentences people should see when they get to the "plt-scheme.org" site is something like this, with links: "If you are new to Scheme or to making computer programs, we recommend __installing PLT Scheme__ and starting with __How to Design Programs (HtDP)__." Maybe on the home page, after a few-bulletpoint elevator speech on PLT Scheme, as well as at the top of other pages people might jump to when they're looking for documentation or downloads. Maybe also add a pop-up to DrScheme that opens every time someone starts DrScheme (until they uncheck the box on the popup), suggesting starting with HtDP and providing a button that opens HtDP in their Web browser. I appreciate the shelf of books on the site, but we really need a librarian to tackle newbies and point them to the starter manual. There will always be macho men/women who say "just show me the reference manual; none of this sissy kindergarten stuff," but those people will just disregard the pointer to HtDP and will have no trouble finding the manuals they seek. -- http://www.neilvandyke.org/ From ikentobi at yahoo.com Mon Jan 19 14:44:32 2009 From: ikentobi at yahoo.com (Luka Stojanovic) Date: Thu Mar 26 02:38:34 2009 Subject: [plt-scheme] Help Desk not responding References: <9b1fff280901191123x6324b67bw83a59aec2b616895@mail.gmail.com> Message-ID: <612475.60081.qm@web55803.mail.re3.yahoo.com> What is the browser setting of DrScheme? On what OS is problem manifesting? Dear All, I have a student that can not access the Help Desk. Every time she clicks on Help Desk, DrScheme freezes up. No error message is reported. She has uninstalled and reinstalled DrScheme to no avail. The version she just installed is 4.1.3[3m]. Any suggestions? Thanks in advance. -- Cheers, Marco From neil at neilvandyke.org Mon Jan 19 15:03:42 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:38:34 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <4974D5F8.6020109@neilvandyke.org> References: <4974D5F8.6020109@neilvandyke.org> Message-ID: <4974DC9E.3000205@neilvandyke.org> Random people with Web pages about Scheme, like myself, can also do our part to point people in the right direction: http://www.neilvandyke.org/scheme/ Neil Van Dyke wrote at 01/19/2009 02:35 PM: > PLTers... > > I think one of the first sentences people should see when they get to > the "plt-scheme.org" site is something like this, with links: > > "If you are new to Scheme or to making computer programs, we recommend > __installing PLT Scheme__ and starting with __How to Design Programs > (HtDP)__." > > Maybe on the home page, after a few-bulletpoint elevator speech on PLT > Scheme, as well as at the top of other pages people might jump to when > they're looking for documentation or downloads. > > Maybe also add a pop-up to DrScheme that opens every time someone > starts DrScheme (until they uncheck the box on the popup), suggesting > starting with HtDP and providing a button that opens HtDP in their Web > browser. > > I appreciate the shelf of books on the site, but we really need a > librarian to tackle newbies and point them to the starter manual. > > There will always be macho men/women who say "just show me the > reference manual; none of this sissy kindergarten stuff," but those > people will just disregard the pointer to HtDP and will have no > trouble finding the manuals they seek. > From eli at barzilay.org Mon Jan 19 15:34:48 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:34 2009 Subject: [plt-scheme] Help Desk not responding In-Reply-To: <9b1fff280901191123x6324b67bw83a59aec2b616895@mail.gmail.com> References: <9b1fff280901191123x6324b67bw83a59aec2b616895@mail.gmail.com> Message-ID: <18804.58344.887657.357003@arabic.ccs.neu.edu> On Jan 19, Marco Morazan wrote: > Dear All, > > I have a student that can not access the Help Desk. Every time she > clicks on Help Desk, DrScheme freezes up. No error message is > reported. > > She has uninstalled and reinstalled DrScheme to no avail. The > version she just installed is 4.1.3[3m]. The OS is the important bit here -- once that's determined, then she should look at the list of processes and see if there's some process stuck. FWIW, this is what DrScheme does on the different platforms: * On Windows it uses a standard Windows facility to start a browser at a given place, which is similar to entering a url in the "Run" dialog. * On OSX it uses some standard OSX script that starts a browser at a URL. * On Linux it runs a process -- one from several that can be set in the preferences. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From morazanm at gmail.com Mon Jan 19 15:45:45 2009 From: morazanm at gmail.com (Marco Morazan) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Help Desk not responding In-Reply-To: <18804.58344.887657.357003@arabic.ccs.neu.edu> References: <9b1fff280901191123x6324b67bw83a59aec2b616895@mail.gmail.com> <18804.58344.887657.357003@arabic.ccs.neu.edu> Message-ID: <9b1fff280901191245x37dd59a9p8b2c320e2c3d0daa@mail.gmail.com> The students is running, I believe, Windows XP. From what I have seen, DrScheme fails to bring up the default browser (i.e. IE). Any suggestions as to how to solve it? On Mon, Jan 19, 2009 at 3:34 PM, Eli Barzilay wrote: > On Jan 19, Marco Morazan wrote: >> Dear All, >> >> I have a student that can not access the Help Desk. Every time she >> clicks on Help Desk, DrScheme freezes up. No error message is >> reported. >> >> She has uninstalled and reinstalled DrScheme to no avail. The >> version she just installed is 4.1.3[3m]. > > The OS is the important bit here -- once that's determined, then she > should look at the list of processes and see if there's some process > stuck. > > FWIW, this is what DrScheme does on the different platforms: > > * On Windows it uses a standard Windows facility to start a browser at > a given place, which is similar to entering a url in the "Run" > dialog. > > * On OSX it uses some standard OSX script that starts a browser at a > URL. > > * On Linux it runs a process -- one from several that can be set in > the preferences. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > -- Cheers, Marco From eli at barzilay.org Mon Jan 19 15:51:43 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Help Desk not responding In-Reply-To: <9b1fff280901191245x37dd59a9p8b2c320e2c3d0daa@mail.gmail.com> References: <9b1fff280901191123x6324b67bw83a59aec2b616895@mail.gmail.com> <18804.58344.887657.357003@arabic.ccs.neu.edu> <9b1fff280901191245x37dd59a9p8b2c320e2c3d0daa@mail.gmail.com> Message-ID: <18804.59359.214442.688044@arabic.ccs.neu.edu> On Jan 19, Marco Morazan wrote: > The students is running, I believe, Windows XP. From what I have > seen, DrScheme fails to bring up the default browser (i.e. IE). > > Any suggestions as to how to solve it? Another thing to try is to hit F1 when the cursor is not next to any word. Other than that I don't know what could be wrong. Does it work to just enter a URL in the "Run" dialog box? Does it work to enter (help) on a mzscheme repl? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From grettke at acm.org Mon Jan 19 16:11:09 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: References: <49749EB3.4040105@gmail.com> Message-ID: <756daca50901191311h454a9312i1da91369edb79302@mail.gmail.com> > I similarly use MysterX to access iTunes; this too would benefit from this patch. Do you have a Planet package for this? From grettke at acm.org Mon Jan 19 16:29:44 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <4974DC9E.3000205@neilvandyke.org> References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> Message-ID: <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> On Mon, Jan 19, 2009 at 2:03 PM, Neil Van Dyke wrote: > Random people with Web pages about Scheme, like myself, can also do our part > to point people in the right direction: Have you found some successful ways to communicate, or convince, experienced programmers that there is something for them to learn with HtDP? Most "experienced programmers" tend to be convinved that there is nothing left to learn but new APIs and frameworks. From eli at barzilay.org Mon Jan 19 16:48:24 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <4974D5F8.6020109@neilvandyke.org> References: <4974D5F8.6020109@neilvandyke.org> Message-ID: <18804.62760.275069.940495@arabic.ccs.neu.edu> Generally speaking, the current layout seems pretty good to me (this is thanks to Matthew): downloading PLT is very easily accessible from the front page (as well as from other pages, using the "Download" link on the navbar). As for the documentation, it is pretty extensive, but it begins with the Guide links which are supposed to fill exactly that gap of newcomers who are looking for an introduction rather than a reference. There is also the recently added "Help!" page which is supposed to be a one-stop "don't panic" place. The only thing that looks like it's missing is an HtDP link -- I'm not sure if it's a good idea to put that on the front page (given that the book is only indirectly related to Scheme), but perhap adding it to the "Help!" page is a good idea? On Jan 19, Neil Van Dyke wrote: > PLTers... > > I think one of the first sentences people should see when they get > to the "plt-scheme.org" site is something like this, with links: > > "If you are new to Scheme or to making computer programs, we > recommend __installing PLT Scheme__ and starting with __How to > Design Programs (HtDP)__." > > Maybe on the home page, after a few-bulletpoint elevator speech on > PLT Scheme, as well as at the top of other pages people might jump > to when they're looking for documentation or downloads. > > Maybe also add a pop-up to DrScheme that opens every time someone > starts DrScheme (until they uncheck the box on the popup), > suggesting starting with HtDP and providing a button that opens HtDP > in their Web browser. > > I appreciate the shelf of books on the site, but we really need a > librarian to tackle newbies and point them to the starter manual. > > There will always be macho men/women who say "just show me the > reference manual; none of this sissy kindergarten stuff," but those > people will just disregard the pointer to HtDP and will have no > trouble finding the manuals they seek. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From chust at web.de Mon Jan 19 17:16:40 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> Message-ID: <4974FBC8.3090209@web.de> Grant Rettke wrote: > [...] > Most "experienced programmers" tend to be convinved that there is > nothing left to learn but new APIs and frameworks. > [...] The "experienced programmers" are right: Programming languages are just APIs to be used by a brain to drive a machine :-P However, like with other APIs, it's sometimes useful to adapt the data structures one uses to work seamlessly with the interface -- which, in this particular case, means that the right thought model can be very helpful when solving a programming problem... cu, Thomas From geoff at knauth.org Mon Jan 19 17:22:38 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> Message-ID: On Jan 19, 2009, at 16:29, Grant Rettke wrote: > Have you [Neil] found some successful ways to communicate, or > convince, > experienced programmers that there is something for them to learn with > HtDP? > Most "experienced programmers" tend to be convinved that there is > nothing left to learn but new APIs and frameworks. I was in that category, but when I learned the HtDP methodology, I was surprised how many times I put some effort into coming up with a solution, thinking I had lots more to do, only to find that really I was done. It's a wonderful feeling. I do wish there were variants like: - How to Design World Financial Recovery - How to Design Mideast Peace - How to Design a Cure for Cancer At least I'm happy HtDP has made my engineering life easier. It even makes teaching C++ easier, which I am doing this semester (hold the catcalls). Today students were clearly thinking things through, checking results against expectations. In 30 minutes they went from not really having a clue where to start, to understanding exactly how to approach the week's work. From neil at neilvandyke.org Mon Jan 19 17:25:36 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:38:35 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <18804.62760.275069.940495@arabic.ccs.neu.edu> References: <4974D5F8.6020109@neilvandyke.org> <18804.62760.275069.940495@arabic.ccs.neu.edu> Message-ID: <4974FDE0.5060809@neilvandyke.org> Whatever you think is the best introductory material for most of the people who go to "plt-scheme.org"... I think you need to hit them over the head with it. There should be no question in the mind of anyone visiting the site what the single, recommended starting-point is. Otherwise, there will be the frequently-asked question of "What's a good way to get started with Scheme?" from the vocal minority of confused newbies, and the silent majority of newbies will just do random walks. Speaking as one of the people using PLT Scheme professionally, I think that "plt-scheme.org" should first make things easiest for *students/educators and young enthusiasts*. You can throw in a hint on the same page that professional programmers will spot, to be reassured that PLT is for them too, and the professionals will be able to find the reference manuals. Maybe a hint for programming language academics, too, although they will know of PLT and where to find papers, in any case. -- http://www.neilvandyke.org/ From matthias at ccs.neu.edu Mon Jan 19 17:37:54 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:38:36 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> Message-ID: On Jan 19, 2009, at 5:22 PM, Geoffrey S. Knauth wrote: > It even makes teaching C++ easier, which I am doing this semester > (hold the catcalls). Today students were clearly thinking things > through, checking results against expectations. In 30 minutes they > went from not really having a clue where to start, to understanding > exactly how to approach the week's work. That's what HtDP was shooting for. Thanks Neil for the idea. I think you're right but we need to find the right way to implement it on our sites. And yes, I appreciate it very much if you and others point to HtDP as the place to start. -- Matthias From dblaheta at knox.edu Mon Jan 19 17:46:59 2009 From: dblaheta at knox.edu (Don Blaheta) Date: Thu Mar 26 02:38:36 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <18804.14801.804854.57717@arabic.ccs.neu.edu>; from eli@barzilay.org on Mon, Jan 19, 2009 at 03:29:05AM -0500 References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> <18800.30792.436062.917137@arabic.ccs.neu.edu> <932b2f1f0901130418s235966uf3472c342e499807@mail.gmail.com> <5BF1783B-E180-4FCF-B2DF-FF8B053FAFC5@ccs.neu.edu> <20090119012209.A22737@winter.phpwebhosting.com> <18804.14801.804854.57717@arabic.ccs.neu.edu> Message-ID: <20090119164659.A25132@winter.phpwebhosting.com> Quoth Eli Barzilay: > On Jan 19, Don Blaheta wrote: > > Quoth Eli Barzilay: > (The problem is not with the file being readable to you, > it's about the sandboxed environment being very limited in what it can > access. ... Yes, I thought it might be something like that. I certainly understand why the *sandboxed* code shouldn't be able to access files like that. :) > Then you can bind your own `x' to the twice the value of the student's > `foo': > > (define x (* 2 (e 'foo))) > > and use this value with the student's `add' function: > > (e `(add foo ,x)) The (e 'foo) trick I had figured out, and I'm definitely coming around to understanding its usefulness... quasiquote makes it even better ;) > Using the sandbox environment is very convenient, because it provides > a clear separation between what happens inside the student code and in > your testing code. Yes. > In any case, the solution for this is a new `call-in-sandbox-context' > function which will run an arbitrary thunk (*your* code) inside the > sandbox environment. For example, to check if a name is defined using > that function, you can do this: > > (require mzlib/etc) > (call-in-sandbox-context e (lambda () (namespace-defined? 'foo))) Ooh, neat. My thunked code runs with its own stuff in the closure, but the "current" namespace when its running is the students' definitions? I think I get it; I need to play with namespaces more. > Therefore, uses of sandboxes almost always need to catch all > exceptions from the sandbox, and be aware of multiple values. But you > do get a lot of help in that *all* errors are just exceptions. A HA! That last was precisely the sentence that made all sorts of stuff click for me. > I didn't do that since it seems like a trivial thing to setup. (By > the way, note that there can be anything in the second form, since you > can call `raise' directly on any value, not just an exception.) Yeah, now that I understand what's going on here, I can write or adapt my existing test suite stuff. (Although, I should probably at least look at the handin server---guess it's time to start grabbing from the SVN repository. :) -- -=-Don Blaheta-=-dblaheta@knox.edu-=-=--=- "Something's been sticking in my craw. No surprise there; I was born with an unusually narrow craw." --Stephen Colbert From eli at barzilay.org Mon Jan 19 17:55:33 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:36 2009 Subject: [plt-scheme] Exporting from an already-written module? In-Reply-To: <20090119164659.A25132@winter.phpwebhosting.com> References: <20090109202702.A17066@winter.phpwebhosting.com> <932b2f1f0901092016h6edb3499m94c4026905a01074@mail.gmail.com> <20090113025832.A20919@winter.phpwebhosting.com> <18800.30792.436062.917137@arabic.ccs.neu.edu> <932b2f1f0901130418s235966uf3472c342e499807@mail.gmail.com> <5BF1783B-E180-4FCF-B2DF-FF8B053FAFC5@ccs.neu.edu> <20090119012209.A22737@winter.phpwebhosting.com> <18804.14801.804854.57717@arabic.ccs.neu.edu> <20090119164659.A25132@winter.phpwebhosting.com> Message-ID: <18805.1254.361.180552@arabic.ccs.neu.edu> On Jan 19, Don Blaheta wrote: > Quoth Eli Barzilay: > > > Using the sandbox environment is very convenient, because it > > provides a clear separation between what happens inside the > > student code and in your testing code. > > Yes. > > > In any case, the solution for this is a new > > `call-in-sandbox-context' function which will run an arbitrary > > thunk (*your* code) inside the sandbox environment. For example, > > to check if a name is defined using that function, you can do > > this: > > > > (require mzlib/etc) > > (call-in-sandbox-context e (lambda () (namespace-defined? 'foo))) > > Ooh, neat. My thunked code runs with its own stuff in the closure, > but the "current" namespace when its running is the students' > definitions? Yes. > I think I get it; I need to play with namespaces more. As another example, you can grab the student's namespace with (call-in-sandbox-context e current-namespace) but there are other things that are local to the sandboxed environment. (For example, it runs on a different thread, under a different custodian, with a different eventspace, etc etc.) The summary is that the sandbox library deals with a bunch of fairly low-level stuff that is needed to make it happen, but that you won't want to learn to just run the code... > > Therefore, uses of sandboxes almost always need to catch all > > exceptions from the sandbox, and be aware of multiple values. But > > you do get a lot of help in that *all* errors are just exceptions. > > A HA! That last was precisely the sentence that made all sorts of > stuff click for me. In that case it would be nice if you find a place to add it to the documentation page so it's more obvious. > > I didn't do that since it seems like a trivial thing to setup. > > (By the way, note that there can be anything in the second form, > > since you can call `raise' directly on any value, not just an > > exception.) > > Yeah, now that I understand what's going on here, I can write or > adapt my existing test suite stuff. (Although, I should probably at > least look at the handin server---guess it's time to start grabbing > from the SVN repository. :) Well, the handin server is doing a bunch of other stuff too -- if all you need is test student code, then the sandbox is enough for just that. Use the handin server when you want to automate homework submission (and as a side bonus it can do some checking of student code while it's being submitted.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From neil at neilvandyke.org Mon Jan 19 18:01:36 2009 From: neil at neilvandyke.org (Neil Van Dyke) Date: Thu Mar 26 02:38:36 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> Message-ID: <49750650.6020109@neilvandyke.org> I've been through phases of advocacy, but the languages advocacy space is *so saturated* with wanking from narrow experience that the marketplace of ideas is more like a sleazy bathhouse. My attitude now, having been doing this for decades, is one of no longer being interested in 99% of people's perspectives on languages or software development. "*Read this one document*, and ask on the list if you get stuck anywhere. Or don't, but stop telling me about your 'python' and your navel-gazing theories. I'm all set with that myself." :) > On Jan 19, 2009, at 16:29, Grant Rettke wrote: >> Have you [Neil] found some successful ways to communicate, or convince, >> experienced programmers that there is something for them to learn with >> HtDP? >> Most "experienced programmers" tend to be convinved that there is >> nothing left to learn but new APIs and frameworks. From geoff at knauth.org Mon Jan 19 19:33:46 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:36 2009 Subject: [plt-scheme] New Here In-Reply-To: References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> Message-ID: <6886F2CD-89A0-4A6C-AE1A-6D4E9C2A67EA@knauth.org> I just noticed Quick the other day. I'm tickled it uses Slideshow. On Jan 19, 2009, at 13:50, Matt Jadud wrote: > On Mon, Jan 19, 2009 at 12:51 PM, Robby Findler > wrote: >> Also on the list belongs Quick, More, and Continue from here: >> >> http://docs.plt-scheme.org/ > > Huh. I hadn't seen "Quick" before. (Of course, saying I haven't seen > something in the PLT documentation is like saying I haven't seen > something in the V&A, no matter how many times you go back.) Of > course, I'm not trying to say that the PLT documentation is like a > warehouse of plundered goods from the countries of the world... but > just that there's a lot of stuff in there. > > I like the use of slideshow. That makes a nice environment for the > introduction of first-class functions at the end of the week. From jmj at fellowhuman.com Mon Jan 19 19:39:11 2009 From: jmj at fellowhuman.com (Jordan Johnson) Date: Thu Mar 26 02:38:36 2009 Subject: [plt-scheme] Pasted images Message-ID: Hi all, When I copy and paste an image (png, jpg, etc) from an external app into DrScheme, what code reads it from the clipboard? I've determined it's created as an image-snip%, with snip-class "wximage", but where does it get created? Thanks, jmj From esmith at acanac.net Mon Jan 19 20:29:34 2009 From: esmith at acanac.net (Ernie Smith) Date: Thu Mar 26 02:38:37 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP References: 18804.62760.275069.940495@arabic.ccs.neu.edu Message-ID: <497528FE.1020204@acanac.net> I'm an experienced working programmer who did start with HtDP. I was careful to keep an open mind and work through it in spite of a sense it was a bit pedantic for an experienced programmer. There was definitely an urge to gloss over it so quickly you get nothing out of it. It took self discipline to keep that in check. What I did get out of it was an appreciation for Dr Scheme. What impressed me most was the beautiful way the language can grow with the student's grasp of it, thus permitting things to be learned with no clutter fogging the issues. But most of the things taught in HtDP were already known to me. I just wish I had it 20 years earlier. I'm looking forward to the next Ht?? What actually drew me here in the first place was a sense that though I had been using programming languages for decades I really never learned how to properly evaluate the merit of a programming language as applicable to a given class of problems. I've observed that PLT scheme is excellent to use for exploring programming language features. I also observed that much exploration is going on around PLT scheme. So I hope for "How to select a programming language" with bated breath. Meanwhile, I suggest to any other battle scarred programmer with similar aspirations, that working through Shriram's "Programming languages: Application and Interpretation" took me forward a long way toward my goal. > http://www.plai.org/ From eli at barzilay.org Mon Jan 19 21:07:56 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:37 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <497528FE.1020204@acanac.net> References: <497528FE.1020204@acanac.net> Message-ID: <18805.12796.787915.807793@arabic.ccs.neu.edu> On Jan 19, Ernie Smith wrote: > > So I hope for "How to select a programming language" with bated > breath. > > Meanwhile, I suggest to any other battle scarred programmer with > similar aspirations, that working through Shriram's "Programming > languages: Application and Interpretation" took me forward a long > way toward my goal. Actually, "How to select a programming language" could be a good subtitle for PLAI. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From noelwelsh at gmail.com Tue Jan 20 03:02:00 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:38:37 2009 Subject: [plt-scheme] New Here In-Reply-To: References: <89c38c820901190933s19dffc43k1bd11cd1c0a2c55a@mail.gmail.com> <825FDFA9C3114A5E97CC0106736142B3@uw2b2dff239c4d> <932b2f1f0901190951n70ba3468n99d8624c6231c1b4@mail.gmail.com> Message-ID: On Mon, Jan 19, 2009 at 6:50 PM, Matt Jadud wrote: > On Mon, Jan 19, 2009 at 12:51 PM, Robby Findler > ... I'm not trying to say that the PLT documentation is like a > warehouse of plundered goods from the countries of the world... That applies better to PLT and the US research system in general. ;-) N. From willi.schiegel at bccn-berlin.de Tue Jan 20 02:59:17 2009 From: willi.schiegel at bccn-berlin.de (Willi Schiegel) Date: Thu Mar 26 02:38:37 2009 Subject: [plt-scheme] Learning PLT-Scheme - HTDP Message-ID: <49758455.40702@bccn-berlin.de> Hello, following the discussions in this list about learning PLT-Scheme I learned that one of the best ways to start learning is with HTDP. So I skimmed through some chapters to find out whether I would understand it with my little C programming background. But the problem for me is that there are no solutions to the exercises (only for teachers). I as a self learner would like to know whether I am on the right track with my code and whether there are more efficient and/or elegant ways to solve a problem. So is there another recommended learning resource with solutions to exercises? Thank you very much. Greetings, Willi Schiegel From noelwelsh at gmail.com Tue Jan 20 04:00:44 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:38:37 2009 Subject: [plt-scheme] Learning PLT-Scheme - HTDP In-Reply-To: <49758455.40702@bccn-berlin.de> References: <49758455.40702@bccn-berlin.de> Message-ID: On Tue, Jan 20, 2009 at 7:59 AM, Willi Schiegel wrote: > Hello, > > following the discussions in this list about learning PLT-Scheme I > learned that one of the best ways to start learning is with HTDP. So I > skimmed through some chapters to find out whether I would understand it > with my little C programming background. But the problem for me is that > there are no solutions to the exercises (only for teachers). A great many people study HtDP on their own, and ask questions about the exercises either on this list, or on this group: http://groups.google.co.uk/group/study-htdp which was created specifically for people going through HtDP. I imagine that, as a motivated adult student you'd make good progress on your own. N. From keydana at gmx.de Tue Jan 20 04:13:05 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:38:37 2009 Subject: [plt-scheme] how to test for optional requirements in nondeterministic programming Message-ID: <497595A1.1060604@gmx.de> Hi, like in the SICP "puzzles", I am using amb to choose people from a list and then verify that requirements are fulfilled with an assert method. Now, in addition to the requirements, I also want to make the result satisfy some "optional" requirements or "nice-to-have"s if possible, but in contrast to the "hard requirements" the program may not fail if this doesn't work out. The only thing I could think of so far was: when "hard requirements" are fulfilled, get the current continuation with call/cc, call some "optional-assert" method which would look like (define optional-assert (lambda (condition current-result cont) (if (not condition) (if (eq? fail 'TOTAL-FAIL) (cont current-result) (fail)) #t))) [where fail is the global variable which holds amb's saved continuation] I haven't tried this yet, but anyway it's surely not an elegant solution. Perhaps someone has a suggestion for me how to better handle this? Thanks a lot in advance, Sigrid From filcab at gmail.com Tue Jan 20 07:24:34 2009 From: filcab at gmail.com (Filipe Cabecinhas) Date: Thu Mar 26 02:38:38 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: <20090119154923.23F9E65009E@mail-svr1.cs.utah.edu> References: <49749EB3.4040105@gmail.com> <20090119154923.23F9E65009E@mail-svr1.cs.utah.edu> Message-ID: <4975C282.9050709@gmail.com> Hi, Just a minor correction: the get-active-object methods don't have a where? argument. I don't know how DCOM relates to that but I suppose you would register a remote object if you wanted, so the where? argument isn't applicable (it just looks up the desired object in a (local, always) table). Regards, F Matthew Flatt wrote: > I've applied this patch and also added documentation in SVN. I didn't > try running or compiling anything (other than docs), so let me know if > it's not ok. > > Thanks for the patch! > Matthew > > At Mon, 19 Jan 2009 15:39:31 +0000, Filipe Cabecinhas wrote: >> Hi all, >> >> I've made a small MysterX patch to add GetActiveObject functionality. >> With this patch, if you want to get hold of an Excel.Application object >> (for example), you don't have to go to the trouble to create one of >> those objects if Excel is running (and it will take a small fraction of >> the time). >> >> I'm using MysterX to automate AutoCAD through MzScheme and AutoCAD takes >> around 1 minute (or more) to start using cci/coclass. For what I'm >> doing, I can just take the running AutoCAD application, and that (with >> GetActiveObject) will take only 0.5 seconds ;-) >> >> This patch adds two functions: >> com-get-active-object-from-coclass >> and its short name: cgao/coclass >> I can live without the short name, I just thought about abbreviating it >> like cci/coclass. >> >> Regards, >> >> F >> Index: collects/mysterx/mysterx.ss >> =================================================================== >> --- collects/mysterx/mysterx.ss (revision 13203) >> +++ collects/mysterx/mysterx.ss (working copy) >> @@ -54,6 +54,8 @@ >> cci/coclass >> cocreate-instance-from-progid >> cci/progid >> + com-get-active-object-from-coclass >> + gao/coclass >> coclass >> progid >> set-coclass! >> @@ -111,6 +113,8 @@ >> (define cci/coclass cocreate-instance-from-coclass) >> (define cocreate-instance-from-progid mxprims:cocreate-instance-from-progid) >> (define cci/progid cocreate-instance-from-progid) >> + (define com-get-active-object-from-coclass mxprims:com-get-active-object- >> from-coclass) >> + (define gao/coclass com-get-active-object-from-coclass) >> (define coclass mxprims:coclass) >> (define progid mxprims:progid) >> (define set-coclass! mxprims:set-coclass!) >> Index: collects/mysterx/private/mxmain.ss >> =================================================================== >> --- collects/mysterx/private/mxmain.ss (revision 13203) >> +++ collects/mysterx/private/mxmain.ss (working copy) >> @@ -39,6 +39,7 @@ >> progid->html >> cocreate-instance-from-coclass >> cocreate-instance-from-progid >> + com-get-active-object-from-coclass >> coclass >> progid >> set-coclass! >> @@ -324,6 +325,7 @@ >> (define progid->html #f) >> (define cocreate-instance-from-coclass #f) >> (define cocreate-instance-from-progid #f) >> + (define com-get-active-object-from-coclass #f) >> (define coclass #f) >> (define progid #f) >> (define set-coclass! #f) >> Index: src/mysterx/mysterx.cxx >> =================================================================== >> --- src/mysterx/mysterx.cxx (revision 13203) >> +++ src/mysterx/mysterx.cxx (working copy) >> @@ -151,6 +151,7 @@ >> { mx_com_release_object,"com-release-object",1,1 }, >> { mx_com_add_ref,"com-add-ref",1,1 }, >> { mx_com_ref_count,"com-ref-count",1,1 }, >> + { mx_com_get_active_object_from_coclass,"com-get-active-object-from- >> coclass",1,1 }, >> >> // browsers >> >> @@ -901,6 +902,64 @@ >> location, machine); >> } >> >> +Scheme_Object *do_get_active_object(CLSID clsId, LPCTSTR name) >> +{ >> + HRESULT hr; >> + IUnknown *pUnk; >> + IDispatch *pIDispatch; >> + MX_COM_Object *com_object; >> + >> + hr = GetActiveObject(clsId, NULL, &pUnk); >> + >> + if (hr != ERROR_SUCCESS) { >> + char errBuff[2048]; >> + sprintf(errBuff, >> + "com-get-active-object-from-coclass: " >> + "Unable to get instance of %s", >> + name); >> + codedComError(errBuff, hr); >> + } >> + >> + hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pIDispatch); >> + >> + if (hr != ERROR_SUCCESS) { >> + char errBuff[2048]; >> + sprintf(errBuff, >> + "com-get-active-object-from-coclass: " >> + "Unable to get instance of %s", >> + name); >> + codedComError(errBuff, hr); >> + } >> + >> + com_object = (MX_COM_Object *)scheme_malloc_tagged(sizeof(MX_COM_Object)); >> + >> + com_object->so.type = mx_com_object_type; >> + com_object->pIDispatch = pIDispatch; >> + com_object->pITypeInfo = NULL; >> + com_object->clsId = clsId; >> + com_object->pEventTypeInfo = NULL; >> + com_object->pIConnectionPoint = NULL; >> + com_object->pISink = NULL; >> + com_object->connectionCookie = (DWORD)0; >> + com_object->released = FALSE; >> + com_object->types = NULL; >> + >> + mx_register_com_object((Scheme_Object *)com_object, pIDispatch); >> + >> + return (Scheme_Object *)com_object; >> +} >> + >> +Scheme_Object *mx_com_get_active_object_from_coclass(int argc, Scheme_Object >> **argv) >> +{ >> + LPCTSTR coclass; >> + >> + GUARANTEE_STRSYM("com-get-active-object-from-coclass", 0); >> + >> + coclass = schemeToText(argv[0]); >> + >> + return do_get_active_object(getCLSIDFromCoClass(coclass), coclass); >> +} >> + >> Scheme_Object *mx_set_coclass(int argc, Scheme_Object **argv) >> { >> CLSID clsId; >> @@ -4211,7 +4270,8 @@ >> retval = retvalVariantToSchemeObject(&retvalVa); >> >> // all pointers are 32 bits, choose arbitrary one >> - if (retvalVa.vt != VT_VOID) >> + if (retvalVa.vt != VT_VOID && >> + retvalVa.vt != VT_HRESULT) >> free(retvalVa.pullVal); >> >> return retval; >> Index: src/mysterx/mysterx.h >> =================================================================== >> --- src/mysterx/mysterx.h (revision 13203) >> +++ src/mysterx/mysterx.h (working copy) >> @@ -343,6 +343,7 @@ >> MX_PRIM_DECL(mx_com_event_type); >> MX_PRIM_DECL(mx_cocreate_instance_from_coclass); >> MX_PRIM_DECL(mx_cocreate_instance_from_progid); >> +MX_PRIM_DECL(mx_com_get_active_object_from_coclass); >> MX_PRIM_DECL(mx_coclass); >> MX_PRIM_DECL(mx_progid); >> MX_PRIM_DECL(mx_set_coclass); >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme -------------- next part -------------- Index: collects/mysterx/scribblings/methprop.scrbl =================================================================== --- collects/mysterx/scribblings/methprop.scrbl (revision 13234) +++ collects/mysterx/scribblings/methprop.scrbl (working copy) @@ -50,11 +50,9 @@ @deftogether[( -@defproc[(com-get-active-object-from-coclass [coclass string?] - [where (or/c (one-of/c 'local 'remote) string?) 'local]) +@defproc[(com-get-active-object-from-coclass [coclass string?]) com-object?] -@defproc[(gao/coclass [coclass string?] - [where (or/c (one-of/c 'local 'remote) string?) 'local]) +@defproc[(gao/coclass [coclass string?]) com-object?] )]{ From dave at pawfal.org Tue Jan 20 07:31:12 2009 From: dave at pawfal.org (Dave Griffiths) Date: Thu Mar 26 02:38:38 2009 Subject: [plt-scheme] exception handling Message-ID: <1232454672.5996.25.camel@kittywake> Hi all, A quick question about exception handling. I'd like to run a thunk in a context where I can capture the error and do something with it in code - i.e. keep the program running after the error has occurred. For example something like this: (define error-happened #f) (define (err n) (set! error-happened #t)) (call-with-exception-handler err (lambda () (modulo 0 1 2))) (when error-happened (do-something)) However, the value of (err) is passed to the uncaught exception handler, which in turn stops evaluation. I certainly don't want to turn off the normal exception handling globally, so I'm guessing I can use (with-handlers) but I'm not sure how. cheers, dave From mflatt at cs.utah.edu Tue Jan 20 07:51:24 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:38 2009 Subject: [plt-scheme] exception handling In-Reply-To: <1232454672.5996.25.camel@kittywake> References: <1232454672.5996.25.camel@kittywake> Message-ID: <20090120125128.D444765009C@mail-svr1.cs.utah.edu> At Tue, 20 Jan 2009 12:31:12 +0000, Dave Griffiths wrote: > A quick question about exception handling. I'd like to run a thunk in a > context where I can capture the error and do something with it in code - > i.e. keep the program running after the error has occurred. For example > something like this: > > (define error-happened #f) > > (define (err n) > (set! error-happened #t)) > > (call-with-exception-handler err (lambda () (modulo 0 1 2))) > > (when error-happened > (do-something)) > > However, the value of (err) is passed to the uncaught exception handler, > which in turn stops evaluation. I certainly don't want to turn off the > normal exception handling globally, so I'm guessing I can use > (with-handlers) but I'm not sure how. An exception handler has to escape out of the expression that raised the exception. And, to escape, you have to create a place to escape to. The most primitive way to do that is to set a prompt and abort to it: (define recover-tag (make-continuation-prompt-tag)) (define (err n) (set! error-happened #t) (abort-current-continuation recover-tag 10)) (define (call-as-recoverable thunk) (call-with-continuation-prompt thunk recover-tag (lambda (v) v))) (call-with-exception-handler err (lambda () (+ (call-as-recoverable (lambda () (modulo 0 1 2))) 5))) That's pretty much what `with-handlers' does: (define (err n) (set! error-happened #t) 10) ; just return a value, because `with-handlers' handles abort (+ (with-handlers ([(lambda (x) #t) err]) (modulo 0 1 2)) 5) Some Scheme/Lisp systems effectively put a prompt at every call to a primitive function, so that an exception handler can recover from any exception that was raised by a primitive by aborting to the call. PLT Scheme doesn't support that, though. Matthew From jos.koot at telefonica.net Tue Jan 20 08:47:14 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:38 2009 Subject: [plt-scheme] call/cc puzzle References: <49722FD8.7050107@cs.utah.edu> <4BB06EF570D14193B59B1FEBFDE17EB9@uw2b2dff239c4d> <932b2f1f0901191122r605c171fve9c21647c991a164@mail.gmail.com> Message-ID: <387E41F8846C4DF9BA4C02DCAC2D26A2@uw2b2dff239c4d> Neither did I expect ((call/cc call/cc) (call/cc call/cc)) to run in bound space, but I had it run on my 1.8 Ghz, 1Mb RAM single processor machine for over 15 minutes without noticing any substantial increase of memory usage. That's why I looked for an explanation of space bound behaviour. Jos ----- Original Message ----- From: "Robby Findler" To: "Jos Koot" Cc: "Shriram Krishnamurthi" ; ; "Scheme PLT" Sent: Monday, January 19, 2009 8:22 PM Subject: Re: [plt-scheme] call/cc puzzle As far as I am able to tell, when you evaluate left-to-right, ((call/cc call/cc) (call/cc call/cc)) should be a non-tail-recursive loop (right-to-left requires constant space). Perhaps Matthew has done something fancy to mzscheme to be able to optimize something somehow to make it tail recursive, or perhaps it is a bug. Robby On Mon, Jan 19, 2009 at 10:03 AM, Jos Koot wrote: > My explanation of ((call/cc call/cc) (call/cc call/cc)). > > Read this in CPS (continuation passing style) > For this purpose think in terms of meta-procedures EXEC and APPLY. > > (EXEC code cont) ; cont=continuation. > Executes the code and passes the result to the cont. > > (APPLY op rand cont) ; op is procedure/operator, rand is argument/operand. > Calls the op with the rand for its arg and passes the result to the cont. > > Notice that (APPLY call/cc A B) --> (APPLY A B B). > Write ((call/cc call/cc) (call/cc call/cc)) as ((cc1 cc2) (cc3 cc4)). > Let `finish' be the continuation of the top form, > for instance the PLRE of a REPL (read-eval-print-loop), > but as we shall see the finish is never reached, > hence `finish' is irrelevant. > Notation: #i=x introduces #i# as short for x. > > First a WRONG explanation: > > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand > finish))))) > (APPLY cc2 #0# #0#) > (APPLY #0# #0# #0#) = > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) > (APPLY cc4 #1# #1#) > (APPLY #1# #1# #1#) > (APPLY #0# #1# finish) > (EXEC (cc3 cc4) #2=(? (rand) (APPLY #1# rand finish))) = > (APPLY cc4 #2# #2#) > (APPLY #2# #2# #2#) > (APPLY #1# #2# finish) > (APPLY #0# #2# finish) > (EXEC (cc3 cc4) #3=(? (rand) (APPLY #2# finish))) = > (APPLY cc4 #3# #3#) > (APPLY #2# #3# finish) > (APPLY #1# #3# finish) > (APPLY #0# #3# finish) > (EXEC (cc3 cc4) #4=(? (rand) (APPLY #3# rand finish))) = > (APPLY cc4 #4# #4#) > (APPLY #4# #4# #4#) > (APPLY #3# #4# finish) > (APPLY #2# #4# finish) > (APPLY #1# #4# finish) > (APPLY #0# #4# finish) > (EXEC (cc3 cc4) #5=(? (rand) (APPLY #4# rand finish))) = > etc. > > This suggests that ((call/cc call/cc) (call/cc call/cc)) would not run in > bound space. However, it does, as on my small system can easily be > verified > by letting it run for some minutes. Apparently Scheme's designers and > implementors ar more clever than shown above. I try again: > > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand > finish))))) > (APPLY cc2 #0# #0#) > (APPLY #0# #0# #0#) > #999=(EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) > (APPLY cc4 #1# #1#) > (APPLY #1# #1# #1#) > (APPLY #0# #1# finish) > (EXEC (cc3 cc4) #2=(? (newrand) (APPLY #1# newrand finish))) = > (EXEC (cc3 cc4) > (? (newrand) > (APPLY (? (rand) (APPLY #0# rand finish)) newrand finish))) = > ; Contract the continuation. > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) = > (EXEC (cc3 cc4) #1#) = #999# ; Space bound loop! > > Is this a correct interpretation? It strikes me that DrScheme's Debug > shows > the WRONG behaviour. That may be due to the fact that debug has to extend > each continuation such as to move its arrow and to display results and > therefore cannot collaps the continuations. Correct? > > Jos > > > > ----- Original Message ----- > From: Shriram Krishnamurthi > To: rafkind@cs.utah.edu > Cc: Scheme PLT > Sent: Saturday, January 17, 2009 8:38 PM > Subject: Re: [plt-scheme] call/cc puzzle > > Just remember that putting a use of call/cc in a context changes the > meaning > of that use... > > snip > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From dave at pawfal.org Tue Jan 20 09:01:21 2009 From: dave at pawfal.org (Dave Griffiths) Date: Thu Mar 26 02:38:38 2009 Subject: [plt-scheme] exception handling In-Reply-To: <20090120125128.D444765009C@mail-svr1.cs.utah.edu> References: <1232454672.5996.25.camel@kittywake> <20090120125128.D444765009C@mail-svr1.cs.utah.edu> Message-ID: <1232460081.5996.35.camel@kittywake> On Tue, 2009-01-20 at 05:51 -0700, Matthew Flatt wrote: > At Tue, 20 Jan 2009 12:31:12 +0000, Dave Griffiths wrote: > > A quick question about exception handling. I'd like to run a thunk in a > > context where I can capture the error and do something with it in code - > > i.e. keep the program running after the error has occurred. For example > > something like this: > > > > (define error-happened #f) > > > > (define (err n) > > (set! error-happened #t)) > > > > (call-with-exception-handler err (lambda () (modulo 0 1 2))) > > > > (when error-happened > > (do-something)) > > > > However, the value of (err) is passed to the uncaught exception handler, > > which in turn stops evaluation. I certainly don't want to turn off the > > normal exception handling globally, so I'm guessing I can use > > (with-handlers) but I'm not sure how. > > An exception handler has to escape out of the expression that raised > the exception. And, to escape, you have to create a place to escape to. > > The most primitive way to do that is to set a prompt and abort to it: > > (define recover-tag (make-continuation-prompt-tag)) > > (define (err n) > (set! error-happened #t) > (abort-current-continuation recover-tag 10)) > > (define (call-as-recoverable thunk) > (call-with-continuation-prompt > thunk > recover-tag > (lambda (v) v))) > > (call-with-exception-handler err (lambda () > (+ (call-as-recoverable > (lambda () (modulo 0 1 2))) > 5))) > > That's pretty much what `with-handlers' does: > > (define (err n) > (set! error-happened #t) > 10) ; just return a value, because `with-handlers' handles abort > > (+ (with-handlers ([(lambda (x) #t) err]) > (modulo 0 1 2)) > 5) > > > Some Scheme/Lisp systems effectively put a prompt at every call to a > primitive function, so that an exception handler can recover from any > exception that was raised by a primitive by aborting to the call. PLT > Scheme doesn't support that, though. Thanks! That works perfectly for me. The ability to do this makes livecoding much more forgiving in certain situations :) Maybe more detailed questions on this at a later date... cheers, dave From chust at web.de Tue Jan 20 09:44:26 2009 From: chust at web.de (Thomas Chust) Date: Thu Mar 26 02:38:38 2009 Subject: [plt-scheme] how to test for optional requirements in nondeterministic programming In-Reply-To: <497595A1.1060604@gmx.de> References: <497595A1.1060604@gmx.de> Message-ID: <4975E34A.20505@web.de> Sigrid Keydana wrote: > [...] > like in the SICP "puzzles", I am using amb to choose people from a list > and then verify that requirements are fulfilled with an assert method. > Now, in addition to the requirements, I also want to make the result > satisfy some "optional" requirements or "nice-to-have"s if possible, but > in contrast to the "hard requirements" the program may not fail if this > doesn't work out. > [...] Hello, this sounds as if you could solve your problem simply by nesting the dynamic scope of amb backtracking contexts. Here is a stupid example that wraps the results satisfying all hard preconditions in pairs whose car is #t iff the soft preconditions are met and whose cdr contains the result itself: #lang scheme (require (planet murphy/amb:1:1/amb)) (define (solutions) (amb-collect (let ([i (let ([i (for/amb ([i (in-range 0 10)]) i)]) ;; Check hard preconditions (amb-assert (odd? i)) (amb-assert (> i 1)) i)]) (cons (amb (begin ;; Check soft preconditions (amb-assert (> i 5)) (amb-assert (< i 9)) #t) #f) i)))) [The for/amb syntax is just a shorthand from my implementation of the amb operator. In this particular example it could be replaced with (amb 0 1 ... 9)] cu, Thomas From mflatt at cs.utah.edu Tue Jan 20 09:58:30 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:39 2009 Subject: [plt-scheme] call/cc puzzle In-Reply-To: <387E41F8846C4DF9BA4C02DCAC2D26A2@uw2b2dff239c4d> References: <49722FD8.7050107@cs.utah.edu> <4BB06EF570D14193B59B1FEBFDE17EB9@uw2b2dff239c4d> <932b2f1f0901191122r605c171fve9c21647c991a164@mail.gmail.com> <387E41F8846C4DF9BA4C02DCAC2D26A2@uw2b2dff239c4d> Message-ID: <20090120145832.74E1E65009C@mail-svr1.cs.utah.edu> There's no fancy optimization of this example in PLT Scheme. It runs in unbounded space --- but *very* slowly. Compare the rate of output when running `grow' versus `stable' in (define counter 0) (define (noisy-call/cc f) (set! counter (+ counter 1)) (cond [(zero? (modulo counter 100)) (display counter) (newline)]) (call/cc f)) (define (grow) (let ([rator (call/cc call/cc)]) (rator (call/cc noisy-call/cc)))) (define (stable) (let ([rand (call/cc call/cc)]) ((call/cc noisy-call/cc) rand))) I've used `let' in both variants to force a particular order of operation (and also used `cond' instead of `when', etc.) so you can try `grow' versus `stable' in implementations other than PLT Scheme. I saw the same qualitative difference between the two across all the implementations I tried. At Tue, 20 Jan 2009 14:47:14 +0100, "Jos Koot" wrote: > Neither did I expect ((call/cc call/cc) (call/cc call/cc)) to run in bound > space, but I had it run on my 1.8 Ghz, 1Mb RAM single processor machine for > over 15 minutes without noticing any substantial increase of memory usage. > That's why I looked for an explanation of space bound behaviour. > Jos > > ----- Original Message ----- > From: "Robby Findler" > To: "Jos Koot" > Cc: "Shriram Krishnamurthi" ; ; > "Scheme PLT" > Sent: Monday, January 19, 2009 8:22 PM > Subject: Re: [plt-scheme] call/cc puzzle > > > As far as I am able to tell, when you evaluate left-to-right, > ((call/cc call/cc) (call/cc call/cc)) should be a non-tail-recursive > loop (right-to-left requires constant space). Perhaps Matthew has done > something fancy to mzscheme to be able to optimize something somehow > to make it tail recursive, or perhaps it is a bug. > > Robby > > On Mon, Jan 19, 2009 at 10:03 AM, Jos Koot wrote: > > My explanation of ((call/cc call/cc) (call/cc call/cc)). > > > > Read this in CPS (continuation passing style) > > For this purpose think in terms of meta-procedures EXEC and APPLY. > > > > (EXEC code cont) ; cont=continuation. > > Executes the code and passes the result to the cont. > > > > (APPLY op rand cont) ; op is procedure/operator, rand is argument/operand. > > Calls the op with the rand for its arg and passes the result to the cont. > > > > Notice that (APPLY call/cc A B) --> (APPLY A B B). > > Write ((call/cc call/cc) (call/cc call/cc)) as ((cc1 cc2) (cc3 cc4)). > > Let `finish' be the continuation of the top form, > > for instance the PLRE of a REPL (read-eval-print-loop), > > but as we shall see the finish is never reached, > > hence `finish' is irrelevant. > > Notation: #i=x introduces #i# as short for x. > > > > First a WRONG explanation: > > > > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = > > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand > > finish))))) > > (APPLY cc2 #0# #0#) > > (APPLY #0# #0# #0#) = > > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) > > (APPLY cc4 #1# #1#) > > (APPLY #1# #1# #1#) > > (APPLY #0# #1# finish) > > (EXEC (cc3 cc4) #2=(? (rand) (APPLY #1# rand finish))) = > > (APPLY cc4 #2# #2#) > > (APPLY #2# #2# #2#) > > (APPLY #1# #2# finish) > > (APPLY #0# #2# finish) > > (EXEC (cc3 cc4) #3=(? (rand) (APPLY #2# finish))) = > > (APPLY cc4 #3# #3#) > > (APPLY #2# #3# finish) > > (APPLY #1# #3# finish) > > (APPLY #0# #3# finish) > > (EXEC (cc3 cc4) #4=(? (rand) (APPLY #3# rand finish))) = > > (APPLY cc4 #4# #4#) > > (APPLY #4# #4# #4#) > > (APPLY #3# #4# finish) > > (APPLY #2# #4# finish) > > (APPLY #1# #4# finish) > > (APPLY #0# #4# finish) > > (EXEC (cc3 cc4) #5=(? (rand) (APPLY #4# rand finish))) = > > etc. > > > > This suggests that ((call/cc call/cc) (call/cc call/cc)) would not run in > > bound space. However, it does, as on my small system can easily be > > verified > > by letting it run for some minutes. Apparently Scheme's designers and > > implementors ar more clever than shown above. I try again: > > > > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = > > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand > > finish))))) > > (APPLY cc2 #0# #0#) > > (APPLY #0# #0# #0#) > > #999=(EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) > > (APPLY cc4 #1# #1#) > > (APPLY #1# #1# #1#) > > (APPLY #0# #1# finish) > > (EXEC (cc3 cc4) #2=(? (newrand) (APPLY #1# newrand finish))) = > > (EXEC (cc3 cc4) > > (? (newrand) > > (APPLY (? (rand) (APPLY #0# rand finish)) newrand finish))) = > > ; Contract the continuation. > > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) = > > (EXEC (cc3 cc4) #1#) = #999# ; Space bound loop! > > > > Is this a correct interpretation? It strikes me that DrScheme's Debug > > shows > > the WRONG behaviour. That may be due to the fact that debug has to extend > > each continuation such as to move its arrow and to display results and > > therefore cannot collaps the continuations. Correct? > > > > Jos > > > > > > > > ----- Original Message ----- > > From: Shriram Krishnamurthi > > To: rafkind@cs.utah.edu > > Cc: Scheme PLT > > Sent: Saturday, January 17, 2009 8:38 PM > > Subject: Re: [plt-scheme] call/cc puzzle > > > > Just remember that putting a use of call/cc in a context changes the > > meaning > > of that use... > > > > snip > > > > _________________________________________________ > > For list-related administrative tasks: > > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From plragde at uwaterloo.ca Tue Jan 20 10:25:25 2009 From: plragde at uwaterloo.ca (Prabhakar Ragde) Date: Thu Mar 26 02:38:39 2009 Subject: [plt-scheme] Interactions in the Module language Message-ID: <4975ECE5.7020803@uwaterloo.ca> We covered mutation today in lecture. I had not done this before using the Module language. Afterwards, a student came up and showed me this interesting phenomenon. In the Definitions window: #lang scheme (define a 1) (set! a 2) (define b 1) In the Interactions window: > (set! a 3) > a 3 > (set! b 2) set!: cannot modify a constant: b Now, I know the top level is hopeless, and I have an intuitive explanation, which is that in the analysis of the module in the Definitions window, b has been optimized down to a constant but a has not. Is there a more accurate explanation, and does a prediction of this exist in Help Desk? I note the parameter `compile-enforce-module-constants', whose explanation seems to have some bearing, but the parameter seems to have value #f in the Interactions window, and I cannot get it to do anything useful in this example. Thanks. --PR From mflatt at cs.utah.edu Tue Jan 20 10:38:58 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:39 2009 Subject: [plt-scheme] Interactions in the Module language In-Reply-To: <4975ECE5.7020803@uwaterloo.ca> References: <4975ECE5.7020803@uwaterloo.ca> Message-ID: <20090120153900.0C75F65009D@mail-svr1.cs.utah.edu> At Tue, 20 Jan 2009 10:25:25 -0500, Prabhakar Ragde wrote: > We covered mutation today in lecture. I had not done this before using > the Module language. Afterwards, a student came up and showed me this > interesting phenomenon. > > In the Definitions window: > > #lang scheme > > (define a 1) > (set! a 2) > (define b 1) > > In the Interactions window: > > > (set! a 3) > > a > 3 > > (set! b 2) > set!: cannot modify a constant: b > > Now, I know the top level is hopeless, and I have an intuitive > explanation, which is that in the analysis of the module in the > Definitions window, b has been optimized down to a constant but a has > not. Any definition that is not `set!'ed within the module is considered constant --- which, of course, may enable optimizations, but constantness doesn't depend on an optimization occurring. > Is there a more accurate explanation, and does a prediction of this > exist in Help Desk? It looks like this information is missing from the specification of `module', so I'll fix that. Also, I thought that Section 6.6 of the Guide would talk about it (http://docs.plt-scheme.org/guide/module-set.html), but the information is missing there, too. > I note the parameter > `compile-enforce-module-constants', whose explanation seems to have some > bearing, Indeed, that seems to be the only place that module-variable constantness is currently defined (which is not nearly good enough). > but the parameter seems to have value #f in the Interactions > window, and I cannot get it to do anything useful in this example. I imagine that the parameter is set after the module is evaluated, but I'm not sure why it would be set at all unless it was meant to be set before compiling the module. I'll investigate further. Meanwhile, I don't think there's a way to parameter within the module. Matthew From mike at sharedlogic.ca Tue Jan 20 13:27:46 2009 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:38:39 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <49750650.6020109@neilvandyke.org> References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> <49750650.6020109@neilvandyke.org> Message-ID: On Mon, Jan 19, 2009 at 5:01 PM, Neil Van Dyke wrote: > I've been through phases of advocacy, but the languages advocacy space is > *so saturated* with wanking from narrow experience that the marketplace of > ideas is more like a sleazy bathhouse. > > My attitude now, having been doing this for decades, is one of no longer > being interested in 99% of people's perspectives on languages or software > development. "*Read this one document*, and ask on the list if you get > stuck anywhere. Or don't, but stop telling me about your 'python' and your > navel-gazing theories. I'm all set with that myself." :) Hear, bloody, hear. Mike From mike at sharedlogic.ca Tue Jan 20 13:30:56 2009 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:38:39 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> Message-ID: On Mon, Jan 19, 2009 at 3:29 PM, Grant Rettke wrote: > On Mon, Jan 19, 2009 at 2:03 PM, Neil Van Dyke wrote: >> Random people with Web pages about Scheme, like myself, can also do our part >> to point people in the right direction: > > Have you found some successful ways to communicate, or convince, > experienced programmers that there is something for them to learn with > HtDP? > > Most "experienced programmers" tend to be convinved that there is > nothing left to learn but new APIs and frameworks. Funny word that, "experience." My late Judo teacher used to talk about the difference between "20 years' worth of experience" and "one year's worth, repeated 20 times over." Mike From jos.koot at telefonica.net Tue Jan 20 14:05:02 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:39 2009 Subject: [plt-scheme] call/cc puzzle References: <49722FD8.7050107@cs.utah.edu><4BB06EF570D14193B59B1FEBFDE17EB9@uw2b2dff239c4d><932b2f1f0901191122r605c171fve9c21647c991a164@mail.gmail.com> <387E41F8846C4DF9BA4C02DCAC2D26A2@uw2b2dff239c4d> <20090120145832.74E1E65009C@mail-svr1.cs.utah.edu> Message-ID: Indeed, grow produces the noise slower and slower. The explanation I labeled wrong because I did not see the growth, must be right then. Indeed, it does explain why the noise (rate of growth) slows down as more cycles are made. The time between subsequent calls to noisy-call/cc must increase linearily with the total number of times it has been called. This means that: rate of growing = (/ constant (sqrt time)), (time counter=n) = (* constant n n), where time is measured from starting procedure grow. I measured the times (within noisy-call/cc) and the results are in excellent agreement with my expectations. Thanks Henk for the nice puzzle and Robby and Matthew for your expert clarification. Jos ----- Original Message ----- From: "Matthew Flatt" To: "Jos Koot" Cc: "Robby Findler" ; Sent: Tuesday, January 20, 2009 3:58 PM Subject: Re: [plt-scheme] call/cc puzzle > There's no fancy optimization of this example in PLT Scheme. It runs in > unbounded space --- but *very* slowly. > > Compare the rate of output when running `grow' versus `stable' in > > (define counter 0) > > (define (noisy-call/cc f) > (set! counter (+ counter 1)) > (cond > [(zero? (modulo counter 100)) > (display counter) (newline)]) > (call/cc f)) > > (define (grow) > (let ([rator (call/cc call/cc)]) > (rator > (call/cc noisy-call/cc)))) > > (define (stable) > (let ([rand (call/cc call/cc)]) > ((call/cc noisy-call/cc) rand))) > > I've used `let' in both variants to force a particular order of > operation (and also used `cond' instead of `when', etc.) so you can try > `grow' versus `stable' in implementations other than PLT Scheme. I saw > the same qualitative difference between the two across all the > implementations I tried. > > > At Tue, 20 Jan 2009 14:47:14 +0100, "Jos Koot" wrote: >> Neither did I expect ((call/cc call/cc) (call/cc call/cc)) to run in >> bound >> space, but I had it run on my 1.8 Ghz, 1Mb RAM single processor machine >> for >> over 15 minutes without noticing any substantial increase of memory >> usage. >> That's why I looked for an explanation of space bound behaviour. >> Jos >> >> ----- Original Message ----- >> From: "Robby Findler" >> To: "Jos Koot" >> Cc: "Shriram Krishnamurthi" ; ; >> "Scheme PLT" >> Sent: Monday, January 19, 2009 8:22 PM >> Subject: Re: [plt-scheme] call/cc puzzle >> >> >> As far as I am able to tell, when you evaluate left-to-right, >> ((call/cc call/cc) (call/cc call/cc)) should be a non-tail-recursive >> loop (right-to-left requires constant space). Perhaps Matthew has done >> something fancy to mzscheme to be able to optimize something somehow >> to make it tail recursive, or perhaps it is a bug. >> >> Robby >> >> On Mon, Jan 19, 2009 at 10:03 AM, Jos Koot >> wrote: >> > My explanation of ((call/cc call/cc) (call/cc call/cc)). >> > >> > Read this in CPS (continuation passing style) >> > For this purpose think in terms of meta-procedures EXEC and APPLY. >> > >> > (EXEC code cont) ; cont=continuation. >> > Executes the code and passes the result to the cont. >> > >> > (APPLY op rand cont) ; op is procedure/operator, rand is >> > argument/operand. >> > Calls the op with the rand for its arg and passes the result to the >> > cont. >> > >> > Notice that (APPLY call/cc A B) --> (APPLY A B B). >> > Write ((call/cc call/cc) (call/cc call/cc)) as ((cc1 cc2) (cc3 cc4)). >> > Let `finish' be the continuation of the top form, >> > for instance the PLRE of a REPL (read-eval-print-loop), >> > but as we shall see the finish is never reached, >> > hence `finish' is irrelevant. >> > Notation: #i=x introduces #i# as short for x. >> > >> > First a WRONG explanation: >> > >> > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = >> > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand >> > finish))))) >> > (APPLY cc2 #0# #0#) >> > (APPLY #0# #0# #0#) = >> > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) >> > (APPLY cc4 #1# #1#) >> > (APPLY #1# #1# #1#) >> > (APPLY #0# #1# finish) >> > (EXEC (cc3 cc4) #2=(? (rand) (APPLY #1# rand finish))) = >> > (APPLY cc4 #2# #2#) >> > (APPLY #2# #2# #2#) >> > (APPLY #1# #2# finish) >> > (APPLY #0# #2# finish) >> > (EXEC (cc3 cc4) #3=(? (rand) (APPLY #2# finish))) = >> > (APPLY cc4 #3# #3#) >> > (APPLY #2# #3# finish) >> > (APPLY #1# #3# finish) >> > (APPLY #0# #3# finish) >> > (EXEC (cc3 cc4) #4=(? (rand) (APPLY #3# rand finish))) = >> > (APPLY cc4 #4# #4#) >> > (APPLY #4# #4# #4#) >> > (APPLY #3# #4# finish) >> > (APPLY #2# #4# finish) >> > (APPLY #1# #4# finish) >> > (APPLY #0# #4# finish) >> > (EXEC (cc3 cc4) #5=(? (rand) (APPLY #4# rand finish))) = >> > etc. >> > >> > This suggests that ((call/cc call/cc) (call/cc call/cc)) would not run >> > in >> > bound space. However, it does, as on my small system can easily be >> > verified >> > by letting it run for some minutes. Apparently Scheme's designers and >> > implementors ar more clever than shown above. I try again: >> > >> > (EXEC ((cc1 cc2) (cc3 cc4)) finish) = >> > (EXEC (cc1 cc2) #0=(? (op) (EXEC (cc3 cc4) (? (rand) (APPLY op rand >> > finish))))) >> > (APPLY cc2 #0# #0#) >> > (APPLY #0# #0# #0#) >> > #999=(EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) >> > (APPLY cc4 #1# #1#) >> > (APPLY #1# #1# #1#) >> > (APPLY #0# #1# finish) >> > (EXEC (cc3 cc4) #2=(? (newrand) (APPLY #1# newrand finish))) = >> > (EXEC (cc3 cc4) >> > (? (newrand) >> > (APPLY (? (rand) (APPLY #0# rand finish)) newrand finish))) = >> > ; Contract the continuation. >> > (EXEC (cc3 cc4) #1=(? (rand) (APPLY #0# rand finish))) = >> > (EXEC (cc3 cc4) #1#) = #999# ; Space bound loop! >> > >> > Is this a correct interpretation? It strikes me that DrScheme's Debug >> > shows >> > the WRONG behaviour. That may be due to the fact that debug has to >> > extend >> > each continuation such as to move its arrow and to display results and >> > therefore cannot collaps the continuations. Correct? >> > >> > Jos >> > >> > >> > >> > ----- Original Message ----- >> > From: Shriram Krishnamurthi >> > To: rafkind@cs.utah.edu >> > Cc: Scheme PLT >> > Sent: Saturday, January 17, 2009 8:38 PM >> > Subject: Re: [plt-scheme] call/cc puzzle >> > >> > Just remember that putting a use of call/cc in a context changes the >> > meaning >> > of that use... >> > >> > snip >> > >> > _________________________________________________ >> > 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 mike at sharedlogic.ca Tue Jan 20 14:47:58 2009 From: mike at sharedlogic.ca (Michael Forster) Date: Thu Mar 26 02:38:39 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> Message-ID: On Tue, Jan 20, 2009 at 12:30 PM, Michael Forster wrote: > On Mon, Jan 19, 2009 at 3:29 PM, Grant Rettke wrote: >> On Mon, Jan 19, 2009 at 2:03 PM, Neil Van Dyke wrote: >>> Random people with Web pages about Scheme, like myself, can also do our part >>> to point people in the right direction: >> >> Have you found some successful ways to communicate, or convince, >> experienced programmers that there is something for them to learn with >> HtDP? >> >> Most "experienced programmers" tend to be convinved that there is >> nothing left to learn but new APIs and frameworks. > > Funny word that, "experience." My late Judo teacher used to talk > about the difference between "20 years' worth of experience" and "one > year's worth, repeated 20 times over." > > Mike > I should clarify, as I just did to someone who replied off-list, that I didn't mean to imply that one measure was better. My teacher was simply asking us to consider the _difference_. And, perhaps, that any amount of experience can be a hindrance in some instances. Cheers, Mike From danprager at optusnet.com.au Tue Jan 20 14:49:43 2009 From: danprager at optusnet.com.au (Daniel Prager) Date: Thu Mar 26 02:38:40 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> Message-ID: <5273896A-212B-4175-BC62-FE2A57A202E8@optusnet.com.au> > A personal perspecitve: > > The two books that have made the biggest impact on me -- as one of > these so-called experienced programmers -- have been Meyer's OOSC2 > late last century, and more recently working through the early > chapters of SICP using DrScheme. I have not read HTDP (yet). > > Within the Scheme-space I think that it would be useful to give some > short guide as to when and why to read: > > * The Little Schemer > * HTDP > * PLAI > > etc. > > Most recently I have made enjoyable, but abortive starts with PLAI > and Norvig's earlier tome, but haven't had the dedication to push > through very far with either. > > In my case it's not clear to me where I should go next, when I have > the time, and I would be more interested to see something of a meta- > reading guide for the experienced programmer interested in "serious > continuing self-education", rather than being "hit over the head" > with any particular tome, no matter how great. > > > Cheers > > Dan > > P.S. When my children are old enough I will make sure that I hit > them^H^H^H^H^H^H gently encourage them to start with DrScheme and > HTDP. I'll report back on this initiative in ~9 years. From grettke at acm.org Tue Jan 20 15:00:14 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:38:40 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <5273896A-212B-4175-BC62-FE2A57A202E8@optusnet.com.au> References: <4974D5F8.6020109@neilvandyke.org> <4974DC9E.3000205@neilvandyke.org> <756daca50901191329v23fb53c5i7dd132d61a8ebf09@mail.gmail.com> <5273896A-212B-4175-BC62-FE2A57A202E8@optusnet.com.au> Message-ID: <756daca50901201200h6eb07c30ud39c12e9f2ded330@mail.gmail.com> >> The two books that have made the biggest impact on me -- as one of these >> so-called experienced programmers -- have been Meyer's OOSC2 late last >> century, That is the best book on object-oriented analysis, design, and programming that I have ever read. Ironically, that is another book that most OO programmers will never, ever read because "it is too long". >> Within the Scheme-space I think that it would be useful to give some short >> guide as to when and why to read: >> >> * The Little Schemer >> * HTDP >> * PLAI After hanging around the PLT list for for a long time and asking a lot of questions, one gets a "sense" of where each book fits, but to your point; an "all in one" guide would be great :). From mikeegg1 at me.com Tue Jan 20 11:49:56 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Thu Mar 26 02:38:40 2009 Subject: [plt-scheme] small, static, mzscheme executable? Message-ID: <20090120164956.GF32213@mail.me.com> Morning, In the mzscheme distribtion is there a single, small, static executable that I can copy to my various platforms? My interest in this question is deciding if mzscheme is a candidate for developing a management system like cfengine(8). My platforms include windows xp, windows vista (32 and 64), mac os x, flavors of linux, and flavors of unix. If there is a small executable, but no static executable, is there a procedure in mzscheme to create a static executable? I'm trying to limit what I install on these various boxes. Mike From eli at barzilay.org Tue Jan 20 16:44:42 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:40 2009 Subject: [plt-scheme] small, static, mzscheme executable? In-Reply-To: <20090120164956.GF32213@mail.me.com> References: <20090120164956.GF32213@mail.me.com> Message-ID: <18806.17866.29042.566496@arabic.ccs.neu.edu> On Jan 20, Mike Eggleston wrote: > Morning, > > In the mzscheme distribtion is there a single, small, static > executable that I can copy to my various platforms? My interest in > this question is deciding if mzscheme is a candidate for developing > a management system like cfengine(8). My platforms include windows > xp, windows vista (32 and 64), mac os x, flavors of linux, and > flavors of unix. > > If there is a small executable, but no static executable, is there a > procedure in mzscheme to create a static executable? I'm trying to > limit what I install on these various boxes. Not directly an answer, but I think that it will be much easier to just use the complete directories. Some related details and comments: * The OSX installer is essentially a directory that you can drag and drop anywhere in the system. The Windows installer does the usual start menu shortcut, and various registry keys -- but ignoring these, the resulting directory can also be moved anywhere you want. The Unix installers give you a choice for a "unix-style" installation (spread according to the FHS) or a single directory which can be moved around. -- The bottom line is that you can get a single directory for each platform that can be placed anywhere in the system. * Since you're interested in MzScheme only, things are even easier. (For example, the Windows installer is basically just creating the directory and does none of the rest.) * The executables do rely on some usual C libraries (but it seems that you're not concerned about that). * There shouldn't be any modifications on any other part of the system. The only possible exception is the users $HOME/.plt-scheme (different directory on OSX/Windows) which is used for things like preferences and planet. Given no gui, and if you won't use planet, you're likely not going to get anything there too. * As another point of reference, you can see our "pre-installers" (they are available for the nightly builds at pre.plt-scheme.org, and I can also make the pre-installers of the official release available). These are all tgz archives of the PLT trees that can simply work anywhere you drop them. (They are one step before last, when they're converted into the various installers.) * Note that the MzScheme distribution is intended for a server situation and not much else. It will be a good idea to have the normal installation on the machine you actually use. * (BTW, I used mzscheme several times to distribute batch jobs to a compute cluster -- and things tend to be extremely easy to set up.) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From danprager at optusnet.com.au Tue Jan 20 16:48:10 2009 From: danprager at optusnet.com.au (danprager@optusnet.com.au) Date: Thu Mar 26 02:38:40 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP Message-ID: <200901202148.n0KLmA40003435@mail01.syd.optusnet.com.au> > Grant Rettke wrote: > > >> The two books that have made the biggest impact on me -- as one of > these > >> so-called experienced programmers -- have been Meyer's OOSC2 late > last > >> century, > > That is the best book on object-oriented analysis, design, and > programming that I have ever read. Ironically, that is another book > that most OO programmers will never, ever read because "it is too > long". More personal reminiscences: After reading OOSC2 in '97 I started thinking in contracts, put mainly preconditions in my Visual Basic 6 code, and saw my debugging times drop by a factor of 10. I adopted the method, but not the tools, and got some great gains At my next job I tried Eiffel (SmallEiffel) and found it personally great, but had no success in evangelizing it. I did have some success evangelizing Python as a "common scripting language", however. I was of the view that Eiffel was ~10 years ahead of industry practice and that it was only a matter of time before its features started seeping into the mainstream. Gratifyingly C# 4 will have some support for contracts. However, the community had -- let us say -- certain problems. In subsequent jobs I have gone back to my initial approach of using parts of the method and coding up my own pre-conditions and sometimes post-conditions in other languages (IME explicit invariants aren't worth it without language support). I have now done this in VB.NET, C#, and more recently ActionScript. As I have risen in seniority over the years and gained confidence and judgement I have been able to encourage / persuade my team-members about DBC and we have worked on blending it in various ways with test-driven development (TDD) and more recently functional integration testing (FIT). I really need to write this stuff up ;-) While I have assigned OOSC2 chapters for reading, I am yet to see anyone else pick up the book and read it several times as I did. Besides contracts OOSC2 has a lot to offer in terms of understanding other aspects of OO too. * * * Reading SICP was relevatory in terms of code/data duality and stratified design. I have the maths for the examples, so that was no obstacle to me. In practice my team and I -- the younger ones have some Haskell from Uni.-- have used a bit of functional programming here and there, but more fun has been writing programs that write programs (typically Python or IronPython) as a routine trick. By stratifying these generated programs into layers, we then do some simple program transformations. * * * So, my experience has been one of learning cool / advanced things and then trying to apply them with more accepted tools. It's a nice trick if your team is smart and open to new ideas. It's a bit like how I felt going from doing a mathematics PhD to working in industry. A little mathematics goes a _long_ way in the commercial world. Same with "sophisticated" programming ideas. The trick is to apply them judiciously. P.S. If someone can do a Scheme -> ActionScript 2 or AVM2 compiler that could be impactful in the RIA-space. (AS2 is the language of Flex / Flash and is very similar to JavaScript.) Similar idea to Clojure on the JVM. From danprager at optusnet.com.au Tue Jan 20 16:54:00 2009 From: danprager at optusnet.com.au (danprager@optusnet.com.au) Date: Thu Mar 26 02:38:40 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP and martial arts!?? Message-ID: <200901202154.n0KLs0jN015492@mail02.syd.optusnet.com.au> Michael Forster wrote: > Funny word that, "experience." My late Judo teacher used to talk [snip] Interesting that this "hit them over the head" metaphor has brought out a Judo reference! Are there any other martial arts aficionados (past- or present-) Judo or otherwise out there? My confession / plug: http://maaml.blogspot.com -- Dan > > On Tue, Jan 20, 2009 at 12:30 PM, Michael Forster > wrote: > > On Mon, Jan 19, 2009 at 3:29 PM, Grant Rettke wrote: > >> On Mon, Jan 19, 2009 at 2:03 PM, Neil Van Dyke > wrote: > >>> Random people with Web pages about Scheme, like myself, can also do > our part > >>> to point people in the right direction: > >> > >> Have you found some successful ways to communicate, or convince, > >> experienced programmers that there is something for them to learn > with > >> HtDP? > >> > >> Most "experienced programmers" tend to be convinved that there is > >> nothing left to learn but new APIs and frameworks. > > > > Funny word that, "experience." My late Judo teacher used to talk > > about the difference between "20 years' worth of experience" and "one > > year's worth, repeated 20 times over." > > > > Mike > > > > I should clarify, as I just did to someone who replied off-list, that > I didn't mean to imply that one measure was better. My teacher was > simply asking us to consider the _difference_. And, perhaps, that any > amount of experience can be a hindrance in some instances. > > Cheers, > > Mike > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From mikeegg1 at me.com Tue Jan 20 16:55:55 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Thu Mar 26 02:38:41 2009 Subject: [plt-scheme] small, static, mzscheme executable? In-Reply-To: <18806.17866.29042.566496@arabic.ccs.neu.edu> References: <20090120164956.GF32213@mail.me.com> <18806.17866.29042.566496@arabic.ccs.neu.edu> Message-ID: <20090120215555.GJ32213@mail.me.com> On Tue, 20 Jan 2009, Eli Barzilay might have said: > On Jan 20, Mike Eggleston wrote: > > Morning, > > > > In the mzscheme distribtion is there a single, small, static > > executable that I can copy to my various platforms? My interest in > > this question is deciding if mzscheme is a candidate for developing > > a management system like cfengine(8). My platforms include windows > > xp, windows vista (32 and 64), mac os x, flavors of linux, and > > flavors of unix. > > > > If there is a small executable, but no static executable, is there a > > procedure in mzscheme to create a static executable? I'm trying to > > limit what I install on these various boxes. > > Not directly an answer, but I think that it will be much easier to > just use the complete directories. Some related details and comments: > > * The OSX installer is essentially a directory that you can drag and > drop anywhere in the system. The Windows installer does the usual > start menu shortcut, and various registry keys -- but ignoring > these, the resulting directory can also be moved anywhere you want. > The Unix installers give you a choice for a "unix-style" > installation (spread according to the FHS) or a single directory > which can be moved around. > > -- The bottom line is that you can get a single directory for each > platform that can be placed anywhere in the system. > > * Since you're interested in MzScheme only, things are even easier. > (For example, the Windows installer is basically just creating the > directory and does none of the rest.) > > * The executables do rely on some usual C libraries (but it seems that > you're not concerned about that). > > * There shouldn't be any modifications on any other part of the > system. The only possible exception is the users $HOME/.plt-scheme > (different directory on OSX/Windows) which is used for things like > preferences and planet. Given no gui, and if you won't use planet, > you're likely not going to get anything there too. > > * As another point of reference, you can see our "pre-installers" > (they are available for the nightly builds at pre.plt-scheme.org, > and I can also make the pre-installers of the official release > available). These are all tgz archives of the PLT trees that can > simply work anywhere you drop them. (They are one step before last, > when they're converted into the various installers.) > > * Note that the MzScheme distribution is intended for a server > situation and not much else. It will be a good idea to have the > normal installation on the machine you actually use. > > * (BTW, I used mzscheme several times to distribute batch jobs to a > compute cluster -- and things tend to be extremely easy to set up.) > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! Wonderful explanation, thank you. I like the idea of cfengine(8), but there are some requirements for that specific application that I'm not wild about and don't really fit to my environment. If I can put something together, and add code to the windows port for fudging with registery, etc., then mzscheme I think will work well for my needed application. Part of the problem is how much time I can steal from my regular duties to put this together. I may use planet for some of the tcp/http/regex stuff, but that's all I can think of off the top. Since the installation is simply a directory (off C:\, off /, etc) then an under the covers installation is much easier than expected and I'm grateful for that. Ideally I want to combine configuration and reporting. Sort of blending cfengine(8) and hobbit/xymon together. Pulling stuff from cvs, updating systems, sounds like great fun. Mike From robby at eecs.northwestern.edu Tue Jan 20 16:59:36 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:41 2009 Subject: [plt-scheme] small, static, mzscheme executable? In-Reply-To: <20090120215555.GJ32213@mail.me.com> References: <20090120164956.GF32213@mail.me.com> <18806.17866.29042.566496@arabic.ccs.neu.edu> <20090120215555.GJ32213@mail.me.com> Message-ID: <932b2f1f0901201359s5b1bcc39kf88cefaa6f4c6038@mail.gmail.com> Tcp/http/regexp is mostly in the standard library, FWIW. Robby On 1/20/09, Mike Eggleston wrote: > On Tue, 20 Jan 2009, Eli Barzilay might have said: > >> On Jan 20, Mike Eggleston wrote: >> > Morning, >> > >> > In the mzscheme distribtion is there a single, small, static >> > executable that I can copy to my various platforms? My interest in >> > this question is deciding if mzscheme is a candidate for developing >> > a management system like cfengine(8). My platforms include windows >> > xp, windows vista (32 and 64), mac os x, flavors of linux, and >> > flavors of unix. >> > >> > If there is a small executable, but no static executable, is there a >> > procedure in mzscheme to create a static executable? I'm trying to >> > limit what I install on these various boxes. >> >> Not directly an answer, but I think that it will be much easier to >> just use the complete directories. Some related details and comments: >> >> * The OSX installer is essentially a directory that you can drag and >> drop anywhere in the system. The Windows installer does the usual >> start menu shortcut, and various registry keys -- but ignoring >> these, the resulting directory can also be moved anywhere you want. >> The Unix installers give you a choice for a "unix-style" >> installation (spread according to the FHS) or a single directory >> which can be moved around. >> >> -- The bottom line is that you can get a single directory for each >> platform that can be placed anywhere in the system. >> >> * Since you're interested in MzScheme only, things are even easier. >> (For example, the Windows installer is basically just creating the >> directory and does none of the rest.) >> >> * The executables do rely on some usual C libraries (but it seems that >> you're not concerned about that). >> >> * There shouldn't be any modifications on any other part of the >> system. The only possible exception is the users $HOME/.plt-scheme >> (different directory on OSX/Windows) which is used for things like >> preferences and planet. Given no gui, and if you won't use planet, >> you're likely not going to get anything there too. >> >> * As another point of reference, you can see our "pre-installers" >> (they are available for the nightly builds at pre.plt-scheme.org, >> and I can also make the pre-installers of the official release >> available). These are all tgz archives of the PLT trees that can >> simply work anywhere you drop them. (They are one step before last, >> when they're converted into the various installers.) >> >> * Note that the MzScheme distribution is intended for a server >> situation and not much else. It will be a good idea to have the >> normal installation on the machine you actually use. >> >> * (BTW, I used mzscheme several times to distribute batch jobs to a >> compute cluster -- and things tend to be extremely easy to set up.) >> >> -- >> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: >> http://www.barzilay.org/ Maze is Life! > > Wonderful explanation, thank you. I like the idea of cfengine(8), but > there are some requirements for that specific application that I'm not > wild about and don't really fit to my environment. If I can put something > together, and add code to the windows port for fudging with registery, > etc., then mzscheme I think will work well for my needed application. > > Part of the problem is how much time I can steal from my regular duties > to put this together. I may use planet for some of the tcp/http/regex > stuff, but that's all I can think of off the top. > > Since the installation is simply a directory (off C:\, off /, etc) then > an under the covers installation is much easier than expected and I'm > grateful for that. > > Ideally I want to combine configuration and reporting. Sort of blending > cfengine(8) and hobbit/xymon together. Pulling stuff from cvs, updating > systems, sounds like great fun. > > Mike > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From grettke at acm.org Tue Jan 20 17:15:24 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:38:41 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <200901202148.n0KLmA40003435@mail01.syd.optusnet.com.au> References: <200901202148.n0KLmA40003435@mail01.syd.optusnet.com.au> Message-ID: <756daca50901201415i4f1d27a6s2511d70a709bee60@mail.gmail.com> On Tue, Jan 20, 2009 at 3:48 PM, wrote: > As I have risen in seniority over the years and gained confidence and judgement I have been able to encourage / persuade my > team-members about DBC and we have worked on blending it in various ways with test-driven development (TDD) and more > recently functional integration testing (FIT). I really need to write this stuff up ;-) When you combine DbC with TDD, you can make some drastic improvements as you have mentioned. Interestingly, the advent of "Inversion of Control" containers makes for a pretty straightforward way of doing DbC by wrapping objects within their contract; thought that approach relies largely on experienced people like yourself who is willing to make a judgment call rather than relying on the "thought leaders" to think for you (as is often so welcomed by most today). > While I have assigned OOSC2 chapters for reading, I am yet to see anyone else pick up the book and read it several times as I > did. I read it twice. I had to read it twice. It was a great read, both times; but the second was better. > So, my experience has been one of learning cool / advanced things and then trying to apply them with more accepted tools. > It's a nice trick if your team is smart and open to new ideas. I am not finished with HtDP, but I have found, as everyone here has said; that the lesson learned are applicable to any language. The essence of how to program adds the value to the book; it just so happens they used Scheme (for some specific *good* reasons, but nonetheless the ideas are what matter). From matthias at ccs.neu.edu Tue Jan 20 17:36:15 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:38:41 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <200901202148.n0KLmA40003435@mail01.syd.optusnet.com.au> References: <200901202148.n0KLmA40003435@mail01.syd.optusnet.com.au> Message-ID: <404D54E1-F684-402D-9775-786E210CEFD5@ccs.neu.edu> On Jan 20, 2009, at 4:48 PM, danprager@optusnet.com.au wrote: > If someone can do a Scheme -> ActionScript 2 or AVM2 compiler that > could be impactful in the RIA-space. (AS2 is the language of > Flex / Flash and is very similar to JavaScript.) You might want to tackle this problem, perhaps with others, starting from the planet package for JS. -- Matthias From sk at cs.brown.edu Tue Jan 20 17:50:47 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:38:41 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <200901202148.n0KLmA40003435@mail01.syd.optusnet.com.au> References: <200901202148.n0KLmA40003435@mail01.syd.optusnet.com.au> Message-ID: Dave Van Horn has a prototype, working (but perhaps unsupported) compiler to JavaScript. Danny Yoo has an ongoing, supported project compiling Scheme to J2ME and Android. Plus, Manuel Serrano's Hop (based on Bigloo) does a GREAT job of working with JavaScript. From danprager at optusnet.com.au Tue Jan 20 19:33:13 2009 From: danprager at optusnet.com.au (danprager@optusnet.com.au) Date: Thu Mar 26 02:38:41 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP Message-ID: <200901210033.n0L0XDeT021699@mail09.syd.optusnet.com.au> Matthias Felleisen wrote: > > > On Jan 20, 2009, at 4:48 PM, danprager@optusnet.com.au wrote: > > > If someone can do a Scheme -> ActionScript 2 or AVM2 compiler that > > could be impactful in the RIA-space. (AS2 is the language of > > Flex / Flash and is very similar to JavaScript.) > > You might want to tackle this problem, perhaps with others, starting > from the planet package for JS. -- Matthias Shriram wrote: > Dave Van Horn has a prototype, working (but perhaps unsupported) > compiler to JavaScript. > > Danny Yoo has an ongoing, supported project compiling Scheme to J2ME > and Android. > > Plus, Manuel Serrano's Hop (based on Bigloo) does a GREAT job of > working with JavaScript. Matthias & Shriram: Good-luck with all the outreach. I would love to help, but unfortunately at this time can only supply encouragement and suggestions. In my day-job as a start-up CTO I can only use ideas and can only justify limited development of tools, so we're making do with raw ActionScript 2 (and gnash teeth a little where the closure model and type-system are silly and where macros are sorely missed). [The tool that we did build is a kick-arse visual FITnesse-esque scenario-testing framework which we use in combination with simple DBC.] My tips for groovy platforms for those who want to have commercial impact is to look to the cloudy and mobile platforms, which seems to already be happening in pieces: * It sounds like JS is already reasonably well-covered and Android support is on the way with Danny Yoo and co. ... * iPhone (i.e. target Objective C + libraries) * Flash / Flex (RIA): Anyone who wants to target this should look at HaXe, which is written in OCaml and compiles down to AVM2 (Flash VMs), JS, and a custom VM. -- Dan From danprager at optusnet.com.au Tue Jan 20 19:35:19 2009 From: danprager at optusnet.com.au (danprager@optusnet.com.au) Date: Thu Mar 26 02:38:42 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP Message-ID: <200901210035.n0L0ZJIo030413@mail02.syd.optusnet.com.au> Grant Rettke wrote: > When you combine DbC with TDD, you can make some drastic improvements > as you have mentioned. > > Interestingly, the advent of "Inversion of Control" containers makes > for a pretty straightforward way of doing DbC by wrapping objects > within their contract; thought that approach relies largely on > experienced people like yourself who is willing to make a judgment > call rather than relying on the "thought leaders" to think for you (as > is often so welcomed by most today). Grant: You're too kind! I would be interested to hear more about how you combine all three (in Scheme or elsewhere). I also forgot to mention that although I am vaguely aware of the contracts stuff in PLT Scheme, but somewhat bizzarely am yet to delve into it. > I am not finished with HtDP, but I have found, as everyone here has > said; that the lesson learned are applicable to any language. The > essence of how to program adds the value to the book; it just so > happens they used Scheme (for some specific *good* reasons, but > nonetheless the ideas are what matter). I'll try to make the time to do it justice (may have to wait for a holiday). -- Dan From eli at barzilay.org Tue Jan 20 21:54:10 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:42 2009 Subject: [plt-scheme] small, static, mzscheme executable? In-Reply-To: <20090120215555.GJ32213@mail.me.com> References: <20090120164956.GF32213@mail.me.com> <18806.17866.29042.566496@arabic.ccs.neu.edu> <20090120215555.GJ32213@mail.me.com> Message-ID: <18806.36434.887343.738924@arabic.ccs.neu.edu> On Jan 20, Mike Eggleston wrote: > > Wonderful explanation, thank you. I like the idea of cfengine(8), > but there are some requirements for that specific application that > I'm not wild about and don't really fit to my environment. If I can > put something together, and add code to the windows port for fudging > with registery, etc., then mzscheme I think will work well for my > needed application. It's already in: search the manual for `registry' -- but that's part of MrEd. In MzScheme it will probably be easy to come up with some foreign code, or just invoke an external process. (IIRC, it's extremely easy to just create the registry bit and apply it with some command line.) > Part of the problem is how much time I can steal from my regular > duties to put this together. I may use planet for some of the > tcp/http/regex stuff, but that's all I can think of off the top. As Robby said, tcp and regexp functionality is already built in; and there is an http library too. (Which might improve in the near future, but it's fine to do most things now.) > Since the installation is simply a directory (off C:\, off /, etc) > then an under the covers installation is much easier than expected > and I'm grateful for that. (By the way, the common way to distribute executables is as "installers", which are basically a packaged directory holding everything needed -- the executable, the shared libraries, the scheme files, etc.) > Ideally I want to combine configuration and reporting. Sort of > blending cfengine(8) and hobbit/xymon together. Pulling stuff from > cvs, updating systems, sounds like great fun. Yes, I enjoyed it... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From sk at cs.brown.edu Tue Jan 20 23:35:29 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:38:42 2009 Subject: [plt-scheme] Another MysterX patch: GetActiveObject functionality In-Reply-To: <756daca50901191311h454a9312i1da91369edb79302@mail.gmail.com> References: <49749EB3.4040105@gmail.com> <756daca50901191311h454a9312i1da91369edb79302@mail.gmail.com> Message-ID: I'll respond to this in a few days. My semester begins tomorrow... On Mon, Jan 19, 2009 at 4:11 PM, Grant Rettke wrote: >> I similarly use MysterX to access iTunes; this too would benefit from this patch. > > Do you have a Planet package for this? > From eli at barzilay.org Wed Jan 21 02:09:17 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:42 2009 Subject: [plt-scheme] PLT Scheme v4.1.4 Message-ID: <200901210709.n0L79HiJ021840@winooski.ccs.neu.edu> PLT Scheme version 4.1.4 is now available from http://plt-scheme.org/ * New libraries include `scheme/package' (for nestable static modules) and `ffi/objc' (support for Objective-C). * New teaching support includes a "universe.ss" teachpack for connecting "worlds" over a network. * Redex now supports automatic test-case generation. Specify a predicate that should hold of your reduction system, and Redex will attempt to falsify it. See 'redex-check' in the manual for more details. * Improvements to the run-time system include better and more reliable memory-limit tracking, function contracts that preserve tail recursion in many cases, native debugging backtraces on x86_64, and performance improvements. * Improved libraries include enhancements to `scheme/sandbox', better handling of zero-sized matches by `regexp-split' and friends, an `equal<%>' interface for specifying equality on class instances (and more general support for attaching properties to interfaces), equality (via `equal<%>') for image objects, and refinements to `scheme/foreign' to support atomic operations and function-pointer conversions. [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 keydana at gmx.de Wed Jan 21 04:28:21 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:38:42 2009 Subject: [plt-scheme] how to test for optional requirements in nondeterministic programming In-Reply-To: <4975E34A.20505@web.de> References: <497595A1.1060604@gmx.de> <4975E34A.20505@web.de> Message-ID: <4976EAB5.7000207@gmx.de> Hi Thomas, thanks a lot! I really should have thought of this - just wrap the soft preconditions in an additional amb and pass this amb the existing solution as a last option. This way I can even rank the soft conditions between themselves. Thanks again, Sigrid Thomas Chust schrieb: > Sigrid Keydana wrote: > >> [...] >> like in the SICP "puzzles", I am using amb to choose people from a list >> and then verify that requirements are fulfilled with an assert method. >> Now, in addition to the requirements, I also want to make the result >> satisfy some "optional" requirements or "nice-to-have"s if possible, but >> in contrast to the "hard requirements" the program may not fail if this >> doesn't work out. >> [...] >> > > Hello, > > this sounds as if you could solve your problem simply by nesting the > dynamic scope of amb backtracking contexts. Here is a stupid example > that wraps the results satisfying all hard preconditions in pairs whose > car is #t iff the soft preconditions are met and whose cdr contains the > result itself: > > #lang scheme > (require > (planet murphy/amb:1:1/amb)) > > (define (solutions) > (amb-collect > (let ([i (let ([i (for/amb ([i (in-range 0 10)]) > i)]) > ;; Check hard preconditions > (amb-assert (odd? i)) > (amb-assert (> i 1)) > i)]) > (cons (amb > (begin > ;; Check soft preconditions > (amb-assert (> i 5)) > (amb-assert (< i 9)) > #t) > #f) > i)))) > > [The for/amb syntax is just a shorthand from my implementation of the > amb operator. In this particular example it could be replaced with (amb > 0 1 ... 9)] > > cu, > Thomas > > From d.j.gurnell at gmail.com Wed Jan 21 06:43:21 2009 From: d.j.gurnell at gmail.com (Dave Gurnell) Date: Thu Mar 26 02:38:42 2009 Subject: [plt-scheme] inverse regexp In-Reply-To: <20090117.232809.19932462.maxigas@anargeek.net> References: <20090117.232809.19932462.maxigas@anargeek.net> Message-ID: <46B6E77D-6325-4D65-86B2-F6D02227ED2D@gmail.com> maxigas wrote: > i am writing an application using dispatch (as you suggested > earlier) which would process all > URLs, but i want to exclude the htdocs directory to serve static > files. i understand that > serve/servlet's #:servlet-regexp key controls which URLs are passed > to start, but i couldn't find > out how to write a regexp which excludes "htdocs". > > so what i want is to match everything that is NOT #rx"^/ > htdocs/.*" [...] Hi, Sorry I'm so late in replying. The latest version of Dispatch (v1.10) will do what Jay suggested and call next-dispatcher if no rules are matched. Make sure you have the latest version, though, because this behaviour changed recently. I typically write web apps with a single servlet. I use serve/servlet like this: (serve/servlet start ; Pass all requests to the servlet: #:servlet-path "/" #:servlet-regexp #rx"" ; Configure extra htdocs paths: #:extra-files-paths ...) Cheers, -- Dave From jpc-ml at zenburn.net Wed Jan 21 07:15:38 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:38:42 2009 Subject: [plt-scheme] Hit People Over the Head with HtDP In-Reply-To: <200901210033.n0L0XDeT021699@mail09.syd.optusnet.com.au> References: <200901210033.n0L0XDeT021699@mail09.syd.optusnet.com.au> Message-ID: <497711EA.80600@zenburn.net> On 1/21/09 1:33 AM, danprager@optusnet.com.au wrote: > * Flash / Flex (RIA): Anyone who wants to target this should look at HaXe, which is written in OCaml and compiles down to AVM2 (Flash VMs), JS, and a custom VM. The quite important thing is that HaXe compiles to Flash bytecodes so it is more efficient than the AS2 itself. Especially since the new additions to the Flash VM [1]. [1]: http://ncannasse.fr/blog/virtual_memory_api -- regards, Jakub Piotr C?apa From jos.koot at telefonica.net Wed Jan 21 07:19:31 2009 From: jos.koot at telefonica.net (Jos Koot) Date: Thu Mar 26 02:38:43 2009 Subject: [plt-scheme] redex Message-ID: <81C24AC232464786A5C306536B0F79CC@uw2b2dff239c4d> I had a look into redex. IT'S GREAT! I carefully copy-pasted the example from http://redex.plt-scheme.org/lam-v.html I don't yet understand how it avoids looping on (traces red (term ((? (x) (x x)) (? (x) (x x))))) but I'll study on that. However, when I try: (traces red (term ((? (x) (x x x)) (? (x) (x x x))))) I get: Welcome to DrScheme, version 4.1.4.1-svn17jan2009 [3m]. Language: Module; memory limit: 1000 megabytes. syntax: incompatible ellipsis match counts for template in: ... No indication where. I carefully checked all ellipses, but cannot find any improper use. I also noticed that (traces red (term (((? x (? y x)) y) z))) does not contract. That's due to the capture avoidance. I'll try to add alpha conversion for this case. Jos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090121/37d047e0/attachment.html From a.rottmann at gmx.at Wed Jan 21 08:29:42 2009 From: a.rottmann at gmx.at (Andreas Rottmann) Date: Thu Mar 26 02:38:43 2009 Subject: [plt-scheme] SRFI-97 and R6RS Message-ID: <87ljt4bxdl.fsf@delenn.lan> Hi! I'm using PLT as one of my target platforms for running R6RS code. Up to now, I've used Derick Eddington's R6RS SRFI collection, which worked nicely on PLT as well, as it used a separate namespace, (xitomatl srfi ...). However, recently Derick has switched to SRFI-97 names: (srfi : ...), which conflicts with PLT, which already provides SRFIs in the (srfi ...) namespace, but does not follow SRFI-97 naming. It would be nice if PLT provided SRFI-97-style aliases for the SRFI libraries it ships with, so one could use PLT's native SRFI implementations from R6RS code in the same way as one would use Derick's SRFI collection on implementations that don't ship SRFIs. This would also resolve the problem of how to use the SRFIs that ship with PLT from R6RS code at all (see http://list.cs.brown.edu/pipermail/plt-scheme/2008-May/024648.html). Regards, Rotty -- Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at http://yi.org/rotty/ | GnuPG Key: http://yi.org/rotty/gpg.asc Fingerprint | C38A 39C5 16D7 B69F 33A3 6993 22C8 27F7 35A9 92E7 v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com Could Jesus microwave a burrito so hot that he himself couldn't eat it? - Homer S. From clklein at cs.uchicago.edu Wed Jan 21 08:40:40 2009 From: clklein at cs.uchicago.edu (Casey Klein) Date: Thu Mar 26 02:38:44 2009 Subject: [plt-scheme] redex In-Reply-To: <81C24AC232464786A5C306536B0F79CC@uw2b2dff239c4d> References: <81C24AC232464786A5C306536B0F79CC@uw2b2dff239c4d> Message-ID: Jos, On Wed, Jan 21, 2009 at 6:19 AM, Jos Koot wrote: > However, when I try: > > (traces red (term ((? (x) (x x x)) (? (x) (x x x))))) > > I get: > > Welcome to DrScheme, version 4.1.4.1-svn17jan2009 [3m]. > Language: Module; memory limit: 1000 megabytes. > syntax: incompatible ellipsis match counts for template in: ... > No indication where. > > I carefully checked all ellipses, but cannot find any improper use. This simpler term has the same behavior: (term ((? (y) y) 1 2)) The error message isn't very helpful, but here's what's happening. This term matches the "?v" rule with `x' bound to '(y) and `v' bound to '(1 2): > (redex-match ?v (in-hole E ((? (x ...) e) v ...)) (term ((? (y) y) 1 2))) (#(struct:match (#(struct:bind E #(struct:hole)) #(struct:bind e y) #(struct:bind v (1 2)) #(struct:bind x (y))))) This rule's right-hand side requires `x' and `v' to be bound to equal-length lists because it "zips" them into a new list with "(x v) ...". This syntax-case expression has the same problem (but a better error message): (syntax-case #'((a b) (1 2 3)) () [((x ...) (v ...)) #'((x v) ...)]) The "?v" rule should probably be written (--> (in-hole E ((? (x ..._1) e) v ..._1)) (in-hole E (subst-n (x v) ... e)) "?v") so it doesn't fire when the argument count doesn't match the parameter count. > I also noticed that > (traces red (term (((? x (? y x)) y) z))) > does not contract. > That's due to the capture avoidance. First, you're missing the parens around the parameter names; i.e., you want (term (((? (x) (? (y) x)) y) z)). But more to the point, "?v" applies only when the arguments are values, and according to the ?v grammar, a variable is not a value: (v (? (x ...) e) number +) HTH, Casey From mflatt at cs.utah.edu Wed Jan 21 09:07:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:44 2009 Subject: [plt-scheme] SRFI-97 and R6RS In-Reply-To: <87ljt4bxdl.fsf@delenn.lan> References: <87ljt4bxdl.fsf@delenn.lan> Message-ID: <20090121140737.3B21D6500A3@mail-svr1.cs.utah.edu> As a starting point, I've added (in SVN) each library listed in SRFI 97 by simply re-exporting the SRFI implementation that's already present. That's wrong for many SRFIs. It's obviously wrong for `(srfi :1)', for example, which needs to be replaced with an implementation that works with mutable lists. Other SRFI implementations could be patched up by wrapping a few functions with uses of `mlist->list' and `list->mlist'. Could we get volunteers to to send me repairs for the broken libraries? Thanks, Matthew At Wed, 21 Jan 2009 14:29:42 +0100, Andreas Rottmann wrote: > Hi! > > I'm using PLT as one of my target platforms for running R6RS code. Up to > now, I've used Derick Eddington's R6RS SRFI collection, which worked > nicely on PLT as well, as it used a separate namespace, (xitomatl srfi > ...). However, recently Derick has switched to SRFI-97 names: (srfi : > ...), which conflicts with PLT, which already provides SRFIs in the > (srfi ...) namespace, but does not follow SRFI-97 naming. > > It would be nice if PLT provided SRFI-97-style aliases for the SRFI > libraries it ships with, so one could use PLT's native SRFI > implementations from R6RS code in the same way as one would use Derick's > SRFI collection on implementations that don't ship SRFIs. > > This would also resolve the problem of how to use the SRFIs that ship > with PLT from R6RS code at all (see > http://list.cs.brown.edu/pipermail/plt-scheme/2008-May/024648.html). > > Regards, Rotty > -- > Andreas Rottmann | Rotty@ICQ | 118634484@ICQ | a.rottmann@gmx.at > http://yi.org/rotty/ | GnuPG Key: http://yi.org/rotty/gpg.asc > Fingerprint | C38A 39C5 16D7 B69F 33A3 6993 22C8 27F7 35A9 92E7 > v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com > > Could Jesus microwave a burrito so hot that he himself couldn't eat it? - > Homer S. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From robby at eecs.northwestern.edu Wed Jan 21 12:44:08 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:44 2009 Subject: [plt-scheme] redex In-Reply-To: References: <81C24AC232464786A5C306536B0F79CC@uw2b2dff239c4d> Message-ID: <932b2f1f0901210944i7a77217fs166ea57b8632b259@mail.gmail.com> Thanks for the suggestion, Casey. I've updated the webpage to use ..._1, like you say. (I'm also looking into better error messages, but that's going to be longer term.) Robby 2009/1/21 Casey Klein : > Jos, > > On Wed, Jan 21, 2009 at 6:19 AM, Jos Koot wrote: >> However, when I try: >> >> (traces red (term ((? (x) (x x x)) (? (x) (x x x))))) >> >> I get: >> >> Welcome to DrScheme, version 4.1.4.1-svn17jan2009 [3m]. >> Language: Module; memory limit: 1000 megabytes. >> syntax: incompatible ellipsis match counts for template in: ... >> No indication where. >> >> I carefully checked all ellipses, but cannot find any improper use. > > This simpler term has the same behavior: > > (term ((? (y) y) 1 2)) > > The error message isn't very helpful, but here's what's happening. > This term matches the "?v" rule with `x' bound to '(y) and `v' bound > to '(1 2): > >> (redex-match ?v (in-hole E ((? (x ...) e) v ...)) (term ((? (y) y) 1 2))) > (#(struct:match (#(struct:bind E #(struct:hole)) > #(struct:bind e y) > #(struct:bind v (1 2)) > #(struct:bind x (y))))) > > This rule's right-hand side requires `x' and `v' to be bound to > equal-length lists because it "zips" them into a new list with "(x v) > ...". This syntax-case expression has the same problem (but a better > error message): > > (syntax-case #'((a b) (1 2 3)) () > [((x ...) (v ...)) > #'((x v) ...)]) > > The "?v" rule should probably be written > > (--> (in-hole E ((? (x ..._1) e) v ..._1)) > (in-hole E (subst-n (x v) ... e)) > "?v") > > so it doesn't fire when the argument count doesn't match the parameter count. > >> I also noticed that >> (traces red (term (((? x (? y x)) y) z))) >> does not contract. >> That's due to the capture avoidance. > > First, you're missing the parens around the parameter names; i.e., you > want (term (((? (x) (? (y) x)) y) z)). But more to the point, "?v" > applies only when the arguments are values, and according to the ?v > grammar, a variable is not a value: > > (v (? (x ...) e) number +) > > HTH, > Casey > From pocmatos at gmail.com Wed Jan 21 13:58:37 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:38:44 2009 Subject: [plt-scheme] Make Module Message-ID: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> Hi all, I remember the existence of a make kind of language but done purely in scheme in the versions 3xx but I can't find it now in the latest one. Was it removed? Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From jay.mccarthy at gmail.com Wed Jan 21 13:59:40 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:44 2009 Subject: [plt-scheme] Make Module In-Reply-To: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> References: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> Message-ID: http://docs.plt-scheme.org/make/index.html On Wed, Jan 21, 2009 at 11:58 AM, Paulo J. Matos wrote: > Hi all, > > I remember the existence of a make kind of language but done purely in > scheme in the versions 3xx but I can't find it now in the latest one. > Was it removed? > > 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 > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From pocmatos at gmail.com Wed Jan 21 14:06:00 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:38:44 2009 Subject: [plt-scheme] Make Module In-Reply-To: References: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> Message-ID: <11b141710901211106p4e2682b1kab437a21bc41a651@mail.gmail.com> On Wed, Jan 21, 2009 at 6:59 PM, Jay McCarthy wrote: > http://docs.plt-scheme.org/make/index.html > Argh, of course, thanks. I thought it was part of mzlib and was searching there. :D > On Wed, Jan 21, 2009 at 11:58 AM, Paulo J. Matos wrote: >> Hi all, >> >> I remember the existence of a make kind of language but done purely in >> scheme in the versions 3xx but I can't find it now in the latest one. >> Was it removed? >> >> 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 >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From pocmatos at gmail.com Wed Jan 21 14:54:28 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:38:45 2009 Subject: [plt-scheme] PLT Redex Workshop Message-ID: <11b141710901211154x655212as2ba7cab015c5792a@mail.gmail.com> Hi all, I am interested in knowing more about PLT Redex. I looked at the site and it says in the workshop part: "The organizers plan to collect all articles in a book on PLT Redex that will consist of three parts: an introduction to reduction and rewriting semantics; a PLT Redex manual; and the collection of revised and refined workshop papers. " Is this book anywhere? In fact I am mainly interested in the introduction to reduction and rewriting semantics, the theory and its applicability. If this book was not made, is there anything like this online? What kind of applications had PLT Redex already? [It would be interesting to see a list of papers which use PLT Redex, both from the implementors and the users perspective] Cheers, -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From robby at eecs.northwestern.edu Wed Jan 21 14:59:17 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:45 2009 Subject: [plt-scheme] PLT Redex Workshop In-Reply-To: <11b141710901211154x655212as2ba7cab015c5792a@mail.gmail.com> References: <11b141710901211154x655212as2ba7cab015c5792a@mail.gmail.com> Message-ID: <932b2f1f0901211159l446c8bcfu4fb7d18f471a7e78@mail.gmail.com> On Wed, Jan 21, 2009 at 1:54 PM, Paulo J. Matos wrote: > Hi all, > > I am interested in knowing more about PLT Redex. I looked at the site > and it says in the workshop part: > "The organizers plan to collect all articles in a book on PLT Redex > that will consist of three parts: an introduction to reduction and > rewriting semantics; a PLT Redex manual; and the collection of revised > and refined workshop papers. " > > Is this book anywhere? In fact I am mainly interested in the > introduction to reduction and rewriting semantics, the theory and its > applicability. If this book was not made, is there anything like this > online? The book is in its final stages of editing, but I don't yet have a final date, sorry. > What kind of applications had PLT Redex already? [It would be > interesting to see a list of papers which use PLT Redex, both from the > implementors and the users perspective] Probably the most notable is the R6RS semantics, and there are a bunch of other models out there, too (like in the book :). Robby From spdegabrielle at gmail.com Wed Jan 21 15:03:01 2009 From: spdegabrielle at gmail.com (Stephen De Gabrielle) Date: Thu Mar 26 02:38:45 2009 Subject: [plt-scheme] Make Module In-Reply-To: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> References: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> Message-ID: <595b9ab20901211203l3a013756qc63a42a5da696feb@mail.gmail.com> There is also Sake http://planet.plt-scheme.org/display.ss?package=sake.plt&owner=schematics I have not tried it (yet). s. On Wed, Jan 21, 2009 at 6:58 PM, Paulo J. Matos wrote: > Hi all, > > I remember the existence of a make kind of language but done purely in > scheme in the versions 3xx but I can't find it now in the latest one. > Was it removed? > > Cheers, > > -- > Paulo Jorge Matos - pocmatos at gmail.com > Webpage: http://www.personal.soton.ac.uk/pocm > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Cheers, Stephen -- Stephen De Gabrielle s.degabrielle@cs.ucl.ac.uk Telephone +44 (0)20 7679 0693 (x30693) Mobile 079 851 890 45 Project: Making Sense of Information (MaSI) Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html Home:http://www.degabrielle.name/stephen UCL Interaction Centre MPEB 8th floor University College London Gower Street London WC1E 6BT -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090121/fc287a5e/attachment.htm From apatinoii at gmail.com Wed Jan 21 17:18:11 2009 From: apatinoii at gmail.com (Adrian Patino) Date: Thu Mar 26 02:38:46 2009 Subject: [plt-scheme] Compile and Run-Time Phase question Message-ID: <4370c947-0ecc-497e-a4f9-ef7a2eca417e@l33g2000pri.googlegroups.com> (define-syntax identifier-syntax (lambda (x) (syntax-case x () ((_ e) (syntax (lambda (x) (syntax-case x () (id (identifier? (syntax id)) (syntax e)) ((id x (... ...)) (identifier? (syntax id)) (syntax (e x (... ...))))))))))) (let ((x 0)) (define-syntax x++ (identifier-syntax (let ((t x)) (set! x (+ t 1)) t))) (let ((a x++)) (list a x))) returns with error: expand: unbound identifier in module (in the transformer environment, which does not include the macro definition that is visible to run- time expressions) using (define-for-syntax identifier-syntax ...) insteads returns with error: compile: identifier used out of context in: x referring to the x in the let expression. Why is it out of context? Also, I noticed that other scheme implementations allow this code to work, such as ypsilon. What are the benefits of using define-for- syntax? From rajanikanth at gmail.com Wed Jan 21 20:15:34 2009 From: rajanikanth at gmail.com (Raj) Date: Thu Mar 26 02:38:46 2009 Subject: [plt-scheme] configure periodic update through a proxy server Message-ID: Hi! My organization uses a proxy server. How can I configure scheme so that it will notify me when there's an update? Thanks, Raj From mflatt at cs.utah.edu Wed Jan 21 21:30:03 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:46 2009 Subject: [plt-scheme] Compile and Run-Time Phase question In-Reply-To: <4370c947-0ecc-497e-a4f9-ef7a2eca417e@l33g2000pri.googlegroups.com> References: <4370c947-0ecc-497e-a4f9-ef7a2eca417e@l33g2000pri.googlegroups.com> Message-ID: <20090122023007.2CC6C6500AE@mail-svr1.cs.utah.edu> At Wed, 21 Jan 2009 14:18:11 -0800 (PST), Adrian Patino wrote: > (define-syntax identifier-syntax > (lambda (x) > (syntax-case x () > ((_ e) > (syntax > (lambda (x) > (syntax-case x () > (id > (identifier? (syntax id)) > (syntax e)) > ((id x (... ...)) > (identifier? (syntax id)) > (syntax (e x (... ...))))))))))) > > (let ((x 0)) > (define-syntax x++ > (identifier-syntax > (let ((t x)) (set! x (+ t 1)) t))) > (let ((a x++)) > (list a x))) > > returns with error: > expand: unbound identifier in module (in the transformer environment, > which does not include the macro definition that is visible to run- > time expressions) > > using (define-for-syntax identifier-syntax ...) insteads returns with > error: > compile: identifier used out of context in: x > referring to the x in the let expression. > > Why is it out of context? When you use `define-for-syntax', then you bind a function `identifier-syntax' that can be used directly in an transformer expression. So, `(identifier-syntax (let ((t x)) ...))' is treated as a function call, and `x' is treated as a direct reference to the one bound to 0. A transformer expression cannot refer directly to a run-time variable (since it doesn't exist, yet), so that's why you get an out-of-context error. > Also, I noticed that other scheme implementations allow this code to > work, such as ypsilon. What are the benefits of using define-for- > syntax? `define-for-syntax' is not what you want in this case. It binds a variable at compile time for use at compile time. You want to bind a macro at compile time for use at compile time. So, you'd want `define-syntax-for-syntax' --- which isn't currently supported. To make this code work in PLT Scheme, you have to put `identifier-syntax' in a separate module, and then import it `for-syntax' into the module that uses `identifier-syntax' for a transformer expression. Matthew From wand at ccs.neu.edu Wed Jan 21 22:46:18 2009 From: wand at ccs.neu.edu (Mitchell Wand) Date: Thu Mar 26 02:38:47 2009 Subject: [plt-scheme] [Scheme Steering Committee announcements] Reminder: Scheme SC Nomination and Registration Period now half over Message-ID: <1bd18ad50901211946n570c0e01uadb0180e5ed0dcff@mail.gmail.com> Skipped content of type multipart/alternative-------------- next part -------------- _______________________________________________ Scheme-announcements mailing list Scheme-announcements@lists.ccs.neu.edu https://lists.ccs.neu.edu/bin/listinfo/scheme-announcements From wand at ccs.neu.edu Wed Jan 21 22:46:18 2009 From: wand at ccs.neu.edu (Mitchell Wand) Date: Thu Mar 26 02:38:47 2009 Subject: [plt-scheme] [Scheme Steering Committee announcements] Reminder: Scheme SC Nomination and Registration Period now half over Message-ID: <1bd18ad50901211946n570c0e01uadb0180e5ed0dcff@mail.gmail.com> Skipped content of type multipart/alternative-------------- next part -------------- _______________________________________________ Scheme-announcements mailing list Scheme-announcements@lists.ccs.neu.edu https://lists.ccs.neu.edu/bin/listinfo/scheme-announcements From pocmatos at gmail.com Thu Jan 22 06:45:36 2009 From: pocmatos at gmail.com (Paulo J. Matos) Date: Thu Mar 26 02:38:47 2009 Subject: [plt-scheme] Make Module In-Reply-To: <595b9ab20901211203l3a013756qc63a42a5da696feb@mail.gmail.com> References: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> <595b9ab20901211203l3a013756qc63a42a5da696feb@mail.gmail.com> Message-ID: <11b141710901220345pa602faay71df97bfb3deab36@mail.gmail.com> On Wed, Jan 21, 2009 at 8:03 PM, Stephen De Gabrielle wrote: > There is also Sake > http://planet.plt-scheme.org/display.ss?package=sake.plt&owner=schematics > > I have not tried it (yet). > Thanks for the reference, looks interesting but not for my application. I want to build a scheme script based on the make module to build general latex projects. > s. > > On Wed, Jan 21, 2009 at 6:58 PM, Paulo J. Matos wrote: >> >> Hi all, >> >> I remember the existence of a make kind of language but done purely in >> scheme in the versions 3xx but I can't find it now in the latest one. >> Was it removed? >> >> Cheers, >> >> -- >> Paulo Jorge Matos - pocmatos at gmail.com >> Webpage: http://www.personal.soton.ac.uk/pocm >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > > > -- > Cheers, > > Stephen > > -- > Stephen De Gabrielle > s.degabrielle@cs.ucl.ac.uk > Telephone +44 (0)20 7679 0693 (x30693) > Mobile 079 851 890 45 > Project: Making Sense of Information (MaSI) > Work:http://www.uclic.ucl.ac.uk/annb/MaSI.html > Home:http://www.degabrielle.name/stephen > > > UCL Interaction Centre > MPEB 8th floor > University College London > Gower Street > London WC1E 6BT > -- Paulo Jorge Matos - pocmatos at gmail.com Webpage: http://www.personal.soton.ac.uk/pocm From keiko at kurims.kyoto-u.ac.jp Thu Jan 22 10:31:59 2009 From: keiko at kurims.kyoto-u.ac.jp (Keiko Nakata) Date: Thu Mar 26 02:38:48 2009 Subject: [plt-scheme] compound mutually recursive units Message-ID: <20090123.003159.125121280.keiko@kurims.kyoto-u.ac.jp> Hello. I want to compound a unit from several units to form recursive bindings, where the imports of a constituent unit are supplied by several other constituents; I cannot figure out how to do this concisely. Here is a snippet from my code, which implements a toy language: ;; heap (define-signature Heap_import^ (eval_cexpr eval_mexpr)) (define-signature Heap_export^ (heap_locate new_location eval_location)) (define-unit Heap@ (import Heap_import^) (export Heap_export^) ... ) ;; the core language (define-signature Cexpr_import^ (eval_location)) (define-signature Cexpr_export^ (subst_cexpr eval_cexpr)) (define-unit Cexpr@ (import Cexpr_import^) (export Cexpr_export^) ...) ;; the mixin language (define-signature Mexpr_import^ (heap_locate new_location eval_location subst_cexpr)) (define-signature Mexpr_export^ (eval_mexpr)) (define-unit Mexpr@ (import Mexpr_import^) (export Mexpr_export^) ... ) I want to compound all the three units Heap@, Cexpr@ and Mexpr@. An easiest way seems to split up signatures in pieces, which does not sound very elegant. I appreciate any advice. Kind regards, Keiko From geoff at knauth.org Thu Jan 22 15:32:44 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:48 2009 Subject: [plt-scheme] stddef.h problem - building from SVN on Ubuntu 8.10 AMD64 Message-ID: <5E7A703A-B8A7-47A4-B988-7CFF47CC3B0D@knauth.org> This seems to be a new problem since my upgrade to Ubuntu 8.10: [...] make[7]: Entering directory `/home/gknauth/test/plt/plt/src/foreign' /home/gknauth/test/plt/plt/src/lt/libtool --mode=compile --tag=CC gcc - g -O2 -Wall -DMZ_USES_SHARED_LIB -I./../mzscheme -I./../mzscheme/ include -I./../mzscheme/src -Igcc/libffi/include -c ./foreign.c -o foreign.lo mkdir .libs gcc -g -O2 -Wall -DMZ_USES_SHARED_LIB -I./../mzscheme -I./../ mzscheme/include -I./../mzscheme/src -Igcc/libffi/include -c ./ foreign.c -fPIC -DPIC -o .libs/foreign.o In file included from ./../mzscheme/include/scheme.h:127, from ./../mzscheme/src/schpriv.h:21, from ./foreign.c:12: /usr/include/stdio.h:34:21: error: stddef.h: No such file or directory In file included from /usr/include/stdio.h:75, from ./../mzscheme/include/scheme.h:127, from ./../mzscheme/src/schpriv.h:21, from ./foreign.c:12: I don't think it's a PLT problem. I've googled enough to see non-PLT folks are having similar difficulties. I'm just wondering if anyone has seen this before building PLT on Ubuntu 8.10. I have build-essential, libc6, libc6-dev installed, and I can even see stddef.h under various gcc subdirectories, just apparently not where gcc is looking. Geoffrey -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090122/999b8f15/attachment.html From mikeegg1 at me.com Thu Jan 22 15:36:24 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Thu Mar 26 02:38:48 2009 Subject: [plt-scheme] mysql? Message-ID: <20090122203624.GE14542@mail.me.com> I know there is an interface to sqlite. Is there already an interface to MySQL? Mike From geoff at knauth.org Thu Jan 22 15:40:34 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:48 2009 Subject: [plt-scheme] mysql? In-Reply-To: <20090122203624.GE14542@mail.me.com> References: <20090122203624.GE14542@mail.me.com> Message-ID: On Jan 22, 2009, at 15:36, Mike Eggleston wrote: > I know there is an interface to sqlite. Is there already an > interface to MySQL? http://groups.google.com/group/plt-scheme/browse_thread/thread/f102c7f1daa1f69b?pli=1 -or- http://tinyurl.com/b2mflh From mikeegg1 at me.com Thu Jan 22 16:00:58 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Thu Mar 26 02:38:49 2009 Subject: [plt-scheme] mysql? In-Reply-To: References: <20090122203624.GE14542@mail.me.com> Message-ID: <20090122210058.GF14542@mail.me.com> On Thu, 22 Jan 2009, Geoffrey S. Knauth might have said: > On Jan 22, 2009, at 15:36, Mike Eggleston wrote: > >I know there is an interface to sqlite. Is there already an > >interface to MySQL? > > http://groups.google.com/group/plt-scheme/browse_thread/thread/f102c7f1daa1f69b?pli=1 > -or- > http://tinyurl.com/b2mflh Great, thanks. Mike From eli at barzilay.org Thu Jan 22 17:46:59 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:49 2009 Subject: [plt-scheme] configure periodic update through a proxy server In-Reply-To: References: Message-ID: <18808.63331.213466.135340@arabic.ccs.neu.edu> On Jan 21, Raj wrote: > Hi! > > My organization uses a proxy server. How can I configure scheme so > that it will notify me when there's an update? First of all you need to let PLT Scheme know that you're using a proxy: in the preferences dialog choose the "Browser" tab and enter your proxy address. Then, in the "Warnings" page you can make DrScheme check for updates periodically. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From ryanc at ccs.neu.edu Thu Jan 22 18:11:57 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:38:49 2009 Subject: [plt-scheme] compound mutually recursive units In-Reply-To: <20090123.003159.125121280.keiko@kurims.kyoto-u.ac.jp> References: <20090123.003159.125121280.keiko@kurims.kyoto-u.ac.jp> Message-ID: On Jan 22, 2009, at 10:31 AM, Keiko Nakata wrote: > Hello. > > I want to compound a unit from several units to form recursive > bindings, where the imports of a constituent unit are > supplied by several other constituents; I cannot figure out how to do > this concisely. > > Here is a snippet from my code, which implements a toy language: > > ;; heap > (define-signature Heap_import^ (eval_cexpr eval_mexpr)) > (define-signature Heap_export^ (heap_locate new_location > eval_location)) > (define-unit Heap@ (import Heap_import^) (export Heap_export^) ... ) > > ;; the core language > (define-signature Cexpr_import^ (eval_location)) > (define-signature Cexpr_export^ (subst_cexpr eval_cexpr)) > (define-unit Cexpr@ (import Cexpr_import^) (export Cexpr_export^) ...) > > ;; the mixin language > (define-signature Mexpr_import^ (heap_locate new_location > eval_location subst_cexpr)) > (define-signature Mexpr_export^ (eval_mexpr)) > (define-unit Mexpr@ (import Mexpr_import^) (export > Mexpr_export^) ... ) Typically, you define signatures for the exports of your units, like so: (define-signature Heap^ (heap_locate new_location eval_location)) (define-signature Cexpr^ (subst_cexpr eval_cexpr)) (define-signature Mexpr^ (eval_mexpr)) Instead of creating a new signature for each unit to describe its imports, you pick the subset of the signatures above that covers the bindings each unit needs. So the unit definitions would look like this: (define-unit Heap@ (import Cexpr^ Mexpr^) (export Heap^) ...) (define-unit Cexpr@ (import Heap^) (export Cexpr^) ...) (define-unit Mexpr@ (import Heap^ Cexpr^) (export Mexpr^) ...) This means that units often import things that they don't actually need, just because they belong to the same signature as something else they do need. This is not a problem. Finally, you can compound the units together using 'define-compound- unit/infer'. For example, if you want that unit to re-export everything defined by the others, list all of the subunits' export signatures in the compound unit's export clause: (define-compound-unit/infer Program@ (import) (export Heap^ Cexpr^ Mexpr^) (link Heap@ Cexpr@ Mexpr@)) Hope that helps, Ryan > > I want to compound all the three units Heap@, Cexpr@ and Mexpr@. > An easiest way seems to split up signatures in pieces, which does not > sound very elegant. > > I appreciate any advice. > > Kind regards, > Keiko > > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From billclem at gmail.com Thu Jan 22 19:16:16 2009 From: billclem at gmail.com (Bill Clementson) Date: Thu Mar 26 02:38:49 2009 Subject: [plt-scheme] lispvan meetings Message-ID: <8757cb490901221616i1a011c25p9dbf3e5cdbaaf212@mail.gmail.com> Hi all, Great lispvan presentation last night - thanks again Dean! After the meeting, I asked for meeting suggestions for the coming year and said that I would send out an email asking others for their ideas as well. Here were the topic suggestions that were made at last night's meeting: 1. Lisp use in graphics applications 2. SLIME - use and tips/tricks 3. Clojure 4. Lisp in AI 5. Haskell Any other topics that people are interested in? Ideally, I would like both a topic suggestion and a presenter (feel free to either volunteer yourself or to suggest someone who you think might do a good job with the topic); however, if you think of a really "killer" topic but can't suggest a presenter, I will attempt to coerce/bribe/blackmail someone into doing the presentation! ;-) Cheers, Bill From toddobryan at gmail.com Thu Jan 22 21:48:04 2009 From: toddobryan at gmail.com (Todd O'Bryan) Date: Thu Mar 26 02:38:49 2009 Subject: [plt-scheme] stddef.h problem - building from SVN on Ubuntu 8.10 AMD64 In-Reply-To: <5E7A703A-B8A7-47A4-B988-7CFF47CC3B0D@knauth.org> References: <5E7A703A-B8A7-47A4-B988-7CFF47CC3B0D@knauth.org> Message-ID: <904774730901221848p76e69d9dk49b7c9a0c2ac0a27@mail.gmail.com> Which version of Ubuntu 8.10? I've built 4.1.3 successfully on the 32-bit version, but haven't tried 4.1.4, yet. Todd On Thu, Jan 22, 2009 at 3:32 PM, Geoffrey S. Knauth wrote: > This seems to be a new problem since my upgrade to Ubuntu 8.10: > [...] > make[7]: Entering directory `/home/gknauth/test/plt/plt/src/foreign' > /home/gknauth/test/plt/plt/src/lt/libtool --mode=compile --tag=CC gcc -g -O2 > -Wall -DMZ_USES_SHARED_LIB -I./../mzscheme -I./../mzscheme/include > -I./../mzscheme/src -Igcc/libffi/include -c ./foreign.c -o foreign.lo > mkdir .libs > gcc -g -O2 -Wall -DMZ_USES_SHARED_LIB -I./../mzscheme > -I./../mzscheme/include -I./../mzscheme/src -Igcc/libffi/include -c > ./foreign.c -fPIC -DPIC -o .libs/foreign.o > In file included from ./../mzscheme/include/scheme.h:127, > from ./../mzscheme/src/schpriv.h:21, > from ./foreign.c:12: > /usr/include/stdio.h:34:21: error: stddef.h: No such file or directory > In file included from /usr/include/stdio.h:75, > from ./../mzscheme/include/scheme.h:127, > from ./../mzscheme/src/schpriv.h:21, > from ./foreign.c:12: > I don't think it's a PLT problem. I've googled enough to see non-PLT folks > are having similar difficulties. I'm just wondering if anyone has seen this > before building PLT on Ubuntu 8.10. > I have build-essential, libc6, libc6-dev installed, and I can even see > stddef.h under various gcc subdirectories, just apparently not where gcc is > looking. > Geoffrey > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From dtp at mindstory.com Thu Jan 22 23:28:21 2009 From: dtp at mindstory.com (David T. Pierson) Date: Thu Mar 26 02:38:49 2009 Subject: [plt-scheme] should mzscheme -ue work? Message-ID: <1232683537.1765%dtp@mindstory.com> Is mzscheme's -e supposed to work when -u is also used? ############################## $ mzscheme --version Welcome to MzScheme v4.1.3 [3m], Copyright (c) 2004-2008 PLT Scheme Inc. $ cat foo.ss #lang scheme (provide bar) (define (bar) (display 'foo)) $ mzscheme -ue foo.ss '(bar)' #f::0: compile: bad syntax; function application is not allowed, because no #%app syntax transformer is bound in: (bar) $ mzscheme -u foo.ss -e '(bar)' $ mzscheme -e '(require (file "foo.ss"))' -e '(bar)' foo ############################## The behavior of the last command was what I was expecting from the previous 2. (It also seems weird that -ue produced different results from -u -e.) Anyway, my real reason for wanting -ue to work is for a trampoline from a shell script. My workaround is: #!/bin/sh #| exec mzscheme --name "$0" -e "(require (file \"$0\"))" -e "(bar)" -- "$@" |# This seems to work fine, so I have no complaint. I just thought -ue would have worked too. David From DekuDekuplex at Yahoo.com Fri Jan 23 01:00:00 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:38:50 2009 Subject: [plt-scheme] Re: lispvan meetings References: <8757cb490901221616i1a011c25p9dbf3e5cdbaaf212@mail.gmail.com> Message-ID: <41min41ksgl8u7oeoa9c5u0m1b7baqpbst@4ax.com> On Thu, 22 Jan 2009 16:16:16 -0800, Bill Clementson wrote: >Hi all, > >Great lispvan presentation last night - thanks again Dean! > >After the meeting, I asked for meeting suggestions for the coming year >and said that I would send out an email asking others for their ideas >as well. Here were the topic suggestions that were made at last >night's meeting: > >1. Lisp use in graphics applications >2. SLIME - use and tips/tricks >3. Clojure >4. Lisp in AI >5. Haskell > >Any other topics that people are interested in? Ideally, I would like >both a topic suggestion and a presenter (feel free to either volunteer >yourself or to suggest someone who you think might do a good job with >the topic); however, if you think of a really "killer" topic but can't >suggest a presenter, I will attempt to coerce/bribe/blackmail someone >into doing the presentation! ;-) How about the following topics: 1. Qi II (see http://www.lambdassociates.org/whatsnew.htm) 2. Monads in Haskell, Qi II, and O'Caml, and Possibilities for Representation in Typed Scheme (see the following related blog entries for reference): A Monad Tutorial for Ocaml | Enfranchised Mind http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/ Programming Kung Fu Qi: Monads in Qi http://programmingkungfuqi.blogspot.com/2007/02/monads-in-qi.html A Cross-language Comparison of Monads in Haskell, O’Caml, and Qi http://dekudekuplex.wordpress.com/2009/01/07/27/ 3. Category Theory as a Possible Theoretical Basis for Representing Monads in Typed Scheme (see the following possibly related blog entry on references for a similar theoretical basis for Haskell): Learning Haskell through Category Theory, and Adventuring in Category Land: Like Flatterland, Only About Categories http://dekudekuplex.wordpress.com/2009/01/16/learning-haskell-through-category-theory-and-adventuring-in-category-land-like-f latterland-only-about-categories/ 4. Refal: Recursive Functions Programming Language (see the following related Web pages for reference: Refal/Supercompilation Community http://www.refal.net/index_e.htm Integrated cover for program developing [Refal-SciTE editor] http://www.refal.net/~belous/refsci-e.htm 5. A Comparison of Advantages and Disadvantages in Programming with Side Effects vs. Purely Functional Programming in Typed Scheme: Explicit Polymorphism, by Shriram Krishnamurthi (course notes of 2003-11-03 for cs173, 2003 at Brown University) http://www.cs.brown.edu/courses/cs173/2003/Textbook/2003-11-03.pdf -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From DekuDekuplex at Yahoo.com Fri Jan 23 01:29:57 2009 From: DekuDekuplex at Yahoo.com (Benjamin L.Russell) Date: Thu Mar 26 02:38:50 2009 Subject: [plt-scheme] Re: lispvan meetings References: <8757cb490901221616i1a011c25p9dbf3e5cdbaaf212@mail.gmail.com> <41min41ksgl8u7oeoa9c5u0m1b7baqpbst@4ax.com> Message-ID: On Fri, 23 Jan 2009 15:00:00 +0900, Benjamin L.Russell wrote: >5. A Comparison of Advantages and Disadvantages in Programming with >Side Effects vs. Purely Functional Programming in Typed Scheme: > > Explicit Polymorphism, by Shriram Krishnamurthi (course notes of >2003-11-03 for cs173, 2003 at Brown University) > http://www.cs.brown.edu/courses/cs173/2003/Textbook/2003-11-03.pdf Actually, to correct myself, perhaps the above-mentioned title should have been the following: 5. A Comparison of Advantages and Disadvantages in Programming with Explicity Polymorphism in Scheme Krishnamurthi's course notes, to correct myself, do not discuss purely functional programming; they discuss explicit polymorphism, using static types. However, the following blog entry does seem relevant to discussing purely functional programming, using an example of "map" to illustrate how mutable pairs can break a Schemer’s natural and ingrained model of programming: PLT Scheme Blog: Getting rid of set-car! and set-cdr!, by Matthew Flatt http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html So perhaps I can modify points 5 and 6 as follows: 5. A Comparison of Advantages and Disadvantages in Programming with Explicity Polymorphism in Scheme Explicit Polymorphism, by Shriram Krishnamurthi (course notes of 2003-11-03 for cs173, 2003 at Brown University) http://www.cs.brown.edu/courses/cs173/2003/Textbook/2003-11-03.pdf 6. A Comparison of Advantages and Disadvantages in Programming with Side Effects vs. Purely Functional Programming in Typed Scheme: PLT Scheme Blog: Getting rid of set-car! and set-cdr!, by Matthew Flatt http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html -- Benjamin L. Russell -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ From mflatt at cs.utah.edu Fri Jan 23 07:58:13 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:50 2009 Subject: [plt-scheme] should mzscheme -ue work? In-Reply-To: <1232683537.1765%dtp@mindstory.com> References: <1232683537.1765%dtp@mindstory.com> Message-ID: <20090123125818.60FDC6500AA@mail-svr1.cs.utah.edu> At Thu, 22 Jan 2009 23:28:21 -0500, "David T. Pierson" wrote: > $ cat foo.ss > #lang scheme > (provide bar) > (define (bar) > (display 'foo)) > > $ mzscheme -ue foo.ss '(bar)' > #f::0: compile: bad syntax; function application is not allowed, because no > #%app syntax transformer is bound in: (bar) When a `require' flag like `-u' appears first, then it disables the normal require of `scheme' into the top-level environment. This rule tends to do the right thing for all sorts of cases, but it isn't what you wanted in this case. I see three alternatives: * Use `-e' to require "foo.ss", as you figured out: mzscheme -e '(require (file "foo.ss"))' -e '(bar)' * Use an `eval'-like flag before `-u': mzscheme -eue '(void)' foo.ss '(bar)' * Change "foo.ss" to re-export `scheme': #lang scheme (provide bar (all-from-out scheme)) (define (bar) (display 'foo)) > $ mzscheme -u foo.ss -e '(bar)' The `-u' flag also causes all later command-line arguments to be treated as non-flags. So, "-e" and "(bar)" are put into `current-command-line-arguments' instead of handled by `mzscheme'. Matthew From filip.stadnik at gmail.com Fri Jan 23 08:01:47 2009 From: filip.stadnik at gmail.com (Filip Stadnik) Date: Thu Mar 26 02:38:50 2009 Subject: [plt-scheme] MysterX & reference type Message-ID: Hi list, I'm trying to call a COM method which accepts a variant reference which gets assigned by the foreign COM object. (com-invoke myLoginControl "Login" session-id) The session-id is supposed to be assigned a valid session id upon successful login, -1 otherwise. Which scheme type am I supposed to use for this session-id object? Thank you, Filip -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090123/4a672bbf/attachment.htm From mikeegg1 at me.com Fri Jan 23 08:53:29 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Thu Mar 26 02:38:51 2009 Subject: [plt-scheme] trying to learn scheme and use sqlite.ss Message-ID: <20090123135329.GB20620@mail.me.com> Morning, In DrScheme I enter in the lower window: > (require (planet "main.ss" ("schematics" "schemeunit.plt" 3 3))) > (define dbh (open (string->path "mikee.sql3"))) . open: illegal use of signature form in: (open (string->path "mikee.sql3")) So the require is working (good), but the open is not working. I don't understand what violation I have in the syntax. To my so far limited understanding I'm following the code at . What am I missing here? Mike From jay.mccarthy at gmail.com Fri Jan 23 09:12:34 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:51 2009 Subject: [plt-scheme] trying to learn scheme and use sqlite.ss In-Reply-To: <20090123135329.GB20620@mail.me.com> References: <20090123135329.GB20620@mail.me.com> Message-ID: The require line should be: (require (planet jaymccarthy/sqlite:3)) As it says in the documentation: http://coach.cs.uchicago.edu:8080/package-source/jaymccarthy/sqlite.plt/3/7/planet-docs/sqlite/index.html That corresponds to how the code you're looking at requires "sqlite.ss". Jay On Fri, Jan 23, 2009 at 6:53 AM, Mike Eggleston wrote: > Morning, > > In DrScheme I enter in the lower window: > >> (require (planet "main.ss" ("schematics" "schemeunit.plt" 3 3))) >> (define dbh (open (string->path "mikee.sql3"))) > . open: illegal use of signature form in: (open (string->path "mikee.sql3")) > > So the require is working (good), but the open is not working. I > don't understand what violation I have in the syntax. To > my so far limited understanding I'm following the code at > . > > What am I missing here? > > Mike > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From jay.mccarthy at gmail.com Fri Jan 23 09:16:18 2009 From: jay.mccarthy at gmail.com (Jay McCarthy) Date: Thu Mar 26 02:38:51 2009 Subject: [plt-scheme] trying to learn scheme and use sqlite.ss In-Reply-To: References: <20090123135329.GB20620@mail.me.com> Message-ID: I also suggest looking at the part of the Continue tutorial on using the SQLite interface: http://docs.plt-scheme.org/continue/index.html#(part._.Using_an_.S.Q.L_database) On Fri, Jan 23, 2009 at 7:12 AM, Jay McCarthy wrote: > The require line should be: > > (require (planet jaymccarthy/sqlite:3)) > > As it says in the documentation: > > http://coach.cs.uchicago.edu:8080/package-source/jaymccarthy/sqlite.plt/3/7/planet-docs/sqlite/index.html > > That corresponds to how the code you're looking at requires "sqlite.ss". > > Jay > > On Fri, Jan 23, 2009 at 6:53 AM, Mike Eggleston wrote: >> Morning, >> >> In DrScheme I enter in the lower window: >> >>> (require (planet "main.ss" ("schematics" "schemeunit.plt" 3 3))) >>> (define dbh (open (string->path "mikee.sql3"))) >> . open: illegal use of signature form in: (open (string->path "mikee.sql3")) >> >> So the require is working (good), but the open is not working. I >> don't understand what violation I have in the syntax. To >> my so far limited understanding I'm following the code at >> . >> >> What am I missing here? >> >> Mike >> _________________________________________________ >> For list-related administrative tasks: >> http://list.cs.brown.edu/mailman/listinfo/plt-scheme >> > > > > -- > Jay McCarthy > Assistant Professor / Brigham Young University > http://teammccarthy.org/jay > > "The glory of God is Intelligence" - D&C 93 > -- Jay McCarthy Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 From mikeegg1 at me.com Fri Jan 23 09:58:18 2009 From: mikeegg1 at me.com (Mike Eggleston) Date: Thu Mar 26 02:38:51 2009 Subject: [plt-scheme] trying to learn scheme and use sqlite.ss In-Reply-To: References: <20090123135329.GB20620@mail.me.com> Message-ID: <20090123145818.GD20620@mail.me.com> On Fri, 23 Jan 2009, Jay McCarthy might have said: > The require line should be: > > (require (planet jaymccarthy/sqlite:3)) > > As it says in the documentation: > > http://coach.cs.uchicago.edu:8080/package-source/jaymccarthy/sqlite.plt/3/7/planet-docs/sqlite/index.html > > That corresponds to how the code you're looking at requires "sqlite.ss". > > Jay > > On Fri, Jan 23, 2009 at 6:53 AM, Mike Eggleston wrote: > > Morning, > > > > In DrScheme I enter in the lower window: > > > >> (require (planet "main.ss" ("schematics" "schemeunit.plt" 3 3))) > >> (define dbh (open (string->path "mikee.sql3"))) > > . open: illegal use of signature form in: (open (string->path "mikee.sql3")) > > > > So the require is working (good), but the open is not working. I > > don't understand what violation I have in the syntax. To > > my so far limited understanding I'm following the code at > > . > > > > What am I missing here? > > > > Mike Thank you, Jay. My test program is now: #lang scheme (require (prefix-in sqlite: (planet jaymccarthy/sqlite:3/sqlite))) (define db (sqlite:open (string->path "mikee.sql3"))) (sqlite:exec/ignore db "CREATE TABLE user ( user_id INTEGER PRIMARY KEY, name TEXT )") (sqlite:insert db "INSERT INTO user (name) VALUES ('noel')") (sqlite:insert db "INSERT INTO user (name) VALUES ('matt')") (sqlite:insert db "INSERT INTO user (name) VALUES ('dave')") (sqlite:select db "select * from user") (sqlite:close db) (delete-file "mikee.sql3") The resulting file size is 2048 bytes. Mike From geoff at knauth.org Fri Jan 23 10:54:03 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:51 2009 Subject: [plt-scheme] stddef.h problem - building from SVN on Ubuntu 8.10 AMD64 In-Reply-To: <904774730901221848p76e69d9dk49b7c9a0c2ac0a27@mail.gmail.com> References: <5E7A703A-B8A7-47A4-B988-7CFF47CC3B0D@knauth.org> <904774730901221848p76e69d9dk49b7c9a0c2ac0a27@mail.gmail.com> Message-ID: <4E15A6C8-F265-4A88-9A88-276C7CEE7CE1@knauth.org> On Jan 22, 2009, at 21:48, Todd O'Bryan wrote: > Which version of Ubuntu 8.10? I've built 4.1.3 successfully on the > 32-bit version, but haven't tried 4.1.4, yet. $ uname -a Linux nelson 2.6.27-9-generic #1 SMP Thu Nov 20 22:15:32 UTC 2008 x86_64 GNU/Linux From m.douglas.williams at gmail.com Fri Jan 23 12:55:58 2009 From: m.douglas.williams at gmail.com (Doug Williams) Date: Thu Mar 26 02:38:52 2009 Subject: [plt-scheme] Validating a Regular Expression Message-ID: Is there a quick way to validate that a string represents a valid regular expression? As far as I can tell, catching any exception raised by regexp (or pregexp) with the string is the best way to do it. Doug -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090123/cf0851da/attachment.html From mflatt at cs.utah.edu Fri Jan 23 13:00:34 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:52 2009 Subject: [plt-scheme] Validating a Regular Expression In-Reply-To: References: Message-ID: <20090123180035.4D6896500AF@mail-svr1.cs.utah.edu> At Fri, 23 Jan 2009 10:55:58 -0700, Doug Williams wrote: > Is there a quick way to validate that a string represents a valid regular > expression? As far as I can tell, catching any exception raised by regexp > (or pregexp) with the string is the best way to do it. Yes, that's the best way I can think of. Matthew From marek at xivilization.net Fri Jan 23 12:57:59 2009 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:38:52 2009 Subject: [plt-scheme] lispvan meetings In-Reply-To: <8757cb490901221616i1a011c25p9dbf3e5cdbaaf212@mail.gmail.com> References: <8757cb490901221616i1a011c25p9dbf3e5cdbaaf212@mail.gmail.com> Message-ID: <20090123185759.4fbdc476@halmanfloyd.lan.local> On Thu, 22 Jan 2009 16:16:16 -0800 Bill Clementson wrote: > Great lispvan presentation last night - thanks again Dean! Are there lispvan recordings? Your presentation topic sound great, but Vancouver is about 8,370 km away and thats a bit too far to go there for me. regards, Marek From fkoksal at cs.bilgi.edu.tr Fri Jan 23 12:54:30 2009 From: fkoksal at cs.bilgi.edu.tr (=?UTF-8?B?Ik0uIEZhdGloIEvDtmtzYWwi?=) Date: Thu Mar 26 02:38:53 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... Message-ID: <497A0456.3030300@cs.bilgi.edu.tr> Hi all, As a part of my thesis, we want to measure the effectiveness of proper usage of Design Recipe. In order to do that we want to record *every* change (with timestamps) in both definition and interaction windows of DrScheme. As far as I know, the "Log Definitions and Interactions..." functionality of DrScheme only records definitions/interactions as the user saves the file, which doesn't help us. Can you please point me if someone else did it before? And if not, what should be the beginning point? M. Fatih K?ksal ?stanbul Bilgi University Computer Science Department -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090123/4a2bc7fe/signature.pgp From robby at eecs.northwestern.edu Fri Jan 23 13:27:11 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:53 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: <497A0456.3030300@cs.bilgi.edu.tr> References: <497A0456.3030300@cs.bilgi.edu.tr> Message-ID: <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> On Fri, Jan 23, 2009 at 11:54 AM, "M. Fatih K?ksal" wrote: > Hi all, > > As a part of my thesis, we want to measure the effectiveness of proper > usage of Design Recipe. In order to do that we want to record *every* > change (with timestamps) in both definition and interaction windows of > DrScheme. > > As far as I know, the "Log Definitions and Interactions..." > functionality of DrScheme only records definitions/interactions as the > user saves the file, which doesn't help us. The log functionality should log each time the user hits 'Run'. > Can you please point me if someone else did it before? And if not, what > should be the beginning point? Probably the drscheme tools manual in Help Desk. Robby From billclem at gmail.com Fri Jan 23 13:46:07 2009 From: billclem at gmail.com (Bill Clementson) Date: Thu Mar 26 02:38:53 2009 Subject: [plt-scheme] lispvan meetings In-Reply-To: <20090123185759.4fbdc476@halmanfloyd.lan.local> References: <8757cb490901221616i1a011c25p9dbf3e5cdbaaf212@mail.gmail.com> <20090123185759.4fbdc476@halmanfloyd.lan.local> Message-ID: <8757cb490901231046h611eacb6y534629b58511dfa8@mail.gmail.com> Hi Marek, On Fri, Jan 23, 2009 at 9:57 AM, Marek Kubica wrote: > On Thu, 22 Jan 2009 16:16:16 -0800 > Bill Clementson wrote: > >> Great lispvan presentation last night - thanks again Dean! > > Are there lispvan recordings? Your presentation topic sound great, > but Vancouver is about 8,370 km away and thats a bit too far to go > there for me. Most lispvan meetings are recorded and I post links to them on my blog. Unfortunately, the January, 2009 was not recorded. I used to maintain a lispvan page on the ALU web site with descriptions of the meetings and links to the screencasts; however, the ALU web site is currently off-line and it is unknown whether it can be restored. For the time being, the easiest way to find the meeting summaries/screencasts is by searching on my blog: http://www.google.com/search?q=lispvan+summary+site%3Abc.tech.coop%2Fblog -- Bill Clementson From eli at barzilay.org Fri Jan 23 15:29:35 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:53 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> Message-ID: <18810.10415.581732.445163@arabic.ccs.neu.edu> On Jan 23, Robby Findler wrote: > On Fri, Jan 23, 2009 at 11:54 AM, "M. Fatih K?ksal" > wrote: > > Can you please point me if someone else did it before? And if not, > > what should be the beginning point? > > Probably the drscheme tools manual in Help Desk. There's an alternative that can work out better for you with getting into DrScheme in a minimal way: * Setup a subversion server through apache, with some basic username/password protection for all students. This will be the difficult part. * Subversion has a `SVNAutoversioning' that can be turned on -- it makes it possible to mount a subversion directory as a "web filesystem", where every write is automatically turned to a commit. Have the students do these mounts for a place they'll work from. * Now you only need to make DrScheme save the file every time "Run" is clicked. Subversion will take care of maintaining all revisions with timestamps. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From geoff at knauth.org Fri Jan 23 16:34:53 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:54 2009 Subject: [plt-scheme] stddef.h problem - building from SVN on Ubuntu 8.10 AMD64 In-Reply-To: <4E15A6C8-F265-4A88-9A88-276C7CEE7CE1@knauth.org> References: <5E7A703A-B8A7-47A4-B988-7CFF47CC3B0D@knauth.org> <904774730901221848p76e69d9dk49b7c9a0c2ac0a27@mail.gmail.com> <4E15A6C8-F265-4A88-9A88-276C7CEE7CE1@knauth.org> Message-ID: <2E47E89C-65E4-4A90-BCED-998AF0681C9C@knauth.org> On Jan 23, 2009, at 10:54, Geoffrey S. Knauth wrote: > On Jan 22, 2009, at 21:48, Todd O'Bryan wrote: >> Which version of Ubuntu 8.10? I've built 4.1.3 successfully on the >> 32-bit version, but haven't tried 4.1.4, yet. > $ uname -a > Linux nelson 2.6.27-9-generic #1 SMP Thu Nov 20 22:15:32 UTC 2008 > x86_64 GNU/Linux I found a message [1] hinting it is a gcc problem, that having a gcc subdirectory triggers the problem. A small experiment [2] seems to confirm this. To be continued. [1] http://gcc.gnu.org/ml/gcc-bugs/2008-11/msg00107.html [2] $ cat foo.c #include main() { printf ("It compiled.\n"); } $ gcc foo.c $ a.out It compiled. $ rm a.out $ mkdir gcc $ gcc foo.c In file included from foo.c:1: /usr/include/stdio.h:34:21: error: stddef.h: No such file or directory ... and more errors ... $ rmdir gcc $ gcc foo.c $ a.out It compiled. $ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090123/c60bfda7/attachment.html From robby at eecs.northwestern.edu Fri Jan 23 16:44:25 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:54 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: <18810.10415.581732.445163@arabic.ccs.neu.edu> References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> Message-ID: <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> On Fri, Jan 23, 2009 at 2:29 PM, Eli Barzilay wrote: > On Jan 23, Robby Findler wrote: >> On Fri, Jan 23, 2009 at 11:54 AM, "M. Fatih K?ksal" >> wrote: >> > Can you please point me if someone else did it before? And if not, >> > what should be the beginning point? >> >> Probably the drscheme tools manual in Help Desk. > > There's an alternative that can work out better for you with > getting into DrScheme in a minimal way: > > * Setup a subversion server through apache, with some basic > username/password protection for all students. This will be the > difficult part. > > * Subversion has a `SVNAutoversioning' that can be turned on -- it > makes it possible to mount a subversion directory as a "web > filesystem", where every write is automatically turned to a commit. > Have the students do these mounts for a place they'll work from. > > * Now you only need to make DrScheme save the file every time "Run" is > clicked. Subversion will take care of maintaining all revisions > with timestamps. How does this do more than DrScheme's built-in transcript operation already does? Robby From eli at barzilay.org Fri Jan 23 16:49:48 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:54 2009 Subject: [plt-scheme] stddef.h problem - building from SVN on Ubuntu 8.10 AMD64 In-Reply-To: <2E47E89C-65E4-4A90-BCED-998AF0681C9C@knauth.org> References: <5E7A703A-B8A7-47A4-B988-7CFF47CC3B0D@knauth.org> <904774730901221848p76e69d9dk49b7c9a0c2ac0a27@mail.gmail.com> <4E15A6C8-F265-4A88-9A88-276C7CEE7CE1@knauth.org> <2E47E89C-65E4-4A90-BCED-998AF0681C9C@knauth.org> Message-ID: <18810.15228.141477.663317@arabic.ccs.neu.edu> On Jan 23, Geoffrey S. Knauth wrote: > On Jan 23, 2009, at 10:54, Geoffrey S. Knauth wrote: > > On Jan 22, 2009, at 21:48, Todd O'Bryan wrote: > >> Which version of Ubuntu 8.10? I've built 4.1.3 successfully on the > >> 32-bit version, but haven't tried 4.1.4, yet. > > $ uname -a > > Linux nelson 2.6.27-9-generic #1 SMP Thu Nov 20 22:15:32 UTC 2008 > > x86_64 GNU/Linux > > I found a message [1] hinting it is a gcc problem, that having a gcc > subdirectory triggers the problem. A small experiment [2] seems to > confirm this. To be continued. > > [1] http://gcc.gnu.org/ml/gcc-bugs/2008-11/msg00107.html That's a report from Mike Vanier who is using PLT, so it might be that he ran into the problem with the PLT build too. Reading that, it looks like you can work around it by making `gcc' a script that will do cpp input-file > temp-file gcc temp-file rm temp-file But I hope that it will be resolved somehow without resorting to a non-solution like renaming `gcc' in the plt source tree... -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From eli at barzilay.org Fri Jan 23 16:50:32 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:55 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> Message-ID: <18810.15272.974904.820903@arabic.ccs.neu.edu> On Jan 23, Robby Findler wrote: > On Fri, Jan 23, 2009 at 2:29 PM, Eli Barzilay wrote: > > > > There's an alternative that can work out better for you with > > getting into DrScheme in a minimal way: > > > > * Setup a subversion server through apache, with some basic > > username/password protection for all students. This will be the > > difficult part. > > > > * Subversion has a `SVNAutoversioning' that can be turned on -- it > > makes it possible to mount a subversion directory as a "web > > filesystem", where every write is automatically turned to a commit. > > Have the students do these mounts for a place they'll work from. > > > > * Now you only need to make DrScheme save the file every time "Run" is > > clicked. Subversion will take care of maintaining all revisions > > with timestamps. > > How does this do more than DrScheme's built-in transcript operation > already does? It takes the file snapshots automatically. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From robby at eecs.northwestern.edu Fri Jan 23 17:28:31 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:55 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: <18810.15272.974904.820903@arabic.ccs.neu.edu> References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> <18810.15272.974904.820903@arabic.ccs.neu.edu> Message-ID: <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> Sorry -- there is clearly some confusion stemming from what I wrote earlier. The logging feature in DrScheme automatically records the definitions and interactions windows each time the user hits the "Run" button. Still, the way to record keystrokes (or perhaps better: editor actions), would be to use the tools interface to connect to drscheme and monitor it. Robby On Fri, Jan 23, 2009 at 3:50 PM, Eli Barzilay wrote: > On Jan 23, Robby Findler wrote: >> On Fri, Jan 23, 2009 at 2:29 PM, Eli Barzilay wrote: >> > >> > There's an alternative that can work out better for you with >> > getting into DrScheme in a minimal way: >> > >> > * Setup a subversion server through apache, with some basic >> > username/password protection for all students. This will be the >> > difficult part. >> > >> > * Subversion has a `SVNAutoversioning' that can be turned on -- it >> > makes it possible to mount a subversion directory as a "web >> > filesystem", where every write is automatically turned to a commit. >> > Have the students do these mounts for a place they'll work from. >> > >> > * Now you only need to make DrScheme save the file every time "Run" is >> > clicked. Subversion will take care of maintaining all revisions >> > with timestamps. >> >> How does this do more than DrScheme's built-in transcript operation >> already does? > > It takes the file snapshots automatically. > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > From geoff at knauth.org Fri Jan 23 17:59:32 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:55 2009 Subject: [plt-scheme] stddef.h problem - building from SVN on Ubuntu 8.10 AMD64 In-Reply-To: <18810.15228.141477.663317@arabic.ccs.neu.edu> References: <5E7A703A-B8A7-47A4-B988-7CFF47CC3B0D@knauth.org> <904774730901221848p76e69d9dk49b7c9a0c2ac0a27@mail.gmail.com> <4E15A6C8-F265-4A88-9A88-276C7CEE7CE1@knauth.org> <2E47E89C-65E4-4A90-BCED-998AF0681C9C@knauth.org> <18810.15228.141477.663317@arabic.ccs.neu.edu> Message-ID: On Jan 23, 2009, at 16:49, Eli Barzilay wrote: >> [1] http://gcc.gnu.org/ml/gcc-bugs/2008-11/msg00107.html > That's a report from Mike Vanier who is using PLT, so it might be that > he ran into the problem with the PLT build too. Yes, I just noticed that too. Small world! > Reading that, it looks like you can work around it by making `gcc' a > script that will do > cpp input-file > temp-file > gcc temp-file > rm temp-file Reading the further dialog in the bug report, I saw on 2008-11-15 Michael Vanier suggested removing . (dot) from PATH. I tried that and it worked. So, problem solved. Thanks Mike, Eli, Todd! Geoff From vinay.sachdev at gmail.com Sat Jan 24 06:38:34 2009 From: vinay.sachdev at gmail.com (Vinay Sachdev) Date: Thu Mar 26 02:38:56 2009 Subject: [plt-scheme] Issue in ver-4.0 with mutable pairs In-Reply-To: <4971FBCD.4050906@soegaard.net> References: <4971FBCD.4050906@soegaard.net> Message-ID: Hi, I am not able to create table or hash-table in r5rs. (define tbl (make-hash-table)) Its giving error "unbound identifier in module". In the help also i am unable to find it. Can you please tell me how to do this. Or there is way to access mzscheme library in r5rs. Also how to access all documentation for r5rs, since i am using this as module lang. Thanks and Regards Vinay sachdev On Sat, Jan 17, 2009 at 7:39 AM, Jens Axel Soegaard wrote: > Vinay Sachdev skrev: > >> Hi, >> I am reading SICP and i am at the start of chap-3. >> I am using PLT-Scheme ver-4.0 .I ran into problem with >> mutable pairs. it was giving error. So instead of using >> set-car! i used set-mcar!, but then even to create list >> i have to create mutable list. >> I have an older version also(ver-3.71). Is it a bad idea to >> install older version or is there any other way out? >> > > In the module language, try this: > > #lang r5rs > (let ((p (cons 1 2))) > (set-car! p 4) > (display p)) > > It prints (4 . 2). > > My main purpose is to do read SICP and do its exercise. >> One more question, is there any other issues with >> PLT-Scheme in later chapters of SICP? >> > > When you come to the picture language, use this > PLaneT package: > > > http://planet.plt-scheme.org/package-source/soegaard/sicp.plt/2/1/planet-docs/sicp-manual/index.html > > > /Jens Axel > -- Thanks and Regards Vinay Sachdev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090124/2188d4eb/attachment.htm From praimon at gmail.com Sat Jan 24 15:57:56 2009 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:38:56 2009 Subject: [plt-scheme] mreverse! Message-ID: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> hello, (require scheme/mpair) (define lst (mlist 1 2 3 4) (mreverse! lst) > {4 3 2 1} lst > {1} Unless I'm misunderstanding the point of mreverse!, that seems like the wrong answer. Shouldn't lst evaluate to {4 3 2 1}? Here's the code for the function: (define (mreverse! l) (let loop ([l l][prev null]) (cond [(null? l) prev] [else (let ([next (mcdr l)]) (set-mcdr! l prev) (loop next l))]))) The original list stops mutating after the first iteration of the loop, i.e., after (set-mcdr! l null), which explains the above result. I tried fiddling with this (I assume the solution is very simple) without success. I did write a rube goldberg-like destructive reverse, but I'm eager to see what an elegant solution looks like. regards, praimon From robby at eecs.northwestern.edu Sat Jan 24 16:00:01 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:56 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> Message-ID: <932b2f1f0901241300u6a3dca71obff83b18d3869c77@mail.gmail.com> That is a correct version of mreverse!. If all you wanted was the reversed list bound to lst, you didn't need mutable pairs at all, tho. Just do this: #lang scheme (define lst (list 1 2 3 4)) (set! lst (reverse lst)) On Sat, Jan 24, 2009 at 2:57 PM, praimon wrote: > hello, > > (require scheme/mpair) > > (define lst (mlist 1 2 3 4) > (mreverse! lst) >> {4 3 2 1} > lst >> {1} > > Unless I'm misunderstanding the point of mreverse!, that > seems like the wrong answer. Shouldn't lst evaluate to > {4 3 2 1}? > > Here's the code for the function: > > (define (mreverse! l) > (let loop ([l l][prev null]) > (cond > [(null? l) prev] > [else (let ([next (mcdr l)]) > (set-mcdr! l prev) > (loop next l))]))) > > The original list stops mutating after the first iteration > of the loop, i.e., after (set-mcdr! l null), which explains > the above result. > > I tried fiddling with this (I assume the solution is very > simple) without success. I did write a rube goldberg-like > destructive reverse, but I'm eager to see what an elegant > solution looks like. > > regards, > praimon > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From matthias at ccs.neu.edu Sat Jan 24 16:06:09 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:38:56 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> Message-ID: mreverse! reverses the list values, it does NOT change the association between any identifier and the value. Just imagine this: (define a (mlist 1 2 3 4)) (define b a) (define c b) (define d a) (define e c) > (mreverse! d) How do you think a function should find ALL possible pointers to the list and ensure that they now point to the other end? (This is an unsolvable problem by the way.) So if you really need to reverse lst you want to say > (set! lst (mreverse lst)) ;; note the missing ! in mreverse If you really really really need the efficiency of in-place reversals (unlikely until you get to the 1000s of items), you say > (set! lst (mreverse! lst)) -- Matthias On Jan 24, 2009, at 3:57 PM, praimon wrote: > hello, > > (require scheme/mpair) > > (define lst (mlist 1 2 3 4) > (mreverse! lst) >> {4 3 2 1} > lst >> {1} > > Unless I'm misunderstanding the point of mreverse!, that > seems like the wrong answer. Shouldn't lst evaluate to > {4 3 2 1}? > > Here's the code for the function: > > (define (mreverse! l) > (let loop ([l l][prev null]) > (cond > [(null? l) prev] > [else (let ([next (mcdr l)]) > (set-mcdr! l prev) > (loop next l))]))) > > The original list stops mutating after the first iteration > of the loop, i.e., after (set-mcdr! l null), which explains > the above result. > > I tried fiddling with this (I assume the solution is very > simple) without success. I did write a rube goldberg-like > destructive reverse, but I'm eager to see what an elegant > solution looks like. > > regards, > praimon > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From praimon at gmail.com Sat Jan 24 16:19:20 2009 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:38:56 2009 Subject: [plt-scheme] mreverse! In-Reply-To: References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> Message-ID: <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> Okay, so I definitely don't understand the point of mreverse! How is it different from (define mreverse! (lambda (l) (let ([rev (mreverse l)]) (set-mcdr! l null) rev))) On Sat, Jan 24, 2009 at 4:06 PM, Matthias Felleisen wrote: > > mreverse! reverses the list values, it does NOT change the association > between any identifier and the value. Just imagine this: > > (define a (mlist 1 2 3 4)) > (define b a) > (define c b) > (define d a) > (define e c) > > > (mreverse! d) I don't understand the point here either. When I apply my own destructive reverse here: d >{4 3 2 1} Why is that wrong? regards, praimon From eli at barzilay.org Sat Jan 24 16:22:46 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:56 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> Message-ID: <18811.34470.944919.605103@arabic.ccs.neu.edu> On Jan 24, praimon wrote: > Okay, so I definitely don't understand the point of mreverse! > How is it different from > (define mreverse! > (lambda (l) > (let ([rev (mreverse l)]) > (set-mcdr! l null) > rev))) You need to see the structure of all pairs in the list. Try this setup: (define d (mcons 4 '())) (define c (mcons 3 d)) (define b (mcons 2 c)) (define a (mcons 1 b)) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From dvanhorn at ccs.neu.edu Sat Jan 24 16:23:49 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:38:56 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> Message-ID: <497B86E5.2000500@ccs.neu.edu> praimon wrote: > Okay, so I definitely don't understand the point of mreverse! (mreverse ls) creates as many cons cells as are in ls. (mreverse! ls) creates no cons cells. David From robby at eecs.northwestern.edu Sat Jan 24 16:25:35 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:38:57 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <497B86E5.2000500@ccs.neu.edu> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> <497B86E5.2000500@ccs.neu.edu> Message-ID: <932b2f1f0901241325u78456712w9b7b2492feccfc7c@mail.gmail.com> You might also want to read HtDP's explanation of mutation. (http://www.htdp.org/). Robby On Sat, Jan 24, 2009 at 3:23 PM, David Van Horn wrote: > praimon wrote: >> >> Okay, so I definitely don't understand the point of mreverse! > > (mreverse ls) creates as many cons cells as are in ls. > (mreverse! ls) creates no cons cells. > > David > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > > From praimon at gmail.com Sat Jan 24 16:28:59 2009 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:38:57 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <497B86E5.2000500@ccs.neu.edu> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> <497B86E5.2000500@ccs.neu.edu> Message-ID: <4acd8930901241328x10b5126ga013393d249a2a6e@mail.gmail.com> Thank you, Eli and David, for those pointers. But if one DID write a destructive reverse in MY strange sense of it, what would it look like? Like I said, my version is nutty looking, and I'd like to see a good, simple coding. regards, praimon On Sat, Jan 24, 2009 at 4:23 PM, David Van Horn wrote: > praimon wrote: >> >> Okay, so I definitely don't understand the point of mreverse! > > (mreverse ls) creates as many cons cells as are in ls. > (mreverse! ls) creates no cons cells. > > David > From eli at barzilay.org Sat Jan 24 16:33:29 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:38:57 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <4acd8930901241328x10b5126ga013393d249a2a6e@mail.gmail.com> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> <497B86E5.2000500@ccs.neu.edu> <4acd8930901241328x10b5126ga013393d249a2a6e@mail.gmail.com> Message-ID: <18811.35113.956227.91925@arabic.ccs.neu.edu> On Jan 24, praimon wrote: > Thank you, Eli and David, for those pointers. > But if one DID write a destructive reverse in MY strange sense of > it, what would it look like? Like I said, my version is nutty > looking, and I'd like to see a good, simple coding. IIRC, your version was something along this line: (define blist (box (list 1 2 3 4))) (define (breverse! blist) (set-box! blist (reverse (unbox blist)))) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From praimon at gmail.com Sat Jan 24 16:40:30 2009 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:38:57 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <18811.35113.956227.91925@arabic.ccs.neu.edu> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> <497B86E5.2000500@ccs.neu.edu> <4acd8930901241328x10b5126ga013393d249a2a6e@mail.gmail.com> <18811.35113.956227.91925@arabic.ccs.neu.edu> Message-ID: <4acd8930901241340x5d32d5c1x9860fb247095660b@mail.gmail.com> Wow, that sure is simple. I know nothing of boxes. regards, praimon On Sat, Jan 24, 2009 at 4:33 PM, Eli Barzilay wrote: > On Jan 24, praimon wrote: >> Thank you, Eli and David, for those pointers. >> But if one DID write a destructive reverse in MY strange sense of >> it, what would it look like? Like I said, my version is nutty >> looking, and I'd like to see a good, simple coding. > > IIRC, your version was something along this line: > > (define blist (box (list 1 2 3 4))) > (define (breverse! blist) (set-box! blist (reverse (unbox blist)))) > > -- > ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: > http://www.barzilay.org/ Maze is Life! > From dvanhorn at ccs.neu.edu Sat Jan 24 16:43:43 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:38:57 2009 Subject: [plt-scheme] mreverse! In-Reply-To: <4acd8930901241340x5d32d5c1x9860fb247095660b@mail.gmail.com> References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> <4acd8930901241319u469166aeiec5c3514eca33de7@mail.gmail.com> <497B86E5.2000500@ccs.neu.edu> <4acd8930901241328x10b5126ga013393d249a2a6e@mail.gmail.com> <18811.35113.956227.91925@arabic.ccs.neu.edu> <4acd8930901241340x5d32d5c1x9860fb247095660b@mail.gmail.com> Message-ID: <497B8B8F.7020908@ccs.neu.edu> praimon wrote: > Wow, that sure is simple. I know nothing of boxes. A box is just a mutable cons cell with one part instead of two. David From praimon at gmail.com Sat Jan 24 18:55:52 2009 From: praimon at gmail.com (praimon) Date: Thu Mar 26 02:38:57 2009 Subject: [plt-scheme] mreverse! In-Reply-To: References: <4acd8930901241257yc9414d1lf603cb202f217b42@mail.gmail.com> Message-ID: <4acd8930901241555o6bb74764x8fa605ef110d56fd@mail.gmail.com> On Sat, Jan 24, 2009 at 4:06 PM, Matthias Felleisen wrote: > > mreverse! reverses the list values, it does NOT change the association > between any identifier and the value. Just imagine this: > > (define a (mlist 1 2 3 4)) > (define b a) > (define c b) > (define d a) > (define e c) > > > (mreverse! d) > > How do you think a function should find ALL possible pointers to the list > and ensure that they now point to the other end? (This is an unsolvable > problem by the way.) Prof Felleisen, let me try again to understand. > (my-mreverse! d) {4 3 2 1} > d {4 3 2 1} > a {4 3 2 1} > b {4 3 2 1} > c {4 3 2 1} > e {4 3 2 1} I'm confused as to whether the above results are correct, incorrect, or just lucky. (I'm guessing lucky) regards, praimon From jpc-ml at zenburn.net Sat Jan 24 20:25:31 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:38:58 2009 Subject: [plt-scheme] A GUI/font puzzle Message-ID: <497BBF8B.3060503@zenburn.net> In the good tradition of posting puzzles I have something funny to present. Does not have much to do with denotational semantics but took from me a little more the ten hours nevertheless. ;-) Try the following program on Windows (but also read the notes below the code): #lang scheme/gui (define my-canvas% (class canvas% (super-new [min-width 100] [min-height 100]) (inherit get-dc) (define/override (on-paint) (let* ([txt "Starting"] [backbuf (make-object bitmap% 100 100)] [back-dc (new bitmap-dc% [bitmap backbuf])] [value-font (make-object font% 18 "Verdana" 'default 'normal 'bold #f 'smoothed)]) (send back-dc set-background (make-object color% 255 255 255)) ; may be left out (send back-dc clear) ; may be left out (send back-dc set-smoothing 'smoothed) ; critical (send back-dc draw-rectangle 0 0 2 2) ; critical (send back-dc set-smoothing 'unsmoothed) ; may be left out (send back-dc set-font value-font) ; critical (send back-dc get-text-extent txt) ; critical (send back-dc draw-text txt 0 0) (send (get-dc) draw-bitmap backbuf 0 0))))) (define frame (new frame% [label "Font test"])) (define canvas (new my-canvas% [parent frame])) (send frame show #t) Some notes: - the problem is with font kerning on Windows only (does not seem to depend on the font) - it manifests itself at least in 4.1.2 and 4.1.4 (but probably in other versions too) on several different WinXP machines (1 VirtualBox and 2 physical) - if you remove any of the lines labeled "critical" the problem disappears - once you run it in a DrScheme session it will make the font look bad (or good) for all future runs (even if you change the code) [this means the error (or the lack of it) persists between custodian shutdowns] - the most impotant operation seems to be the call to get-text-extent before the call to draw-text (adding another draw-text before get-text-extent fixes the bug) - this is probably the best testcase I have ever done (I found this bug in a 2KLoS multithreaded program ;) -- regards, Jakub Piotr C?apa From ryanc at ccs.neu.edu Sat Jan 24 21:58:50 2009 From: ryanc at ccs.neu.edu (Ryan Culpepper) Date: Thu Mar 26 02:38:58 2009 Subject: [plt-scheme] Issue in ver-4.0 with mutable pairs In-Reply-To: References: <4971FBCD.4050906@soegaard.net> Message-ID: <497BD56A.5060801@ccs.neu.edu> Vinay Sachdev wrote: > Hi, > I am not able to create table or hash-table in r5rs. > > (define tbl (make-hash-table)) > Its giving error "unbound identifier in module". > In the help also i am unable to find it. > Can you please tell me how to do this. Or there is > way to access mzscheme library in r5rs. > Also how to access all documentation for r5rs, since > i am using this as module lang. You can access mzscheme and other PLT languages and libraries from r5rs modules by using '#%require'. For example, #lang r5rs (#%require (only mzscheme make-hash-table hash-table-put! hash-table-get)) (define tbl (make-hash-table)) ... Search the PLT help for "r5rs" and you should find several relevant sections. One of the pages, in the Guide, also has a link to R5RS (the report) itself. Ryan > > Thanks and Regards > Vinay sachdev > > On Sat, Jan 17, 2009 at 7:39 AM, Jens Axel Soegaard > wrote: > >> Vinay Sachdev skrev: >> >>> Hi, >>> I am reading SICP and i am at the start of chap-3. >>> I am using PLT-Scheme ver-4.0 .I ran into problem with >>> mutable pairs. it was giving error. So instead of using >>> set-car! i used set-mcar!, but then even to create list >>> i have to create mutable list. >>> I have an older version also(ver-3.71). Is it a bad idea to >>> install older version or is there any other way out? >>> >> In the module language, try this: >> >> #lang r5rs >> (let ((p (cons 1 2))) >> (set-car! p 4) >> (display p)) >> >> It prints (4 . 2). >> >> My main purpose is to do read SICP and do its exercise. >>> One more question, is there any other issues with >>> PLT-Scheme in later chapters of SICP? >>> >> When you come to the picture language, use this >> PLaneT package: >> >> >> http://planet.plt-scheme.org/package-source/soegaard/sicp.plt/2/1/planet-docs/sicp-manual/index.html >> >> >> /Jens Axel >> > > > > > ------------------------------------------------------------------------ > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From geoff at knauth.org Sun Jan 25 02:15:54 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:58 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> <18810.15272.974904.820903@arabic.ccs.neu.edu> <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> Message-ID: On Jan 23, 2009, at 17:28, Robby Findler wrote: > The logging feature in DrScheme automatically records the > definitions and interactions windows each time the user hits the > "Run" button. > > Still, the way to record keystrokes (or perhaps better: editor > actions), would be to use the tools interface to connect to drscheme > and monitor it. John McCarthy has an idea called Elephant [1], for programs "that can refer directly to the past." ("An Elephant never forgets.") If one wants to track whether the Design Recipe is being followed, there could be a new tool or mode in DrScheme that would add in templates for things one is supposed to fill in. DrScheme would then know and could remember the order in which Design Recipe elements were followed. DivaScheme [2] already does this a little: start typing an S- expression, and DivaScheme lays out a mini-template to fill in. On the plus side, having Design Recipe templates helpfully inserted in response to user commands or DrScheme HAL-like insight [3] might encourage people to follow the Design Recipe more often. On the down side, if someone didn't want to use inserted templates every time, the measurement of "effectiveness of proper usage" of the Design Recipe would still have to be done by looking at code changes without semantic markers. Also, we don't want HAL to control us. A human expert watching a person use the Design Recipe can tell immediately when someone skipped a step either deliberately (for a good or not-so-good reason) or out of ignorance. The human expert knows what the next step is supposed to look like. Maybe pattern matching could be used to recognize recipe elements that are in various stages of completion. There could be a library of patterns for common errors in the application of the recipe. Geoffrey [1] http://www-formal.stanford.edu/jmc/elephant.html [2] http://www.cs.brown.edu/research/plt/software/divascheme/ [3] http://en.wikipedia.org/wiki/HAL_9000#The_future_of_computing From geoff at knauth.org Sun Jan 25 02:24:50 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:58 2009 Subject: [plt-scheme] Make Module In-Reply-To: <11b141710901220345pa602faay71df97bfb3deab36@mail.gmail.com> References: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> <595b9ab20901211203l3a013756qc63a42a5da696feb@mail.gmail.com> <11b141710901220345pa602faay71df97bfb3deab36@mail.gmail.com> Message-ID: On Jan 22, 2009, at 06:45, Paulo J. Matos wrote: > I want to build a scheme script based on the make module to build > general latex projects. Just curious... Is there a capability PLaneT's `make' has that is more useful than vanilla `make'? The one I can think of is being able to control everything from within PLT Scheme. From yinso.chen at gmail.com Sun Jan 25 02:58:40 2009 From: yinso.chen at gmail.com (YC) Date: Thu Mar 26 02:38:59 2009 Subject: [plt-scheme] dtrace like logging? Message-ID: <779bf2730901242358t42d7fa64rab6812f168472ec5@mail.gmail.com> Hi all - are there dtrace like instrumentation mechanisms (or plans for)? i.e. adding/removing trace/logs dynamically against a code base? Thanks, yc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090124/0933dd7b/attachment.html From noelwelsh at gmail.com Sun Jan 25 03:55:06 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:38:59 2009 Subject: [plt-scheme] dtrace like logging? In-Reply-To: <779bf2730901242358t42d7fa64rab6812f168472ec5@mail.gmail.com> References: <779bf2730901242358t42d7fa64rab6812f168472ec5@mail.gmail.com> Message-ID: There is the existing logging facility, but it isn't dynamic like dtrace. N. On Sun, Jan 25, 2009 at 7:58 AM, YC wrote: > Hi all - > > are there dtrace like instrumentation mechanisms (or plans for)? i.e. > adding/removing trace/logs dynamically against a code base? > > Thanks, > yc From noelwelsh at gmail.com Sun Jan 25 03:57:05 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:38:59 2009 Subject: [plt-scheme] Make Module In-Reply-To: References: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> <595b9ab20901211203l3a013756qc63a42a5da696feb@mail.gmail.com> <11b141710901220345pa602faay71df97bfb3deab36@mail.gmail.com> Message-ID: On Sun, Jan 25, 2009 at 7:24 AM, Geoffrey S. Knauth wrote: > Just curious... Is there a capability PLaneT's `make' has that is more > useful than vanilla `make'? The one I can think of is being able to control > everything from within PLT Scheme. Do you mean sake (on planet) or the PLT make macro? The former is more like Ant in Scheme (dependencies but not file based) the later more like traditional make. N. From mflatt at cs.utah.edu Sun Jan 25 06:02:32 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:38:59 2009 Subject: [plt-scheme] A GUI/font puzzle In-Reply-To: <497BBF8B.3060503@zenburn.net> References: <497BBF8B.3060503@zenburn.net> Message-ID: <20090125110235.53B2165008D@mail-svr1.cs.utah.edu> Thanks for tracking this down! It's now fixed in SVN. The bug was in installing a font (either explicitly or implicitly by `get-text-extent') when the most recent drawing was in smoothed mode. The mangled text-size information survived across runs within DrScheme, because `get-text-extent' installs its results in an internal cache that is used by future calls to `draw-text' and `get-text-extent'. At Sun, 25 Jan 2009 02:25:31 +0100, Jakub Piotr C?apa wrote: > In the good tradition of posting puzzles I have something funny to > present. Does not have much to do with denotational semantics but took > from me a little more the ten hours nevertheless. ;-) > > Try the following program on Windows (but also read the notes below the > code): > #lang scheme/gui > (define my-canvas% > (class canvas% > (super-new [min-width 100] > [min-height 100]) > > (inherit get-dc) > > (define/override (on-paint) > (let* ([txt "Starting"] > [backbuf (make-object bitmap% 100 100)] > [back-dc (new bitmap-dc% [bitmap backbuf])] > [value-font (make-object font% 18 "Verdana" 'default > 'normal 'bold #f 'smoothed)]) > (send back-dc set-background (make-object color% 255 255 255)) > ; may be left out > (send back-dc clear) ; may be left out > (send back-dc set-smoothing 'smoothed) ; critical > (send back-dc draw-rectangle 0 0 2 2) ; critical > (send back-dc set-smoothing 'unsmoothed) ; may be left out > (send back-dc set-font value-font) ; critical > (send back-dc get-text-extent txt) ; critical > (send back-dc draw-text txt 0 0) > > (send (get-dc) draw-bitmap backbuf 0 0))))) > > (define frame (new frame% [label "Font test"])) > (define canvas (new my-canvas% [parent frame])) > (send frame show #t) > > > > Some notes: > > - the problem is with font kerning on Windows only (does not seem to > depend on the font) > - it manifests itself at least in 4.1.2 and 4.1.4 (but probably in other > versions too) on several different WinXP machines (1 VirtualBox and 2 > physical) > - if you remove any of the lines labeled "critical" the problem > disappears > - once you run it in a DrScheme session it will make the font look bad > (or good) for all future runs (even if you change the code) > [this means the error (or the lack of it) persists between custodian > shutdowns] > - the most impotant operation seems to be the call to get-text-extent > before the call to draw-text (adding another draw-text before > get-text-extent fixes the bug) > - this is probably the best testcase I have ever done (I found this bug > in a 2KLoS multithreaded program ;) > > -- > regards, > Jakub Piotr C?apa > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From geoff at knauth.org Sun Jan 25 09:10:34 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:38:59 2009 Subject: [plt-scheme] Make Module In-Reply-To: References: <11b141710901211058y65b8dbbbi1f1e482773b8c0f5@mail.gmail.com> <595b9ab20901211203l3a013756qc63a42a5da696feb@mail.gmail.com> <11b141710901220345pa602faay71df97bfb3deab36@mail.gmail.com> Message-ID: <6C5E47B3-262D-4AC7-AADE-225B92FE6721@knauth.org> On Jan 25, 2009, at 03:57, Noel Welsh wrote: > Do you mean sake (on planet) or the PLT make macro? The former is more > like Ant in Scheme (dependencies but not file based) the later more > like traditional make. I think that answers my question. Thanks. I was mainly wondering whether existing tools were insufficient and PLT sake/make went beyond the capabilities of existing tools. From jpc-ml at zenburn.net Sun Jan 25 09:39:08 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:39:00 2009 Subject: [plt-scheme] A GUI/font puzzle In-Reply-To: <20090125110235.53B2165008D@mail-svr1.cs.utah.edu> References: <497BBF8B.3060503@zenburn.net> <20090125110235.53B2165008D@mail-svr1.cs.utah.edu> Message-ID: <497C798C.3050909@zenburn.net> On 1/25/09 12:02 PM, Matthew Flatt wrote: > Thanks for tracking this down! It's now fixed in SVN. Wow. Thanks for a fast fix. AFAICT it hasn't yet reached the nightly builds so I guess I'll have to try tomorrow [1]. [1]: I haven't yet tried to build PLT Scheme myself but it seems there is no way to cross-compile from Linux (using crossmingw32), am I right? PS. Another interesting question is whether it is possible (given the all the needed files from both installations) to cross compile the distribution packages (like in Scheme->Create executable...) If not: is it a good idea for me to dig into the compiler module to try to do it myself or would it be too big a change? -- regards, Jakub Piotr C?apa From grettke at acm.org Sun Jan 25 12:16:45 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:39:00 2009 Subject: [plt-scheme] How to replace a Unicode string in the definitions with the result of evaluating it? Message-ID: <756daca50901250916i51821184j42613879afb02ce3@mail.gmail.com> Hi folks, In DrScheme I would to be able to type: "\u266C" in the definitions window, and with the cursor here: "\u266C"| execute some code that would replace the entire string with the result of evaluating it in the repl (but without the double quotes): =A2=DD I am not sure of the best way to go about evaluating the string. I am going to start by investigating namespaces. What is the best way to do this? I figured that I can find the editor manipulation in the DrScheme source to do the replacement itself. From keydana at gmx.de Sun Jan 25 11:28:20 2009 From: keydana at gmx.de (Sigrid Keydana) Date: Thu Mar 26 02:39:00 2009 Subject: [plt-scheme] use web service from scheme? Message-ID: <497C9324.80801@gmx.de> Hi, I'd like to ask if there is a tutorial or example of how to use a web service from scheme? (Already saw flickr.plt on Planet, but a tutorial would be even more helpful of course :-) ) Thanks a lot for any hints, Sigrid From robby at eecs.northwestern.edu Sun Jan 25 12:50:42 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:39:00 2009 Subject: [plt-scheme] How to replace a Unicode string in the definitions with the result of evaluating it? In-Reply-To: <756daca50901250916i51821184j42613879afb02ce3@mail.gmail.com> References: <756daca50901250916i51821184j42613879afb02ce3@mail.gmail.com> Message-ID: <932b2f1f0901250950x36dbc996s10552b75479dff29@mail.gmail.com> The two notations for the strings produce identical strings (just ones that are written differently), so you don't need to evaluate anything, just use read & write (or if you don't want the quotes, read and display). Robby 2009/1/25 Grant Rettke : > Hi folks, > > In DrScheme I would to be able to type: > > "\u266C" > > in the definitions window, and with the cursor here: > > "\u266C"| > > execute some code that would replace the entire string with the result > of evaluating it in the repl (but without the double quotes): > > ? > > I am not sure of the best way to go about evaluating the string. I am > going to start by investigating namespaces. What is the best way to do > this? > > I figured that I can find the editor manipulation in the DrScheme > source to do the replacement itself. > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme > From grettke at acm.org Sun Jan 25 12:55:06 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:39:01 2009 Subject: [plt-scheme] How to replace a Unicode string in the definitions with the result of evaluating it? In-Reply-To: <932b2f1f0901250950x36dbc996s10552b75479dff29@mail.gmail.com> References: <756daca50901250916i51821184j42613879afb02ce3@mail.gmail.com> <932b2f1f0901250950x36dbc996s10552b75479dff29@mail.gmail.com> Message-ID: <756daca50901250955u7c9c1141jc28c9d53fc8c13cd@mail.gmail.com> > The two notations for the strings produce identical strings (just ones > that are written differently), so you don't need to evaluate anything, > just use read & write (or if you don't want the quotes, read and > display). I see. The use case I am trying to satisfy is the one where I write something like: (define (play-"\u266C" notes) ; work goes here #t) I am trying to find how easy it is use use Unicode symbols directly in the code. From robby at eecs.northwestern.edu Sun Jan 25 12:58:29 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:39:01 2009 Subject: [plt-scheme] How to replace a Unicode string in the definitions with the result of evaluating it? In-Reply-To: <756daca50901250955u7c9c1141jc28c9d53fc8c13cd@mail.gmail.com> References: <756daca50901250916i51821184j42613879afb02ce3@mail.gmail.com> <932b2f1f0901250950x36dbc996s10552b75479dff29@mail.gmail.com> <756daca50901250955u7c9c1141jc28c9d53fc8c13cd@mail.gmail.com> Message-ID: <932b2f1f0901250958w52562794iafff960251c852b3@mail.gmail.com> On Sun, Jan 25, 2009 at 11:55 AM, Grant Rettke wrote: > The use case I am trying to satisfy is the one where I write something like: > > (define (play-"\u266C" notes) > ; work goes here > #t) > > I am trying to find how easy it is use use Unicode symbols directly in the code. Probably the easiest thing is to just copy and paste out of the REPL. You might also add a keybinding that inserts the character, if there are just a few. Also, see the TeX codes that are in there (and let me know if you want to add more). Finally, there is typically some platform-specific way to enter unicode that is handled at the OS level that lets you type those things in. On the mac, for example, I can switch my keyboard mode and type ???. Robby From dvanhorn at ccs.neu.edu Sun Jan 25 12:57:59 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:39:01 2009 Subject: [plt-scheme] URLs with passwords Message-ID: <497CA827.40603@ccs.neu.edu> The delicious API (http://delicious.com/help/api) requires URLs like the following: https://user:password@api.del.icio.us/v1/posts/get?tag=foo But I can't seem to construct such a URL with the net/url library. The colon between user and password always gets encoded. So for example, (url->string (string->url "https://user:password@api.del.icio.us/v1/posts/get?tag=foo")) ==> "https://user%3Apassword@api.del.icio.us/v1/posts/get?tag=foo" Is this a bug, or is there some other way to construct the appropriate URL? (This is in 4.1.3.3-svn3dec2008). David From matthias at ccs.neu.edu Sun Jan 25 12:57:59 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:39:01 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> <18810.15272.974904.820903@arabic.ccs.neu.edu> <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> Message-ID: On Jan 25, 2009, at 2:15 AM, Geoffrey S. Knauth wrote: > On Jan 23, 2009, at 17:28, Robby Findler wrote: >> The logging feature in DrScheme automatically records the >> definitions and interactions windows each time the user hits the >> "Run" button. >> >> Still, the way to record keystrokes (or perhaps better: editor >> actions), would be to use the tools interface to connect to >> drscheme and monitor it. > > John McCarthy has an idea called Elephant [1], for programs "that > can refer directly to the past." ("An Elephant never forgets.") > > If one wants to track whether the Design Recipe is being followed, > there could be a new tool or mode in DrScheme that would add in > templates for things one is supposed to fill in. DrScheme would > then know and could remember the order in which Design Recipe > elements were followed. > > DivaScheme [2] already does this a little: start typing an S- > expression, and DivaScheme lays out a mini-template to fill in. They aren't templates in the sense of HtDP. > On the plus side, having Design Recipe templates helpfully inserted > in response to user commands or DrScheme HAL-like insight [3] might > encourage people to follow the Design Recipe more often. On the > down side, if someone didn't want to use inserted templates every > time, the measurement of "effectiveness of proper usage" of the > Design Recipe would still have to be done by looking at code > changes without semantic markers. Also, we don't want HAL to > control us. It doesn't take any of that smarts. If we used a typed approach, the template would simply follow from the datatype def in most cases. BUT, how woudl students learn to think through such problems for a language that has neither algebraic types nor dispatch? It's not about showing off Scheme features and it's not about automating stuff. It's about making sure students truly understand why they'e doing things so that they can reason in an analogical manner in different situations. -- Matthias > > A human expert watching a person use the Design Recipe can tell > immediately when someone skipped a step either deliberately (for a > good or not-so-good reason) or out of ignorance. The human expert > knows what the next step is supposed to look like. Maybe pattern > matching could be used to recognize recipe elements that are in > various stages of completion. There could be a library of patterns > for common errors in the application of the recipe. > > Geoffrey > > [1] http://www-formal.stanford.edu/jmc/elephant.html > [2] http://www.cs.brown.edu/research/plt/software/divascheme/ > [3] http://en.wikipedia.org/wiki/HAL_9000#The_future_of_computing > > _________________________________________________ > For list-related administrative tasks: > http://list.cs.brown.edu/mailman/listinfo/plt-scheme From pivanyi at freemail.hu Sun Jan 25 12:30:56 2009 From: pivanyi at freemail.hu (Ivanyi Peter) Date: Thu Mar 26 02:39:01 2009 Subject: [plt-scheme] Similarity checking Message-ID: Hi all, Maybe someone has developed a code or concept that I could use. I teach quite a few students. They have to write tests and hand in homeworks. It seems to me that nowadays it is a tendency, that they track down who has the same problem and they share the results, the programs. (Recently I have seen quite a few high tech to do this.) They are smart to change for example the variable names and some bits, but of course not the whole program. So I would like some help from a program and check automatically the handed in programs for plagiarism or similarity. Is there any code which can compare Scheme programs? Or maybe compares programs with a subset of Scheme? Has anybody heard or thought about it? I am thinking along the line to parse in the program to have some binary tree, but I am not sure how to do "fuzzy"-style comparison on them. I would appreciate any suggestion. Peter Ivanyi From clements at brinckerhoff.org Sun Jan 25 13:02:02 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:39:02 2009 Subject: [plt-scheme] Similarity checking In-Reply-To: References: Message-ID: <11A3C020-AC9F-4518-B7FF-417D16F422E1@brinckerhoff.org> On Jan 25, 2009, at 9:30 AM, Ivanyi Peter wrote: > Hi all, > > Maybe someone has developed a code or concept that I could use. > I teach quite a few students. > They have to write tests and hand in homeworks. It seems to me > that nowadays it is a tendency, that they track down who has the > same problem and they share the results, the programs. > (Recently I have seen quite a few high tech to do this.) > They are smart to change for example the variable names and > some bits, but of course not the whole program. So I would like > some help from a program and check automatically the handed in > programs for plagiarism or similarity. > Is there any code which can compare Scheme programs? Or maybe > compares programs with a subset of Scheme? > Has anybody heard or thought about it? > > I am thinking along the line to parse in the program to have some > binary tree, but I am not sure how to do "fuzzy"-style comparison > on them. > > I would appreciate any suggestion. Check out Alex Aiken's "MOSS" (measure of software similarity) system. I've used it successfully for several years. It does pretty much exactly what you describe. John -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2484 bytes Desc: not available Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090125/fb06274c/smime.bin From clements at brinckerhoff.org Sun Jan 25 13:07:48 2009 From: clements at brinckerhoff.org (John Clements) Date: Thu Mar 26 02:39:02 2009 Subject: [plt-scheme] Similarity checking In-Reply-To: <11A3C020-AC9F-4518-B7FF-417D16F422E1@brinckerhoff.org> References: <11A3C020-AC9F-4518-B7FF-417D16F422E1@brinckerhoff.org> Message-ID: On Jan 25, 2009, at 10:02 AM, John Clements wrote: > > On Jan 25, 2009, at 9:30 AM, Ivanyi Peter wrote: > >> Hi all, >> >> Maybe someone has developed a code or concept that I could use. >> I teach quite a few students. >> They have to write tests and hand in homeworks. It seems to me >> that nowadays it is a tendency, that they track down who has the >> same problem and they share the results, the programs. >> (Recently I have seen quite a few high tech to do this.) >> They are smart to change for example the variable names and >> some bits, but of course not the whole program. So I would like >> some help from a program and check automatically the handed in >> programs for plagiarism or similarity. >> Is there any code which can compare Scheme programs? Or maybe >> compares programs with a subset of Scheme? >> Has anybody heard or thought about it? >> >> I am thinking along the line to parse in the program to have some >> binary tree, but I am not sure how to do "fuzzy"-style comparison >> on them. >> >> I would appreciate any suggestion. > > Check out Alex Aiken's "MOSS" (measure of software similarity) > system. I've used it successfully for several years. It does pretty > much exactly what you describe. In the interest of full disclosure, I should also point out that after working successfully for several years, I observed about four months ago that it was not working correctly on Scheme code. I'm optimistic that it's now been fixed :). 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/20090125/80b4b710/smime.bin From robby at eecs.northwestern.edu Sun Jan 25 13:11:16 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:39:03 2009 Subject: [plt-scheme] URLs with passwords In-Reply-To: <497CA827.40603@ccs.neu.edu> References: <497CA827.40603@ccs.neu.edu> Message-ID: <932b2f1f0901251011m3c2f7c55jd64fa349e254c36e@mail.gmail.com> On Sun, Jan 25, 2009 at 11:57 AM, David Van Horn wrote: > The delicious API (http://delicious.com/help/api) requires URLs like the > following: > > https://user:password@api.del.icio.us/v1/posts/get?tag=foo > > But I can't seem to construct such a URL with the net/url library. The > colon between user and password always gets encoded. So for example, > > (url->string > (string->url > "https://user:password@api.del.icio.us/v1/posts/get?tag=foo")) > > ==> > > "https://user%3Apassword@api.del.icio.us/v1/posts/get?tag=foo" > > Is this a bug, or is there some other way to construct the appropriate URL? > (This is in 4.1.3.3-svn3dec2008). > By my read, this is legal, according to section 2.4.2 of RFC 2396: http://www.ietf.org/rfc/rfc2396.txt It would also be legal to leave it unescaped, but the way the RFC is written, the colon is not reserved there, but just a general character as part of the userinfo field (and the colon can change the meaning elsewhere, of course). So, I think it would be safe to put actual colons into the userinfo field without escaping them, but I'll have to make the actual change later on (feel free to submit a patch, if you have time to add test cases, etc). Robby From marek at xivilization.net Sun Jan 25 13:34:04 2009 From: marek at xivilization.net (Marek Kubica) Date: Thu Mar 26 02:39:03 2009 Subject: [plt-scheme] use web service from scheme? In-Reply-To: <497C9324.80801@gmx.de> References: <497C9324.80801@gmx.de> Message-ID: <20090125193404.3a089602@halmanfloyd.lan.local> Hi, On Sun, 25 Jan 2009 17:28:20 +0100 Sigrid Keydana wrote: > I'd like to ask if there is a tutorial or example of how to use a web > service from scheme? One question would be: What kind of web service? A Java-like web service that uses SOAP? XML-RPC which is more typical for Python? JSON combined with something RESTful like some Web2.0 sites provide? JSON-RPC? regards, Marek From noelwelsh at gmail.com Sun Jan 25 14:41:32 2009 From: noelwelsh at gmail.com (Noel Welsh) Date: Thu Mar 26 02:39:03 2009 Subject: [plt-scheme] URLs with passwords In-Reply-To: <497CA827.40603@ccs.neu.edu> References: <497CA827.40603@ccs.neu.edu> Message-ID: On Sun, Jan 25, 2009 at 5:57 PM, David Van Horn wrote: > The delicious API (http://delicious.com/help/api) requires URLs like the > following: Just checking: you know about the delicious package on planet? N. From geoff at knauth.org Sun Jan 25 14:49:39 2009 From: geoff at knauth.org (Geoffrey S. Knauth) Date: Thu Mar 26 02:39:03 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> <18810.15272.974904.820903@arabic.ccs.neu.edu> <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> Message-ID: On Jan 25, 2009, at 12:57, Matthias Felleisen wrote: > how would students learn to think through such problems for a > language that has neither algebraic types nor dispatch? It's not > about showing off Scheme features and it's not about automating stuff. I see your points. Back to what M. Fatih K?ksa seeks, "to measure the effectiveness of proper usage of Design Recipe." I now realize I misread his question. I imagined he was trying to measure the extent to which people were following the recipe properly. Now I read it differently, that if the Design Recipe is properly used, what is its effectiveness? That makes me wonder, against which other approaches? From dvanhorn at ccs.neu.edu Sun Jan 25 14:49:43 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:39:03 2009 Subject: [plt-scheme] URLs with passwords In-Reply-To: References: <497CA827.40603@ccs.neu.edu> Message-ID: <497CC257.70007@ccs.neu.edu> Noel Welsh wrote: > On Sun, Jan 25, 2009 at 5:57 PM, David Van Horn wrote: >> The delicious API (http://delicious.com/help/api) requires URLs like the >> following: > > Just checking: you know about the delicious package on planet? Yes, but there are open tickets saying it doesn't work in v4, and I get an error at install time about not finding srfi/42/comprehensions.ss. (Looks like it is .scm in the SVN repository). David From sk at cs.brown.edu Sun Jan 25 15:11:27 2009 From: sk at cs.brown.edu (Shriram Krishnamurthi) Date: Thu Mar 26 02:39:03 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> <18810.15272.974904.820903@arabic.ccs.neu.edu> <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> Message-ID: > Back to what M. Fatih K?ksa seeks, "to measure the > effectiveness of proper usage of Design Recipe." I now realize I misread > his question. I imagined he was trying to measure the extent to which > people were following the recipe properly. Now I read it differently, that > if the Design Recipe is properly used, what is its effectiveness? I am going to hazard a guess that Fatih meant was actually the former: for instance, check whether people are typing the recipe steps first and working methodically, or only entering it at the last minute before turning in the solution. (It would be interesting to hear whether those who do the former do in fact do better than those who do the latter!) Shriram From robby at eecs.northwestern.edu Sun Jan 25 15:12:11 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:39:03 2009 Subject: [plt-scheme] URLs with passwords In-Reply-To: <932b2f1f0901251011m3c2f7c55jd64fa349e254c36e@mail.gmail.com> References: <497CA827.40603@ccs.neu.edu> <932b2f1f0901251011m3c2f7c55jd64fa349e254c36e@mail.gmail.com> Message-ID: <932b2f1f0901251212va5bf041j1bb259698077b92a@mail.gmail.com> On Sun, Jan 25, 2009 at 12:11 PM, Robby Findler wrote: > On Sun, Jan 25, 2009 at 11:57 AM, David Van Horn wrote: >> The delicious API (http://delicious.com/help/api) requires URLs like the >> following: >> >> https://user:password@api.del.icio.us/v1/posts/get?tag=foo >> >> But I can't seem to construct such a URL with the net/url library. The >> colon between user and password always gets encoded. So for example, >> >> (url->string >> (string->url >> "https://user:password@api.del.icio.us/v1/posts/get?tag=foo")) >> >> ==> >> >> "https://user%3Apassword@api.del.icio.us/v1/posts/get?tag=foo" >> >> Is this a bug, or is there some other way to construct the appropriate URL? >> (This is in 4.1.3.3-svn3dec2008). >> > > By my read, this is legal, according to section 2.4.2 of RFC 2396: > [ ... ] Looks like I had the wrong RFC. I should have been reading 3986. I'm not clear if it says the net library is wrong or not in the case, but I went ahead and checked in a change so you now see colons instead of %3a in the userinfo field. Robby From dvanhorn at ccs.neu.edu Sun Jan 25 15:15:26 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:39:04 2009 Subject: [plt-scheme] URLs with passwords In-Reply-To: <932b2f1f0901251212va5bf041j1bb259698077b92a@mail.gmail.com> References: <497CA827.40603@ccs.neu.edu> <932b2f1f0901251011m3c2f7c55jd64fa349e254c36e@mail.gmail.com> <932b2f1f0901251212va5bf041j1bb259698077b92a@mail.gmail.com> Message-ID: <497CC85E.3040600@ccs.neu.edu> Robby Findler wrote: > Looks like I had the wrong RFC. I should have been reading 3986. I'm > not clear if it says the net library is wrong or not in the case, but > I went ahead and checked in a change so you now see colons instead of > %3a in the userinfo field. Great, thanks. As a single data point to support this change: curl doesn't escape the colon. David From dvanhorn at ccs.neu.edu Sun Jan 25 15:52:56 2009 From: dvanhorn at ccs.neu.edu (David Van Horn) Date: Thu Mar 26 02:39:04 2009 Subject: [plt-scheme] use web service from scheme? In-Reply-To: <497C9324.80801@gmx.de> References: <497C9324.80801@gmx.de> Message-ID: <497CD128.4030406@ccs.neu.edu> Sigrid Keydana wrote: > Hi, > > I'd like to ask if there is a tutorial or example of how to use a web > service from scheme? (Already saw flickr.plt on Planet, but a tutorial > would be even more helpful of course :-) ) I'm not sure this counts as a tutorial, but here is a lightweight way of interacting with a simple web service, delicious. The delicious web service basically offers you a number of functions, which you call by visiting certain URLs. The path part of the URL determines which function you call, and arguments, which are named, are given in query part. Results are returned as XML. You can call these functions without using Scheme at all either by using a web browser, or a command line program like curl, or wget. For example, change user:pass appropriately, and visit: https://user:pass@api.del.icio.us/v1/posts/recent?tag=scheme You get an XML document listing all you bookmarks tagged with "scheme". The function in this case is "posts/recent" and the "tag" argument is "scheme". With this example, I get: Moving into the Scheme world, suppose we have a function that takes one of the designated delicious function names and named arguments. A natural way to model named arguments is with keywords. Rather than return an XML document, let's return an S-Expression representing the XML result (an X-Expr). The example becomes: (delicious "posts/get" #:tags "scheme") Which evaluates to: (posts ((dt "2009-01-25T08:00:00Z") (tag "") (user "dvanhorn")) (post ((description "PLT Scheme") (hash "4ffc3abae9db52de059f66944ef834f9") (href "http://plt-scheme.org/") (tag "scheme plt awesome") (time "2009-01-25T19:32:05Z")))) This is just a plain ol' list in Scheme. You can use all your familiar list functions to operate on these values. You can construct new values with quasiquote and friends. Generating HTML pages or RSS feeds are really simple exercises (compare this to just about any other programming language). Here are some more examples: (delicious "posts/update") (delicious "posts/recent") (delicious "posts/dates") (delicious "posts/add" #:url "http://plt-scheme.org/" #:description "PLT Scheme" #:extended (string-append "PLT Scheme is an innovative programming " "language that builds on a rich academic " "and practical tradition.") #:tags "scheme plt awesome") The details between each web service will vary (flickr, for example, has a much more complicated authentication scheme), but more or less they're all variations of the above. Ask if you have more questions. David ;; Lightweight delicious API wrapper. ;; For a more complete solution see planet: untyped/delicious. #lang scheme (require scheme/system net/uri-codec xml) (define usr (make-parameter "")) (define pwd (make-parameter "")) ;; A MethodName is one of: ;; - "posts/update" ;; - "posts/add" ;; - "posts/delete" ;; ... ;; MethodName [Keyword Arg] ... -> S-Expr ;; Invoke the given method with the given arguments. ;; http://delicious.com/help/api (define delicious (make-keyword-procedure (lambda (kws kw-args method) (let ((in (fetch (delicious-url method kws kw-args)))) (xml->xexpr ((eliminate-whitespace '(posts tags dates bundles) (lambda (x) x)) (document-element (read-xml in)))))))) ;; String -> InputPort ;; Fetch a URL (represented as a string) as a port. (define (fetch str-url) ;; Alt: (get-pure-port (string->url str-url)) (match (process (string-append "curl \"" str-url "\"")) [(list in out pid err send) (begin (send 'wait) in)])) ;; MethodName [Listof Keyword] [Listof String] -> String ;; Construct a delicious API URL. (define (delicious-url method args vals) (format "https://~a:~a@api.del.icio.us/v1/~a?~a" (usr) (pwd) method (interpolate-& (map (lambda (s1 s2) (string-append s1 "=" s2)) (map keyword->string args) (map uri-encode vals))))) ;; [Listof String] -> String ;; Interpolate the list of strings (list s1 s2 .. sN) as "s1&s2..&sN". (define (interpolate-& los) (cond [(empty? los) ""] [(empty? (rest los)) (first los)] [else (string-append (first los) "&" (interpolate-& (rest los)))])) ;; Examples (usr "dvanhorn") (pwd "********") (delicious "posts/update") (delicious "posts/recent") (delicious "posts/dates") (delicious "posts/add" #:url "http://plt-scheme.org/" #:description "PLT Scheme" #:extended (string-append "PLT Scheme is an innovative programming " "language that builds on a rich academic " "and practical tradition.") #:tags "scheme plt awesome") (delicious "posts/get" #:tags "scheme") From eli at barzilay.org Sun Jan 25 17:11:06 2009 From: eli at barzilay.org (Eli Barzilay) Date: Thu Mar 26 02:39:04 2009 Subject: [plt-scheme] A GUI/font puzzle In-Reply-To: <497C798C.3050909@zenburn.net> References: <497BBF8B.3060503@zenburn.net> <20090125110235.53B2165008D@mail-svr1.cs.utah.edu> <497C798C.3050909@zenburn.net> Message-ID: <18812.58234.384364.654221@arabic.ccs.neu.edu> On Jan 25, Jakub Piotr C?apa wrote: > > Wow. Thanks for a fast fix. AFAICT it hasn't yet reached the nightly > builds so I guess I'll have to try tomorrow [1]. Yes, the nightly builds happen every night, and they're available around 5-6am (eastern time). On occasion, if there's some important fix, or if someome has a stressing need for an earlier build, I'll start one manually. (A build is pretty heavy on computing resources, since it's done on 9 different machines.) > [1]: I haven't yet tried to build PLT Scheme myself but it seems > there is no way to cross-compile from Linux (using crossmingw32), am > I right? No. Just the C parts of the build will probably take a lot of work to get working, and I'm not sure about mingw (or the cross version), but at least with cygwin there are some issues which mean that it's better to use the MS compiler. > PS. Another interesting question is whether it is possible (given > the all the needed files from both installations) to cross compile > the distribution packages (like in Scheme->Create executable...) > > If not: is it a good idea for me to dig into the compiler module to > try to do it myself or would it be too big a change? This will probably be difficult to get too: you'll need to make it aware of files on other platform. The minimal requirement for this would be to somehow make it possible to change what (system-type) returns in some cases (to bundle the right files) but not in others (so the environment actually works fine). So I guess that any attempt at doing this will involve some new (current-crossover-system-type) parameter, which will default to the actual type, but can change for doing such packaging. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://www.barzilay.org/ Maze is Life! From jpc-ml at zenburn.net Sun Jan 25 18:51:41 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:39:04 2009 Subject: [plt-scheme] Attaching modules to namespaces in compiled code Message-ID: <497CFB0D.6010409@zenburn.net> I already asked this question here once but AFAICT some things changed since then. I have the following code fragment: (let ([ns (make-base-namespace)] [sepack-mod (module-path-index-resolve (module-path-index-join "sepack.ss" (syntax-source-module #'here)))]) (namespace-attach-module (current-namespace) sepack-mod ns) (parameterize ([current-namespace ns] [current-prompt-read prompt]) (namespace-require sepack-mod) (read-eval-print-loop))) The last time I tried to do this I had to manually resolve the name recursively (I basically copied and pasted the code Matthew suggested). The module-path-index-resolve is certainly nicer but I am curious whether it can be improved upon: 1. Quite a few functions are needed to acquire one module path. 2. As far as I understand I still need to require the module statically somewhere (even if it is needed only in dynamically evaluated code) for mzc to compile it in. Can this be fused with define-runtime-path somehow? I really admire the thought you put into the module system and especially the machinery required to make it work in self-contained executables. AFAIK there are no papers (other than the Reference) describing the module name/namespace (especially in the context of mzc), are there? -- regards, Jakub Piotr C?apa From mflatt at cs.utah.edu Sun Jan 25 19:32:44 2009 From: mflatt at cs.utah.edu (Matthew Flatt) Date: Thu Mar 26 02:39:04 2009 Subject: [plt-scheme] Attaching modules to namespaces in compiled code In-Reply-To: <497CFB0D.6010409@zenburn.net> References: <497CFB0D.6010409@zenburn.net> Message-ID: <20090126003247.DF07265008C@mail-svr1.cs.utah.edu> At Mon, 26 Jan 2009 00:51:41 +0100, Jakub Piotr C?apa wrote: > I already asked this question here once but AFAICT some things changed > since then. > > I have the following code fragment: > (let ([ns (make-base-namespace)] > [sepack-mod (module-path-index-resolve (module-path-index-join > "sepack.ss" (syntax-source-module #'here)))]) > (namespace-attach-module (current-namespace) sepack-mod ns) > (parameterize ([current-namespace ns] > [current-prompt-read prompt]) > (namespace-require sepack-mod) > (read-eval-print-loop))) > > The last time I tried to do this I had to manually resolve the name > recursively (I basically copied and pasted the code Matthew suggested). > The module-path-index-resolve is certainly nicer but I am curious > whether it can be improved upon: > 1. Quite a few functions are needed to acquire one module path. > 2. As far as I understand I still need to require the module statically > somewhere (even if it is needed only in dynamically evaluated code) for > mzc to compile it in. Can this be fused with define-runtime-path somehow? We have better pieces for making this work, now, and I've put them together into a `define-runtime-module-path' form that is exported by `scheme/runtime-path'. > AFAIK there are no papers (other than the Reference) > describing the module name/namespace (especially in the context of mzc), > are there? No, not so far. Matthew From jpc-ml at zenburn.net Sun Jan 25 21:11:37 2009 From: jpc-ml at zenburn.net (=?UTF-8?B?SmFrdWIgUGlvdHIgQ8WCYXBh?=) Date: Thu Mar 26 02:39:04 2009 Subject: [plt-scheme] Attaching modules to namespaces in compiled code In-Reply-To: <20090126003247.DF07265008C@mail-svr1.cs.utah.edu> References: <497CFB0D.6010409@zenburn.net> <20090126003247.DF07265008C@mail-svr1.cs.utah.edu> Message-ID: <497D1BD9.8080500@zenburn.net> On 1/26/09 1:32 AM, Matthew Flatt wrote: > We have better pieces for making this work, now, and I've put them > together into a `define-runtime-module-path' form that is exported by > `scheme/runtime-path'. Great, thanks! I checked your code and it seems that I missed at least one nice shortcut. ;-) The only-in/for-label require combination will take care of including the module in the compiled binary? (why both? wouldn't an empty only-in be sufficient?) -- regards, Jakub Piotr C?apa From lunarc.lists at gmail.com Sun Jan 25 22:38:35 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:39:05 2009 Subject: [plt-scheme] Binding C-Structs Containing Fixed-Size Arrays with the FFI Message-ID: I'm trying to bind parts of ODE[1] with the FFI, but I've ran into an issue I haven't had to face before, and I haven't been able to resolve by looking at the FFI documentation. Take a look at the type definitions: typedef float dReal; //... typedef dReal dVector3[4]; //... typedef struct dJointFeedback { dVector3 f1; /* force applied to body 1 */ dVector3 t1; /* torque applied to body 1 */ dVector3 f2; /* force applied to body 2 */ dVector3 t2; /* torque applied to body 2 */ } dJointFeedback; Now, as I understand it, dJointFeedback structs will basically contain 16 floats. I'm not sure how I should be binding this, though. The closest thing I have found looking through the documentation is _cvector[2], but that seems to actually wrap arrays-as-pointers, which would only let me define structs containing 4 float pointers, which doesn't work out. How should I handle this? Henk [1] http://ode.org/ [2] http://docs.plt-scheme.org/foreign/foreign_procedures.html#(form._((lib._scheme/foreign..ss).__cvector)) From grettke at acm.org Mon Jan 26 00:26:29 2009 From: grettke at acm.org (Grant Rettke) Date: Thu Mar 26 02:39:05 2009 Subject: [plt-scheme] Question about drawing to a dc<%> and intersection of shapes Message-ID: <756daca50901252126u478ebdbeqa199a57207a9f93e@mail.gmail.com> Hi folks, I've got a question about drawing to a dc<%>: Suppose I've got a dc% that represents at 10x10 rectangle, and that I want to draw a 3x3 ellipse at a random point, but only if the ellipse doesn't intersect with any of the edges of the rectangle. Is there an existing function to detect intersection of shapes? In this case I guess it would be checking with 4 lines, one for each edge, with the ellipse? Best wishes, Grant From lunarc.lists at gmail.com Mon Jan 26 01:42:55 2009 From: lunarc.lists at gmail.com (Henk Boom) Date: Thu Mar 26 02:39:05 2009 Subject: [plt-scheme] Issue with Output _cvector Types Held in Variables Message-ID: As I would expect, the ffi reports no error from the following (I'm just using 'printf as an example, I know it makes no sense and is dangerous): #lang scheme/base (require scheme/foreign) (unsafe!) (define test (get-ffi-obj 'printf #f (_fun (_cvector o _int 4) -> _void))) (test) If I put the cvector type in a variable, however: #lang scheme/base (require scheme/foreign) (unsafe!) (define t (_cvector o _int 4)) (define test (get-ffi-obj 'printf #f (_fun t -> _void))) (test) and I get the error: ffi:printf: expects 1 argument, given 0 If I understand the documentation properly, the above two should be identical, shouldn't they? Henk From stephen at degabrielle.name Mon Jan 26 04:44:15 2009 From: stephen at degabrielle.name (Stephen De Gabrielle) Date: Thu Mar 26 02:39:05 2009 Subject: [plt-scheme] #:log-format 'parenthesized-default Message-ID: <595b9ab20901260144l1708bf78xea4926e0b126d93f@mail.gmail.com> Hi, I think I'm missing a trick: I'm using serve/servlet with #:log-file (build-path (current-directory) (string->path (string-append "thread-" (get-date)))) and #:log-format 'parenthesized-default but it brings up an error 'does not expect an argument with keyword #:log-format' This seems odd, as excluding the argument returns the error 'application: missing argument expression after keyword in: #:log-format' * Adding a require for web-server/dispatchers/dispatch-log seemed to have no effect. * I believe the argument is correct as per http://docs.plt-scheme.org/web-server/servlet-env_ss.html I think I've probably missed something simple - any suggestions? Thanks, Stephen -a working example- #lang scheme (require web-server/servlet web-server/templates web-server/dispatchers/dispatch-log scheme/date ) (provide/contract (start (request? . -> . response?))) (define (logfile-path) (build-path (current-directory) (string->path (string-append "thread-" (number->string (date-year (seconds->date (current-seconds)))) "-" (number->string (date-month (seconds->date (current-seconds)))) "-" (number->string (date-day (seconds->date (current-seconds)))) "_" (number->string (date-hour (seconds->date (current-seconds)))) "-" (number->string (date-minute (seconds->date (current-seconds)))) "-" (number->string (date-second (seconds->date (current-seconds)))) ".log" )))) (define (start request) `(html (head (title "Hello world!")) (body (p "Hey out there!")))) (require web-server/servlet-env) (serve/servlet start #:launch-browser? #t #:quit? #f #:listen-ip #f #:port 8000 #:extra-files-paths (list (current-directory)) #:servlet-path "/threads-vi.ss" #:mime-types-path "data/mime.types" #:log-file (logfile-path) #:log-format 'parenthesized-default ) ;--- -MY code- #lang scheme ;#lang web-server/insta (require web-server/servlet web-server/templates web-server/dispatchers/dispatch-log scheme/gui ; xml net/sendurl scheme/date "standard-requires.ss" ) (provide/contract (start (request? . -> . response?))) [...] (require web-server/servlet-env) (serve/servlet start #:launch-browser? #t #:quit? #f #:listen-ip #f #:port 8000 #:extra-files-paths (list (current-directory)) #:servlet-path "/threads-vi.ss" #:mime-types-path "data/mime.types" #:log-file (build-path (current-directory) (string->path (string-append "thread-" (get-date)))) #:log-format 'parenthesized-default ) - From fkoksal at cs.bilgi.edu.tr Mon Jan 26 06:58:50 2009 From: fkoksal at cs.bilgi.edu.tr (=?UTF-8?B?Ik0uIEZhdGloIEvDtmtzYWwi?=) Date: Thu Mar 26 02:39:06 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> <18810.15272.974904.820903@arabic.ccs.neu.edu> <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> Message-ID: <497DA57A.7080000@cs.bilgi.edu.tr> Shriram Krishnamurthi wrote: > I am going to hazard a guess that Fatih meant was actually the former: > for instance, check whether people are typing the recipe steps first > and working methodically, or only entering it at the last minute > before turning in the solution. (It would be interesting to hear > whether those who do the former do in fact do better than those who do > the latter!) Exactly... We evaluated the final exams, where the students are assigned two questions, and we graded every step of Design Recipe. Using "R", we conducted a linear model analysis. R says, template and tests are most significant, meaning that students who did the template and the tests properly, also wrote fully functional code. Or, vice versa :) Since we don't know whether they did the code first and then the template, test, etc. we want to record every change and replay the session of the student. This will strengthen our case. Using this technique I can tag the students submissions according to the order of the application of design steps, then use this extra information for the analysis. M. Fatih K?ksal ?stanbul Bilgi University Computer Science Department -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 260 bytes Desc: OpenPGP digital signature Url : http://list.cs.brown.edu/pipermail/plt-scheme/attachments/20090126/eb9464ed/signature.pgp From matthias at ccs.neu.edu Mon Jan 26 07:20:08 2009 From: matthias at ccs.neu.edu (Matthias Felleisen) Date: Thu Mar 26 02:39:06 2009 Subject: [plt-scheme] Log "every change in" Definitions and Interactions... In-Reply-To: <497DA57A.7080000@cs.bilgi.edu.tr> References: <497A0456.3030300@cs.bilgi.edu.tr> <932b2f1f0901231027p9f73166tc96794e91cc1bc06@mail.gmail.com> <18810.10415.581732.445163@arabic.ccs.neu.edu> <932b2f1f0901231344q34983afo514dcbfc86d144c3@mail.gmail.com> <18810.15272.974904.820903@arabic.ccs.neu.edu> <932b2f1f0901231428m718e320bse41f4b04279895b4@mail.gmail.com> <497DA57A.7080000@cs.bilgi.edu.tr> Message-ID: <83259576-86BB-422C-A4D8-738BF5538D21@ccs.neu.edu> On Jan 26, 2009, at 6:58 AM, M. Fatih K?ksal wrote: > Shriram Krishnamurthi wrote: >> I am going to hazard a guess that Fatih meant was actually the >> former: >> for instance, check whether people are typing the recipe steps first >> and working methodically, or only entering it at the last minute >> before turning in the solution. (It would be interesting to hear >> whether those who do the former do in fact do better than those >> who do >> the latter!) > > Exactly... > We evaluated the final exams, where the students are assigned two > questions, and we graded every step of Design Recipe. Using "R", we > conducted a linear model analysis. R says, template and tests are most > significant, meaning that students who did the template and the tests > properly, also wrote fully functional code. This is no surprise. I'd go even further and say template >> tests > rest as soon as you hit non-trivial data defs. > Or, vice versa :) Since we don't know whether they did the code first > and then the template, test, etc. we want to record every change and > replay the session of the student. This will strengthen our case. > Using > this technique I can tag the students submissions according to the > order of the application of design steps, then use this extra > information for the analysis. And logging won't necessarily prove it. Everyone who has absorbed the DR writes the template in his head and often, though not always writes the tests after the fact. -- Matthias From robby at eecs.northwestern.edu Mon Jan 26 07:25:27 2009 From: robby at eecs.northwestern.edu (Robby Findler) Date: Thu Mar 26 02:39:06 2009 Subject: [plt-scheme] Question about drawing to a dc<%> and intersection of shapes In-Reply-To: <756daca50901252126u478ebdbeqa199a57207a9f93e@mail.gmail.com> References: <756daca50901252126u478ebdbeqa199a57207a9f93e@mail.gmail.com> Message-ID: <932b2f1f0901260425u7fafe267x24eda61db87fba7d@mail.gmail.com> On Sun, Jan 25, 2009 at 11:26 PM, Grant Rettke wrote: > Is there an existing function to detect intersection of shapes? No, I don't believe you can do that in a simple way with the current toolkit (Matthew is working on a rewrite for the coming months, and then the answer will be "if it is a part of cairo: yes".) You can create a region% object that is the intersection, then draw with that region and then s