unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: Hans Aberg <haberg-1@telia.com>
Cc: guile-user@gnu.org
Subject: Re: Backquote simplification
Date: Sat, 11 Dec 2010 00:25:19 +0000	[thread overview]
Message-ID: <878vzxqhow.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <82C5B00A-68C2-4FB9-8C99-8E705B6B4312@telia.com> (Hans Aberg's message of "Sat, 11 Dec 2010 01:03:48 +0100")

Hans Aberg <haberg-1@telia.com> writes:

> The reply I got was helpful, but I decided to settle for a macro
> implementation:
>
> (use-syntax (ice-9 syncase))
>
> (define-syntax tuple
>   (syntax-rules ()
>     ((tuple xs ...)
>      `(tuple ,xs ...))
>     ((tuple x1 x2 . y)
>      (append `(tuple ,x1 ,x2) y))
>     ((tuple x1 . y)
>      (append `(tuple ,x1) y))
> ))

OK, I roughly see that this solves your problem of wanting to unquote an
arbitrary number of list elements.  (Although I don't understand why you
need to do that.)

> It behaves as I want in my context, a functional language on top of
> Guile.

Scheme is already a functional language, isn't it?

> I decided to implement the construct (lambda (x_1 ... x_k . y)
> f)

What syntax is that expression in?  In Scheme syntax, it's a lambda that
returns a value that is apparently unrelated to any of the arguments,
and so could equally well be written as (lambda ignored-args f).

> using an improper list (x_1 ... x_k . y); when it is a proper list,
> one just gets the fixed number of arguments construct.
>
> Then the object (x_1 ... x_k . y) also become available, so it is
> possible to form
>   (define f (lambda (x_1 ... x_k . y) (x_1 ... x_k . y)))

How is this different from 

  (define f (lambda args args))

?

> Then one would expect f(a_1, ..., a_n), for n >= k, to be (a_1, ...,
> a_n) - this a form of the identity.
>
> So to get this effect, I need a function g that can call improper
> lists (g x_1, ..., x_k . y), where y is a list.

As Dan pointed out, that is not an improper list.  It's a proper list.

In the hope that these questions might be useful to at least one of us...

        Neil



  reply	other threads:[~2010-12-11  0:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09 11:00 Backquote simplification Hans Aberg
     [not found] ` <CCCBC725-4AE9-4585-B18D-7DF6650D5880@mac.com>
2010-12-09 19:44   ` Hans Aberg
2010-12-10 23:12     ` Neil Jerram
2010-12-11  0:03       ` Hans Aberg
2010-12-11  0:25         ` Neil Jerram [this message]
2010-12-11  8:33           ` Hans Aberg
2010-12-11 10:01             ` Neil Jerram
2010-12-11 10:09               ` Hans Aberg

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=878vzxqhow.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@gnu.org \
    --cc=haberg-1@telia.com \
    /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).