Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard library documentation #1

Merged
merged 26 commits into from
Apr 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f5f9757
Standard library empty pages
BenjaminNavarro Apr 11, 2020
a278feb
std/io doc update
BenjaminNavarro Apr 11, 2020
13a3a0b
Minors fixes to std/io
BenjaminNavarro Apr 12, 2020
2731052
str module documentation
BenjaminNavarro Apr 12, 2020
2f71cce
Fixes in std/str
BenjaminNavarro Apr 12, 2020
cf60f71
Fixes in std/str
BenjaminNavarro Apr 13, 2020
5c7aa1c
std/vec doc
BenjaminNavarro Apr 13, 2020
885b202
Minor fixes
BenjaminNavarro Apr 13, 2020
46db3bf
std/lang doc
BenjaminNavarro Apr 14, 2020
adb4199
Fix std/vec member functions ordering
BenjaminNavarro Apr 14, 2020
e1d2a5a
std/map doc
BenjaminNavarro Apr 14, 2020
fd7766b
Move all imports in the header for clearer examples
BenjaminNavarro Apr 15, 2020
cf1e023
std/fs doc
BenjaminNavarro Apr 15, 2020
51954d1
Minor fixes to std/fs
BenjaminNavarro Apr 16, 2020
e298454
std.core doc outline
BenjaminNavarro Apr 21, 2020
caecfc7
Move part of std.str to std.core
BenjaminNavarro Apr 21, 2020
8a190ee
Minor fix in std/fs
BenjaminNavarro Apr 21, 2020
501f48b
std/os doc
BenjaminNavarro Apr 21, 2020
ebbae33
Add new sections
BenjaminNavarro Apr 21, 2020
7bf552b
Fixing typos
BenjaminNavarro Apr 22, 2020
0ae17fd
std/runtime doc
BenjaminNavarro Apr 22, 2020
c47681f
std/ptr doc
BenjaminNavarro Apr 22, 2020
c7cf6be
Merging std/runtime with std/sys
BenjaminNavarro Apr 22, 2020
76ee8a4
Addressing PR comments
BenjaminNavarro Apr 24, 2020
4b2bbef
std/builder doc
BenjaminNavarro Apr 25, 2020
06be0a0
Addressing PR comments
BenjaminNavarro Apr 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/13-core-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ io.println(hello[5]);

Output:
```
h
!
(nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm... (nil) should have been ! and h should be as it is 😛

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

```
10 changes: 5 additions & 5 deletions src/std/1-std-io.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ My name is John. I am 21.
```
println(args...) -> nil
```
Prints all given `args` to the standard output and add a new line after the last one
Prints all given `args` to the standard output and adds a new line after the last one

Example:
```
Expand Down Expand Up @@ -87,7 +87,7 @@ My name is John. I am 21.
```
fprintln(file: file, args...) -> nil
```
Writes all given `args` to `file` and add a new line after the last one
Writes all given `args` to `file` and adds a new line after the last one

Example:
```
Expand Down Expand Up @@ -139,7 +139,7 @@ The possible color codes are the following:
```
cprintln(args...) -> nil
```
Prints all given `args` to the standard output and add a new line after the last one and interpret color codes to change the text color. A color change is not bound to a single `cprintln` call and will remain active until another one comes in.
Prints all given `args` to the standard output and adds a new line after the last one and interpret color codes to change the text color. A color change is not bound to a single `cprintln` call and will remain active until another one comes in.

Example:
```
Expand Down Expand Up @@ -171,7 +171,7 @@ For the list of available color codes, please refer to [cprint](#cprint)
```
cdprintln(args...) -> nil
```
Prints all given `args` to the standard output and add a new line after the last one and interpret color codes to change the text color. A color change is not bound to a single `cprintln` call and will remain active until another one comes in.
Prints all given `args` to the standard output and adds a new line after the last one and interpret color codes to change the text color. A color change is not bound to a single `cprintln` call and will remain active until another one comes in.

Example:
```
Expand Down Expand Up @@ -207,7 +207,7 @@ You are 21 years old
```
scaneof(prompt: string = '') -> string
```
Reads text from the standard input until *EOF* is found. Even id *EOF* can be emitted by a user (usually *CTRL-D* on UNIX), `scaneof` is more likely to be useful when a **Feral** script takes as an input the output of another program.
Reads text from the standard input until *EOF* is found. Even if *EOF* can be emitted by a user (usually *CTRL-D* on UNIX), `scaneof` is more likely to be useful when a **Feral** script takes as an input the output of another program.

An optional `prompt` parameter can be passed to write the given string before reading the standard input.

Expand Down
6 changes: 3 additions & 3 deletions src/std/2-std-lang.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The **lang** module offers a way to create user-defined structures and enumerations.

A structure can pack together variables and functions, which allow object-oriented programming.
A structure can pack together variables and functions, which allows object-oriented programming.

An enumeration is a set of names bounds to constant numerical values.

Expand All @@ -20,9 +20,9 @@ let io = import('std/io');
```
lang.struct(field = value, ...) -> type
```
Creates a new structure type type holding a set of `field`s. The given `value`s are used to infer the type of each field and as default values during construction. The return type can be used to instantiate objects of this type.
Creates a new structure type type holding a set of `field`s. The given `value`s are used to infer the type of each field and as default values during construction. The returned type can be used to instantiate objects of this type.

Adding member functions to a type is done with the `let func in type = fn(args) {}` construct, with `func` being the function's name. Inside the function, variables and functions belonging to the type can be accessed using the `self` keyword.
Adding member functions to a type is done with the `let func in type = fn(args) {};` construct, with `func` being the function's name. Inside the function, variables and functions belonging to the type can be accessed using the `self` keyword.

Example:
```
Expand Down
2 changes: 1 addition & 1 deletion src/std/3-std-strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The **str** module defines member functions for the native `string` type and other string manipulation related functions.
The functions available natively in the language can be consulted [here](/13-core-functions.html#string).

A `string` is a sequence of characters. There is no character type in **Feral** and so are represented are one character strings.
A `string` is a sequence of characters. There is no character type in **Feral** and so are represented as one character strings.

All the given examples assume the following imports:
```
Expand Down
2 changes: 1 addition & 1 deletion src/std/4-std-vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Gives the output:
```
vector.slice(start: int, end: int = -1) -> vector
```
Extracts the elements from `start` to `end - 1` and returns them in a new vector. If `end == -1` then the slice ends at the end of the vector
Extracts the elements from `start` to `end - 1` and returns them in a new vector. If `end == -1` then the slice ends at the end of the vector. Any modification in the elements of a slice will affect its original vector as well

Example:
```
Expand Down
4 changes: 2 additions & 2 deletions src/std/5-std-maps.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Maps

The **map** module defines the `map` type and all the vector manipulation related functions.
The **map** module defines the `map` type and all the map manipulation related functions.

A `map` is an associative container that can store heterogeneous types.

Expand Down Expand Up @@ -40,7 +40,7 @@ Gives the output:
{Answer?: 42, 0: Zero, 1: One}
```

Note that the elements are not stored in the order they are given. They are lexicographically sorted
Note that the elements are not stored in any particular order and thus does not necessarily follow the given one
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thus does not thus do not


### len
```
Expand Down