I have a list
L = [-n,-b,-s]
How do i get a list with
L = [n,b,s]
Is there a built in predicate to do this?.
I have a list
L = [-n,-b,-s]
How do i get a list with
L = [n,b,s]
Is there a built in predicate to do this?.
Yes! meta-predicate maplist/3
can handle the recursive part for you, but you have to customize it by declaring what the mapping of a single list element should be like.
minus_stripped(-X, X).
Sample query:
?- maplist(minus_stripped, [-n,-b,-s], Xs).
Xs = [n,b,s].