de.cm.frw.core.fun.impl
Class LP
java.lang.Object
de.cm.frw.core.fun.impl.LP
public class LP
- extends java.lang.Object
LP collects some utilities for processing lists in a LISP like fashion in order
to support taking over existing LISP code
- Author:
- cm
Nested Class Summary |
static class |
LP.ConsCell
A functional implementation of an (immutable) cons cell where values for
car and cdr are captured in a closure when the cons cell function is created. |
static class |
LP.ConsPair
Use a ConsCell to implement Pair |
static class |
LP.EmptyConsCell
|
static class |
LP.List
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
car
public static final Function car
cdr
public static final Function cdr
cons
public static final Function cons
- The cons function creates a cons cell with the given objects
list
public static final Function list
- The list function takes 0 or more arguments to form a list
made from cons cells
reduce
public static final Function reduce
append
public static final Function append
filter
public static Function filter
LP
public LP()
mapcan
public static Function mapcan(Function f,
Function lst)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
append
public static LP.ConsCell append(java.util.Collection lists)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
isEmptyList
public static boolean isEmptyList(java.lang.Object stream)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
makeEmptyList
public static java.lang.Object makeEmptyList()
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
car
public static java.lang.Object car(java.lang.Object stream)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
cdr
public static java.lang.Object cdr(java.lang.Object stream)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
listRef
public static java.lang.Object listRef(java.lang.Object stream,
int n)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
iterRef
public static java.lang.Object iterRef(java.lang.Object stream,
int n)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
filter
public static LP.ConsCell filter(Predicate pred,
LP.ConsCell lst)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
keep
public static LP.ConsCell keep(Predicate pred,
LP.ConsCell lst)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
drop
public static LP.ConsCell drop(Predicate pred,
LP.ConsCell lst)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments
cons
public static java.lang.Object cons(java.lang.Object a,
java.lang.Object b)
throws Function.InvalidArguments
- Throws:
Function.InvalidArguments