is there a define syntax equivalent to this lambda

(define list (lambda x x x))
(list 1 2 3 4 5 "a")
;returns 
;'(1 2 3 4 5 "a")


I wanted to write subsets from SICP without 
passing the parameter as a list, and a simiar
version of average 


(define nil '())

(define (subsets s)
  (if (null? s)
      (list nil)
      (let ((rest (subsets (cdr s))))
        (append
         rest
         (map
          (lambda (x)
            (append (list (car s))
                    x))
          rest)))))

(subsets (list 1 2 3))  

; complete using the format of the simplified list lambda
(define ss
  (lambda s
    (if (null? s)
      (list nil)
      (let ((rest (subsets (cdr s))))
        (append
         rest
         (map
          (lambda (x)
            (append (list (car s))
                    x))
          rest))))))

(ss 1 2 3)

-- 
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