I have a list L created as:
atomic_list_concat(L,' ', 'This is a string').
L = ['This',is,a,string]
Now I want to search an atom in L using member function. I tried :
?- member(' is',L).
L = [' is'|_G268] .
?- member( is,L).
L = [is|_G268] .
What is it that I am doing wrong here?
Although the solution posted by dasblinkenlight is correct, it somewhat breaks the interactive nature of using the Prolog top-level. Typically, you want to base your next query on the previous solution.
For this reason it is possible to reuse top-level bindings by writing
$Var
whereVar
is the name of a variable used in a previous query.In your case:
PS: Notice that you would not get a result when searching for
' is'
since separators are removed byatomic_list_concat/3
.