Write some amount of documentation
This commit is contained in:
41
docs/comparison.md
Normal file
41
docs/comparison.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Comparison
|
||||
|
||||
Compare values and produce boolean results (0 or 1).
|
||||
|
||||
## Equality
|
||||
|
||||
```forth
|
||||
3 3 = ( 1 - equal )
|
||||
3 4 = ( 0 - not equal )
|
||||
3 4 != ( 1 - not equal )
|
||||
3 4 <> ( 1 - not equal, alternative )
|
||||
```
|
||||
|
||||
## Ordering
|
||||
|
||||
```forth
|
||||
2 3 lt ( 1 - less than )
|
||||
3 2 gt ( 1 - greater than )
|
||||
3 3 <= ( 1 - less or equal )
|
||||
3 3 >= ( 1 - greater or equal )
|
||||
```
|
||||
|
||||
## With Conditionals
|
||||
|
||||
```forth
|
||||
step 4 lt { "kick" s . } ? ( kick on first 4 steps )
|
||||
|
||||
beat 8 >= { 0.5 gain } ? ( quieter after beat 8 )
|
||||
```
|
||||
|
||||
## Words
|
||||
|
||||
| Word | Stack | Description |
|
||||
|------|-------|-------------|
|
||||
| `=` | (a b -- bool) | Equal |
|
||||
| `!=` | (a b -- bool) | Not equal |
|
||||
| `<>` | (a b -- bool) | Not equal (alias) |
|
||||
| `lt` | (a b -- bool) | Less than |
|
||||
| `gt` | (a b -- bool) | Greater than |
|
||||
| `<=` | (a b -- bool) | Less or equal |
|
||||
| `>=` | (a b -- bool) | Greater or equal |
|
||||
Reference in New Issue
Block a user