langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
5
Task/Function-definition/Neko/function-definition.neko
Normal file
5
Task/Function-definition/Neko/function-definition.neko
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// a function definition
|
||||
var multiply = function(a,b) { a*b }
|
||||
|
||||
// and calling a function
|
||||
$print( multiply(2,3) + "\n");
|
||||
23
Task/Function-definition/NetRexx/function-definition.netrexx
Normal file
23
Task/Function-definition/NetRexx/function-definition.netrexx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref savelog symbols binary
|
||||
|
||||
pi = 3.14159265358979323846264338327950
|
||||
radiusY = 10
|
||||
in2ft = 12
|
||||
ft2yds = 3
|
||||
in2mm = 25.4
|
||||
mm2m = 1 / 1000
|
||||
radiusM = multiply(multiply(radiusY, multiply(multiply(ft2yds, in2ft), in2mm)), mm2m)
|
||||
|
||||
say "Area of a circle" radiusY "yds radius: " multiply(multiply(radiusY, radiusY), pi).format(3, 3) "sq. yds"
|
||||
say radiusY "yds =" radiusM.format(3, 3) "metres"
|
||||
say "Area of a circle" radiusM.format(3, 3)"m radius:" multiply(multiply(radiusM, radiusM), pi).format(3, 3)"m**2"
|
||||
|
||||
|
||||
/**
|
||||
* Multiplication function
|
||||
*/
|
||||
method multiply(multiplicand, multiplier) public static returns Rexx
|
||||
|
||||
product = multiplicand * multiplier
|
||||
return product
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
> (define (my-multiply a b) (* a b))
|
||||
(lambda (a b) (* a b))
|
||||
> (my-multiply 2 3)
|
||||
6
|
||||
1
Task/Function-definition/Nial/function-definition-1.nial
Normal file
1
Task/Function-definition/Nial/function-definition-1.nial
Normal file
|
|
@ -0,0 +1 @@
|
|||
multiply is operation a b {a * b}
|
||||
2
Task/Function-definition/Nial/function-definition-2.nial
Normal file
2
Task/Function-definition/Nial/function-definition-2.nial
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
|multiply 2 3
|
||||
=6
|
||||
1
Task/Function-definition/Nial/function-definition-3.nial
Normal file
1
Task/Function-definition/Nial/function-definition-3.nial
Normal file
|
|
@ -0,0 +1 @@
|
|||
mul is *
|
||||
2
Task/Function-definition/Nial/function-definition-4.nial
Normal file
2
Task/Function-definition/Nial/function-definition-4.nial
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
|mul 3 4
|
||||
=12
|
||||
1
Task/Function-definition/Nial/function-definition-5.nial
Normal file
1
Task/Function-definition/Nial/function-definition-5.nial
Normal file
|
|
@ -0,0 +1 @@
|
|||
multiply is op a b {a * b}
|
||||
4
Task/Function-definition/Nial/function-definition-6.nial
Normal file
4
Task/Function-definition/Nial/function-definition-6.nial
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|2 multiply 3
|
||||
=6
|
||||
|multiply 2 3
|
||||
=6
|
||||
4
Task/Function-definition/Nial/function-definition-7.nial
Normal file
4
Task/Function-definition/Nial/function-definition-7.nial
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|mul 3 [1,2]
|
||||
=3 6
|
||||
|mul [1,2] [10,20]
|
||||
=10 40
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
proc multiply(a, b: Int): Int =
|
||||
result = a * b
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
proc multiply(a, b: Int): Int =
|
||||
return a * b
|
||||
2
Task/Function-definition/OCaml/function-definition.ocaml
Normal file
2
Task/Function-definition/OCaml/function-definition.ocaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
let int_multiply x y = x * y
|
||||
let float_multiply x y = x *. y
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
PROCEDURE Multiply(a, b: INTEGER): INTEGER;
|
||||
BEGIN
|
||||
RETURN a * b;
|
||||
END Multiply;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function : Multiply(a : Float, b : Float) ~, Float {
|
||||
return a * b;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function r = mult(a, b)
|
||||
r = a .* b;
|
||||
endfunction
|
||||
3
Task/Function-definition/Oz/function-definition-1.oz
Normal file
3
Task/Function-definition/Oz/function-definition-1.oz
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fun {Multiply X Y}
|
||||
X * Y
|
||||
end
|
||||
1
Task/Function-definition/Oz/function-definition-2.oz
Normal file
1
Task/Function-definition/Oz/function-definition-2.oz
Normal file
|
|
@ -0,0 +1 @@
|
|||
Multiply = Number.'*'
|
||||
|
|
@ -0,0 +1 @@
|
|||
multiply(a,b)=a*b;
|
||||
|
|
@ -0,0 +1 @@
|
|||
multiply=(a,b)->a*b;
|
||||
|
|
@ -0,0 +1 @@
|
|||
multiply={(a,b)->a*b;}
|
||||
4
Task/Function-definition/PL-I/function-definition.pli
Normal file
4
Task/Function-definition/PL-I/function-definition.pli
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
PRODUCT: procedure (a, b) returns (float);
|
||||
declare (a, b) float;
|
||||
return (a*b);
|
||||
end PRODUCT;
|
||||
7
Task/Function-definition/PL-SQL/function-definition.sql
Normal file
7
Task/Function-definition/PL-SQL/function-definition.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
FUNCTION multiply(p_arg1 NUMBER, p_arg2 NUMBER) RETURN NUMBER
|
||||
IS
|
||||
v_product NUMBER;
|
||||
BEGIN
|
||||
v_product := p_arg1 * p_arg2;
|
||||
RETURN v_product;
|
||||
END;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
function multiply(a,b: real): real;
|
||||
begin
|
||||
multiply := a*b;
|
||||
end;
|
||||
|
|
@ -0,0 +1 @@
|
|||
sub multiply { return @_[0] * @_[1]; }
|
||||
|
|
@ -0,0 +1 @@
|
|||
sub multiply { [*] @_ }
|
||||
|
|
@ -0,0 +1 @@
|
|||
sub multiply (Rat $a, Rat $b --> Rat) { $a * $b }
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
sub multiply (Rat $a, Rat $b) returns Rat { $a * $b }
|
||||
my Rat sub multiply (Rat $a, Rat $b) { $a * $b }
|
||||
|
|
@ -0,0 +1 @@
|
|||
my &multiply := -> $a, $b { $a * $b };
|
||||
|
|
@ -0,0 +1 @@
|
|||
my &multiply := { $^a * $^b };
|
||||
|
|
@ -0,0 +1 @@
|
|||
my &multiply := * * *;
|
||||
|
|
@ -0,0 +1 @@
|
|||
@list.grep( *.substr(0,1).lc.match(/<[0..9 a..f]>/) )
|
||||
|
|
@ -0,0 +1 @@
|
|||
@list.grep( -> $obj { $obj.substr(0,1).lc.match(/<[0..9 a..f]>/) )
|
||||
3
Task/Function-definition/Pike/function-definition.pike
Normal file
3
Task/Function-definition/Pike/function-definition.pike
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int multiply(int a, int b){
|
||||
return a * b;
|
||||
}
|
||||
3
Task/Function-definition/Pop11/function-definition.pop11
Normal file
3
Task/Function-definition/Pop11/function-definition.pop11
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
define multiply(a, b);
|
||||
a * b
|
||||
enddefine;
|
||||
|
|
@ -0,0 +1 @@
|
|||
3 4 mul
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/multiply{
|
||||
/x exch def
|
||||
/y exch def
|
||||
x y mul =
|
||||
}def
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function multiply {
|
||||
return $args[0] * $args[1]
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function multiply {
|
||||
$args[0] * $args[1]
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function multiply ($a, $b) {
|
||||
return $a * $b
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
function multiply {
|
||||
param ($a, $b)
|
||||
return $a * $b
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function multiply ([int] $a, [int] $b) {
|
||||
return $a * $b
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Procedure multiply(a,b)
|
||||
ProcedureReturn a*b
|
||||
EndProcedure
|
||||
1
Task/Function-definition/Q/function-definition-1.q
Normal file
1
Task/Function-definition/Q/function-definition-1.q
Normal file
|
|
@ -0,0 +1 @@
|
|||
multiply:{[a;b] a*b}
|
||||
1
Task/Function-definition/Q/function-definition-2.q
Normal file
1
Task/Function-definition/Q/function-definition-2.q
Normal file
|
|
@ -0,0 +1 @@
|
|||
multiply:{x*y}
|
||||
1
Task/Function-definition/Q/function-definition-3.q
Normal file
1
Task/Function-definition/Q/function-definition-3.q
Normal file
|
|
@ -0,0 +1 @@
|
|||
multiply:*
|
||||
2
Task/Function-definition/Q/function-definition-4.q
Normal file
2
Task/Function-definition/Q/function-definition-4.q
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
multiply[2;3]
|
||||
6
|
||||
1
Task/Function-definition/REBOL/function-definition.rebol
Normal file
1
Task/Function-definition/REBOL/function-definition.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
multiply: func [a b][a * b]
|
||||
4
Task/Function-definition/RLaB/function-definition-1.rlab
Normal file
4
Task/Function-definition/RLaB/function-definition-1.rlab
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
>> class(sin)
|
||||
function
|
||||
>> type(sin)
|
||||
builtin
|
||||
9
Task/Function-definition/RLaB/function-definition-2.rlab
Normal file
9
Task/Function-definition/RLaB/function-definition-2.rlab
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
f = function(x, y)
|
||||
{
|
||||
return x + y;
|
||||
};
|
||||
|
||||
>> class(f)
|
||||
function
|
||||
>> type(f)
|
||||
user
|
||||
6
Task/Function-definition/RLaB/function-definition-3.rlab
Normal file
6
Task/Function-definition/RLaB/function-definition-3.rlab
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
somelist = <<>>;
|
||||
somelist.f = function(x, y)
|
||||
{
|
||||
rval = x + y;
|
||||
return rval;
|
||||
};
|
||||
6
Task/Function-definition/RLaB/function-definition-4.rlab
Normal file
6
Task/Function-definition/RLaB/function-definition-4.rlab
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
g = function(x, y)
|
||||
{
|
||||
global(somelist);
|
||||
rval = x * somelist.f(x, 2*y);
|
||||
return rval;
|
||||
};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
define multiply use a, b
|
||||
a b *
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
define multiply use a, b
|
||||
(a * b)
|
||||
|
|
@ -0,0 +1 @@
|
|||
define multiply *
|
||||
1
Task/Function-definition/Retro/function-definition.retro
Normal file
1
Task/Function-definition/Retro/function-definition.retro
Normal file
|
|
@ -0,0 +1 @@
|
|||
: multiply ( nn-n ) * ;
|
||||
7
Task/Function-definition/SNOBOL4/function-definition.sno
Normal file
7
Task/Function-definition/SNOBOL4/function-definition.sno
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
define('multiply(a,b)') :(mul_end)
|
||||
multiply multiply = a * b :(return)
|
||||
mul_end
|
||||
* Test
|
||||
output = multiply(10.1,12.2)
|
||||
output = multiply(10,12)
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package Functions is
|
||||
function Multiply (A, B : Integer) return Integer;
|
||||
--# pre A * B in Integer; -- See note below
|
||||
--# return A * B; -- Implies commutativity on Multiply arguments
|
||||
end Functions;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
type Input_Type is range 0 .. 10;
|
||||
type Result_Type is range 0 .. 100;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package body Functions is
|
||||
function Multiply (A, B : Integer) return Integer is
|
||||
begin
|
||||
return A * B;
|
||||
end Multiply;
|
||||
end Functions;
|
||||
2
Task/Function-definition/Seed7/function-definition.seed7
Normal file
2
Task/Function-definition/Seed7/function-definition.seed7
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
const func float: multiply (in float: a, in float: b) is
|
||||
return a * b;
|
||||
|
|
@ -0,0 +1 @@
|
|||
define: #multiply -> [| :a :b | a * b].
|
||||
|
|
@ -0,0 +1 @@
|
|||
define: #multiply -> #* `er.
|
||||
|
|
@ -0,0 +1 @@
|
|||
a@(Number traits) multiplyBy: b@(Number traits) [a * b].
|
||||
|
|
@ -0,0 +1 @@
|
|||
[| :a :b | a * b] asMethod: #multipleBy: on: {Number traits. Number traits}.
|
||||
|
|
@ -0,0 +1 @@
|
|||
val multiply = op *
|
||||
|
|
@ -0,0 +1 @@
|
|||
fun multiply (x, y) = x * y
|
||||
|
|
@ -0,0 +1 @@
|
|||
fun multiply x y = x * y
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
multiply(a, b)
|
||||
Func
|
||||
Return a * b
|
||||
EndFunc
|
||||
4
Task/Function-definition/TXR/function-definition-1.txr
Normal file
4
Task/Function-definition/TXR/function-definition-1.txr
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
@(define multiply (a b out))
|
||||
@(bind out @(* a b))
|
||||
@(end)
|
||||
@(multiply 3 4 result)
|
||||
2
Task/Function-definition/TXR/function-definition-2.txr
Normal file
2
Task/Function-definition/TXR/function-definition-2.txr
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@(do (defun mult (a b) (* a b))
|
||||
(format t "3 * 4 = ~a\n" (* 3 4)))
|
||||
1
Task/Function-definition/Toka/function-definition.toka
Normal file
1
Task/Function-definition/Toka/function-definition.toka
Normal file
|
|
@ -0,0 +1 @@
|
|||
[ ( ab-c ) * ] is multiply
|
||||
10
Task/Function-definition/UNIX-Shell/function-definition-1.sh
Normal file
10
Task/Function-definition/UNIX-Shell/function-definition-1.sh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
multiply() {
|
||||
# There is never anything between the parentheses after the function name
|
||||
# Arguments are obtained using the positional parameters $1, and $2
|
||||
# The return is given as a parameter to the return command
|
||||
return `expr "$1" \* "$2"` # The backslash is required to suppress interpolation
|
||||
}
|
||||
|
||||
# Call the function
|
||||
multiply 3 4 # The function is invoked in statement context
|
||||
echo $? # The dollarhook special variable gives the return value
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
multiply() {
|
||||
return $(($1 * $2))
|
||||
}
|
||||
|
||||
multiply 5 6
|
||||
echo $?
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
multiply() {
|
||||
echo -n $(($1 * $2))
|
||||
}
|
||||
|
||||
echo $(multiply 5 6)
|
||||
|
|
@ -0,0 +1 @@
|
|||
multiply = math..mul
|
||||
|
|
@ -0,0 +1 @@
|
|||
multiply = ("a","b"). math..mul ("a","b")
|
||||
|
|
@ -0,0 +1 @@
|
|||
multiply("a","b") = math..mul ("a","b")
|
||||
1
Task/Function-definition/V/function-definition-1.v
Normal file
1
Task/Function-definition/V/function-definition-1.v
Normal file
|
|
@ -0,0 +1 @@
|
|||
[multiply *].
|
||||
2
Task/Function-definition/V/function-definition-2.v
Normal file
2
Task/Function-definition/V/function-definition-2.v
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
2 3 multiply
|
||||
=6
|
||||
3
Task/Function-definition/V/function-definition-3.v
Normal file
3
Task/Function-definition/V/function-definition-3.v
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[multiply
|
||||
[a b] let
|
||||
a b *].
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
function multiply( multiplicand, multiplier )
|
||||
multiply = multiplicand * multiplier
|
||||
end function
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
dim twosquared
|
||||
twosquared = multiply(2, 2)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Function Multiply(ByVal a As Integer, ByVal b As Integer) As Integer
|
||||
Return a * b
|
||||
End Function
|
||||
|
|
@ -0,0 +1 @@
|
|||
Multiply(1, 1)
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
section .text
|
||||
global _start
|
||||
|
||||
_multiply_regs:
|
||||
mul ebx
|
||||
mov eax, ebx
|
||||
ret
|
||||
|
||||
_multiply_stack:
|
||||
enter 2,0
|
||||
mov eax, [esp+4]
|
||||
mov ebx, [esp+8]
|
||||
mul ebx
|
||||
mov eax, ebx
|
||||
leave
|
||||
ret
|
||||
|
||||
_start:
|
||||
mov ax, 6 ;The number to multiply by
|
||||
mov ebx, 16 ;base number to multiply.
|
||||
call _multiply_regs
|
||||
push 6
|
||||
push 16
|
||||
call _multiply_stack
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
multiply proc arg1:dword, arg2:dword
|
||||
mov eax, arg1
|
||||
mov ebx, arg2
|
||||
mul ebx
|
||||
mov eax, ebx
|
||||
ret
|
||||
multiply endp
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
invoke multiply, 6, 16
|
||||
;or..
|
||||
push 16
|
||||
push 6
|
||||
call multiply
|
||||
8
Task/Function-definition/XPL0/function-definition.xpl0
Normal file
8
Task/Function-definition/XPL0/function-definition.xpl0
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
func Multiply(A, B); \the characters in parentheses are only a comment
|
||||
int A, B; \the arguments are actually declared here, as integers
|
||||
return A*B; \the default (undeclared) function type is integer
|
||||
\no need to enclose a single statement in brackets
|
||||
|
||||
func real FloatMul(A, B); \floating point version
|
||||
real A, B; \arguments are declared here as floating point (doubles)
|
||||
return A*B;
|
||||
10
Task/Function-definition/XSLT/function-definition.xslt
Normal file
10
Task/Function-definition/XSLT/function-definition.xslt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<xsl:template name="product">
|
||||
<xsl:param name="a" select="2"/>
|
||||
<xsl:param name="b" select="3"/>
|
||||
<fo:block>product = <xsl:value-of select="$a * $b"/></fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:call-template name="product">
|
||||
<xsl:with-param name="a">4</xsl:with-param>
|
||||
<xsl:with-param name="b">5</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
func multiply(x, y) {
|
||||
return x * y;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue