From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user Subject: Re: map, for-each Date: Thu, 26 Aug 2010 14:19:37 +0200 Message-ID: <87hbihva5i.fsf@ambire.localdomain> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1282825415 18029 80.91.229.12 (26 Aug 2010 12:23:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 26 Aug 2010 12:23:35 +0000 (UTC) Cc: guile-user@gnu.org To: "Eric J. Van der Velden" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Aug 26 14:23:33 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OobUN-0004fe-VX for guile-user@m.gmane.org; Thu, 26 Aug 2010 14:23:30 +0200 Original-Received: from localhost ([127.0.0.1]:52064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OobUM-0004sr-8r for guile-user@m.gmane.org; Thu, 26 Aug 2010 08:23:26 -0400 Original-Received: from [140.186.70.92] (port=58373 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OobUG-0004rv-U1 for guile-user@gnu.org; Thu, 26 Aug 2010 08:23:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OobTz-0000KW-9S for guile-user@gnu.org; Thu, 26 Aug 2010 08:23:04 -0400 Original-Received: from smtp205.alice.it ([82.57.200.101]:53261) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OobTy-0000KC-QV for guile-user@gnu.org; Thu, 26 Aug 2010 08:23:03 -0400 Original-Received: from ambire.localdomain (79.0.68.106) by smtp205.alice.it (8.5.124.08) id 4C1A2645040898BE; Thu, 26 Aug 2010 14:22:59 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.69) (envelope-from ) id 1OobQf-0001dL-Vf; Thu, 26 Aug 2010 14:19:37 +0200 In-Reply-To: (Eric J. Van der Velden's message of "Thu, 26 Aug 2010 13:17:38 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Windows 98 (1) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8102 Archived-At: () "Eric J. Van der Velden" () Thu, 26 Aug 2010 13:17:38 +0200 But the following are ERR, (for-each display 1 3) ; A (for-each display '(1 3) '(1 3)) ; B The arity of the proc (specifically, the "required" portion) must concord with the number of lists passed as arg2... to =E2=80=98for-each=E2=80=99. In this case, the arity of =E2=80=98display=E2= =80=99 is 1. In A, there are two errors: - arg2... are not lists - (count arg2...) =3D> 2, which is not 1 In B, there is only one error: - (count arg2...) =3D> 2, which is not 1 If you: (define (display2 a b) (display a) (display #\space) (display b) (newline)) then substituting it for =E2=80=98display=E2=80=99 in A produces only one error, and in B none. Actually, the above is a simplification: =E2=80=98display=E2=80=99 accepts an optional second arg, a port to send its output to, so one could say that B has an additional error: arg3 is not a list of output ports (this is a type error in some schools). For example, this does not produce an error: (define CO (current-output-port)) (for-each display '(1 3) (list CO CO)) ; C For C, (count arg2...) =3D> 2, which is not 1, but that's ok.