[racket] Replacing lambdas with defines
On Jun 8, 2012, at 10:25 AM, Ashok Bakthavathsalam wrote:
>
> (define (permute l)
>
>
> (if (null? l)
>
>
> '(())
>
>
> (apply append (map (lambda (p)
>
>
> (map (lambda (n)
>
>
> (insert p n (car l)))
>
>
> (seq 0 (length p))))
>
>
> (permute (cdr l))))))
1. These nested lambdas are fine.
2.
(define (permute l)
(cond
[(null? l) '(())]
[else (define (silly1 p)
(define (silly2 n)
(insert p n (car l)))
(map silly2 (seq 0 (length p)))
(apply append (map silly1 (permute (cdr l))))]))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120608/6c21edea/attachment-0001.html>