Updated smnp.lang (markdown)

Bartłomiej Przemysław Pluta
2020-03-25 19:18:12 +01:00
parent d6cb550523
commit 586538958b

@@ -6,12 +6,6 @@ Constructors technically are nothing but functions. They just "emulate" real con
Creates new `int` from other `int` or `float`. Creates new `int` from other `int` or `float`.
The construction is typically used in other stdlib modules to round `float` types down. The construction is typically used in other stdlib modules to round `float` types down.
### Arguments
* value of `int` or `float` type
### Output
* newly created `int`
### Example ### Example
``` ```
x = 3.14; x = 3.14;
@@ -30,9 +24,6 @@ Creates new `note` with given parameters.
* `duration` - the denominator of fraction that determines the duration of note: `1 = whole, 2 = half, 4 = quarter, ...` * `duration` - the denominator of fraction that determines the duration of note: `1 = whole, 2 = half, 4 = quarter, ...`
* `dot` - an optional dot which extends the note duration by half of its value * `dot` - an optional dot which extends the note duration by half of its value
### Output
* note of given parameters
### Example ### Example
``` ```
x = Note("Eb", 3, 16, true); x = Note("Eb", 3, 16, true);
@@ -55,9 +46,6 @@ durationNumerator == 0.25 * durationDenominator -> quarter note
``` ```
* `durationDenominator` - as above * `durationDenominator` - as above
### Output
* note of given parameters
### Example ### Example
``` ```
x = Note("Eb", 3, 3, 32); x = Note("Eb", 3, 3, 32);
@@ -68,12 +56,6 @@ println(x == @Eb3:16d); # true
## `typeOf(object)` ## `typeOf(object)`
Returns the type name of passed object. Returns the type name of passed object.
### Arguments
* object - object of any type
### Output
* type name of passed object as string
### Example ### Example
``` ```
println(typeOf(14)); # integer println(typeOf(14)); # integer
@@ -85,13 +67,7 @@ println(typeOf({ c -> @c, d -> @d })); # map
# Methods # Methods
## `list.get(index: int)` ## `list.get(index: int)`
Returns list element of given index. Returns list element of given index or throws error if index is greater than `list.size - 1`.
### Arguments
* index - index of desired element. Note, that counting starts with 0.
### Output
* element of list with given index. Throws an error if index is out of bounds.
### Example ### Example
``` ```
@@ -101,13 +77,7 @@ println(lastElement); # 4
``` ```
## `map.get(key: <int, note, string, bool>)` ## `map.get(key: <int, note, string, bool>)`
Returns map element associated with given key. Returns map element associated with given key or throws an error if key doesn't exist in the map.
### Arguments
* key - key of value that is about to be returned
### Output
* element associated with given key. Throws an error if key doesn't exist.
### Example ### Example
``` ```
@@ -122,13 +92,7 @@ println(element); # world
``` ```
## `string.charAt(index: int)` ## `string.charAt(index: int)`
Returns string's character of given index. Returns string's character of given index or throws error if index is greater than `string.length - 1`.
### Arguments
* index - index of desired character. Counting starts with 0.
### Output
*character of given index. Throws an error if index is out of bounds.
### Example ### Example
``` ```
@@ -137,21 +101,4 @@ println(x.charAt(1)); # e
``` ```
## `<any>.toString()` ## `<any>.toString()`
Returns a string representation of any available object. Returns a string representation of object.
### Arguments
_none_
### Output
* string representation of object
### Example
```
println(@Eb3:8d.toString()); # D#3:(3/16)
println(typeOf(14.toString())); # string
println(typeOf("hello, world".toString())); # string
println(typeOf(true.toString())); # string
println(typeOf(@Gb3:16d.toString())); # string
println(typeOf({ first -> @c, second -> [1, 2, 3] }.toString())); # string
```