implement main
open core
classpredicates
print_one:(string*)determ.
clauses
run():-
console::init(),
succeed(),
print_one(["frank","leonard","Tedd"]). % place your own code here :cry:
print_one([]):-!.
print_one([I1,I2,I3]):-
stdIO::write(I1),_= stdIO::readChar().
end implement main
this code shows one error, someone could help me to solve this.
print_one([]):-!.
print_one([I1|T]):-% process first item in list
stdIO::write(I1)= stdIO::readChar(),% I don't understand what this is trying to do. Are you trying to output a list item and then have the user enter it back in and test if they match or are you trying to pass the list item value to another predicate?% pass the rest of the list back to this predicate.
print_one(T). % this will allow N list entries to process.
Thanks for read my post and your help.
Certainly, your prediction is correct, actually I need to send or pass four parameters, from one predicate to another (just 5 predicates, like overloading) and then return a result (phrase), depending of the parameters sent (as a parameter list).
Because this, I need to pass the parameters and use all them at the same time, and no recursively.
The problem with your code is that you only handle lists of certain lengths: empty and with three elements. But your code must handle all lists to be a procedure.