From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "WJ" Newsgroups: gmane.emacs.help Subject: Re: Python syntax in Lisp and Scheme Date: 2 Dec 2012 09:37:26 GMT Organization: NewsGuy - Unlimited Usenet $19.95 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: ger.gmane.org 1354441219 23347 80.91.229.3 (2 Dec 2012 09:40:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Dec 2012 09:40:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 02 10:40:32 2012 Return-path: Envelope-to: geh-help-gnu-emacs@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 1Tf62F-0006tb-Hf for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Dec 2012 10:40:27 +0100 Original-Received: from localhost ([::1]:57306 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tf623-0004Q3-2W for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Dec 2012 04:40:15 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!enews1 Original-Newsgroups: gnu.emacs.help Original-Lines: 41 Original-NNTP-Posting-Host: p94f06725f986cddcdb80b069976534223705bd7cc4ac7c62b3f342e795831056.newsdawg.com User-Agent: XanaNews/1.18.1.6 X-Antivirus: avast! (VPS 121201-0, 12/01/2012), Outbound message X-Antivirus-Status: Clean X-Received-Bytes: 1683 Original-Xref: usenet.stanford.edu gnu.emacs.help:195696 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88017 Archived-At: Re: Python syntax in Lisp and Scheme Frode Vatvedt Fjeld wrote: > > Scheme > > (define vector-fill! > > (lambda (v x) > > (let ((n (vector-length v))) > > (do ((i 0 (+ i 1))) > > ((= i n)) > > (vector-set! v i x))))) > > > > Python > > def vector_fill(v, x): > > for i in range(len(v)): > > v[i] = x > > > > To me the Python code is easier to read, and I can't possibly fathom > > how somebody could think the Scheme code is easier to read. It truly > > boggles my mind. [..] > > The scheme example can only have been written by someone who is on the > outset determined to demonstrate that sexp-syntax is complicated. This > is how I'd write it in Common Lisp: > > (defun vector-fill (v x) > (dotimes (i (length v)) > (setf (aref v i) x))) > > As you can see, it matches the python example quite closely. Racket: (define vec (vector 2 3 4 5)) (vector-fill! vec 0) vec ==> '#(0 0 0 0) (vector-set*! vec 3 'a 2 'b) vec ==> '#(0 0 b a)