Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,12 @@
ORG RESET
mov a, #100
mov b, #10
call multiply
; at this point, the result of 100*10 = 1000 = 03e8h is stored in registers a and b
; a = e8
; b = 03
jmp $
multiply:
mul ab
ret

View file

@ -0,0 +1,2 @@
multiply: * /`*' is a normal function
multiply: {x * y}

View file

@ -0,0 +1 @@
{expr-or-def1; expr-or-def2; ..; return-expr}

View file

@ -0,0 +1,3 @@
Lbl MULT
r₁*r₂
Return

View file

@ -0,0 +1,6 @@
fun float multiply (float a, float b)
{
return a * b;
}
// uncomment next line and change values to test
//<<< multiply(16,4) >>>;

View file

@ -0,0 +1 @@
multiply = -> @@0 * @@1

View file

@ -0,0 +1 @@
double = -> 2 * it

View file

@ -0,0 +1,25 @@
(define (multiply a b) (* a b)) → multiply ;; (1)
(multiply 1/3 666) → 222
;; a function is a lambda definition :
multiply
→ (λ (_a _b) (#* _a _b))
;; The following is the same as (1) :
(define multiply (lambda(a b) (* a b)))
multiply
→ (🔒 λ (_a _b) (#* _a _b)) ;; a closure
;; a function may be compiled
(lib 'compile)
(compile 'multiply "-float-verbose")
💡 [0] compiling _🔶_multiply ((#* _a _b))
;; object code (javascript) :
var ref,top = _blocks[_topblock];
/* */return (
/* */(_stack[top] *_stack[1 + top])
/* */);
multiply → (λ (_a _b) (#🔶_multiply)) ;; compiled function

View file

@ -0,0 +1,5 @@
' FB 1.05.0 Win64
Function multiply(d1 As Double, d2 As Double) As Double
Return d1 * d2
End Function

View file

@ -0,0 +1 @@
#Define multiply(d1, d2) (d1) * (d2)

View file

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

View file

@ -0,0 +1,6 @@
include "ConsoleWindow"
local fn multiply( a as long, b as long ) as long
end fn = a * b
print fn multiply( 3, 9 )

View file

@ -0,0 +1,2 @@
(defun mutiply (a b)
(* a b))

View file

@ -0,0 +1,3 @@
define multiply(a,b) => {
return #a * #b
}

View file

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

View file

@ -0,0 +1,6 @@
// Signatures that convert second input to match first input
define multiply(a::integer,b::any) => #a * integer(#b)
define multiply(a::decimal,b::any) => #a * decimal(#b)
// Catch all signature
define multiply(a::any,b::any) => decimal(#a) * decimal(#b)

View file

@ -0,0 +1,4 @@
define multiply(a: Integer, b: Integer): Integer
{
return a * b
}

View file

@ -0,0 +1,3 @@
on multiply (a, b)
return a * b
end

View file

@ -0,0 +1,5 @@
function multiplyy n1 n2
return n1 * n2
end multiplyy
put multiplyy(2,5) -- = 10

View file

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

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 @@
proc multiply(a, b: Int): Int = a * b

View file

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

View file

@ -0,0 +1 @@
: multiply2(a, b) a b * ;

View file

@ -0,0 +1,3 @@
@Integer multiply(@Integer a, @Integer b) [
return a * b;
]

View file

@ -0,0 +1,3 @@
function multiply(atom a, atom b)
return a*b
end function

View file

@ -0,0 +1 @@
multiply(A, B) = A*B.

View file

@ -0,0 +1 @@
func multiply x,y return x*y

View file

@ -0,0 +1,5 @@
01000000000000100000000000000000 0. -2 to c
00100000000000000000000000000000 1. 4 to CI
01111111111111111111111111111111 2. -2
00000000000001110000000000000000 3. Stop
11100000000000000000000000000000 4. 7

View file

@ -0,0 +1,26 @@
00010000000000000000000000000000 6. 8
11100000000000000000000000000000 7. 7
11111000000001100000000000000000 8. c to 31
01100000000000100000000000000000 9. -6 to c
01111000000001100000000000000000 10. c to 30
01111000000000100000000000000000 11. -30 to c
01111000000001100000000000000000 12. c to 30
11100000000000100000000000000000 13. -7 to c
11100000000001100000000000000000 14. c to 7
11100000000000100000000000000000 15. -7 to c
00111000000000010000000000000000 16. Sub. 28
11100000000001100000000000000000 17. c to 7
00111000000000010000000000000000 18. Sub. 28
00000000000000110000000000000000 19. Test
00111000000001000000000000000000 20. Add 28 to CI
11111000000000000000000000000000 21. 31 to CI
01100000000000100000000000000000 22. -6 to c
01111000000000010000000000000000 23. Sub. 30
01100000000001100000000000000000 24. c to 6
01100000000000100000000000000000 25. -6 to c
01100000000001100000000000000000 26. c to 6
10111000000000000000000000000000 27. 29 to CI
10000000000000000000000000000000 28. 1
00110000000000000000000000000000 29. 12
00000000000000000000000000000000 30. 0
00000000000000000000000000000000 31. 0

View file

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

View file

@ -0,0 +1,3 @@
func multiply(a: Double, b: Double) -> Double {
return a * b
}

View file

@ -0,0 +1,4 @@
# multiply is a built-in in ursa, so the function is called mult instead
def mult (int a, int b)
return (* a b)
end

View file

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

View file

@ -0,0 +1,2 @@
(multiply 3 4)
=> 12

View file

@ -0,0 +1,2 @@
(multiply 3 :a 4) # arg order doesn't matter here, but try subtract instead
=> 12

View file

@ -0,0 +1,2 @@
def (multiply a b|by)
(* a b)

View file

@ -0,0 +1,2 @@
multiply 3 :by 4
=> 12

View file

@ -0,0 +1,2 @@
(defun multiply (x y)
(* x y))

View file

@ -0,0 +1,2 @@
(define (multiply x y)
(* x y))

View file

@ -0,0 +1,2 @@
(define multiply
(lambda (x y) (* x y)))

View file

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

View file

@ -0,0 +1,2 @@
# 2 | generate(. * .) will generate 2, 4, 16, 256, ...
def generate(f): def r: ., (f | r); r;

View file

@ -0,0 +1 @@
def summation(f): reduce .[] as $x (0; . + ($x|f));

View file

@ -0,0 +1 @@
summation( .h * .w)