-
-
Notifications
You must be signed in to change notification settings - Fork 4
broadcasting
pannous edited this page Nov 14, 2020
·
3 revisions
All functions are automatically broadcasting on lists and pair values:
square number=number*number
square [1 2 3] == [1 4 9]
square [a:1 b:2 c:3] == [a:1 b:4 c:9]
delete file = run `rm $file.name`
delete all files in ls / # 🧐
Even though the map functor is part of angle, in 99% situations it should be superfluous via all/iteration as seen above.
Broadcasting reduces the amount of cases where function pointers are necessary.
Just use square [1 2 3] == [1 4 9]
instead of map &square [1 2 3] == [1 4 9]