guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCM_CALL_N


From: Neil Jerram
Subject: Re: SCM_CALL_N
Date: 24 Jun 2001 11:45:28 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Keisuke" == Keisuke Nishida <address@hidden> writes:

    Keisuke> I guess the reason for using scm_listofnull is to reduce
    Keisuke> consing.

    Keisuke> The following two expressions are equivalent

    Keisuke>   scm_apply (proc, SCM_LIST1 (arg1), SCM_EOL);

    Keisuke>   scm_apply (proc, arg1, scm_listofnull);

    Keisuke> except that the former conses a cell.

Thanks for explaining (yourself and Dirk too).  I see now that some of
the complication arises because scm_apply is used in C to achieve the
equivalent of both
        (func arg1 arg2 ...)
and
        (apply func arg1 arg2 ...)
and because Scheme `apply' has to handle both a variable number of
arguments and its last argument being a list of arguments.

    Keisuke> I thought the SCM_CALL_N macros are good because they
    Keisuke> abstract the actual calls.  I think this is good as long
    Keisuke> as we know what they do exactly.

Yes, on reflection, I now agree with you.  Perhaps SCM_APPLY_N would
also be useful, where SCM_APPLY_N is defined to take N arguments and a
final list argument:

        SCM_APPLY_N (proc, arg1, ..., argN, args)
        ->
        (apply proc arg1 ... argN args)

Then SCM_CALL_N and SCM_APPLY_N would completely encapsulate the
optimization use of scm_listofnull, I think.

Regards,
        Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]