From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Understanding dotimes skipping by 2 Date: Thu, 27 Sep 2018 14:48:40 -0800 Organization: AkWebsoft Message-ID: <20180927224840.GA2161@mail.akwebsoft.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1538088996 17224 195.159.176.226 (27 Sep 2018 22:56:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Sep 2018 22:56:36 +0000 (UTC) User-Agent: Mutt/1.10.0 (2018-05-17) To: Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 28 00:56:32 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 1g5fCy-0004Ob-K1 for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Sep 2018 00:56:32 +0200 Original-Received: from localhost ([::1]:40177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5fF5-0004oo-5L for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Sep 2018 18:58:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5fEV-0004kW-JD for Help-gnu-emacs@gnu.org; Thu, 27 Sep 2018 18:58:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5f5Q-0007w1-Cr for Help-gnu-emacs@gnu.org; Thu, 27 Sep 2018 18:48:47 -0400 Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:33220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5f5Q-0007uK-4N for Help-gnu-emacs@gnu.org; Thu, 27 Sep 2018 18:48:44 -0400 Original-Received: by linus (Postfix, from userid 1000) id 28E4E240039; Thu, 27 Sep 2018 14:48:40 -0800 (AKDT) Mail-Followup-To: Emacs Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.4.232.191 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:118037 Archived-At: using GNU Emacs 26.1 (GTK+ Version) on ubuntu 14.04 the following code snippet is as follows: (setq l `(1 2 3 4 5 6 7 8 9 0)) (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 thanks -- Tim Johnson http://www.tj49.com