How to change string to atoms using maplist.
This does not work :
?- maplist(atom_string,["a","b","c"]).
first because atom_string/2 has arity of two (How do you do partial-function//currying in prolog).
But even if partial-fun worked the complication is that the first argument of atom_string is the unknown i.e. the call is :
atom_string(A,"atom")
not :
atom_string("atom",A)
this worked :
?- use_module(library(lambda)).
?- F = \Y^X^(atom_string(X,Y)), maplist(F,["a","b","c"],L).
F = \Y^X^atom_string(X, Y),
L = [a, b, c].
atom_string(A, "atom")
is a problem? SWI-Prolog's documentation for atom_string/2 says that it's bidirectional, and running the query?- atom_string(A, "atom").
I get the expected answerA = atom.
. – Isabelle Newbie