-
-
Notifications
You must be signed in to change notification settings - Fork 4
all
Pannous edited this page Dec 28, 2022
·
4 revisions
The all keyword takes a block making it a functor similar to map:
all files{ delete it }
If no block is given, then
The all
keyword is a destructor, splicing a list into its items.
It is usually not needed:
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 files in ls / # 🧐
In some cases the destructor all
can differentiate between function signatures:
print numbers = print "one at a time please"
print number = printf("%d",d)
print [1 2 3] == "one at a time please"
print [1 2 3] == "1" "2" "3"