-
Notifications
You must be signed in to change notification settings - Fork 444
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
Add BUILTINS.MD #492
Add BUILTINS.MD #492
Conversation
This should be Squashed. |
BUILTINS.md
Outdated
STRING_NIL_TAG = 0 | ||
STRING_CONS_TAG = 1 | ||
``` | ||
|
||
```bend | ||
IO_DONE_TAG = 0 | ||
IO_PUT_TEXT_TAG = 1 | ||
IO_GET_TEXT_TAG = 2 | ||
IO_WRITE_FILE_TAG = 3 | ||
IO_READ_FILE_TAG = 4 | ||
IO_GET_TIME_TAG = 5 | ||
IO_SLEEP_TAG = 6 | ||
IO_DRAW_IMAGE_TAG = 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section about tags is outdated and should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
BUILTINS.md
Outdated
## Types | ||
|
||
### String | ||
```bend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although we want to have bend
to indicate that this is a bend program, github doesn't yet support it for syntax highlighting. I've been using either python or rust depending on what looks better on each specific example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed some ot pythjon and some to rust, and it looks great indeed
|
||
- **Nil**: Represents an empty string. | ||
- **Cons head ~tail**: Represents a string with a `head` character and a `tail` string. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention that we have syntax for these types, maybe explain it here or maybe point to the syntax reference.
BUILTINS.md
Outdated
data IO | ||
= (Done term) | ||
| (PutText text cont) | ||
| (GetText cont) | ||
| (WriteFile file data cont) | ||
| (ReadFile file cont) | ||
| (GetTime cont) | ||
| (Sleep time cont) | ||
| (DrawImage tree cont) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type definition is outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it there a place where I can find a more up to date version?
BUILTINS.md
Outdated
``` | ||
|
||
Prints text to the console. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prints text to the console. | |
Prints text to the console (to stdout). |
BUILTINS.md
Outdated
``` | ||
|
||
### IO/bind | ||
Chains IO operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we need to explain how the bind syntax works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it there a section or place where I can find a clear explanation on this? The last missing piece
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/HigherOrderCO/Bend/blob/main/docs/syntax.md#do
and
https://github.com/HigherOrderCO/Bend/blob/main/docs/syntax.md#monadic-bind-blocks
Now I noticed they each have one part of the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inside a do Type
block, you can do a monadic call with <-
or ask
(depending on the syntax).
Each <-
is converted into a call to the bind function Type/bind(asked, λvar: next)
For example:
do MyType:
x <- Foo
y = Bar
z <- Baz
return Something(x, y, z)
becomes
(MyType/bind Foo λx let y = Bar; (MyType/Bind Baz λz (Something x y z))
Added the file BUILTINS.MD as a TODO. The plan is to start working on it or have at least some clarity before doing the book (some sort of WIP / POC)
removed the .com on the readme.md