27 lines
1.1 KiB
C
27 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_lstmap.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2016/12/04 19:18:15 by gtertysh #+# #+# */
|
||
|
/* Updated: 2016/12/06 18:08:53 by gtertysh ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem))
|
||
|
{
|
||
|
t_list *new;
|
||
|
|
||
|
new = NULL;
|
||
|
if (lst && f)
|
||
|
{
|
||
|
new = f(lst);
|
||
|
new->next = ft_lstmap(lst->next, f);
|
||
|
}
|
||
|
return (new);
|
||
|
}
|