From d272efa49173c3708ddde54a96486261b73d7908 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 15 Jan 2022 00:13:48 +0100 Subject: ... --- content/wyrd_v1/computation/_index.md | 179 ++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 content/wyrd_v1/computation/_index.md (limited to 'content/wyrd_v1/computation') diff --git a/content/wyrd_v1/computation/_index.md b/content/wyrd_v1/computation/_index.md new file mode 100644 index 0000000..d0462a0 --- /dev/null +++ b/content/wyrd_v1/computation/_index.md @@ -0,0 +1,179 @@ +--- +menuTitle: +title: Computation +weight: 3 +--- +This page presents all the ``s that can be performed in Wyrd. +``s do not modify the memory, but they always return a ``. + +**Shortcut to each ``:** +* [`(add_text_effect {name: String} {parameters: List} {values: list})`](#add_text_effect) +* [`(address )`](#address) +* [`(cast {from: String} {to: String} )`](#cast) +* [`(constant {type: String} {value: String})`](#constant) +* [`(get_allocable_address)`](#get_allocable_address) +* [`(if_else )`](#if_else) +* [`(last_choice_index)`](#last_choice_index) +* [`(newline)`](#newline) +* [`(operation {operator: String} )`](#unary-operation) +* [`(operation {operator: String} )`](#operation) +* [`(relative_address )`](#relative_address) +* [`(size )`](#target) +* [`(text {values: List})`](#text) +* [`(value_of )`](#value_of) +* [`({extra_computation} {parameters: List})`](#extra_computation) + +### add_text_effect +`(add_text_effect {name: String} {parameters: List} {values: list})` + +Add an effect to a list of texts, returning it as a single text. + +**Parameters:** +* `name` is a `{String}` indicating the name of the effect. +* `parameters` is a `{List}` of `` that will yield the ``s + used as parameters for the effect. +* `values` is a `{ List}` that will yield the texts to merge and + apply the effect to. These will yield ``s. + +**Process:** +* Compute the `{params: List}` corresponding to `parameters` (keep the + order). +* Compute the `{texts: List}` corresponding to `values` (keep the + order). +* Return a new `` `` with `texts` as `content`, + `name` as `effect_name`, and `params` as `effect_parameters`. + +### address +`(address )` + +Converts to an address. + +**Parameters:** +* `value_or_target` is a `` that will either result in in a + `` or a ``. + +**Process:** +* Compute the `` corresponding to `value_or_target`. +* If this resulted in a ``, return the value as is. +* If this resulted in a ``, interpret the value as + `{addr: String}`, return a new `` built from a singleton list + with `addr` as its only element. + +### cast +`(cast {from: String} {to: String} )` + +Convert from one type to another. + +**Parameters:** +* `from` is a `{String}` naming the type `content` will result to. +* `to` is a `{String}` naming the type to convert `content` to. +* `content` is a `` that will yield the `` to convert. + +**Process:** +* Compute the `` associate with `content`. +* Convert this `` from `from` to `to`. +* Return the converted value. + +**Note:** +The following conversions are expected to be available: +* A type to the same type, returning the same value. +* `` to ``, returning `(StringValue "true")` if + `` is `(BoolValue TRUE)` and `(StringValue "false")` otherwise. +* `` to ``, same as above, but with text instead of + string. +* `` to ``. +* `` to ``. +* `` to ``, using a *floor* function. +* `` to ``. +* `` to ``. +* `` to ``. +* `` to ``, with `0` being `(BoolValue FALSE)` and + anything else being `(BoolValue TRUE)`. +* `` to ``. +* `` to ``. +* `` to ``, `(BoolValue TRUE)` if the string is + `"true"`, `(BoolValue FALSE)` if it is `"false"`. Convert to lowercase prior + to checking. +* `` to ``, by recursively converting all content to + `{String}`, discarding effects and newlines, and appending it all. +* `` to ``, by converting it to `` first. +* `` to ``, by converting it to `` first. +* `` to ``, by converting it to `` first. + +### constant +`(constant {type: String} {value: String})` + +**Parameters:** + +**Process:** + +### get_allocable_address +`(get_allocable_address)` + +**Process:** + +### if_else +`(if_else )` + +**Parameters:** + +**Process:** + +### last_choice_index +`(last_choice_index)` + +**Process:** + +### newline +`(newline)` + +**Process:** + +### Unary operation +`(operation {operator: String} )` + +**Parameters:** + +**Process:** + +### operation +`(operation {operator: String} )` + +**Parameters:** + +**Process:** + +### relative_address +`(relative_address )` + +**Parameters:** + +**Process:** + +### size +`(size )` + +**Parameters:** + +**Process:** + +### text +`(text {values: List})` + +**Parameters:** + +**Process:** + +### value_of +`(value_of )` + +**Parameters:** + +**Process:** + +### extra_computation +`({extra_computation} {parameters: List})` + +**Parameters:** + +**Process:** -- cgit v1.2.3-70-g09d2