On Wed 18 Jan 2012 00:26, Tobias Brandt writes:
>> 0. I'm sure there is another way, but my mind blanks at the moment
>
> After you got me started, I was able to simplify and generalize it a bit.
> (-> is a GOOPS generic accessor I defined elsewhere. It works with
> vectors, arrays, strings, etc
On Wed 18 Jan 2012 04:15, Mark H Weaver writes:
> Should this verify that `obj' is a values object?
>
> Should it verify that `idx' can fit in an inum?
Agreed!
> Also, if `obj' is _not_ a values object and `idx' is 0, should this
> simply return `obj'? Since a single value is conceptually no d
Hi Mark,
Mark H Weaver skribis:
> Julian Graham writes:
>> +SCM
>> +scm_c_value_ref (SCM obj, size_t idx)
>> +{
>> + SCM values = scm_struct_ref (obj, SCM_INUM0);
>> + return scm_list_ref (values, SCM_I_MAKINUM (idx));
>> +}
>> +
>
> Should this verify that `obj' is a values object?
>
> Shoul
Hi all,
Thanks for the review!
On Wed, Jan 18, 2012 at 3:19 PM, Ludovic Courtès wrote:
> Julian: could you change these bits and send an updated patch?
Will do.
Regards,
Julian
l...@gnu.org (Ludovic Courtès) writes:
> Mark H Weaver skribis:
>
>> Julian Graham writes:
>>> +SCM
>>> +scm_c_value_ref (SCM obj, size_t idx)
>>> +{
>>> + SCM values = scm_struct_ref (obj, SCM_INUM0);
>>> + return scm_list_ref (values, SCM_I_MAKINUM (idx));
>>> +}
>>> +
>>
>> Should this veri
Hi!
Mark H Weaver skribis:
> l...@gnu.org (Ludovic Courtès) writes:
>
>> Mark H Weaver skribis:
>>
>>> Julian Graham writes:
+SCM
+scm_c_value_ref (SCM obj, size_t idx)
+{
+ SCM values = scm_struct_ref (obj, SCM_INUM0);
+ return scm_list_ref (values, SCM_I_MAKINUM (i
I think something along these lines be ideal,
though this code is UNTESTED.
Mark
SCM
scm_c_value_ref (SCM obj, size_t idx)
{
if (SCM_VALUESP (obj))
{
SCM values = scm_struct_ref (obj, SCM_INUM0);
size_t i = idx;
while (SCM_LIKELY (!scm_is_null (values)))
{
At Julian's request, I went ahead and pushed my implementation of
`scm_c_value_ref' to the stable-2.0 branch, so it will be in 2.0.4.
Thanks,
Mark