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
25
Task/Bitwise-operations/LFE/bitwise-operations-1.lfe
Normal file
25
Task/Bitwise-operations/LFE/bitwise-operations-1.lfe
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
(defun bitwise (a b)
|
||||
(io:format '"~p~n" (list (band a b)))
|
||||
(io:format '"~p~n" (list (bor a b)))
|
||||
(io:format '"~p~n" (list (bxor a b)))
|
||||
(io:format '"~p~n" (list (bnot a)))
|
||||
(io:format '"~p~n" (list (bsl a b)))
|
||||
(io:format '"~p~n" (list (bsr a b))))
|
||||
|
||||
(defun d2b
|
||||
(x) (integer_to_list x 2))
|
||||
|
||||
(defun bitwise
|
||||
((a b 'binary)
|
||||
(io:format '"(~s ~s ~s): ~s~n"
|
||||
(list "band" (d2b a) (d2b b) (d2b (band a b))))
|
||||
(io:format '"(~s ~s ~s): ~s~n"
|
||||
(list "bor" (d2b a) (d2b b) (d2b (bor a b))))
|
||||
(io:format '"(~s ~s ~s): ~s~n"
|
||||
(list "bxor" (d2b a) (d2b b) (d2b (bxor a b))))
|
||||
(io:format '"(~s ~s): ~s~n"
|
||||
(list "bnot" (d2b a) (d2b (bnot a))))
|
||||
(io:format '"(~s ~s ~s): ~s~n"
|
||||
(list "bsl" (d2b a) (d2b b) (d2b (bsl a b))))
|
||||
(io:format '"(~s ~s ~s): ~s~n"
|
||||
(list "bsr" (d2b a) (d2b b) (d2b (bsr a b))))))
|
||||
17
Task/Bitwise-operations/LFE/bitwise-operations-2.lfe
Normal file
17
Task/Bitwise-operations/LFE/bitwise-operations-2.lfe
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
> (bitwise 255 170)
|
||||
170
|
||||
255
|
||||
85
|
||||
-256
|
||||
381627307539845370001346183518875822092557105621893120
|
||||
0
|
||||
ok
|
||||
> (bitwise 255 170 'binary)
|
||||
(band 11111111 10101010): 10101010
|
||||
(bor 11111111 10101010): 11111111
|
||||
(bxor 11111111 10101010): 1010101
|
||||
(bnot 11111111): -100000000
|
||||
(bsl 11111111 10101010): 1111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
(bsr 11111111 10101010): 0
|
||||
ok
|
||||
>
|
||||
Loading…
Add table
Add a link
Reference in a new issue