Re: [racket-dev] for/first and multiple values
On 8/29/10 8:33 PM, Carl Eastlund wrote: On Sun, Aug 29, 2010 at 8:32 PM, David Van Horn wrote: On 8/29/10 8:27 PM, Carl Eastlund wrote: What do you propose for/first should return if the set s is empty? #f? Which will do what in a 2-valued context? Blow up I suppose. I don't care; I'm not going to use for/first with an empty set. David _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] for/first and multiple values
On Sun, Aug 29, 2010 at 8:32 PM, David Van Horn wrote: > On 8/29/10 8:27 PM, Carl Eastlund wrote: >> >> What do you propose for/first should return if the set s is empty? > > #f? Which will do what in a 2-valued context? --Carl _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] for/first and multiple values
On 8/29/10 8:27 PM, Carl Eastlund wrote: What do you propose for/first should return if the set s is empty? #f? _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] for/first and multiple values
What do you propose for/first should return if the set s is empty? It will be somewhat difficult to make it divine that it ought to return two values. Perhaps, if this feature is adopted, for/first should allow a #:default keyword to specify the return value if no elements crop up, so you can put in the right number of values. Carl Eastlund On Sun, Aug 29, 2010 at 8:21 PM, David Van Horn wrote: > Why is the body of a for/first a single valued context? I would expect this > to work: > > (let ((s (set 1 3 10))) > (for/first ((x (in-set s))) > (values x (set-remove s x > > But I get: > > context expected 1 value, received 2 values: 1 (set 3 10) > > (By the way, this operation would be nice to have in racket/set.) > > David _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
[racket-dev] for/first and multiple values
Why is the body of a for/first a single valued context? I would expect this to work: (let ((s (set 1 3 10))) (for/first ((x (in-set s))) (values x (set-remove s x But I get: context expected 1 value, received 2 values: 1 (set 3 10) (By the way, this operation would be nice to have in racket/set.) David _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev