fold


Description:

public IteratorResult fold (IteratorFoldFunction func, ref Value ret)

Folds func over the elements of iter.

That is to say, func will be called as func (object, ret, user_data) for each object in this. The normal use of this procedure is to accumulate the results of operating on the objects in ret.

This procedure can be used (and is used internally) to implement the @foreach and find_custom operations.

The fold will proceed as long as func returns true. When the iterator has no more arguments, DONE will be returned. If func returns false, the fold will stop, and OK will be returned. Errors or resyncs will cause fold to return ERROR or RESYNC as appropriate.

The iterator will not be freed.

Parameters:

this

The Iterator to fold over

func

the fold function

ret

the seed value passed to the fold function

user_data

user data passed to the fold function

Returns:




2022 vala-language.org