From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Reader syntax for accessing arrays Date: Tue, 23 Aug 2011 01:17:38 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1314055073 27878 80.91.229.12 (22 Aug 2011 23:17:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 22 Aug 2011 23:17:53 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Aug 23 01:17:47 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QvdkW-0004V2-Vr for guile-user@m.gmane.org; Tue, 23 Aug 2011 01:17:45 +0200 Original-Received: from localhost ([::1]:48061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvdkW-0000sh-8u for guile-user@m.gmane.org; Mon, 22 Aug 2011 19:17:44 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:38927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvdkT-0000sa-8a for guile-user@gnu.org; Mon, 22 Aug 2011 19:17:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvdkS-0005gx-4G for guile-user@gnu.org; Mon, 22 Aug 2011 19:17:41 -0400 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:39220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvdkR-0005ek-Pl for guile-user@gnu.org; Mon, 22 Aug 2011 19:17:40 -0400 Original-Received: by vxj3 with SMTP id 3so5504413vxj.0 for ; Mon, 22 Aug 2011 16:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=HODbMQo8hfMeNy0P7OLv3I+Q8aYAwOVcRgosSQol/pI=; b=l26IT+2vzJIoNvYIAGZb0EKx0bRc4P+Lx657GX8xVq2uZQq6xHrMy/qeVuyWtW+zbu bJKHH3g0DhfyLSNR0biATUYQQ/KwFdly0W0IiKDD5xB5nkFWdVhGW3aYgnMR1TKVx80+ 7gKYGO7u2DKNUVAybr02XwWTtOkoTNaTu65uQ= Original-Received: by 10.52.67.72 with SMTP id l8mr403441vdt.87.1314055058808; Mon, 22 Aug 2011 16:17:38 -0700 (PDT) Original-Received: by 10.220.194.136 with HTTP; Mon, 22 Aug 2011 16:17:38 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.169 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8724 Archived-At: Hi, I've noticed that one of the biggest inconveniences of lisp is a very clumsy way of accessing arrays. Having to write (array-set! a (* (array-ref a i j) 2) i j)) seems to be unnecessarily prolix, for in C, language designed specifically to access arrays, the same operation could be written as a[i][j] *= 2; Indeed, LISP is intended for processing lists, but there are certain tasks where dealing with arrays is inevitable. So perhaps it would be a good idea to use square brackets, as it is done in C, to access arrays, so that [a i j] could be understood by the interpreter as (ref-array a i j) where ref-array is the appropriate getter with setter. Therefore I wonder how could this functionality be implemented in guile, or, preferably, in generic R^5RS. [I've heard that R^6RS makes no distinction between [] and ()] Regards Maciek