feat(vars): $@ and $* init

This commit is contained in:
william.valenduc 2026-01-24 16:02:37 +00:00
parent 00c2b9c979
commit 32d38c0d13
3 changed files with 74 additions and 6 deletions

View file

@ -107,4 +107,9 @@ int list_find(struct list *list, void *value);
// struct list *list_split(struct list *list, size_t index);
// END PROTO list_split
/**
* @brief: Folds the list from left to right using func and an accumulator.
*/
void list_fold(struct list *list, void *acc, void (*func)(void *, void *));
#endif /* ! LISTS_H */

View file

@ -115,3 +115,13 @@ void list_deep_destroy(struct list *l)
elt = next_elt;
}
}
void list_fold(struct list *list, void *acc, void (*func)(void *, void *))
{
struct list *elt = list;
while (elt != NULL)
{
func(acc, elt->data);
elt = elt->next;
}
}