parent
5bc4bcb702
commit
13420ed745
@ -156,7 +156,7 @@ They return the result as the type it was passed into the function.
|
||||
### Values
|
||||
|
||||
Operators take values as arguments and produce values as results.
|
||||
Values can be boolean, integer or floating point numbers.
|
||||
Values can be boolean, integer or floating point numbers, tuples or the empty type.
|
||||
Strings are supported as well, but there are no operations defined for them yet.
|
||||
Values are denoted as displayed in the following table.
|
||||
|
||||
@ -165,8 +165,15 @@ Values are denoted as displayed in the following table.
|
||||
| `Value::Boolean` | `true`, `false` |
|
||||
| `Value::Int` | `3`, `-9`, `0`, `135412` |
|
||||
| `Value::Float` | `3.`, `.35`, `1.00`, `0.5`, `123.554` |
|
||||
| `Value::Tuple` | `(3, 55.0, false, ())`, `(1, 2)` |
|
||||
| `Value::Empty` | `()` |
|
||||
|
||||
Integers are internally represented as `i64`, and floating point numbers are represented as `f64`.
|
||||
Tuples are represented as `Vec<Value>` and empty values are not stored, but represented by rust's unit type `()` where necessary.
|
||||
|
||||
There exist type aliases for some of the types.
|
||||
They include `IntType`, `FloatType`, `TupleType` and `EmptyType`.
|
||||
|
||||
Values can be constructed either directly or using the `From` trait.
|
||||
Values can be decomposed using the `Value::as_[type]` methods.
|
||||
The type of a value can be checked using the `Value::is_[type]` methods.
|
||||
|
11
src/lib.rs
11
src/lib.rs
@ -143,7 +143,7 @@
|
||||
//! ### Values
|
||||
//!
|
||||
//! Operators take values as arguments and produce values as results.
|
||||
//! Values can be boolean, integer or floating point numbers.
|
||||
//! Values can be boolean, integer or floating point numbers, tuples or the empty type.
|
||||
//! Strings are supported as well, but there are no operations defined for them yet.
|
||||
//! Values are denoted as displayed in the following table.
|
||||
//!
|
||||
@ -152,8 +152,15 @@
|
||||
//! | `Value::Boolean` | `true`, `false` |
|
||||
//! | `Value::Int` | `3`, `-9`, `0`, `135412` |
|
||||
//! | `Value::Float` | `3.`, `.35`, `1.00`, `0.5`, `123.554` |
|
||||
//! | `Value::Tuple` | `(3, 55.0, false, ())`, `(1, 2)` |
|
||||
//! | `Value::Empty` | `()` |
|
||||
//!
|
||||
//! Integers are internally represented as `i64`, and floating point numbers are represented as `f64`.
|
||||
//! Tuples are represented as `Vec<Value>` and empty values are not stored, but represented by rust's unit type `()` where necessary.
|
||||
//!
|
||||
//! There exist type aliases for some of the types.
|
||||
//! They include `IntType`, `FloatType`, `TupleType` and `EmptyType`.
|
||||
//!
|
||||
//! Values can be constructed either directly or using the `From` trait.
|
||||
//! Values can be decomposed using the `Value::as_[type]` methods.
|
||||
//! The type of a value can be checked using the `Value::is_[type]` methods.
|
||||
@ -283,7 +290,7 @@ pub use function::Function;
|
||||
pub use interface::*;
|
||||
pub use tree::Node;
|
||||
pub use value::{
|
||||
value_type::ValueType, EmptyType, FloatType, IntType, TupleType, Value, EMPTY_VALUE,
|
||||
EMPTY_VALUE, EmptyType, FloatType, IntType, TupleType, Value, value_type::ValueType,
|
||||
};
|
||||
|
||||
mod context;
|
||||
|
Loading…
Reference in New Issue
Block a user