Question: Write prolog code that removes the quotes from a char: This is my attempt: % removes the quotes from an atom removeQuotes ( QuotedAtom ,
Write prolog code that removes the quotes from a char:
This is my attempt:
removes the quotes from an atom
removeQuotesQuotedAtom Atom :
atomcharsQuotedAtomChars Check if QuotedAtom starts with a single quote
appendInnerChars Chars Remove the last single quote
atomcharsAtom InnerChars Convert the list of characters back to an atom
Cut to prevent backtracking
removeQuotesAtom Atom If QuotedAtom is not quoted, leave it unchanged
The terminal responds with:
removeQuotesaR
R a
removeQuotesR
R
The problem is removeing from a number. How do we remove the quotes from a atom that has a char in it so The code should be able to handle the atom in and respond with R in
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
