From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Roland Thiers Newsgroups: gmane.emacs.help Subject: Run a program Date: Tue, 27 Sep 2011 16:28:02 +1100 Message-ID: <4BB5BAB3-2D48-402A-85EF-070EEC256DB3@canl.nc> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1317157265 20584 80.91.229.12 (27 Sep 2011 21:01:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2011 21:01:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 27 23:01:00 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R8elw-00048C-FX for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Sep 2011 23:01:00 +0200 Original-Received: from localhost ([::1]:45917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8elv-00044k-W5 for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Sep 2011 17:00:59 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8Rgk-0005Wb-FQ for help-gnu-emacs@gnu.org; Tue, 27 Sep 2011 03:02:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8Rgj-00071Y-FZ for help-gnu-emacs@gnu.org; Tue, 27 Sep 2011 03:02:46 -0400 Original-Received: from gw-smtp-5.canl.nc ([202.87.159.14]:36970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8Rgi-0006YF-QZ for help-gnu-emacs@gnu.org; Tue, 27 Sep 2011 03:02:45 -0400 Original-Received: from smtp1.canl.nc ([202.171.64.24] helo=mail1.canl.nc) by gw-smtp-5.canl.nc ([202.171.64.13]:10025) with esmtp id 1R8QD9-0001sa-Uq (Exim 4.74) for help-gnu-emacs@gnu.org (return-path ); Tue, 27 Sep 2011 16:28:07 +1100 Original-Received: from host-203-147-78-149.h31.canl.nc ([203.147.78.149] helo=[192.168.2.2]) by mail1.canl.nc ([202.171.64.2]:587) with esmtpa (plain:roland.thiers@canl.nc) id 1R8QD6-0005Oc-ED (Exim 4.74) for help-gnu-emacs@gnu.org (return-path ); Tue, 27 Sep 2011 16:28:07 +1100 X-ACL: Processed by Anti-SPAM ACL on gw-smtp-5.canl.nc X-Weight: 0 X-AVE-Signature: 7a0c96715c4b033bffe193698e615e98 X-AVE-Status: No virus found X-AVE-Scanned: by AVE Virus Scanner X-ACL: Processed by Anti-SPAM ACL on mail1.canl.nc X-Mailer: Apple Mail (2.936) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 202.87.159.14 X-Mailman-Approved-At: Tue, 27 Sep 2011 17:00:53 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82356 Archived-At: Hi all, I am a novice programming in Emacs Lisp. My question : I dit this program : (defun coins (n) (let ((i n) (repartition [0 0 0]) (c1 0) (c2 0) (r 0)) (while (> i 0) (setq c1 (random 2)) (setq c2 (random 2)) (setq r (+ c1 c2)) (aset repartition r (1+ (aref repartition r))) (setq i (- i 1))) (message " repartition %s " repartition))) aim : you toss two coins, count tails : 0 or 1 or 2. Repeat 10 times or more and see what happens. If I evaluate this program with C-x C-e and do (coins 10) C-x C-e it works fine, I get some thing like [3 5 2]. But if I repeat C-x C-e after (coins 10) I get some thing like [5 11 4] then [9 15 6] ... I can't understand that ! Could some one help me ? Roland Thiers Noumea New Caledonia roland dot thiers at canl dot nc