lilypond-devel
[Top][All Lists]
Advanced

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

Re: Likely a good frog project for someone with C knowledge


From: David Kastrup
Subject: Re: Likely a good frog project for someone with C knowledge
Date: Wed, 17 Aug 2011 10:33:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Bertrand Bordage <address@hidden> writes:
>
>> 2011/8/17 David Kastrup <address@hidden>
>>
>>     Bertrand Bordage <address@hidden> writes:
>>     
>>     
>>     > This would be great if Han-Wen decides to keep it like that.
>>     > Otherwise there is really a lot of work, with many shortcuts to
>>     > define.
>>     > to_boolean (scm_is_pair (x))
>>     
>>     
>>     That one would be wrong since scm_is_pair already returns a C
>>     boolean.
>>     
>>
>> I was thinking about scm_pair_p ()...
>> This is typically the kind of mistakes that should be solved.
>> Shame on me, I won't do it again.
>>
>> Where did you find SCM_CONSP ?
>> I don't see it in guile's reference. Maybe something to add to the CG
>> ?
>
> Guile reference manual for Guile 1.8, "Pair data".  It is even indexed.
> What version of the Guile manual are you using?  To quote:
>
>    Guile implements pairs by mapping the CAR and CDR of a pair directly
> into the two words of the cell.
>
>  -- Macro: int SCM_CONSP (SCM X)
>      Return non-zero iff X is a Scheme pair object.
>
>  -- Macro: int SCM_NCONSP (SCM X)
>      The complement of SCM_CONSP.

However, I found that as a reasonably dependable heuristic, "functions"
scm_is_* are implemented as macros after all.  That is probably why we
have scm_is_eq, but not scm_is_equal which needs to be done by something
like scm_is_true (scm_equal_p (...)) instead.  Or by ly_is_equal (which
we have).

So here I would just use scm_is_pair and !scm_is_pair.

-- 
David Kastrup




reply via email to

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