WJ
unread,May 22, 2012, 12:41:41 AM5/22/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Marco Antoniotti wrote:
> I know how to do it. I a just wondering what people feel would be a
> good interface (in the spirit of the PARTITION/SPLIT-SEQUENCE and
> EXTREMIZE debate).
>
> I often find myself doing things like
>
> (loop for i from 0 to N collect (make-something))
>
> just because
>
> (make-list N :initial-element (make-something))
>
> fills the list with EQ elements. (The same applies to MAKE-ARRAY, of
> course).
>
> I was thinking to write something along the lines of
>
> (defun make-list-collecting (n &key
> (element-constructor (lambda () nil)))
> (loop for i from 0 below N collect (funcall f)))
Racket:
(apply eq? (make-list 2 (list 'u)))
=> #t
(apply eq? (build-list 2 (thunk* (list 'u))))
=> #f