فهرست منبع

add some methods for `Array` object, update citations

tcheukueppo 2 سال پیش
والد
کامیت
b2fbda3b50
3فایلهای تغییر یافته به همراه45 افزوده شده و 14 حذف شده
  1. 5 5
      docs/citations.md
  2. 0 2
      docs/maat_dev_ref/maat.md
  3. 40 7
      docs/maat_dev_ref/objects/Array.md

+ 5 - 5
docs/Citations.md → docs/citations.md

@@ -1,19 +1,19 @@
 - Only mads believe impressive things got their impressiveness based on complexity
 
 - If you took too much time to understand a thing, it isn't only because of how your brain works
-  it is also what causes your brain to work that way, free yourself.
+  it is also because of what caused your brain to work that way, free yourself.
 
 - Science is art but humans over complicate this art.
 
 - If adding a feature to a software overcomplicates it then the problem is not the feature, but
-  you, every solution to a problem is simple!
+  you, every solution to a problem is simple though simplicity is subjective.
 
 - It is a lexury to be able to **needly** translate your thoughts into a piece of code
 
-- The Web specification is an example of how immature people can think, we know them!
+- The Web is an example of how immature people can think, we know them!
 
-- Conventions and agreements on things are the keys to build software that solve a particular
+- Conventions and agreements on things are the keys to building software that solve a particular
   problem and promote compatibility but what if these conventions are bullshit?
 
 - If the software you are building isn't a layer on top of another stupid abstraction then it
-  is the opportunity to connect to your real art and build something beautiful, grab it!
+  is the opportunity for you to connect to your real art and build something beautiful, grab it!

+ 0 - 2
docs/maat_dev_ref/maat.md

@@ -24,8 +24,6 @@ inspired from the lovely `Perl`, `Raku` and `Lua` programming languages.
 
 ## Basic unary operators
 
-- `&`: (b) address retrieval operator
-- `*`: (b) dereference operator
 - `++`: (p,b) inc
 - `--`: (p,b) dec
 - `-`: (b) negative

+ 40 - 7
docs/maat_dev_ref/objects/Array.md

@@ -16,15 +16,48 @@ var c = Array.new(2, 3, "four", a<5 6>)
 
 ## Methods
 
-(**Note that parenthesis are Always optional in method calls**)
+### Key notes
+
+- Parenthesis in method and function calls are always optional
+- Maat is dynamically and at the same time statically type and thus type errors aren't raised unless necessary
+- `->` Specifies the return type
+- `|` Stands for alternation, so for example `-> Num | Array` means to return either a `Num` or an `Array`
+- `[]` Simply means the rest of the arguments are optional
+- `EXP`: represents an expression, see maat's BNF for what is an expression
+
+### Note
 
 Let `a` be a variable containing an object of type `Array`, `a` has the following
 methods:
 
-- `a.len() -> Num`: Return the number of elements in `a`.
-- `a.pop([ Any n ]) -> Any | Array`: If `n` is omitted, pop last element from `a` and return it else pop `n` elements from it and return them in an Array. Fail if array is emty.
+- `a.len -> Num`: Return the number of elements in `a`
+- `a.of()`: Tell us `of` what type are the elements of `a`
+- `a.clone()`: Clone object in `a` into a new fresh one and return it
+- `a.min -> Any`: Return the minimum element in `a` based on numeric comparison
+- `a.minstr -> Any`: Return the minimum element in `a` based on stringwise comparison
+- `a.max -> Any`: Return the maximum element in `a` based on numeric comparison
+- `a.maxstr -> Any`: Return the maximum element in `a` based on stringwise comparison
+- `a.cmp(Array b) -> Num`: 
+- `a.end -> Any`: Return the index of the last element in `a`
+- `a.minmax -> Array`: Return two element in the list, first the the maxinum and second in the minimum both in `a` (Completely different from infix `minmax` operator)
+- `a.minmaxstr -> Array`: The stringwise version of `a.minmax`
+- `a.keys -> Array`: Return an Array of indexes of `a`
+- `a.kv -> Map`: Return a created Map from elements of `a`, abort if `a.len` is odd.
+- `a.ikv -> Map`: Return the Map version of `a` with indexes as keys
+- `a.rev -> Array`: Return the list in reverse order
+- `a.join([ Str sep ]) -> Str`: Stringyfy elements in `a` and interleave them with the separator `sep` or empty string if not specified
+- `a.pop([ Num | Str n ]) -> Num | Array`: If `n` is omitted, pop last element from `a` and return it else pop `n` elements from it. Fail if array is emty.
 - `a.push(Any x [, Any y, ... ]) -> Array`: Push into `a` elements passed as arguments to `push` into `a`. return the modified array.
-- `a.append(Any x [, Any y, ... ]) -> Array`: Same as `push` except that it flattens arrays to append them invidually instead of appending as a single unit. Return the modified array.
-- `a.map()`:
-- `a.lmap()`:
-- `a.grep()`:
+- `a.append(Any x [, Any y, ... ]) -> Array`: Same as `push` except that it flattens arrays to append them invidually. Return the modified array.
+- `a.shift([ Num | Str n ])`: 
+- `a.unshift([ Num | Str n ])`: 
+- `a.prepend() -> Array`: 
+- `a.del(Num | Str n)`:
+- `a.splice() -> Array`: 
+- `a.flat() -> Array`: flattens 
+- `a.map(Fun f | Exp) -> Array`: run function F or evaluate expression for each elements in `a` and collect the return values into an Array
+- `a.lmap(Fun f | Exp) -> Array`: Same as `a.map` but `.flat` the result return it
+- `a.grep(Fun f | Exp) -> Array:
+- `a.last_by(Fun f | Exp) -> Any`:
+- `a.first_by(Fun f | Exp) -> Any`:
+- ``