GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
chaiscript_prelude_docs.hpp File Reference

Go to the source code of this file.

Classes

class  ChaiScript_Language::Object
 Generic concept of a value in ChaiScript. More...
class  ChaiScript_Language::Map_Pair
 Item returned from a Range object from a Map. More...
class  ChaiScript_Language::Map
 Maps strings to Objects. More...
class  ChaiScript_Language::Container
 A concept implemented by string, Vector and Map. It is convertible to Range, default constructable and back_insertable. More...
class  ChaiScript_Language::string
 ChaiScript representation of std::string. It is an std::string but only some member are exposed to ChaiScript. More...
class  ChaiScript_Language::Range
 A concept in ChaiScript that is implemented by string, Vector and Map. It provides easy iteration over the elements in a container. More...
class  ChaiScript_Language::Const_Range
 A concept in ChaiScript that is implemented by string, Vector and Map. It provides easy iteration over the elements in a container. Contained values are const. More...
class  ChaiScript_Language::Vector
 A vector of Objects. More...
class  ChaiScript_Language::Type_Info
class  ChaiScript_Language::Function
 Represents a function object in ChaiScript. More...

Namespaces

namespace  ChaiScript_Language
 Items in this namespace exist in the ChaiScript language runtime. They are not part of the C++ API.

Functions

string ChaiScript_Language::to_string (Object o)
 Converts o into a string.
void ChaiScript_Language::puts (Object o)
 Prints o to the terminal, without a trailing carriage return. Applies conversions to string automatically.
void ChaiScript_Language::print (Object o)
 Prints o to the terminal, with a trailing carriage return. Applies conversions to string automatically.
class ChaiScript_Language::Function ChaiScript_Language::max (Object a, Object b)
 Returns the max of a or b. Requires that operator>(a, b) exists Equivalent to.
string get_annotation () const
 Returns the annotation description of the function.
int get_arity () const
 Returns the arity of the function, -1 if the function takes a variable number of parameters.
Vector get_contained_functions () const
 Returns a vector of the contained functions.
Function get_guard () const
 Returns a function guard as function.
Vector get_param_types () const
 Returns a vector of Type_Info objects that represent the param types for this function. The first value in the list is the return type.
bool has_guard () const
 Returns true if the function has a guard to it. Always returns false for a conglomerate function.
Object call (Vector t_params) const
 Calls the function with the given set of parameters and returns the value;.
Object ChaiScript_Language::min (Object a, Object b)
 Returns the min of a or b. Requires that operator<(a, b) exists.
bool ChaiScript_Language::even (Object x)
 Returns true if x is an even integer.
void ChaiScript_Language::for_each (Range c, Function f)
 Applies the function f over each element in the Range c.
Object ChaiScript_Language::map (Range c, Function f)
 Applies f over each element in the Range c, joining all the results.
Object ChaiScript_Language::foldl (Range c, Function f, Object initial)
 Starts with the initial value and applies the function f to it and the first element of the Range c. The result is then applied to the second element, and so on until the elements are exhausted.
Numeric ChaiScript_Language::sum (Range c)
 Returns the sum total of the values in the Range c.
Numeric ChaiScript_Language::product (Range c)
 Returns the product of the value in the Range c.
Object ChaiScript_Language::take (Range c, int num)
 Takes num elements from the Range c, returning them.
Object ChaiScript_Language::take_while (Range c, Function f)
 Takes elements from the Range c that match function f, stopping at the first non-match, returning them as a new Vector.
Object ChaiScript_Language::drop (Range c, int num)
 Drops num elements from the Range c, returning the remainder.
Object ChaiScript_Language::drop_while (Range c, Function f)
 Drops elements from the Range c that match f, stopping at the first non-match, returning the remainder.
Object ChaiScript_Language::reduce (Range c, Function f)
 Similar to foldl, this takes the first two elements as its starting values for f. This assumes Range c has at least 2 elements.
Object ChaiScript_Language::filter (Container c, Function f)
 Takes elements from Container c that match function f, return them.
string ChaiScript_Language::join (Range c, string delim)
 Joins the elements of the Range c into a string, delimiting each with the delim string.
Container ChaiScript_Language::reverse (Container c)
 Returns the contents of the Container c in reversed order.
Vector ChaiScript_Language::generate_range (Object x, Object y)
 Generates a new Vector filled with values starting at x and ending with y.
Object ChaiScript_Language::concat (Range x, Range y)
 Returns a new Range with x and y concatenated.
Vector ChaiScript_Language::collate (Object x, Object y)
 Returns a new Vector with x and y as its values.
Vector ChaiScript_Language::zip_with (Function f, Range x, Range y)
 Applies f to elements of x and y, returning a new Vector with the result of each application.
Vector ChaiScript_Language::zip (Range x, Range y)
 Collates elements of x and y, returning a new Vector with the result.
bool ChaiScript_Language::call_exists (Function f,...)
 returns true if there exists a call to the Function f that takes the given parameters
Range ChaiScript_Language::retro (Range)
 Reverses a Range object so that the elements are accessed in reverse.
Const_Range ChaiScript_Language::retro (Const_Range)
 Reverses a Const_Range object so that the elements are accessed in reverse.
void ChaiScript_Language::throw (Object)
 Raises the given object as an exception. Any type of object can be thrown.

Function Documentation

◆ call()

Object max::call ( Vector t_params) const

Calls the function with the given set of parameters and returns the value;.

Example:

eval> `-`.call([2,1]);
1
Here is the caller graph for this function:

◆ get_annotation()

string max::get_annotation ( ) const

Returns the annotation description of the function.

◆ get_arity()

int max::get_arity ( ) const

Returns the arity of the function, -1 if the function takes a variable number of parameters.

Example:

eval> f.get_arity()
1
eval> f2.get_arity()
-1
double f(const std::string &, double, bool) noexcept
Definition profile_cpp_calls_2.cpp:4
int f2(char c)
Definition test.cpp:51
Here is the caller graph for this function:

◆ get_contained_functions()

Vector max::get_contained_functions ( ) const

Returns a vector of the contained functions.

Example:

eval> f.get_contained_functions().size()
0
eval> f2.get_contained_functions().size()
11
eval> var v = f2.get_contained_functions();
v[0].get_arity()
2

◆ get_guard()

Function max::get_guard ( ) const

Returns a function guard as function.

Example:

eval> f.get_guard() // Throws exception
Function does not have a guard
eval> f3.get_guard().get_arity()
1
Definition EffectI.hh:11

◆ get_param_types()

Vector max::get_param_types ( ) const

Returns a vector of Type_Info objects that represent the param types for this function. The first value in the list is the return type.

If this function is a conglomerate of several functions (get_contained_values().size() > 0) then the function returns as many Type_Info objects as it can. If the functions contained all have the same arity, then it represents the arity. If they have different arities, it returns only one value - the return type.

For each parameter that is the same type, the type is returned. If the types are different then a Type_Info for Object is returned.

Example:

eval> f2.get_param_types().size(); // Returns a Type_Info for Object for the return type
1

◆ has_guard()

bool max::has_guard ( ) const

Returns true if the function has a guard to it. Always returns false for a conglomerate function.

Here is the caller graph for this function: