Skip to content

Commit e8da616

Browse files
committed
Update README
1 parent 18eed7d commit e8da616

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ First, you should notice the `export const s = 5;`. This is telling it to export
2828
Next up, we see the main function, called `a`. It also takes in an argument of `x`. Inside this function, there's an if statement that checks what function's turn it is. It also uses the `s` variable from before as a scale. If it turns out to be the sin's turn, the state will be set to `sin(x)`, otherwise it'll be `cos(x)`.
2929

3030
## Restrictions
31-
Functions weren't made for doing this, so as you can imagine, there are a few restrictions. First off, you only get one point of memory, called the state (which also acts as your output). You can define variables, but they can only be read from, so they act a bit more for convenience. Even so, two functions can technically have two distinct states, although they will need to combine them somehow before the function returns. On that note, early returns, or any kind of jumps, are also impossible. This effects LogiMat's internals as well, and as such means that every code path is executed, but only the needed values are actually returned. Keep this in mind, as if any code paths return undefined, the entire function will return undefined.
31+
Functions weren't made for doing this, so as you can imagine, there are a few restrictions. First off, you only get one point of memory, called the state (which also acts as your output). You can define variables, but they can only be read from, so they act a bit more for convenience. Even so, two functions can technically have two distinct states, although they will need to combine them somehow before the function returns. On that note, early returns, or any kind of jumps, are also impossible. This effects LogiMat's internals as well, and as such means that every code path is executed, but only the needed values are actually returned. Keep this in mind, as if any code paths return undefined, the entire function will return undefined (you can use safe functions, such as `safeDivide`, `safeLog`, etc to avoid this).
3232

3333
## How it works
3434
The core of LogiMat is actually fairly simple. I've created certain functions (which you can view in more detail inside of src/libs/ops.ts) which act as either logic gates, or operators (==, !=, <, etc). These are then chained together to perform the more familiar logical operations found inside the if statement. The only special functions that LogiMat requires are the `ceil`, `floor`, and `abs` functions.

0 commit comments

Comments
 (0)