From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: defconst in life.el Date: Fri, 19 Nov 2004 19:52:35 +0200 Organization: JURTA Message-ID: <87wtwhiv4s.fsf@jurta.org> References: <200411141840.iAEIeXG24252@raven.dms.auburn.edu> <87k6so2ljb.fsf-monnier+emacs@gnu.org> <200411142139.iAELd9q27391@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1100887017 16959 80.91.229.6 (19 Nov 2004 17:56:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Nov 2004 17:56:57 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 19 18:56:48 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CVD04-0000XJ-00 for ; Fri, 19 Nov 2004 18:56:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CVD8y-0005l6-AV for ged-emacs-devel@m.gmane.org; Fri, 19 Nov 2004 13:06:00 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CVD8n-0005j5-D0 for emacs-devel@gnu.org; Fri, 19 Nov 2004 13:05:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CVD8m-0005i5-KO for emacs-devel@gnu.org; Fri, 19 Nov 2004 13:05:48 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CVD8m-0005hb-GA for emacs-devel@gnu.org; Fri, 19 Nov 2004 13:05:48 -0500 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CVCzO-0006jM-0N for emacs-devel@gnu.org; Fri, 19 Nov 2004 12:56:06 -0500 Original-Received: from mail.jurta.org (80-235-37-43-dsl.mus.estpak.ee [80.235.37.43]) by knife.dreamhost.com (Postfix) with ESMTP id D92D7E41E7; Fri, 19 Nov 2004 09:56:03 -0800 (PST) Original-To: Thien-Thi Nguyen In-Reply-To: (Thien-Thi Nguyen's message of "14 Nov 2004 17:32:44 -0500") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30099 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30099 Thien-Thi Nguyen writes: > Luc Teirlinck 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/