From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: Repeat syntax Date: Sat, 25 Nov 2017 06:47:38 -0800 Message-ID: References: <1511586326.26826.3.camel@qlfiles.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1511621298 2723 195.159.176.226 (25 Nov 2017 14:48:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 25 Nov 2017 14:48:18 +0000 (UTC) Cc: Guile User Mailing List To: Christopher Howard Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Nov 25 15:48:05 2017 Return-path: Envelope-to: guile-user@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 1eIbkT-00088D-5c for guile-user@m.gmane.org; Sat, 25 Nov 2017 15:48:05 +0100 Original-Received: from localhost ([::1]:53390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIbkY-00076o-55 for guile-user@m.gmane.org; Sat, 25 Nov 2017 09:48:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIbkA-00076Y-D4 for guile-user@gnu.org; Sat, 25 Nov 2017 09:47:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIbk5-0000N7-Of for guile-user@gnu.org; Sat, 25 Nov 2017 09:47:46 -0500 Original-Received: from mail-pg0-x22a.google.com ([2607:f8b0:400e:c05::22a]:40569) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eIbk5-0000MY-H5 for guile-user@gnu.org; Sat, 25 Nov 2017 09:47:41 -0500 Original-Received: by mail-pg0-x22a.google.com with SMTP id u3so16826249pgn.7 for ; Sat, 25 Nov 2017 06:47:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=nDq4PdbnklJLi1lI0aFjn+h5bQ4PQ1nLaiB18yYrQUo=; b=V8SWGFJbwXadAvUXSd1qrGmj7StFd8sz3X3RnV/JMG8Yql4EHoN7ji88dIXBMyZgKz Heb3RcjOr16F+OAxztBbY+VGhqcZIls37YmwYwz50s36qSNdix0B3BOQALLSBOQ5Fx8C AV+1t9/Hdi0FhM77MBz3TQrtfcqGYtpcF0rcKMJD2MW4LFtztZfjtuFx406D41ya3gzn wq9scQV0ZuQFVBxeq0VycEm9URIwWX/UeTTn25cotEdgbOmuEPBoyiVaykV3ManIPvZE Wg6U0fvjFRZ2dy5ZdHaLbOqRpICID8KAlUD1gibYEOyjuMvjFx3QJ1vOkxvgNOBZFye4 1EoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=nDq4PdbnklJLi1lI0aFjn+h5bQ4PQ1nLaiB18yYrQUo=; b=ZbSBeZwHWeXH6yZzE/MpCpq0/SDNxefOHLDiESWyUO0tWvVK025ZqoSb6a0URqejCo FGw9zrYRauy+GQn+nfWPoH3Q2UAYg1o0hISdPI6Fw4ywu7X+b7+AUlvvoQRF4lA9WaQO TKBrweSKlKheaqMTQnXXJ62uaTAWUdO0Y4u/Np6rnHYMDJH+LLvWKK7D3viA0t1K50hi +UJ8SevWAMzGNCmvl1CyQnmWnfxzZqqzVrHbZIz3QiDcTdiTBqs2FT7y2xTXPZb5tmcz U21gtnZ/ce7yPLhn8+dcVxPM1v1t8CKc0E6CfsAxhOJy08d1gFIqPPcqLSuhs7YIggLZ GONg== X-Gm-Message-State: AJaThX5s2/UgGEj5OTY4Jz27fj+YHCwBfmg+FoV93QCZM4cbsoF/VpAY suunJBuLcZtK+LpkPmm9B7kCbpo9 X-Google-Smtp-Source: AGs4zMYDU5VQdDk5PtO5TqYAGrN117Zl3CDSeNZ//L4J+tGUUZhuDQf3DsBaz7xSIsV+nmL/bMU7DQ== X-Received: by 10.98.75.68 with SMTP id y65mr11498322pfa.78.1511621260151; Sat, 25 Nov 2017 06:47:40 -0800 (PST) Original-Received: from nautilus.championbroadband.com (216-165-229-229.championbroadband.com. [216.165.229.229]) by smtp.gmail.com with ESMTPSA id t2sm46785390pfk.90.2017.11.25.06.47.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Nov 2017 06:47:39 -0800 (PST) In-Reply-To: <1511586326.26826.3.camel@qlfiles.net> X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22a X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14288 Archived-At: > On Nov 24, 2017, at 9:05 PM, Christopher Howard = wrote: >=20 > Hi list, I want to have a function >=20 > (repeat n exp exp* ...) >=20 > That calls the expressions n times for side effect, like for-each, but > without the bother of dealing with a list. It seems like somebody else > must have thought of this before, but I couldn't find the equivalent > procedure. After reading 6.10.2 I came up with this >=20 > (define-syntax repeat > (syntax-rules (repeat) > ((_ n exp exp* ...) > '(unless (<=3D n 0) > exp > exp* > ... > (repeat (- n 1) exp exp* ...))))) >=20 > Which doesn't work I think because repeat gets expanded infinitely = many > times. I was pondering other ways to do this, but they all seem to end > in either infinite expansion, or an important variable getting > overshadowed. So, could somebody point me in the right direction? >=20 > --=20 > https://emailselfdefense.fsf.org/en/ you probably want named let ((_ n exp exp* ...) (let loop ((n n)) (unless (<=3D n 0) exp exp* ... (loop (1- n)))