From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.devel Subject: take! 0==1? Date: Fri, 12 Jul 2013 09:14:45 +0200 Organization: AvatarAcademy.nl Message-ID: <87fvvkz1ui.fsf@nlvehvbe01nb29b.ddns.nl-htc01.nxp.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1373613296 11099 80.91.229.3 (12 Jul 2013 07:14:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Jul 2013 07:14:56 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jul 12 09:14:58 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UxXZB-0007AC-Kf for guile-devel@m.gmane.org; Fri, 12 Jul 2013 09:14:57 +0200 Original-Received: from localhost ([::1]:53640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxXZB-0000bj-3d for guile-devel@m.gmane.org; Fri, 12 Jul 2013 03:14:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxXZ7-0000bQ-Mx for guile-devel@gnu.org; Fri, 12 Jul 2013 03:14:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UxXZ6-0001kj-9C for guile-devel@gnu.org; Fri, 12 Jul 2013 03:14:53 -0400 Original-Received: from smtp-vbr2.xs4all.nl ([194.109.24.22]:3386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UxXZ6-0001kO-0W for guile-devel@gnu.org; Fri, 12 Jul 2013 03:14:52 -0400 Original-Received: from nlvehvbe01nb29b.ddns.nl-htc01.nxp.com.peder.onsbrabantnet.nl (static.ip-80-255-245-177.signet.nl [80.255.245.177]) (authenticated bits=0) by smtp-vbr2.xs4all.nl (8.13.8/8.13.8) with ESMTP id r6C7EoeM036702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 12 Jul 2013 09:14:51 +0200 (CEST) (envelope-from janneke@gnu.org) X-Url: http://AvatarAcademy.nl User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 194.109.24.22 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16526 Archived-At: Hi, Reading the documentation of take! -- Scheme Procedure: take lst i -- Scheme Procedure: take! lst i Return a list containing the first I elements of LST. `take!' may modify the structure of the argument list LST in order to produce the result. its behaviour surpsises me. For list LST, (take! lst 0) leaves LST in the same state as (take! lst 1) does. Worse, the return value suggests that it worked scheme@(guile-user)> (use-modules (srfi srfi-1)) scheme@(guile-user)> (define lst '(a)) scheme@(guile-user)> (take! lst 0) $4 =3D () scheme@(guile-user)> lst $5 =3D (a) scheme@(guile-user)> (take! lst 1) $6 =3D (a) scheme@(guile-user)> lst $7 =3D (a) scheme@(guile-user)> How are you doing such things? Is anyone using take! at all to reduce a list to n elements? Using list-cdr-set! and set!/list-set! also seems a bit clumsy. Greetings, Jan --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20