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
14
Task/Arithmetic-Integer/LFE/arithmetic-integer-1.lfe
Normal file
14
Task/Arithmetic-Integer/LFE/arithmetic-integer-1.lfe
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(defmodule arith
|
||||
(export all))
|
||||
|
||||
(defun demo-arith ()
|
||||
(case (: io fread '"Please enter two integers: " '"~d~d")
|
||||
((tuple 'ok (a b))
|
||||
(: io format '"~p + ~p = ~p~n" (list a b (+ a b)))
|
||||
(: io format '"~p - ~p = ~p~n" (list a b (- a b)))
|
||||
(: io format '"~p * ~p = ~p~n" (list a b (* a b)))
|
||||
(: io format '"~p^~p = ~p~n" (list a b (: math pow a b)))
|
||||
; div truncates towards zero
|
||||
(: io format '"~p div ~p = ~p~n" (list a b (div a b)))
|
||||
; rem's result takes the same sign as the first operand
|
||||
(: io format '"~p rem ~p = ~p~n" (list a b (rem a b))))))
|
||||
11
Task/Arithmetic-Integer/LFE/arithmetic-integer-2.lfe
Normal file
11
Task/Arithmetic-Integer/LFE/arithmetic-integer-2.lfe
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
> (slurp '"arith.lfe")
|
||||
#(ok arith)
|
||||
> (demo-arith)
|
||||
Please enter two integers: 2 8
|
||||
2 + 8 = 10
|
||||
2 - 8 = -6
|
||||
2 * 8 = 16
|
||||
2^8 = 256.0
|
||||
2 div 8 = 0
|
||||
2 rem 8 = 2
|
||||
ok
|
||||
Loading…
Add table
Add a link
Reference in a new issue