I want to add the first element of a list to another list using this:
findall(X, nth1(1, List1, X,), List2).
but it returns false.
Someone knows why?
I want to add the first element of a list to another list using this:
findall(X, nth1(1, List1, X,), List2).
but it returns false.
Someone knows why?
If you get the syntax right (no third comma in
nth1/3) and we put in some concrete lists, then it seems to do what you ask:If you actually have two lists and you're trying to generate a third, then this can work: