Last active
December 15, 2015 13:28
-
-
Save heatherjc07/5267160 to your computer and use it in GitHub Desktop.
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
| Baby := Object clone | |
| Baby description := "A little person" | |
| Baby cry := method("Wahh" println) | |
| Baby slotNames println | |
| // Returns list(cry, description, type) | |
| Baby cry | |
| // Returns "Wahh" |
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
| Vehicle description := "Takes you from A to B" | |
| Vehicle description | |
| //Returns "Takes you from A to B" |
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
| ::= //Creates slot, creates setter, assigns value | |
| := //Creates slot, assigns value | |
| = //Assigns value to slot if it exists, otherwise raises exception |
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
| ferrari getSlot("drive") | |
| // Returns method ("Vroom" println) |
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
| pets := list("dog", "cat") // returns list("dog", "cat") | |
| pets size // returns 2 | |
| pets append("rabbit") //returns list("dog", "cat", "rabbit") | |
| list(1, 2, 3, 4) | |
| list(1, 2, 3, 4) average //returns 2.5 | |
| list(1, 2, 3, 4) sum //returns 10 | |
| list(1, 2, 3) pop // returns 3 |
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
| horse := Map clone | |
| horse atPut("home", "stable") | |
| horse at("home") //returns home = "stable" | |
| horse atPut("food", "hay") //returns food = "hay" | |
| horse asList //returns list(list("food", "hay"), list("home", "stable")) | |
| horse keys //returns list("food", "home") | |
| horse size //returns 2 | |
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
| Car drive := method("Vroom" println) | |
| ferrari := Car clone | |
| ferrari drive | |
| //Returns Vroom |
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
| io answer.io |
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
| Madonna := Object clone | |
| Madonna clone := Madonna |
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
| Vehicle := Object clone | |
| Vehicle description := "Something to take you places" | |
| Vehicle slotNames println |
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
| Vehicle slotNames | |
| //Returns ("type", "description") |
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
| (1 + 1) println // 2 | |
| //1 + "one" println | |
| // Exception: argument 0 to method '+' must be a Number, | |
| // not a 'Sequence' | |
| //Therefore Strongly Typed |
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
| Vehicle := Object clone |
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
| if(0) println // true | |
| if("") println //true | |
| if(nil) println //false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment