C# Class LSharp.Runtime

The LSharp Runtime
Show file Open project: RobBlackwell/LSharp Class Usage Examples

Public Properties

Property Type Description
EXIT LSharp.Symbol
NIL LSharp.Symbol
PLUS LSharp.Symbol
PLUSPLUS LSharp.Symbol
QUASIQUOTE LSharp.Symbol
T LSharp.Symbol
UNQUOTE LSharp.Symbol
UNQUOTE_SPLICING LSharp.Symbol

Public Methods

Method Description
Add ( IEnumerable args ) : object
AllInt ( IEnumerable args ) : bool

Returns true if all arguments are integers

AllSeq ( IEnumerable args ) : bool
AllString ( IEnumerable args ) : bool

Returns true if all arguments are strings

And ( IEnumerable args, Environment environment ) : bool
Apply ( object f, IEnumerable args, Environment environment ) : object
AsArray ( object list ) : object[]
Boolify ( object o ) : bool

LSharp has a liberal view of true and false, including T NIL and null. This method normalises any object to Boolean true or false.

Bound ( LSharp.Symbol symbol, Environment environment ) : bool
Caar ( object arg ) : Object
Cadr ( object arg ) : Object
Car ( object arg ) : Object
Cddr ( object arg ) : Object
Cdr ( object arg ) : Object
Coerce ( object o, object t ) : object

Changes the type of o to be type t

Compile ( object arg ) : Object
Cons ( object a, object b ) : Object
Disp ( object arg, TextWriter textWriter ) : Object
Divide ( object args ) : Object

(/ numerator denominator+) Divides a numerator by one or more denominators

Do1 ( object args ) : Object
EachLoop ( IEnumerable enumeration, object body, Environment environment ) : object
Err ( object o ) : Object
Eval ( object arg ) : Object
EvalReader ( TextReader textReader, Environment environment ) : Object
EvalString ( string s ) : Object
EvalStrings ( string s ) : Object
ExpandSSyntax ( Object x ) : Object
ForLoop ( int start, int finish, object body, Environment environment ) : object
FromArray ( object os, int skip ) : Pair
GreaterThan ( IEnumerable args ) : Object

(> object1 object2 object*) Returns true if object1 is greater than object2, object2 is greater than object3 and so on.

HasSyntaxChar ( string s ) : bool
Help ( object x, TextWriter writer ) : object
IdFn ( object arg ) : Object
If ( object args, Environment environment ) : object
Inspect ( object o, TextWriter writer ) : object
Is ( object a, object b ) : bool
IsAtom ( object arg ) : bool
IsEmpty ( object arg ) : bool
IsLiteral ( Object o ) : bool
IsNumber ( Object o ) : bool
IsSeq ( object o ) : bool
IsSsyntax ( object x ) : bool
Join ( IEnumerable os ) : ISequence
Join ( ISequence a, ISequence b ) : ISequence
Last ( object arg ) : object
Len ( object arg ) : int
LessThan ( IEnumerable args ) : Object

(< object1 object2 object*) Less than Returns true if object1 is less than object2 and object2 is less than object3 and so on.

List ( IEnumerable args ) : Pair
Load ( string filename ) : Object
Load ( string filename, Environment environment ) : Object
MacroExpand ( object expression, bool once, Environment environment ) : object
MakeFunction ( object parameters, object body, string documentation, Environment environment ) : Function
MakeMacro ( object parameters, object body, string documentation, Environment environment ) : Macro
Map ( Function f, object arg, Environment environment ) : ISequence
Member ( object item, object seq ) : bool
Mod ( object args ) : Object
Multiply ( object args ) : Object

(* number*) Returns the result of multiplying all number arguments

New ( object args ) : Object
Not ( object a ) : bool
Nth ( object arg, int n ) : object

Length

Or ( IEnumerable args, Environment environment ) : bool
Pr ( IEnumerable args, TextWriter textWriter ) : Object
PrintToString ( Object expression ) : string

Changes a Lisp object into the string of characters that READ would need to reconstruct it

Prn ( IEnumerable args, TextWriter textWriter ) : Object
Progn ( object args ) : Object
QuasiQuote ( Object form, Environment environment ) : object
Range ( int start, int finish, int step ) : ISequence
ReadFromString ( string s ) : object
Reduce ( Function f, object arg, Environment environment ) : object
Reference ( object assemblyNames ) : Object
Repl ( ) : void

A Read Eval Print Loop

Runtime ( TextReader textReader, TextWriter writer, TextWriter errorWriter ) : System

Creates a new runtime

Seq ( object o ) : Sequence
StdErr ( ) : TextWriter
StdIn ( ) : TextReader
StdOut ( ) : TextWriter
Str ( IEnumerable xs ) : string
StringAppend ( IEnumerable args ) : string
Subtract ( IEnumerable args ) : Object

(- number*) Subtraction

Time ( object arg, TextWriter textWriter, Environment environment ) : Object
ToList ( object list ) : Pair
Type ( object o ) : Type
TypeOf ( object arg ) : Type
Uniq ( ) : LSharp.Symbol
Using ( IEnumerable n ) : Object
VarRef ( LSharp.Symbol symbol, Environment environment ) : object

Returns the value that symbol is bound to in the given environment

VarSet ( LSharp.Symbol symbol, Object value, Environment environment ) : object

Binds the given symbol to the given value in the given environment

WhileLoop ( object test, object body, Environment environment ) : object
WriteC ( char c, TextWriter textWriter ) : Object

Private Methods

Method Description
Reverse ( object arg ) : object
SequenceLength ( ISequence sequence ) : int

Method Details

Add() public static method

public static Add ( IEnumerable args ) : object
args IEnumerable
return object

AllInt() public static method

Returns true if all arguments are integers
public static AllInt ( IEnumerable args ) : bool
args IEnumerable
return bool

AllSeq() public static method

public static AllSeq ( IEnumerable args ) : bool
args IEnumerable
return bool

AllString() public static method

Returns true if all arguments are strings
public static AllString ( IEnumerable args ) : bool
args IEnumerable
return bool

And() public static method

public static And ( IEnumerable args, Environment environment ) : bool
args IEnumerable
environment Environment
return bool

Apply() public static method

public static Apply ( object f, IEnumerable args, Environment environment ) : object
f object
args IEnumerable
environment Environment
return object

AsArray() public static method

public static AsArray ( object list ) : object[]
list object
return object[]

Boolify() public static method

LSharp has a liberal view of true and false, including T NIL and null. This method normalises any object to Boolean true or false.
public static Boolify ( object o ) : bool
o object
return bool

Bound() public static method

public static Bound ( LSharp.Symbol symbol, Environment environment ) : bool
symbol LSharp.Symbol
environment Environment
return bool

Caar() public static method

public static Caar ( object arg ) : Object
arg object
return Object

Cadr() public static method

public static Cadr ( object arg ) : Object
arg object
return Object

Car() public static method

public static Car ( object arg ) : Object
arg object
return Object

Cddr() public static method

public static Cddr ( object arg ) : Object
arg object
return Object

Cdr() public static method

public static Cdr ( object arg ) : Object
arg object
return Object

Coerce() public static method

Changes the type of o to be type t
public static Coerce ( object o, object t ) : object
o object
t object
return object

Compile() public method

public Compile ( object arg ) : Object
arg object
return Object

Cons() public static method

public static Cons ( object a, object b ) : Object
a object
b object
return Object

Disp() public static method

public static Disp ( object arg, TextWriter textWriter ) : Object
arg object
textWriter System.IO.TextWriter
return Object

Divide() public static method

(/ numerator denominator+) Divides a numerator by one or more denominators
public static Divide ( object args ) : Object
args object
return Object

Do1() public static method

public static Do1 ( object args ) : Object
args object
return Object

EachLoop() public static method

public static EachLoop ( IEnumerable enumeration, object body, Environment environment ) : object
enumeration IEnumerable
body object
environment Environment
return object

Err() public static method

public static Err ( object o ) : Object
o object
return Object

Eval() public method

public Eval ( object arg ) : Object
arg object
return Object

EvalReader() public static method

public static EvalReader ( TextReader textReader, Environment environment ) : Object
textReader TextReader
environment Environment
return Object

EvalString() public method

public EvalString ( string s ) : Object
s string
return Object

EvalStrings() public method

public EvalStrings ( string s ) : Object
s string
return Object

ExpandSSyntax() public static method

public static ExpandSSyntax ( Object x ) : Object
x Object
return Object

ForLoop() public static method

public static ForLoop ( int start, int finish, object body, Environment environment ) : object
start int
finish int
body object
environment Environment
return object

FromArray() public static method

public static FromArray ( object os, int skip ) : Pair
os object
skip int
return Pair

GreaterThan() public static method

(> object1 object2 object*) Returns true if object1 is greater than object2, object2 is greater than object3 and so on.
public static GreaterThan ( IEnumerable args ) : Object
args IEnumerable
return Object

HasSyntaxChar() public static method

public static HasSyntaxChar ( string s ) : bool
s string
return bool

Help() public static method

public static Help ( object x, TextWriter writer ) : object
x object
writer System.IO.TextWriter
return object

IdFn() public static method

public static IdFn ( object arg ) : Object
arg object
return Object

If() public static method

public static If ( object args, Environment environment ) : object
args object
environment Environment
return object

Inspect() public static method

public static Inspect ( object o, TextWriter writer ) : object
o object
writer System.IO.TextWriter
return object

Is() public static method

public static Is ( object a, object b ) : bool
a object
b object
return bool

IsAtom() public static method

public static IsAtom ( object arg ) : bool
arg object
return bool

IsEmpty() public static method

public static IsEmpty ( object arg ) : bool
arg object
return bool

IsLiteral() public static method

public static IsLiteral ( Object o ) : bool
o Object
return bool

IsNumber() public static method

public static IsNumber ( Object o ) : bool
o Object
return bool

IsSeq() public static method

public static IsSeq ( object o ) : bool
o object
return bool

IsSsyntax() public static method

public static IsSsyntax ( object x ) : bool
x object
return bool

Join() public static method

public static Join ( IEnumerable os ) : ISequence
os IEnumerable
return ISequence

Join() public static method

public static Join ( ISequence a, ISequence b ) : ISequence
a ISequence
b ISequence
return ISequence

Last() public static method

public static Last ( object arg ) : object
arg object
return object

Len() public static method

public static Len ( object arg ) : int
arg object
return int

LessThan() public static method

(< object1 object2 object*) Less than Returns true if object1 is less than object2 and object2 is less than object3 and so on.
public static LessThan ( IEnumerable args ) : Object
args IEnumerable
return Object

List() public static method

public static List ( IEnumerable args ) : Pair
args IEnumerable
return Pair

Load() public method

public Load ( string filename ) : Object
filename string
return Object

Load() public static method

public static Load ( string filename, Environment environment ) : Object
filename string
environment Environment
return Object

MacroExpand() public static method

public static MacroExpand ( object expression, bool once, Environment environment ) : object
expression object
once bool
environment Environment
return object

MakeFunction() public static method

public static MakeFunction ( object parameters, object body, string documentation, Environment environment ) : Function
parameters object
body object
documentation string
environment Environment
return Function

MakeMacro() public static method

public static MakeMacro ( object parameters, object body, string documentation, Environment environment ) : Macro
parameters object
body object
documentation string
environment Environment
return Macro

Map() public static method

public static Map ( Function f, object arg, Environment environment ) : ISequence
f Function
arg object
environment Environment
return ISequence

Member() public static method

public static Member ( object item, object seq ) : bool
item object
seq object
return bool

Mod() public static method

public static Mod ( object args ) : Object
args object
return Object

Multiply() public static method

(* number*) Returns the result of multiplying all number arguments
public static Multiply ( object args ) : Object
args object
return Object

New() public static method

public static New ( object args ) : Object
args object
return Object

Not() public static method

public static Not ( object a ) : bool
a object
return bool

Nth() public static method

Length
public static Nth ( object arg, int n ) : object
arg object
n int
return object

Or() public static method

public static Or ( IEnumerable args, Environment environment ) : bool
args IEnumerable
environment Environment
return bool

Pr() public static method

public static Pr ( IEnumerable args, TextWriter textWriter ) : Object
args IEnumerable
textWriter System.IO.TextWriter
return Object

PrintToString() public static method

Changes a Lisp object into the string of characters that READ would need to reconstruct it
public static PrintToString ( Object expression ) : string
expression Object
return string

Prn() public static method

public static Prn ( IEnumerable args, TextWriter textWriter ) : Object
args IEnumerable
textWriter System.IO.TextWriter
return Object

Progn() public static method

public static Progn ( object args ) : Object
args object
return Object

QuasiQuote() public static method

public static QuasiQuote ( Object form, Environment environment ) : object
form Object
environment Environment
return object

Range() public static method

public static Range ( int start, int finish, int step ) : ISequence
start int
finish int
step int
return ISequence

ReadFromString() public static method

public static ReadFromString ( string s ) : object
s string
return object

Reduce() public static method

public static Reduce ( Function f, object arg, Environment environment ) : object
f Function
arg object
environment Environment
return object

Reference() public static method

public static Reference ( object assemblyNames ) : Object
assemblyNames object
return Object

Repl() public method

A Read Eval Print Loop
public Repl ( ) : void
return void

Runtime() public method

Creates a new runtime
public Runtime ( TextReader textReader, TextWriter writer, TextWriter errorWriter ) : System
textReader TextReader
writer System.IO.TextWriter
errorWriter System.IO.TextWriter
return System

Seq() public static method

public static Seq ( object o ) : Sequence
o object
return Sequence

StdErr() public method

public StdErr ( ) : TextWriter
return System.IO.TextWriter

StdIn() public method

public StdIn ( ) : TextReader
return TextReader

StdOut() public method

public StdOut ( ) : TextWriter
return System.IO.TextWriter

Str() public static method

public static Str ( IEnumerable xs ) : string
xs IEnumerable
return string

StringAppend() public static method

public static StringAppend ( IEnumerable args ) : string
args IEnumerable
return string

Subtract() public static method

(- number*) Subtraction
public static Subtract ( IEnumerable args ) : Object
args IEnumerable
return Object

Time() public static method

public static Time ( object arg, TextWriter textWriter, Environment environment ) : Object
arg object
textWriter System.IO.TextWriter
environment Environment
return Object

ToList() public static method

public static ToList ( object list ) : Pair
list object
return Pair

Type() public static method

public static Type ( object o ) : Type
o object
return System.Type

TypeOf() public static method

public static TypeOf ( object arg ) : Type
arg object
return System.Type

Uniq() public static method

public static Uniq ( ) : LSharp.Symbol
return LSharp.Symbol

Using() public static method

public static Using ( IEnumerable n ) : Object
n IEnumerable
return Object

VarRef() public static method

Returns the value that symbol is bound to in the given environment
public static VarRef ( LSharp.Symbol symbol, Environment environment ) : object
symbol LSharp.Symbol
environment Environment
return object

VarSet() public static method

Binds the given symbol to the given value in the given environment
public static VarSet ( LSharp.Symbol symbol, Object value, Environment environment ) : object
symbol LSharp.Symbol
value Object
environment Environment
return object

WhileLoop() public static method

public static WhileLoop ( object test, object body, Environment environment ) : object
test object
body object
environment Environment
return object

WriteC() public static method

public static WriteC ( char c, TextWriter textWriter ) : Object
c char
textWriter System.IO.TextWriter
return Object

Property Details

EXIT public static property

public static Symbol,LSharp EXIT
return LSharp.Symbol

NIL public static property

public static Symbol,LSharp NIL
return LSharp.Symbol

PLUS public static property

public static Symbol,LSharp PLUS
return LSharp.Symbol

PLUSPLUS public static property

public static Symbol,LSharp PLUSPLUS
return LSharp.Symbol

QUASIQUOTE public static property

public static Symbol,LSharp QUASIQUOTE
return LSharp.Symbol

T public static property

public static Symbol,LSharp T
return LSharp.Symbol

UNQUOTE public static property

public static Symbol,LSharp UNQUOTE
return LSharp.Symbol

UNQUOTE_SPLICING public static property

public static Symbol,LSharp UNQUOTE_SPLICING
return LSharp.Symbol