[m-dev.] new higher-order predicates for map/tree234.

David Glen JEFFERY dgj at cs.mu.OZ.AU
Mon Mar 30 16:44:10 AEST 1998


On 30-Mar-1998, Thomas Charles CONWAY <conway at cs.mu.OZ.AU> wrote:
> DJ, can you please review this?
> 
> library/map.m:
> 	added map__foldl/4 and map__map_values/3 which forward to the
> 	corresponding predicates in tree234.
> 
> library/tree234.m:
> 	implement tree234__foldl and tree234__map_values.
> 

[array.m snipped]

> Index: library/map.m
> ===================================================================

Fine, but heed lee's words.

> Index: library/tree234.m
> ===================================================================

Ditto.

> +tree234__foldl(Pred, four(K0, V0, K1, V1, K2, V2, T0, T1, T2, T3), Acc0, Acc) :-
> +	tree234__foldl(Pred, T0, Acc0, Acc1),
> +	call(Pred, K0, V0, Acc1, Acc2),
> +	tree234__foldl(Pred, T1, Acc2, Acc3),
> +	call(Pred, K1, V1, Acc3, Acc4),
> +	tree234__foldl(Pred, T2, Acc4, Acc5),
> +	call(Pred, K2, V2, Acc5, Acc6),
> +	tree234__foldl(Pred, T3, Acc6, Acc).

Gee, all these sequentially numbered accumulators could do with some kind of
syntactic support in the language to make them for concise and maintainable. 

;-)


love and cuddles,
dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
MEngSc student,                 |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list