Re: [racket] Saving and restoring many parameters

2011-10-21 Thread Robby Findler
I like that better. :) A minor thing: you could use multiple values and multiple arguments, ie > (ps1) 1 2 > (ps1 2 3) > (ps1) 2 3 > (ps1 5) ... arity error (You'd still have to use your own version of parameterize, tho, I think.) Robby On Fri, Oct 21, 2011 at 9:38 AM, Neil Toronto

Re: [racket] Saving and restoring many parameters

2011-10-21 Thread Neil Toronto
How about this? This code: (define p1 (make-parameter 1)) (define p2 (make-parameter 2)) (define-parameter-group ps1 (p1 p2)) defines a parameter-like group as before, and also defines a 'ps1-value' struct. Interaction: > (ps1) (ps1-value 1 2) > (ps1 (ps1-value 10 20))

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Robby Findler
What I'm saying is that parameter-list* and parameter-list-append do not seem like things that belong in this API. And it isn't really a "list" in the sense that it is least fixed point of an inductive definition like X = nil | (cons parameter X). Really, there is a new type of data whose purpose

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Neil Toronto
Is there a better data type to tangle them with? I considered multiple values, but those were cumbersome to save because (values v ...) isn't a first-class value. Saving and restoring multiple parameters is the main reason to use a parameter list. I tried making structs, but that forced me in

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Vincent St-Amour
At Thu, 20 Oct 2011 09:54:56 -0600, Neil Toronto wrote: > I know Blake has wanted these before, so I might throw them into unstable. Please do. I've wanted these before as well. Vincent _ For list-related administrative tasks: http://lists.racke

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Robby Findler
Good. I'm glad we avoided the unknown boogeyman. But I don't see why you need tangle lists and these things. Robby On Thu, Oct 20, 2011 at 10:54 AM, Neil Toronto wrote: > On 10/20/2011 08:08 AM, Robby Findler wrote: >> >> Well, what about the current-namespace? The output ports? It seems >> dan

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Neil Toronto
On 10/20/2011 08:08 AM, Robby Findler wrote: Well, what about the current-namespace? The output ports? It seems dangerous and leak introducing (possibly). I don't actually have an example where it could cause a problem tho. But you might try to think thru the ramifications by searing for "curren

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Robby Findler
Well, what about the current-namespace? The output ports? It seems dangerous and leak introducing (possibly). I don't actually have an example where it could cause a problem tho. But you might try to think thru the ramifications by searing for "current-" in the docs. Robby On Tuesday, October 18

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Sam Tobin-Hochstadt
But without this bug, I never would have learned how to use 'gdb --pid=...'. ;) On Thu, Oct 20, 2011 at 8:41 AM, Robby Findler wrote: > Perhaps worth pointing out: this PR > >   http://bugs.racket-lang.org/query/?cmd=view&pr=12280 > > is an example of how getting an unexpected parameter setting c

Re: [racket] Saving and restoring many parameters

2011-10-20 Thread Robby Findler
Perhaps worth pointing out: this PR http://bugs.racket-lang.org/query/?cmd=view&pr=12280 is an example of how getting an unexpected parameter setting can lead to strange behavior. (This one is a relatively easy one, too; I knew what was going on right away.) Robby On Wed, Oct 19, 2011 at 4:

Re: [racket] Saving and restoring many parameters

2011-10-19 Thread Neil Toronto
On 10/19/2011 12:52 PM, Robby Findler wrote: On Wed, Oct 19, 2011 at 12:39 PM, Neil Toronto wrote: If I spawn a render thread that inherits the parent thread's parameters, won't things like current-namespace and current-custodian have the right values? It's starting to look like that is the so

Re: [racket] Saving and restoring many parameters

2011-10-19 Thread Robby Findler
On Wed, Oct 19, 2011 at 12:39 PM, Neil Toronto wrote: > On 10/19/2011 10:31 AM, John Clements wrote: >> >> On Oct 19, 2011, at 9:29 AM, John Clements wrote: >> >>> >>> On Oct 19, 2011, at 4:03 AM, Robby Findler wrote: >>> (I'm sorry if you got this message already; I thought I sent it al

Re: [racket] Saving and restoring many parameters

2011-10-19 Thread Neil Toronto
On 10/19/2011 11:39 AM, Neil Toronto wrote: On 10/19/2011 10:31 AM, John Clements wrote: On Oct 19, 2011, at 9:29 AM, John Clements wrote: On Oct 19, 2011, at 4:03 AM, Robby Findler wrote: (I'm sorry if you got this message already; I thought I sent it already but I don't see it.) What ab

Re: [racket] Saving and restoring many parameters

2011-10-19 Thread Neil Toronto
On 10/19/2011 10:31 AM, John Clements wrote: On Oct 19, 2011, at 9:29 AM, John Clements wrote: On Oct 19, 2011, at 4:03 AM, Robby Findler wrote: (I'm sorry if you got this message already; I thought I sent it already but I don't see it.) What about the current-output/error-port? what about

Re: [racket] Saving and restoring many parameters

2011-10-19 Thread John Clements
On Oct 19, 2011, at 4:03 AM, Robby Findler wrote: > (I'm sorry if you got this message already; I thought I sent it > already but I don't see it.) > > What about the current-output/error-port? what about the > current-namespace? current-custodian? > > There are lots of parameters that affect co

Re: [racket] Saving and restoring many parameters

2011-10-19 Thread John Clements
On Oct 19, 2011, at 9:29 AM, John Clements wrote: > > On Oct 19, 2011, at 4:03 AM, Robby Findler wrote: > >> (I'm sorry if you got this message already; I thought I sent it >> already but I don't see it.) >> >> What about the current-output/error-port? what about the >> current-namespace? curr

Re: [racket] Saving and restoring many parameters

2011-10-19 Thread Robby Findler
(I'm sorry if you got this message already; I thought I sent it already but I don't see it.) What about the current-output/error-port? what about the current-namespace? current-custodian? There are lots of parameters that affect core functions in subtle ways and if you do something like this in p

Re: [racket] Saving and restoring many parameters

2011-10-18 Thread Neil Toronto
I hear you. If I used any parameters except the plot ones, I'd have a problem, and write macros as you suggest. (Or save and restore the exceptions instead.) For now, I'm trying Matthew's suggestion, and using this: (define (parameterize-procedure t) (define parameterization (current

Re: [racket] Saving and restoring many parameters

2011-10-18 Thread Robby Findler
There are parameterizations, but they pick up all parameters and that may make other things go wrong (or you have to be more careful how you look up your parameter values but I think you might object to that on similar grounds to the below). I would probably use the solution you have below, but wi

Re: [racket] Saving and restoring many parameters

2011-10-18 Thread Neil Van Dyke
It wouldn't work well to have a "plot context" object, perhaps stored in "current-plot-context" parameter? -- http://www.neilvandyke.org/ _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Saving and restoring many parameters

2011-10-18 Thread Matthew Flatt
At Tue, 18 Oct 2011 13:40:12 -0600, Neil Toronto wrote: > Executive summary: Is there a good way to save a large set of parameter > values, or *all* the parameter values, and then restore them when needed? `current-parameterization' and `call-with-parameterization'? _

Re: [racket] Saving and restoring many parameters

2011-10-18 Thread Vincent St-Amour
At Tue, 18 Oct 2011 13:40:12 -0600, Neil Toronto wrote: > Executive summary: Is there a good way to save a large set of parameter > values, or *all* the parameter values, and then restore them when needed? Would parameterizations help? Vincent _