Package hydra.lisp.syntax
Class LetExpression
- java.lang.Object
-
- hydra.lisp.syntax.LetExpression
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<LetExpression>
public class LetExpression extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<LetExpression>
Local variable bindings. Serializes as (let [x 1 y 2] body) in Clojure (always sequential), (let ((x 1) (y 2)) body) or (let* ...) in other dialects- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLetExpression.BuilderA fluent builder forLetExpression.
-
Field Summary
Fields Modifier and Type Field Description java.util.List<LetBinding>bindingsThe variable bindingsstatic NameBINDINGSName of thehydra.lisp.syntax.LetExpression.bindingsfield.java.util.List<Expression>bodyThe body expressionsstatic NameBODYName of thehydra.lisp.syntax.LetExpression.bodyfield.LetKindkindThe kind of let (parallel or sequential)static NameKINDName of thehydra.lisp.syntax.LetExpression.kindfield.static NameTYPE_Name of thehydra.lisp.syntax.LetExpressiontype.
-
Constructor Summary
Constructors Constructor Description LetExpression(LetKind kind, java.util.List<LetBinding> bindings, java.util.List<Expression> body)Constructs an immutableLetExpression.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LetExpression.Builderbuilder()Creates a new fluent builder forLetExpression.intcompareTo(LetExpression other)booleanequals(java.lang.Object other)inthashCode()java.lang.StringtoString()LetExpressionwithBindings(java.util.List<LetBinding> bindings)Returns a copy of thisLetExpressionwithbindingsreplaced.LetExpressionwithBody(java.util.List<Expression> body)Returns a copy of thisLetExpressionwithbodyreplaced.LetExpressionwithKind(LetKind kind)Returns a copy of thisLetExpressionwithkindreplaced.
-
-
-
Field Detail
-
TYPE_
public static final Name TYPE_
Name of thehydra.lisp.syntax.LetExpressiontype.
-
KIND
public static final Name KIND
Name of thehydra.lisp.syntax.LetExpression.kindfield.
-
BINDINGS
public static final Name BINDINGS
Name of thehydra.lisp.syntax.LetExpression.bindingsfield.
-
BODY
public static final Name BODY
Name of thehydra.lisp.syntax.LetExpression.bodyfield.
-
kind
public final LetKind kind
The kind of let (parallel or sequential)
-
bindings
public final java.util.List<LetBinding> bindings
The variable bindings
-
body
public final java.util.List<Expression> body
The body expressions
-
-
Constructor Detail
-
LetExpression
public LetExpression(LetKind kind, java.util.List<LetBinding> bindings, java.util.List<Expression> body)
Constructs an immutableLetExpression.- Parameters:
kind- The kind of let (parallel or sequential)bindings- The variable bindingsbody- The body expressions
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(LetExpression other)
- Specified by:
compareToin interfacejava.lang.Comparable<LetExpression>
-
withKind
public LetExpression withKind(LetKind kind)
Returns a copy of thisLetExpressionwithkindreplaced.
-
withBindings
public LetExpression withBindings(java.util.List<LetBinding> bindings)
Returns a copy of thisLetExpressionwithbindingsreplaced.
-
withBody
public LetExpression withBody(java.util.List<Expression> body)
Returns a copy of thisLetExpressionwithbodyreplaced.
-
builder
public static LetExpression.Builder builder()
Creates a new fluent builder forLetExpression.
-
-