This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Scheme is too complicated


On Fri, 30 Oct 1998, Jay Glascoe wrote:

> I must confess that although I've been studying Scheme for a while now, I
> really am a bit rusty at practical Scheme programming; you guessed
> correctly.
> 

oops, case in point:

> here's what I would call a functional version:
> 
> (define hash->keys
>   (lambda (mytab)
>     (let ((bucket->keys (lambda (bucket) (map entry->key bucket)))
>           (entry->key cadr))
>       (apply append (map bucket->keys (vector->list (cdr mytab)))))))
> 

this is better:

(define hash->keys
  (let ((entry->key cadr)
        (bucket->keys (lambda (bucket) (map entry->key bucket))))
    (lambda (mytab) 
      (apply append (map bucket->keys (vector->list (cdr mytab)))))))


	Jay
	jglascoe@jay.giss.nasa.gov