Last active
February 10, 2019 20:35
-
-
Save aaronlelevier/a408795caa255448ac415a4820743564 to your computer and use it in GitHub Desktop.
Sunday Feb 10, 2019 - Learning Erlang for an hour
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
| 23> Person = {person, {age, 34}, {hobby, "biking"}}. | |
| {person,{age,34},{hobby,"biking"}} | |
| 24> A. | |
| * 1: variable 'A' is unbound | |
| 25> B. | |
| * 1: variable 'B' is unbound | |
| 26> A, B = Person. | |
| * 1: variable 'A' is unbound | |
| 27> {A, B} = Person | |
| 27> . | |
| ** exception error: no match of right hand side value {person,{age,34},{hobby,"biking"}} | |
| 28> {Type, HobbyName, HobbyType} = Person. | |
| {person,{age,34},{hobby,"biking"}} | |
| 29> Type | |
| 29> . | |
| person | |
| 30> Hobby. | |
| * 1: variable 'Hobby' is unbound | |
| 31> HobbyName. | |
| {age,34} | |
| 32> Person | |
| 32> . | |
| {person,{age,34},{hobby,"biking"}} | |
| 33> HobbyType. | |
| {hobby,"biking"} | |
| 34> MoneyOnHand = {"cash", 7}. | |
| {"cash",7} | |
| 35> Multiplier = fun({Desc, Amt}) -> io.fwrite("10x~n", []), Amt*10 end. | |
| * 1: syntax error before: '.' | |
| 35> Multiplier = fun({Desc, Amt}) -> Amt*10 end. | |
| #Fun<erl_eval.6.99386804> | |
| 36> Multiplier(MoneyOn). | |
| * 1: variable 'MoneyOn' is unbound | |
| 37> Multiplier(MoneyOnHand). | |
| 70 | |
| 38> io:fwrite("what if you had 10x $$$'s ~n", []). | |
| what if you had 10x $$$'s | |
| ok | |
| 39> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment