Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package jason.stdlib;

Internal action: .atom.

Description: checks whether the argument is an atom (a structure with arity 0), for example "p". Numbers, strings, and free variables are not atoms.


  • + arg (any term): the term to be checked.


  • .atom(b(10)): false.
  • .atom(b): true.
  • .atom(~b): false.
  • .atom(10): false.
  • .atom("home page"): false.
  • .atom(X): only true if X is bound to an atom.
  • .atom(a(X)): false.
  • .atom(a[X]): false.
  • .atom([a,b,c]): false.
  • .atom([a,b,c(X)]): false.

public class atom extends DefaultInternalAction {
    private static InternalAction singleton = null;
    public static InternalAction create() {
        if ( == null
             = new atom();
        return ;
    @Override public int getMinArgs() { return 1; }
    @Override public int getMaxArgs() { return 1; }
    public Object execute(TransitionSystem tsUnifier unTerm[] argsthrows Exception {
        return args[0].isAtom();
New to GrepCode? Check out our FAQ X