This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; so in Racket, when you define a struct: | |
| (struct game-board (cells-list winner)) | |
| ; you create a new struct like this: | |
| ; (it has to be named something different from the struct itself, which means you need to | |
| ; shorten the name, or call it `a-game-board` or something) | |
| (define gb (game-board '(X O X) 'X) | |
| ; now that you have a struct, you get data from it like this: (these functions are | |
| ; auto-generated by `struct` based on what I named `game-board`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NOTES: | |
| - some forms are shown on the same line as other forms because they're closely related | |
| to each other | |
| - I'm using the term "primitives" to roughly mean "any data type that represents one | |
| thing which can't be divided into sub-things". I'm not really sure if Janet has a | |
| concept of "primitives" but this is the best term I could think of for the distinction | |
| between "primitives" and data structures | |
| - the order of these categories is fairly arbitrary right now, but ideally I think it | |
| would be best to put them in order from most fundamental to most esoteric, so that | |
| someone who is trying to refresh their memory on how Janet works can read them in |