Thanks for joining in.

The amended question had nothing to do with the earlier example

I'm  wondering if there's a quick, standard (and easily understood) idiom 
(without an internal helper function) to recur on the variable argument list y

The flatten's not ideal - I may want to retain some sub-list structure 

(define x 4)
(define t2
  (lambda y
    (let ((z (car y)))
      (display y)(newline)
      (display (flatten y))(newline)
      (display z)(newline)
      (if (> x 0)
          (begin
            (set! x (- x 1))
            ;(t2 (cdr y)))
            (t2 y))
          (void)))))
(t2 1 2 3 4 5 6)



RETURNS
(1 2 3 4 5 6)
(1 2 3 4 5 6)
1
((1 2 3 4 5 6))
(1 2 3 4 5 6)
(1 2 3 4 5 6)
(((1 2 3 4 5 6)))
(1 2 3 4 5 6)
((1 2 3 4 5 6))
((((1 2 3 4 5 6))))
(1 2 3 4 5 6)
(((1 2 3 4 5 6)))
(((((1 2 3 4 5 6)))))
(1 2 3 4 5 6)
((((1 2 3 4 5 6))))


On Tuesday, September 6, 2016 at 9:04:07 PM UTC-4, Jon Zeppieri wrote:
> On Tue, Sep 6, 2016 at 8:50 PM, Jon Zeppieri <zepp...@gmail.com> wrote:
>  
> The `(lambda s ...)` is variable-arity, but when you call `ss` internally 
> [...]
> 
> 
> Sorry, I realized after that your `ss` function essentially *is* a wrapper 
> around your `subsets` function -- which is exactly what I was suggesting. 
> However, there's no reason for it to duplicate so much of the work of 
> `subsets`. Since `subsets` works on any list, your definition of `ss` can 
> simply be:
> 
> 
> (define (ss . xs) (subsets xs))
> 
> 
> The only purpose of `ss` is to package up its arguments as a list and pass 
> that list to `subsets`.
> 
> 
> - Jon

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to