langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
8
Task/Call-a-function/Perl-6/call-a-function-1.pl6
Normal file
8
Task/Call-a-function/Perl-6/call-a-function-1.pl6
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
foo # as list operator
|
||||
foo() # as function
|
||||
foo.() # as function, explicit postfix form
|
||||
$ref() # as object invocation
|
||||
$ref.() # as object invocation, explicit postfix
|
||||
&foo() # as object invocation
|
||||
&foo.() # as object invocation, explicit postfix
|
||||
::($name)() # as symbolic ref
|
||||
1
Task/Call-a-function/Perl-6/call-a-function-10.pl6
Normal file
1
Task/Call-a-function/Perl-6/call-a-function-10.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
my $result = somefunc(1,2,3) + 2;
|
||||
13
Task/Call-a-function/Perl-6/call-a-function-2.pl6
Normal file
13
Task/Call-a-function/Perl-6/call-a-function-2.pl6
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
foo 1 # as list operator
|
||||
foo(1) # as named function
|
||||
foo.(1) # as named function, explicit postfix
|
||||
$ref(1) # as object invocation (must be hard ref)
|
||||
$ref.(1) # as object invocation, explicit postfix
|
||||
1.$foo # as pseudo-method meaning $foo(1) (hard ref only)
|
||||
1.$foo() # as pseudo-method meaning $foo(1) (hard ref only)
|
||||
1.&foo # as pseudo-method meaning &foo(1) (is hard foo)
|
||||
1.&foo() # as pseudo-method meaning &foo(1) (is hard foo)
|
||||
1.foo # as method via dispatcher
|
||||
1.foo() # as method via dispatcher
|
||||
1."$name"() # as method via dispatcher, symbolic
|
||||
+1 # as operator to prefix:<+> function
|
||||
13
Task/Call-a-function/Perl-6/call-a-function-3.pl6
Normal file
13
Task/Call-a-function/Perl-6/call-a-function-3.pl6
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
foo 1,2 # as list operator
|
||||
foo(1,2) # as named function
|
||||
foo.(1,2) # as named function, explicit postfix
|
||||
$ref(1,2) # as object invocation (must be hard ref)
|
||||
$ref.(1,2) # as object invocation, explicit postfix
|
||||
1.$foo: 2 # as pseudo-method meaning $foo(1,2) (hard ref only)
|
||||
1.$foo(2) # as pseudo-method meaning $foo(1,2) (hard ref only)
|
||||
1.&foo: 2 # as pseudo-method meaning &foo(1,2) (is hard foo)
|
||||
1.&foo(2) # as pseudo-method meaning &foo(1,2) (is hard foo)
|
||||
1.foo: 2 # as method via dispatcher
|
||||
1.foo(2) # as method via dispatcher
|
||||
1."$name"(2) # as method via dispatcher, symbolic
|
||||
1 + 2 # as operator to infix:<+> function
|
||||
13
Task/Call-a-function/Perl-6/call-a-function-4.pl6
Normal file
13
Task/Call-a-function/Perl-6/call-a-function-4.pl6
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
foo @args # as list operator
|
||||
foo(@args) # as named function
|
||||
foo.(@args) # as named function, explicit postfix
|
||||
$ref(@args) # as object invocation (must be hard ref)
|
||||
$ref.(@args) # as object invocation, explicit postfix
|
||||
1.$foo: @args # as pseudo-method meaning $foo(1,@args) (hard ref)
|
||||
1.$foo(@args) # as pseudo-method meaning $foo(1,@args) (hard ref)
|
||||
1.&foo: @args # as pseudo-method meaning &foo(1,@args)
|
||||
1.&foo(@args) # as pseudo-method meaning &foo(1,@args)
|
||||
1.foo: @args # as method via dispatcher
|
||||
1.foo(@args) # as method via dispatcher
|
||||
1."$name"(@args) # as method via dispatcher, symbolic
|
||||
@args X @blargs # as list infix operator to infix:<X>
|
||||
2
Task/Call-a-function/Perl-6/call-a-function-5.pl6
Normal file
2
Task/Call-a-function/Perl-6/call-a-function-5.pl6
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
my @args = 1,2,3;
|
||||
foo(|@args); # equivalent to foo(1,2,3)
|
||||
2
Task/Call-a-function/Perl-6/call-a-function-6.pl6
Normal file
2
Task/Call-a-function/Perl-6/call-a-function-6.pl6
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
foo :a, :b(4), :!c, d => "stuff"
|
||||
foo(:a, :b(4), :!c, d => "stuff")
|
||||
1
Task/Call-a-function/Perl-6/call-a-function-7.pl6
Normal file
1
Task/Call-a-function/Perl-6/call-a-function-7.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
1 + 1 :a :b(4) :!c :d("stuff") # calls infix:<+>(1,1,:a, :b(4), :!c, d => "stuff")
|
||||
1
Task/Call-a-function/Perl-6/call-a-function-8.pl6
Normal file
1
Task/Call-a-function/Perl-6/call-a-function-8.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
foo(); bar(); baz(); # evaluate for side effects
|
||||
1
Task/Call-a-function/Perl-6/call-a-function-9.pl6
Normal file
1
Task/Call-a-function/Perl-6/call-a-function-9.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
1 / find-a-func(1,2,3)(4,5,6) ** 2;
|
||||
Loading…
Add table
Add a link
Reference in a new issue