unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Panicz Maciej Godek <godek.maciek@gmail.com>
To: Barry Fishman <barry_fishman@acm.org>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Guile Assembler
Date: Tue, 23 Jun 2015 23:00:19 +0200	[thread overview]
Message-ID: <CAMFYt2beX7J_erFG_RLog8huX7r+VX2fL28rqB7HnX3u0KwozA@mail.gmail.com> (raw)
In-Reply-To: <m3k2uuwpog.fsf@barry_fishman.acm.org>

[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]

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 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.

[-- Attachment #2: Type: text/html, Size: 2955 bytes --]

  reply	other threads:[~2015-06-23 21:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 18:32 Guile Assembler Sjoerd van Leent
2015-06-22 20:49 ` Panicz Maciej Godek
2015-06-23  6:28   ` Nala Ginrut
2015-06-23  9:12     ` tomas
2015-06-23  9:19       ` Nala Ginrut
2015-06-23  9:27         ` tomas
2015-06-23  9:30           ` Nala Ginrut
2015-06-23  9:45             ` tomas
2015-06-23 21:33               ` Panicz Maciej Godek
2015-06-24  8:34                 ` tomas
2015-06-24  9:44                   ` Panicz Maciej Godek
2015-06-24 11:59                     ` dsmich
2015-06-24 21:54                     ` Panicz Maciej Godek
2015-09-04  0:54                       ` Mark H Weaver
2015-09-04  9:31                         ` Panicz Maciej Godek
2015-09-04 16:58                           ` Mark H Weaver
2015-06-23 12:54         ` Barry Fishman
2015-06-23 21:00           ` Panicz Maciej Godek [this message]
2015-06-24  2:18             ` Barry Fishman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMFYt2beX7J_erFG_RLog8huX7r+VX2fL28rqB7HnX3u0KwozA@mail.gmail.com \
    --to=godek.maciek@gmail.com \
    --cc=barry_fishman@acm.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).