September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,5 @@
INTEGER FUNCTION MULTIPLY( A, B );
INTEGER A, B;
BEGIN
MULTIPLY := A * B;
END;

View file

@ -0,0 +1,3 @@
define multiply(a, b) { return a*b }
print multiply(2, 3)

View file

@ -0,0 +1 @@
[*] sm

View file

@ -0,0 +1,2 @@
3 4 lm x f
= 12

View file

@ -0,0 +1,2 @@
real multiply(RealNumber a, RealNumber b)
= a * b.

View file

@ -0,0 +1 @@
symbol f := (:x:y)(x * y).

View file

@ -0,0 +1,7 @@
--There are multiple ways to create a function in Elm
--This is a named function
multiply x y = x*y
--This is an anonymous function
\x y -> x*y

View file

@ -0,0 +1,11 @@
Public Sub Main()
Print Multiply(56, 4.66)
End
Public Sub Multiply(f1 As Float, f2 As Float) As Float
Return f1 * f2
End

View file

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

View file

@ -0,0 +1,2 @@
(defn multiply [a b]
(* a b))

View file

@ -0,0 +1 @@
(def multiply (fn [a b] (* a b)))

View file

@ -0,0 +1,96 @@
'1. Not Object Oriented Program
DECLARE Multiply(N1:INT,N2:INT),INT
DEF A,B:INT
A=2:B=2
OPENCONSOLE
PRINT Multiply(A,B)
PRINT
'When compiled as a console only program, a press any key to continue is automatic.
CLOSECONSOLE
END
SUB Multiply(N1:INT,N2:INT),INT
DEF Product:INT
Product=N1*N2
RETURN Product
ENDSUB
'Can also be written with no code in the subroutine and just RETURN N1*N2.
----
'2. Not Object Oriented Program Using A Macro
$MACRO Multiply (N1,N2) (N1*N2)
DEF A,B:INT
A=5:B=5
OPENCONSOLE
PRINT Multiply (A,B)
PRINT
'When compiled as a console only program, a press any key to continue is automatic.
CLOSECONSOLE
END
----
'3. In An Object Oriented Program
CLASS Associate
'functions/methods
DECLARE Associate:'object constructor
DECLARE _Associate:'object destructor
'***Multiply declared***
DECLARE Multiply(UnitsSold:UINT),UINT
'members
DEF m_Price:UINT
DEF m_UnitsSold:UINT
DEF m_SalesTotal:UINT
ENDCLASS
DEF Emp:Associate
m_UnitsSold=10
Ass.Multiply(m_UnitsSold)
OPENCONSOLE
PRINT"Sales total: ",:PRINT"$"+LTRIM$(STR$(Emp.m_SalesTotal))
PRINT
CLOSECONSOLE
END
'm_price is set in constructor
SUB Associate::Multiply(UnitsSold:UINT),UINT
m_SalesTotal=m_Price*UnitsSold
RETURN m_SalesTotal
ENDSUB
SUB Associate::Associate()
m_Price=10
ENDSUB
SUB Associate::_Associate()
'Nothing to cleanup
ENDSUB

View file

@ -1,3 +0,0 @@
function C = multiply(A,B)
C = A*B;
end

View file

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

View file

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

View file

@ -0,0 +1 @@
[&MULTIPLY#,A#,B#],A#<,B#<MUL RF

View file

@ -0,0 +1,3 @@
method int multiply int x int y {
return x * y
}

View file

@ -0,0 +1,7 @@
SAY multiply(5, 6)
EXIT
multiply:
PROCEDURE
PARSE ARG x, y
RETURN x*y

View file

@ -0,0 +1,5 @@
say multiply(5, 6)
::routine multiply
use arg x, y
return x *y

View file

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

View file

@ -0,0 +1,4 @@
multiply(a,b)=
x = a*b
<= x
.

View file

@ -0,0 +1 @@
fcn multiply(x,y){x*y}

View file

@ -0,0 +1 @@
fcn(x,y){x*y}(4.5,3) // --> 13.5

View file

@ -0,0 +1,2 @@
fcn multiply{vm.arglist.reduce('*)}
multiply(1,2,3,4,5) //--> 120

View file

@ -0,0 +1 @@
var mul=Op("*"); mul(4,5) //-->20