public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Andrea Bernardini <andrebask@gmail.com>
Cc: Kawa mailing list <kawa@sourceware.org>
Subject: Re: list comprehension patterns
Date: Sat, 20 May 2017 21:03:00 -0000	[thread overview]
Message-ID: <1081fbfb-a9f0-360a-8694-925d466640a3@bothner.com> (raw)
In-Reply-To: <CAPFJfsv1_Btp77Mzo2LZDrNeFSEy95x3tgO8m8VVeT9qKg5_uA@mail.gmail.com>

On 05/18/2017 03:58 PM, Andrea Bernardini wrote:
> Quite interesting article, I found some minor typos/issues
> 
> * Where you say Kawa-specific "|" do you mean Kawa-specific "!" ?
> 
> * There is a repetition in this sentence "A "scan context" is is an expression"
> 
> * "and then result sequence is "spliced" into its context." You meant
> "and the result"?

Oops.  Fixed.

> * Another repetition and the sentence is not completely clear "When in
> the scope of two more more distinct scan variables then are scanned
> "in parallel""

Re-phrased.

> Regarding the hypothetical filtering syntax
> 
> (! [a ...] A #!if (P a))
> 
> what about using one of 'when', the first is inspired by the single
> branch if in Racket (where the 'if' keyword is replaced by when).
> 
> (! [a ...] A when (P a))
> 
> Also 'where' or 'on' could be possibilities.

Yes, those are all possible.  Note that Scheme generally does not use
identifiers this way, with rare exceptions (such as 'else' in 'case').
We also have to be careful about parser ambiguities, as well as robustness
when it comes to errors.

I think the decision will come down to what filtering syntax
works best with cross product.

> The ellipsis syntax is nice, however when more scan patterns are
> nested together can be confusing, have you considered using two dots
> instead of three
> 
> #|kawa:31|# (define (fun2 [[x ..] ..] [y ..])
> #|.....32|#   [[(+ x y) ..] ..])

I don't think that helps any.  The key thing to note is that we're using '...'
*exactly* the way '...' is used in R5RS syntax patterns and templates
(except not in a macro-definition context, of course).  So using '...'
makes a lot of sense.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

  reply	other threads:[~2017-05-20 21:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 17:00 Per Bothner
2017-05-17 23:31 ` Sudarshan S Chawathe
2017-05-20 20:56   ` Per Bothner
2017-05-18 22:58 ` Andrea Bernardini
2017-05-20 21:03   ` Per Bothner [this message]
2017-05-19 15:38 ` Helmut Eller
2017-05-20 20:09   ` Per Bothner

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

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

  git send-email \
    --in-reply-to=1081fbfb-a9f0-360a-8694-925d466640a3@bothner.com \
    --to=per@bothner.com \
    --cc=andrebask@gmail.com \
    --cc=kawa@sourceware.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).