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.devel Subject: Re: Guile Assembler Date: Tue, 23 Jun 2015 23:00:19 +0200 Message-ID: References: <1435040921.1695.4.camel@Renee-desktop.suse> <20150623091251.GA19575@tuxteam.de> <1435051196.1695.13.camel@Renee-desktop.suse> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bf1981896c147051935ad41 X-Trace: ger.gmane.org 1435093232 27845 80.91.229.3 (23 Jun 2015 21:00:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jun 2015 21:00:32 +0000 (UTC) Cc: guile-devel To: Barry Fishman Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 23 23:00:32 2015 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 1Z7VIx-0002P8-7D for guile-devel@m.gmane.org; Tue, 23 Jun 2015 23:00:27 +0200 Original-Received: from localhost ([::1]:47409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7VIw-0006Qt-Fz for guile-devel@m.gmane.org; Tue, 23 Jun 2015 17:00:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7VIs-0006Nk-Sk for guile-devel@gnu.org; Tue, 23 Jun 2015 17:00:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7VIr-00080r-MR for guile-devel@gnu.org; Tue, 23 Jun 2015 17:00:22 -0400 Original-Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:35424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7VIr-0007zs-DE for guile-devel@gnu.org; Tue, 23 Jun 2015 17:00:21 -0400 Original-Received: by wgbhy7 with SMTP id hy7so19964478wgb.2 for ; Tue, 23 Jun 2015 14:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YYn1Gyhk2oZyWAKQ9ADTrjhok6E34wCn+jkpsr1VzFU=; b=V2Y6IpEZ1TZ81MkKiL0odzRO5OPcS0/DmTr6UAEosvutyvDsXJhROjvGqqHQmVuHAk NFR7+4yXJpLeVtpIPQum6uTRn4hHKoTs/4upNBvJEa/P2du5Zfpnhl5WpLZaQKzflYWK nXTleR53tncubxKxVrFHNajh6zOs2ZjxE35bf1DKd15vSsdnJ5UAWAC1xKdGkYGdBIaw zPJae6XIolQC1DqM/iY9EQ8p8TsXA8DlGD4lHnLgbYvJlIkPBAooOjrcgK6xy7kjz36V Fe9lUgtoCNePl02vJpSAGJOVjYAD26dN1GuoaDDoH0wh+HESwZHfq+mQ1tqJFg0wJz7Y Gp2g== X-Received: by 10.194.88.69 with SMTP id be5mr55075325wjb.149.1435093219850; Tue, 23 Jun 2015 14:00:19 -0700 (PDT) Original-Received: by 10.194.47.207 with HTTP; Tue, 23 Jun 2015 14:00:19 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::234 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:17746 Archived-At: --047d7bf1981896c147051935ad41 Content-Type: text/plain; charset=UTF-8 2015-06-23 14:54 GMT+02:00 Barry Fishman : > > On 2015-06-23 17:19:56 +0800, Nala Ginrut wrote: > > On Tue, 2015-06-23 at 11:12 +0200, tomas@tuxteam.de wrote: > >> What does number/base do? Does it change the read syntax of numbers? > >> > > > > I think it defines a function (number/base base) first, then use it as > > argument of the outer function... > > > > http://docs.racket-lang.org/reference/define.html > > > > How is this syntax macro style improve on a more direct and simple > standard scheme implementation of: > > (define (number/base base) > (lambda (lst) > (let loop ((digits lst) > (accumulator 0)) > (if (null? digits) > accumulator > (loop (cdr digits) > (+ (car digits) (* accumulator base))))))) > > I think it's the same improvement as between your version and the even more "direct and simple" standard scheme implementation: (define number/base (lambda (base) (lambda (lst) (let loop ((digits lst) (accumulator 0)) (if (null? digits) accumulator (loop (cdr digits) (+ (car digits) (* accumulator base)))))))) (And using obscure names such as "car" and "cdr" in the code doesn't enhance readability either) This amalgam of 'match' and 'define-syntax's style '...', and > 'destructuring-bind' syntax just seems to add complexity to a language > whose prime benefit is the clarity of its explicitness and lack of > syntax. > I agree that the presence of ellipsis in the pattern matcher is dubious. On the other hand, since it's already there, it allows to make it clear to the reader that a given argument is meant to be a list. OTOH I see that it wasn't much of a problem for you to understand the code. Best regards M. --047d7bf1981896c147051935ad41 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
2015= -06-23 14:54 GMT+02:00 Barry Fishman <barry_fishman@acm.org>:

On 2015-06-23 17:19:56 +0800, Nala Ginrut wrote:
> On Tue, 2015-06-23 at 11:12 +0200, tomas@tuxteam.de wrote:
>> What does number/base do? Does it change the read syntax of number= s?
>>
>
> I think it defines a function (number/base base) first, then use it as=
> argument of the outer function...
>
> http://docs.racket-lang.org/reference/define.h= tml
>

How is this syntax macro style improve on a more direct and sim= ple
standard scheme implementation of:

(define (number/base base)
=C2=A0 (lambda (lst)
=C2=A0 =C2=A0 (let loop ((digits lst)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(accumulator 0))
=C2=A0 =C2=A0 =C2=A0 (if (null? digits)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 accumulator
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (loop (cdr digits)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (+ (car digits) (* = accumulator base)))))))


I think it's the same improvement = as between your version and the even more "direct and simple" sta= ndard scheme implementation:

(define number/base
=C2=A0 (lambda (base)
=C2=A0 =C2=A0 (lambda (lst)
<= div>=C2=A0 =C2=A0 =C2=A0 =C2=A0(let loop ((digits lst)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (accumul= ator 0))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (null? digits)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0accumulator
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(loop (cdr digits)
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(+ (car digits) (* accumulator base))))))))

= (And using obscure names such as "car" and "cdr" in the= code doesn't enhance readability either)

This amalgam of 'match' and 'define-syntax's style '...= ', and
'destructuring-bind' syntax just seems to add complexity to a langu= age
whose prime benefit is the clarity of its explicitness and lack of
syntax.

I agree that the presence of el= lipsis in the pattern matcher is dubious. On the other hand, since it's= already there, it allows to make it clear to the reader that a given argum= ent is meant to be a list.

OTOH I see that it wasn= 't much of a problem for you to understand the code.

Best regards
M.

--047d7bf1981896c147051935ad41--