From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marco Wahl Newsgroups: gmane.emacs.help Subject: Re: Understanding dotimes skipping by 2 Date: Fri, 28 Sep 2018 01:14:59 +0200 Organization: Aioe.org NNTP Server Message-ID: <84a7o28rd8.fsf@gmail.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1538090008 20557 195.159.176.226 (27 Sep 2018 23:13:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Sep 2018 23:13:28 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 28 01:13:24 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5fTH-0005GN-JK for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Sep 2018 01:13:23 +0200 Original-Received: from localhost ([::1]:40238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5fVO-0002nj-9a for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Sep 2018 19:15:34 -0400 Original-Path: usenet.stanford.edu!goblin3!goblin2!goblin.stu.neva.ru!news.unit0.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-NNTP-Posting-Host: ESbnWO2keewT5ZTrqCSfLQ.user.gioia.aioe.org Original-X-Complaints-To: abuse@aioe.org Cancel-Lock: sha1:9ctj3HXov18zr9mHZHs/LbOi7NU= X-Notice: Filtered by postfilter v. 0.8.3 Original-Xref: usenet.stanford.edu gnu.emacs.help:223912 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:118038 Archived-At: Tim Johnson writes: > the following code snippet is as follows: > (setq l `(1 2 3 4 5 6 7 8 9 0)) > ;; iterate through a list two elements at a time > (let ((x 0)) > (dotimes (/ (length l) 2) > (progn > (insert (format "%s %s, " (nth x l) (nth (+ x 1) l))) > (setq x (+ x 2))))) > > ;; and below are the results > 1 2, 3 4, 5 6, 7 8, 9 0, nil nil, nil nil, nil nil, nil nil, nil nil, 2 > > I'm confused about the output (nil etc...)which follow the expected numbers. > could someone explain? > P.S. I get the same output without the `progn form Looks like "/" is a variable which gets bound to the values of 0 up to (length l) and the result of the loop is 2. It's in the documentation (C-h f dotimes). HTH -- Marco