emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defconst in life.el


From: Juri Linkov
Subject: Re: defconst in life.el
Date: Fri, 19 Nov 2004 19:52:35 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Thien-Thi Nguyen <address@hidden> writes:
> Luc Teirlinck <address@hidden> writes:
>>    Maybe somebody who uses life.el could give a more definitive answer.
>
> the docstring gives a hint: "some".  this var is meant to be used
> experimentally (value modified, augmented, etc), so defvar is more
> suitable than defconst.
>
> e.g.:
> (defun random-life () (interactive)
>   (let* ((w (+ 10 (random (- (frame-width) 10))))
>          (h (+ 5 (random (- (frame-height) 5))))
>          ;; a pleasant propensity to delightful density
>          (n (random (round (/ (* w h) 2))))
>          (r (mapcar (lambda (x) (make-string w 32))
>                     (number-sequence 1 h))))
>     (while (< 0 n)
>       (aset (nth (random h) r) (random w) ?@)
>       (setq n (1- n)))
>     (let ((life-patterns (vector r)))
>       (life 0))))

Why don't you install your fun?  Filling the matrix with random values
is one of the most amusing aspects of life.

As I see in life.el, Luc already changed the life-pattern type from
defconst to defvar so it's good to install it now.  But please rename
`random-life' to `life-random' to satisfy the package prefix.  Thanks.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]