chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Which API to use (llrb)?


From: Jörg F. Wittenberger
Subject: Re: [Chicken-users] Which API to use (llrb)?
Date: Fri, 30 Oct 2015 10:44:06 +0100
User-agent: Mozilla/5.0 (X11; Linux armv7l; rv:31.0) Gecko/20100101 Icedove/31.7.0

Am 29.10.2015 um 20:49 schrieb Dan Leslie:
> Whatever works with the doto macro?

Looks like `doto` expects it's first `var` argument to be mutable and
returns the same reference.  This would argue in favor of the srfi-69
ordering.  (Which is available via the -table API atop.)

However those "binding-set"s are immutable.  To work with the `doto`
macro the latter would have to return the result of the application of
`proc` instead of `var`.


> Sent from my BlackBerry 10 smartphone.
>   Original Message  
> From: Jörg F. Wittenberger
> Sent: Thursday, October 29, 2015 12:47 PM
> To: chicken-users
> Subject: [Chicken-users] Which API to use (llrb)?
> 
> Hi all,
> 
> I did some more refinements to the LLRB-code I recently posted here.
> 
> However I got stuck on the inability to decide which API to use.
> 
> The idea is to have a type "binding-set" (is there a better name?) as an
> alternative t alists.
> 
> However when it comes to `fold` I'm not sure if it is better to follow
> the srfi-1 argument order (combiner-initial-set) or the srfi-69 style
> order (set-combiner-initial).
> 
> At one hand trying to be a "drop-in" for lists it would better not
> change the argument order wrt. srfi-1.
> 
> However the fold procedure from srfi-1 takes two arguments, the element
> (for alists the key-value-pair) and the accumulated value. The fold
> operation for "binding-set" is to be called with three arguments, key,
> value and result-so-far. Just like srfi-69's hash-table-fold.
> 
> Therefore being 100% drop-in is not possible anyway. Therefore it might
> be better to follow to srfi-69 order.
> 
> So which line of reasoning to follow? Which one of the following is
> APIs "better"? Any reasoning I'm not aware of?
> 
> Best
> 
> /Jörg
> 
> 
> A: srfi-69
> 
> <procedure>(binding-set-fold set proc nil)</procedure>
> 
> {{Proc}} must be a procedure of three arguments. It is invoked for
> each element with the key, value and the accumulated value (nil for
> the first element).
> 
> B: srfi-1
> 
> <procedure>(binding-set-fold proc nil set)</procedure>
> 
> {{Proc}} must be a procedure of three arguments. It is invoked for
> each element with the key, value and the accumulated value (nil for
> the first element).
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users
> 




reply via email to

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