emacs-devel
[Top][All Lists]
Advanced

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

Re: defconst in life.el


From: Thien-Thi Nguyen
Subject: Re: defconst in life.el
Date: 14 Nov 2004 17:32:44 -0500

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

thi




reply via email to

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