langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,5 @@
// a function definition
var multiply = function(a,b) { a*b }
// and calling a function
$print( multiply(2,3) + "\n");

View 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

View file

@ -0,0 +1,4 @@
> (define (my-multiply a b) (* a b))
(lambda (a b) (* a b))
> (my-multiply 2 3)
6

View file

@ -0,0 +1 @@
multiply is operation a b {a * b}

View file

@ -0,0 +1,2 @@
|multiply 2 3
=6

View file

@ -0,0 +1 @@
mul is *

View file

@ -0,0 +1,2 @@
|mul 3 4
=12

View file

@ -0,0 +1 @@
multiply is op a b {a * b}

View file

@ -0,0 +1,4 @@
|2 multiply 3
=6
|multiply 2 3
=6

View file

@ -0,0 +1,4 @@
|mul 3 [1,2]
=3 6
|mul [1,2] [10,20]
=10 40

View file

@ -0,0 +1,2 @@
proc multiply(a, b: Int): Int =
result = a * b

View file

@ -0,0 +1,2 @@
proc multiply(a, b: Int): Int =
return a * b

View file

@ -0,0 +1,2 @@
let int_multiply x y = x * y
let float_multiply x y = x *. y

View file

@ -0,0 +1,4 @@
PROCEDURE Multiply(a, b: INTEGER): INTEGER;
BEGIN
RETURN a * b;
END Multiply;

View file

@ -0,0 +1,3 @@
function : Multiply(a : Float, b : Float) ~, Float {
return a * b;
}

View file

@ -0,0 +1,3 @@
function r = mult(a, b)
r = a .* b;
endfunction

View file

@ -0,0 +1,3 @@
fun {Multiply X Y}
X * Y
end

View file

@ -0,0 +1 @@
Multiply = Number.'*'

View file

@ -0,0 +1 @@
multiply(a,b)=a*b;

View file

@ -0,0 +1 @@
multiply=(a,b)->a*b;

View file

@ -0,0 +1 @@
multiply={(a,b)->a*b;}

View file

@ -0,0 +1,4 @@
PRODUCT: procedure (a, b) returns (float);
declare (a, b) float;
return (a*b);
end PRODUCT;

View 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;

View file

@ -0,0 +1,4 @@
function multiply(a,b: real): real;
begin
multiply := a*b;
end;

View file

@ -0,0 +1 @@
sub multiply { return @_[0] * @_[1]; }

View file

@ -0,0 +1 @@
sub multiply { [*] @_ }

View file

@ -0,0 +1 @@
sub multiply (Rat $a, Rat $b --> Rat) { $a * $b }

View file

@ -0,0 +1,2 @@
sub multiply (Rat $a, Rat $b) returns Rat { $a * $b }
my Rat sub multiply (Rat $a, Rat $b) { $a * $b }

View file

@ -0,0 +1 @@
my &multiply := -> $a, $b { $a * $b };

View file

@ -0,0 +1 @@
my &multiply := { $^a * $^b };

View file

@ -0,0 +1 @@
my &multiply := * * *;

View file

@ -0,0 +1 @@
@list.grep( *.substr(0,1).lc.match(/<[0..9 a..f]>/) )

View file

@ -0,0 +1 @@
@list.grep( -> $obj { $obj.substr(0,1).lc.match(/<[0..9 a..f]>/) )

View file

@ -0,0 +1,3 @@
int multiply(int a, int b){
return a * b;
}

View file

@ -0,0 +1,3 @@
define multiply(a, b);
a * b
enddefine;

View file

@ -0,0 +1 @@
3 4 mul

View file

@ -0,0 +1,5 @@
/multiply{
/x exch def
/y exch def
x y mul =
}def

View file

@ -0,0 +1,3 @@
function multiply {
return $args[0] * $args[1]
}

View file

@ -0,0 +1,3 @@
function multiply {
$args[0] * $args[1]
}

View file

@ -0,0 +1,3 @@
function multiply ($a, $b) {
return $a * $b
}

View file

@ -0,0 +1,4 @@
function multiply {
param ($a, $b)
return $a * $b
}

View file

@ -0,0 +1,3 @@
function multiply ([int] $a, [int] $b) {
return $a * $b
}

View file

@ -0,0 +1,3 @@
Procedure multiply(a,b)
ProcedureReturn a*b
EndProcedure

View file

@ -0,0 +1 @@
multiply:{[a;b] a*b}

View file

@ -0,0 +1 @@
multiply:{x*y}

View file

@ -0,0 +1 @@
multiply:*

View file

@ -0,0 +1,2 @@
multiply[2;3]
6

View file

@ -0,0 +1 @@
multiply: func [a b][a * b]

View file

@ -0,0 +1,4 @@
>> class(sin)
function
>> type(sin)
builtin

View file

@ -0,0 +1,9 @@
f = function(x, y)
{
return x + y;
};
>> class(f)
function
>> type(f)
user

View file

@ -0,0 +1,6 @@
somelist = <<>>;
somelist.f = function(x, y)
{
rval = x + y;
return rval;
};

View file

@ -0,0 +1,6 @@
g = function(x, y)
{
global(somelist);
rval = x * somelist.f(x, 2*y);
return rval;
};

View file

@ -0,0 +1,2 @@
define multiply use a, b
a b *

View file

@ -0,0 +1,2 @@
define multiply use a, b
(a * b)

View file

@ -0,0 +1 @@
define multiply *

View file

@ -0,0 +1 @@
: multiply ( nn-n ) * ;

View 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

View file

@ -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;

View file

@ -0,0 +1,2 @@
type Input_Type is range 0 .. 10;
type Result_Type is range 0 .. 100;

View file

@ -0,0 +1,6 @@
package body Functions is
function Multiply (A, B : Integer) return Integer is
begin
return A * B;
end Multiply;
end Functions;

View file

@ -0,0 +1,2 @@
const func float: multiply (in float: a, in float: b) is
return a * b;

View file

@ -0,0 +1 @@
define: #multiply -> [| :a :b | a * b].

View file

@ -0,0 +1 @@
define: #multiply -> #* `er.

View file

@ -0,0 +1 @@
a@(Number traits) multiplyBy: b@(Number traits) [a * b].

View file

@ -0,0 +1 @@
[| :a :b | a * b] asMethod: #multipleBy: on: {Number traits. Number traits}.

View file

@ -0,0 +1 @@
val multiply = op *

View file

@ -0,0 +1 @@
fun multiply (x, y) = x * y

View file

@ -0,0 +1 @@
fun multiply x y = x * y

View file

@ -0,0 +1,4 @@
multiply(a, b)
Func
Return a * b
EndFunc

View file

@ -0,0 +1,4 @@
@(define multiply (a b out))
@(bind out @(* a b))
@(end)
@(multiply 3 4 result)

View file

@ -0,0 +1,2 @@
@(do (defun mult (a b) (* a b))
(format t "3 * 4 = ~a\n" (* 3 4)))

View file

@ -0,0 +1 @@
[ ( ab-c ) * ] is multiply

View 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

View file

@ -0,0 +1,6 @@
multiply() {
return $(($1 * $2))
}
multiply 5 6
echo $?

View file

@ -0,0 +1,5 @@
multiply() {
echo -n $(($1 * $2))
}
echo $(multiply 5 6)

View file

@ -0,0 +1 @@
multiply = math..mul

View file

@ -0,0 +1 @@
multiply = ("a","b"). math..mul ("a","b")

View file

@ -0,0 +1 @@
multiply("a","b") = math..mul ("a","b")

View file

@ -0,0 +1 @@
[multiply *].

View file

@ -0,0 +1,2 @@
2 3 multiply
=6

View file

@ -0,0 +1,3 @@
[multiply
[a b] let
a b *].

View file

@ -0,0 +1,3 @@
function multiply( multiplicand, multiplier )
multiply = multiplicand * multiplier
end function

View file

@ -0,0 +1,2 @@
dim twosquared
twosquared = multiply(2, 2)

View file

@ -0,0 +1,3 @@
Function Multiply(ByVal a As Integer, ByVal b As Integer) As Integer
Return a * b
End Function

View file

@ -0,0 +1 @@
Multiply(1, 1)

View file

@ -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

View file

@ -0,0 +1,7 @@
multiply proc arg1:dword, arg2:dword
mov eax, arg1
mov ebx, arg2
mul ebx
mov eax, ebx
ret
multiply endp

View file

@ -0,0 +1,5 @@
invoke multiply, 6, 16
;or..
push 16
push 6
call multiply

View 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;

View 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>

View file

@ -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