Package jason.stdlib

Class suffix

All Implemented Interfaces:
InternalAction, Serializable

@Manual(literal=".suffix(suffix,list)", hint="checks if some list is a suffix of other list, backtracking all free variables", argsHint={"the suffix to be checked","the list where the suffix is from"}, argsType={"list","list"}, examples=".suffix([c],[a,b,c]): true.suffix([a,b],[a,b,c]): false.suffix(X,[a,b,c]): unifies X with any suffix of the list, i.e., [a,b,c], [b,c], [c], and [] in this order", seeAlso={"jason.stdlib.concat","jason.stdlib.length","jason.stdlib.sort","jason.stdlib.nth","jason.stdlib.max","jason.stdlib.min","jason.stdlib.reverse","jason.stdlib.prefix","jason.stdlib.sublist","jason.stdlib.difference","jason.stdlib.intersection","jason.stdlib.union"}) public class suffix extends DefaultInternalAction

Internal action: .suffix(S,L).

Description: checks if some list or string S is a suffix of list/string L. If S has free variables, this internal action backtracks all possible values for S.

Parameters:

  • +/- suffix (list or string): the suffix to be checked.
  • + list (list or string): the list where the suffix is from.

Examples:

  • .suffix([c],[a,b,c]): true.
  • .suffix([a,b],[a,b,c]): false.
  • .suffix(X,[a,b,c]): unifies X with any suffix of the list, i.e., [a,b,c], [b,c], [c], and [] in this order.
  • .suffix("c","abc"): true.
  • .suffix("ab","abc"): false.
  • .suffix(X,"abc"): unifies X with any suffix of the string, i.e., "abc", "bc", "c", and "" in this order.
See Also: