I'm fairly new to prolog and was gven code to modify for homework. However i am stuck with inputting stings. I am aware that strings inputted in prolgo are lists of ascii codes. ie, "abc" = [97, 98, 99]
This is the given code
accept(W) :- start(S), path(S, W).
path(S, []) :- final(S).
path(S, [H|T]) :- arc(S, H, N), path(N, T).
start(1).
final(3).
arc(1, a, 1).
arc(1, b, 2).
arc(2, a, 2).
arc(2, b, 3).
arc(3, a, 3).
This is a nondeterministic machine, with the knowledge of how strings are implemented, it was my assumption that the changing of the arc() facts to something like
arc(1, 97, 1).
arc(1, 98, 2).
arc(2, 97, 2).
arc(2, 98, 3).
arc(3, 97, 3).
would enable me to input a string of a's and b's, but that didnt work, can anyone help me with how i would do so? Thank you