Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Latest commit

 

History

History
74 lines (44 loc) · 2.14 KB

File metadata and controls

74 lines (44 loc) · 2.14 KB

Stringed Computation

This doc explains high-level computation on Stringed.

Boolean Operation

Boolean value can be encoded in string with true or false, this is exactly what equal operation returns. But, we could use 1 or 0 instead, it is shorter and readily usable with slice.

Let's call true and false stringified boolean and 1 and 0 boolean digit.

The following expression converts stringified boolean to boolean digit. Assuming _ is the operand, you may want to use closure here.

"----10"[#_:][:"1"]

And the following does the opposite.

$"{falsetrue}["+":"[_:]+{"5"}+":"[:_]+"]"

The following are few boolean operation, accepting and returning boolean digit. For "and" and "or" operations, it accepts two digits of it, you may need to concat it.

NOT
"10"[_:][:"1"]

AND
("0"+_["1":])[_[:"1"]:][:"1"]

OR
(_["1":]+"1")[_[:"1"]:][:"1"]

Arithmetic Operation

On surface, stringed have highly limited arithmetic operations. It have length operator that finds length of string and return a number in string format, lets call this stringified number, that format is usable with slice.

We could simulate arithmetic operation by manipulating the length of string, addition would be concat and subtraction would be slice (underflow causes error, I might relax the restriction of slice in the future), and other than that, thats pretty much the only arithmetic operation in stringed.

Additionally, we can't yet convert stringified number to a string with that length.

String Operation

Well, duh.

Compounded data

Stringed only have 1 variable name _, there can be multiple variables but it shadows any variables on higher scope. We may need to store many data in single string.

TODO

Conditional

Stringed have eval, and we can manipulate the string before it gets evaluated.

The following accepts a single boolean digit and the string of code. inputting "1"+{"thing"} would return thing, and "0"+{"thing"} return empty string.

$$"{"+{""}+_["1":]+"}["+":"[_[:"1"]:]+{"2"}+":"[:_[:"1"]]+"]"

TODO more explanation

Recursion

The following is the key for recursion.

$"_:"+_

TODO