You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It walks down the GSList calling a function for every data element, stopping either when the list is exhausted (in which case it returns NULL) or stopping when the function returns non-NULL and returning that value. It's somewhat like find, I suppose, or forall, but with early termination.
It takes a shallow copy of the list, so the callback can modify the list if it wishes. Since it uses NULL to mean terminate, the list cannot contain NULL values, but I've not found this a problem in practice.
Anyway, another possibility.
The text was updated successfully, but these errors were encountered:
Hello, I also use glib in a somewhat functional style. The most useful primitive I've found is a simple iterator with a function argument:
https://github.com/jcupitt/libvips/blob/master/libvips/iofuncs/util.c#L114
It walks down the GSList calling a function for every data element, stopping either when the list is exhausted (in which case it returns NULL) or stopping when the function returns non-NULL and returning that value. It's somewhat like find, I suppose, or forall, but with early termination.
It takes a shallow copy of the list, so the callback can modify the list if it wishes. Since it uses NULL to mean terminate, the list cannot contain NULL values, but I've not found this a problem in practice.
Anyway, another possibility.
The text was updated successfully, but these errors were encountered: