diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-02-02 19:50:25 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-02-02 19:50:25 -0800 |
| commit | 5f6aae8d9da1e1ed0e5d11cfac02e5ffa6ef9e30 (patch) | |
| tree | 7015ee0589eed083a3b94c546a08a26133354e37 /lib | |
| parent | 6212e1207f65e5b270980c8f225e0cdcd43f69e9 (diff) | |
Added inheritance section for tutorial
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/tools/tutorial.nom | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/tools/tutorial.nom b/lib/tools/tutorial.nom index dd26ada..c74d088 100755 --- a/lib/tools/tutorial.nom +++ b/lib/tools/tutorial.nom @@ -270,15 +270,35 @@ $lessons = [ # This method is used to add to a buffer ($self, add $bit) means: $bits, add $bit + + # ($list, joined) is a list method that concatenates the list items: + ($self, as text) means ($bits, joined) # Write a method called ($self, length) that returns the sum of the lengths of each bit in the buffer: <your code here> + + # Create an instance of a Buffer: $b = (a Buffer) + test that ($b is "a Buffer") + test that ((type of $b) == "a Buffer") $b, add "xx" $b, add "yyy" + test that (($b, as text) == "xxyy") test that (($b, length) == 5) + # You can define a thing that inherits the behaviors of another thing like this: + (a Backwards Buffer) is (a Buffer) with [$bits]: + # ($list, reversed) is a method that returns a copy of $list with + the order of the items reversed. + ($self, as text) means ($bits, reversed, joined) + + $bb = (a Backwards Buffer) + $bb, add "one" + $bb, add "two" + test that (($bb, length) == (???)) + test that (($bb, as text) == (???)) + lesson "Files Part 1": # Define an external action here: external: |
