[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scheme max/min in c++
From: |
Mark Knoop |
Subject: |
Re: scheme max/min in c++ |
Date: |
Fri, 19 Aug 2016 13:58:06 +0100 |
At 13:56 on 19 Aug 2016, David Kastrup wrote:
>Mark Knoop <address@hidden> writes:
>> Just trying out some more ideas for the keep-alive-together-engraver.
>> How do I use the Guile max/min functions on a scheme list in C++? I
>> have tried this:
>
>Well...
>
> 5.5.2.11 Arithmetic Functions
> .............................
>
> The C arithmetic functions below always takes two arguments, while
> the Scheme functions can take an arbitrary number. When you need to
> invoke them with just one argument, for example to compute the
> equivalent od `(- x)', pass `SCM_UNDEFINED' as the second one:
> `scm_difference (x, SCM_UNDEFINED)'.
>
>[...]
>
> -- Scheme Procedure: max x1 x2 ...
> -- C Function: scm_max (x1, x2)
> Return the maximum of all parameter values.
>
>Most notable, scm_max is a C function, not a Scheme function (which
>would be of type SCM itself). You cannot pass it to scm_apply_0.
Thanks David for the pointers.
>If you really, really want to use the Scheme function, however, ...
I have no particular desire to use the Scheme function, but was just
looking for the most elegant way to do this. Would it perhaps be better
to convert to C types?
--
Mark Knoop