refresh
This commit is contained in:
		
							parent
							
								
									0de5cde8b8
								
							
						
					
					
						commit
						79818d918a
					
				@ -96,10 +96,10 @@ list_element_t foldl_list(list_t *lst, list_element_t init,
 | 
			
		||||
    list_element_t (*folder)(list_element_t, list_element_t)) {
 | 
			
		||||
list_element_t acc = init;
 | 
			
		||||
 | 
			
		||||
if (lst && folder) {
 | 
			
		||||
for (size_t i = 0; i < lst->length; ++i) {
 | 
			
		||||
acc = folder(acc, lst->elements[i]);
 | 
			
		||||
}
 | 
			
		||||
    if (lst && folder) {
 | 
			
		||||
        for (size_t i = 0; i < lst->length; ++i) {
 | 
			
		||||
            acc = folder(acc, lst->elements[i]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
return acc;
 | 
			
		||||
@ -107,6 +107,22 @@ return acc;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
list_element_t foldr_list(list_t *lst, list_element_t init,
 | 
			
		||||
    list_element_t (*folder)(list_element_t, list_element_t)) {
 | 
			
		||||
list_element_t acc = init;
 | 
			
		||||
 | 
			
		||||
    if (lst && folder) {
 | 
			
		||||
        for (size_t i = lst->length; i > 0; --i) {
 | 
			
		||||
            acc = folder(lst->elements[i - 1], acc);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
return acc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
list_t *reverse_list(list_t *lst) {
 | 
			
		||||
    if (!lst) return NULL;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user