Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
(define-constant DIX! (factorial 10))
|
||||
(define-constant DIX!+1 (1+ DIX!))
|
||||
|
||||
(writeln DIX!+1)
|
||||
3628801
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
' Calculations can be done in a Const declaration at compile time
|
||||
' provided only literals or other constant expressions are used
|
||||
|
||||
Const factorial As Integer = 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10
|
||||
Print factorial ' 3628800
|
||||
Sleep
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
-- create new (movie) script at runtime
|
||||
m = new(#script)
|
||||
|
||||
-- the following line triggers compilation to bytecode
|
||||
m.scriptText = "on fac10"&RETURN&"return "&(10*9*8*7*6*5*4*3*2)&RETURN&"end"
|
||||
|
||||
put fac10()
|
||||
-- 3628800
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
proc fact(x: int): int =
|
||||
result = 1
|
||||
for i in 2..x:
|
||||
result = result * i
|
||||
|
||||
const fact10 = fact(10)
|
||||
echo(fact10)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
...
|
||||
STRING_LITERAL(TMP122, "3628800", 7);
|
||||
...
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
10 seq reduce(#*) Constant new: FACT10
|
||||
: newFunction FACT10 . ;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
20 seq map(#[ seq reduce(#*) ]) Constant new: ALLFACTS
|
||||
: fact(n) n ifZero: [ 1 ] else: [ ALLFACTS at(n) ] ;
|
||||
|
||||
ALLFACTS println
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
integer a,b
|
||||
a = 10*9*8*7*6*5*4*3*2*1
|
||||
b = factorial(10)
|
||||
?{a,b}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
a = 10*9*8*7*6*5*4*3*2*1
|
||||
b = factorial(10)
|
||||
see a + nl
|
||||
see b + nl
|
||||
|
||||
func factorial nr if nr = 1 return 1 else return nr * factorial(nr-1) ok
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
define n = (10!);
|
||||
say n;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
define n = (func(n){ n > 0 ? __FUNC__(n-1)*n : 1 }(10));
|
||||
say n;
|
||||
|
|
@ -0,0 +1 @@
|
|||
(defmacro f10-at-compile-time () (* 2 3 4 5 6 7 8 9 10))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(defmacro f10-at-run-time () '(* 2 3 4 5 6 7 8 9 10))
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[1] (defun test-f10-ct () (f10-at-compile-time))
|
||||
|
||||
TEST-F10-CT
|
||||
[2] (defun test-f10-rt () (f10-at-run-time))
|
||||
|
||||
TEST-F10-RT
|
||||
Loading…
Add table
Add a link
Reference in a new issue