Package jason.stdlib

Class delete

All Implemented Interfaces:
InternalAction, Serializable

@Manual(literal=".delete(arg0,arg1,arg2[,arg3])", hint="delete elements of strings or lists", argsHint={"if term, this is the element to be removed in the list; if string, this is the substring to be removed; if number, where to start to delete","if arg0 is list/string, the list/string where to delete; if arg0 is number, where to stop to delete","if arg0 is list/string, the list/string with the result of the deletion, if arg0 is number, the list/string where to delete.","if arg0 is number, the list/string with the result of the deletion [present when arg0 is a number]"}, argsType={"term, string, or number","number, list or string","number, list or string","list or string"}, examples={".delete(a,[a,b,c,a],L): L unifies with [b,c]",".delete(a,[a,b,c,a],[c]): false",".delete(0,[a,b,c,a],L): L unifies with [b,c,a]",".delete(1,3,[a,b,c,a],L): L unifies with [a,a]",".delete(\"a\",\"banana\",S): S unifies with \"bnn\"",".delete(0,\"banana\",S): S unifies with \"anana\""}, seeAlso={"jason.stdlib.concat","jason.stdlib.length","jason.stdlib.member","jason.stdlib.sort","jason.stdlib.substring","jason.stdlib.nth","jason.stdlib.max","jason.stdlib.min","jason.stdlib.reverse","jason.stdlib.difference","jason.stdlib.intersection","jason.stdlib.union"}) public class delete extends DefaultInternalAction

Internal action: .delete.

Description: delete elements of strings or lists.

Parameters:

  • + arg[0] (term, string, or number): if term, this arg is the element to be removed in the list (all occurrences of the element will be removed); if string, this arg is the substring to be removed (the second arg should be a string); if number, this arg is the position in the list/string of the element/character to be removed.
  • + arg[1] (list or string): the list/string where to delete.
  • +/- arg[2] (list or string): the list/string with the result of the deletion.
or
  • + arg[0] (number): where to start to delete
  • + arg[1] (number): where to stop to delete
  • + arg[2] (list or string): the list/string where to delete.
  • +/- arg[3] (list or string): the list/string with the result of the deletion.

    Examples:

    • .delete(a,[a,b,c,a],L): L unifies with [b,c].
    • .delete(a,[a,b,c,a],[c]): false.
    • .delete(0,[a,b,c,a],L): L unifies with [b,c,a].
    • .delete(1,3,[a,b,c,a],L): L unifies with [a,a].
    • .delete("a","banana",S): S unifies with "bnn".
    • .delete(0,"banana",S): S unifies with "anana".
  • See Also: