ChaiScript
chaiscript_prelude_docs.hpp
1 
5 namespace ChaiScript_Language {
13 
20  class Object {
21  public:
23  Type_Info get_type_info() const;
24 
26  bool is_type(string) const;
27 
29  bool is_type(Type_Info) const;
30 
32  bool is_var_const() const;
33 
35  bool is_var_null() const;
36 
38  bool is_var_pointer() const;
39 
41  bool is_var_reference() const;
42 
44  bool is_var_undef() const;
45 
49  string type_name() const;
50  };
51 
53  class Map_Pair {
54  public:
56  const string first();
57 
59  Object second();
60  };
61 
82  class Map {
83  public:
85  Range range();
86 
88  Const_Range range() const;
89 
91  int size() const;
92 
94  Object operator[](string);
95 
97  void clear();
98 
100  int count(string) const;
101 
103  bool empty() const;
104  };
105 
107  class Container {
108  public:
109  void push_back(Object);
110  Range range();
111  Const_Range range() const;
112  };
113 
120  string to_string(Object o);
121 
129  void puts(Object o);
130 
139  void print(Object o);
140 
154  class string {
155  public:
161  int find(string s) const;
162 
168  int rfind(string s) const;
169 
176  int find_first_of(string list) const;
177 
184  int find_last_of(string list) const;
185 
192  int find_first_not_of(string list) const;
193 
200  int find_last_not_of(string list) const;
201 
212  string lstrim() const;
213 
224  string rtrim() const;
225 
238  string trim() const;
239 
241  const char &operator[](int t_index) const;
242 
244  char &operator[](int t_index);
245 
247  const char *c_str() const;
248 
250  const char *data() const;
251 
253  void clear();
254 
256  bool empty() const;
257 
262  int size() const;
263 
265  Range range();
266 
268  Const_Range range() const;
269  };
270 
277  class Range {
278  public:
280  Object back();
281 
284  bool empty() const;
285 
287  Object front();
288 
292  void pop_back();
293 
297  void pop_front();
298  };
299 
306  class Const_Range {
307  public:
309  const Object back();
310 
313  bool empty() const;
314 
316  const Object front();
317 
321  void pop_back();
322 
326  void pop_front();
327  };
328 
346  class Vector {
347  public:
349  Object operator[](int t_index);
350 
352  const Object operator[](int t_index) const;
353 
355  Object back();
356 
358  void clear();
359 
361  bool empty();
362 
364  void erase_at(int t_index);
365 
367  Object front();
368 
372  void insert_ref_at(int, Object);
373 
377  void insert_at(int, Object);
378 
380  void pop_back();
381 
385  void push_back_ref(Object);
386 
390  void push_back(Object);
391 
393  Range range();
394 
396  Const_Range range() const;
397 
399  int size() const;
400  };
401 
402  class Type_Info {
403  public:
406  bool bare_equal(Type_Info t_ti) const;
407 
409  string cpp_bare_name() const;
410 
412  string cpp_name() const;
413 
415  bool is_type_const() const;
416 
418  bool is_type_pointer() const;
419 
421  bool is_type_reference() const;
422 
424  bool is_type_undef() const;
425 
427  bool is_type_void() const;
428 
430  string name() const;
431  };
432 
453  class Function {
454  public:
456  string get_annotation() const;
457 
467  int get_arity() const;
468 
481  Vector get_contained_functions() const;
482 
492  Function get_guard() const;
493 
510  Vector get_param_types() const;
511 
513  bool has_guard() const;
514 
522  Object call(Vector t_params) const;
523  }
524 
536  Object
537  max(Object a, Object b);
538 
551  Object min(Object a, Object b);
552 
562  bool even(Object x);
563 
573  bool even(Object x);
574 
584  void for_each(Range c, Function f);
585 
593  Object map(Range c, Function f);
594 
603  Object foldl(Range c, Function f, Object initial);
604 
617  Numeric sum(Range c);
618 
631  Numeric product(Range c);
632 
642  Object take(Range c, int num);
643 
654 
664  Object drop(Range c, int num);
665 
674 
682  Object reduce(Range c, Function f);
683 
692 
700  string join(Range c, string delim);
701 
710 
721 
729  Object concat(Range x, Range y);
730 
738  Vector collate(Object x, Object y);
739 
748 
756  Vector zip(Range x, Range y);
757 
765  bool call_exists(Function f, ...);
766 
768  Range retro(Range);
769 
772 
782  void throw(Object);
783 } // namespace ChaiScript_Language
string join(Range c, string delim)
Joins the elements of the Range c into a string, delimiting each with the delim string.
A vector of Objects.
Definition: chaiscript_prelude_docs.hpp:346
ChaiScript representation of std::string.
Definition: chaiscript_prelude_docs.hpp:154
Range retro(Range)
Reverses a Range object so that the elements are accessed in reverse.
Maps strings to Objects.
Definition: chaiscript_prelude_docs.hpp:82
bool is_type(string) const
Returns true if the Object is of the named type.
bool is_var_const() const
Returns true if the Object is immutable.
bool is_var_reference() const
Returns true if the Object is stored as a reference.
void puts(Object o)
Prints o to the terminal, without a trailing carriage return.
Numeric sum(Range c)
Returns the sum total of the values in the Range c.
class ChaiScript_Language::Function max(Object a, Object b)
Returns the max of a or b.
Object drop_while(Range c, Function f)
Drops elements from the Range c that match f, stopping at the first non-match, returning the remainde...
void for_each(Range c, Function f)
Applies the function f over each element in the Range c.
Object 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...
bool is_var_null() const
Returns true if the Object is a pointer and the pointer is null.
Vector zip(Range x, Range y)
Collates elements of x and y, returning a new Vector with the result.
This file is not technically part of the ChaiScript API.
Definition: chaiscript_prelude_docs.hpp:5
bool call_exists(Function f,...)
returns true if there exists a call to the Function f that takes the given parameters ...
bool even(Object x)
Returns true if x is an even integer.
void print(Object o)
Prints o to the terminal, with a trailing carriage return.
A concept implemented by string, Vector and Map. It is convertible to Range, default constructable an...
Definition: chaiscript_prelude_docs.hpp:107
Object filter(Container c, Function f)
Takes elements from Container c that match function f, return them.
Vector generate_range(Object x, Object y)
Generates a new Vector filled with values starting at x and ending with y.
Generic concept of a value in ChaiScript.
Definition: chaiscript_prelude_docs.hpp:20
bool is_var_pointer() const
Returns true if the Object is stored as a pointer.
Container reverse(Container c)
Returns the contents of the Container c in reversed order.
bool is_var_undef() const
Returns true if the Object does not contain a value is is undefined.
Object take(Range c, int num)
Takes num elements from the Range c, returning them.
Object reduce(Range c, Function f)
Similar to foldl, this takes the first two elements as its starting values for f. ...
Definition: chaiscript_prelude_docs.hpp:402
Object 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.
Item returned from a Range object from a Map.
Definition: chaiscript_prelude_docs.hpp:53
Vector 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.
A concept in ChaiScript that is implemented by string, Vector and Map.
Definition: chaiscript_prelude_docs.hpp:306
Represents a function object in ChaiScript.
Definition: chaiscript_prelude_docs.hpp:453
A concept in ChaiScript that is implemented by string, Vector and Map.
Definition: chaiscript_prelude_docs.hpp:277
Object min(Object a, Object b)
Returns the min of a or b.
Object map(Range c, Function f)
Applies f over each element in the Range c, joining all the results.
Object concat(Range x, Range y)
Returns a new Range with x and y concatenated.
string type_name() const
Returns the registered name of the type of the object.
string to_string(Object o)
Converts o into a string.
Type_Info get_type_info() const
Returns the Type_Info value for this Object.
Object drop(Range c, int num)
Drops num elements from the Range c, returning the remainder.
Vector collate(Object x, Object y)
Returns a new Vector with x and y as its values.
Numeric product(Range c)
Returns the product of the value in the Range c.