unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: User perception on backward compatibility
Date: Thu, 21 Jan 2010 20:14:40 +0000	[thread overview]
Message-ID: <87my072p1r.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87fx5zv8gu.fsf@gnu.org> ("Ludovic Courtès"'s message of "Thu, 21 Jan 2010 15:27:45 +0100")

ludo@gnu.org (Ludovic Courtès) writes:

> Hi,
>
> Thien-Thi Nguyen <ttn@gnuvola.org> writes:
>
>> At the moment, i would ask you to look at the guile-user message
>> w/ subject "(define ((f a) b) ...)".
>
> I didn’t reply on the grounds that Andy may have his views on this.  :-)

I think it just needs a bit of define-syntax.

As it happens, the definition of define-public has the required form:

(define-syntax define-public
  (syntax-rules ()
    ((_ (name . args) . body)
     (define-public name (lambda args . body)))
    ((_ name val)
     (begin
       (define name val)
       (export name)))))

and it works:

scheme@(guile-user)> (define-public ((f a) b) (* a b))
scheme@(guile-user)> (f 2)
#<program a117550 (b)>
scheme@(guile-user)> ((f 2) 3)
6

But I completely agree that we want `define' to support that too, `out
of the box'.

What is the correct way of writing something like this in boot-9.scm?

(define-syntax primitive-define define)

(define-syntax define
  (syntax-rules ()
    ((_ (name . args) . body)
     (define name (lambda args . body)))
    ((_ name val)
     (begin
       (primitive-define name val)
       (export name)))))

Regards,
      Neil




  reply	other threads:[~2010-01-21 20:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 10:54 User perception on backward compatibility Ludovic Courtès
2010-01-21 12:42 ` Thien-Thi Nguyen
2010-01-21 14:27   ` Ludovic Courtès
2010-01-21 20:14     ` Neil Jerram [this message]
2010-01-21 15:09 ` Mike Gran
2010-01-21 16:04   ` Ludovic Courtès
2010-01-21 16:57   ` Sergey Poznyakoff
2010-01-22 14:26   ` Peter Brett
     [not found] <cmu-lmtpd-30631-1264093887-1@mail-imap1.uio.no>
2010-01-21 17:36 ` Kjetil S. Matheussen

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=87my072p1r.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.org \
    --cc=ludo@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).