Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package jason.stdlib;

Internal action: .max.

Description: gets the maximum value within a list of terms, using the "natural" order for each type of term. Between different types of terms, the following order is used:
numbers < atoms < structures < lists


  • + list (list): the list where to find the maximum term.
  • +/- maximum (term).


  • .max([c,a,b],X): X unifies with c.
  • .max([b,c,10,g,f(10),5,f(4)],X): X unifies with f(10).
  • .max([3,2,5],2]): false.
  • .max([3,2,5],5): true.
  • .max([],X): false.

public class max extends min {
    private static InternalAction singleton = null;
    public static InternalAction create() {
        if ( == null
             = new max();
        return ;
    protected boolean compare(Term aTerm t) {
        return a.compareTo(t) < 0;
New to GrepCode? Check out our FAQ X