Qi練習帳
http://www.lambdassociates.org/qilisp.htm
Qiのコメントはなんと「\」!HTMLやLuaのコメント(-- )も初見はぎょっとしたものだが、それ以上にのけぞった。でLispのコメント「;」は普通のシンボルなんだよなぁww
使ってみたところ、PrologやErlang似の型推論ありの関数型言語って感じ。「論理」によりコンストラクタなしでユーザ定義データ型を作成できるのはかなり新鮮。
This is SBCL 1.0.7, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. Qi 2007, Copyright (C) 2001-2007 Mark Tarver www.lambdassociates.org version 9.0 (Turbo-E) (0-) hello hello (1-) !0 0. hello hello (0-) (= b b) true (1-) (= B b) false (2-) (and true false) false (3-) (or true false) true (4-) (not false) true (5-) (if true 5 6) 5 (6-) if if (7-) hage hage (8-) !a 7. hage hage (9-) %a 2. (and true false) 7. hage 8. hage (9-) 2 2 (10-) %tru (10-) %an 2. (and true false) (10-) 3 3 (11-) %an 2. (and true false) (11-) 1 1 (12-) !an 2. (and true false) false (13-) Hello Sailor Hello (14-) Sailor Sailor (15-) (= 6 ^ error: input aborted (15-) (* 7) #<CLOSURE [LAMBDA [X6]] {AA579D5}> (16-) ((* 7 ) 8) 56 (17-) (/. x x) #<FUNCTION [LAMBDA [x]] {AA79EB5}> (18-) ((/. x x) 7) 7 (19-) (/. x (/. y (+ x y))) #<FUNCTION [LAMBDA [x]] {AA9EE1D}> (20-) ((/. x (/. y (+ x y))) 3 4) 7 (21-) [1 2 3] [1 2 3] (22-) ( 1 2 3) error: Odd application; 1 to 2 (23-) (= [1 (+ 1 1) 3][1 2 3]) true (24-) (cons 1 2) [1 . 2] (25-) [1 . 2] The value 2 is not of type LIST. (25-) [1 2] [1 2] (26-) (head [1 2 3]) 1 (27-) (car [1 2 3]) The function car is undefined. (28-) (tail [1 2 3]) [2 3] (29-) [1 2 3 | [4]] [1 2 3 4] (30-) [1 | 3] [1 . 3] (31-) (define f 0 -> 1 1 -> 0) f (32-) f f (33-) (f 0) 1 (34-) (f 1) 0 (35-) (f 999) track f ? (y or n) n error: partial function f; (36-) (f 999) track f ? (y or n) y STYLE-WARNING: redefining f in DEFUN error: partial function f; (37-) (define half x -> (/ x 2)) ; in: LAMBDA NIL ; / ; ; caught WARNING: ; Asserted type NUMBER conflicts with derived type (VALUES (MEMBER x) &OPTIONAL). ; See also: ; The SBCL Manual, Node "Handling of Types" ; ; compilation unit finished ; caught 1 WARNING condition half (38-) (define half X -> (/ X 2)) STYLE-WARNING: redefining half in DEFUN half (39-) (half 8) 4 (40-) (half 8.6) 4.3 (41-) (half 7) 7/2 (42-) (total [1 2]) The function total is undefined. (43-) (define total [] -> 0 [X | Y] -> (+ X (total Y))) total (44-) (total [1 2 3 4 5 6 7 8 9 10]) 55 (45-) (define mymember _ [] -> [] X [X | Y] -> [X | Y] X [_ | Y] -> (mymember X Y)) mymember (46-) (mymember 3 [1 2 3 4]) [3 4] (47-) (member 3 [1 2 3 4]) The function member is undefined. (48-) (define triples [] -> [] [W X Y | Z] -> [[W X Y] | (triples Z)]) triples (49-) (triples [1 2 3]) [[1 2 3]] (50-) (triples [1 2 3 4 5 6 7]) track triples ? (y or n) n error: partial function triples; (51-) (triples [1 2 3 4 5 6 7 8 9]) [[1 2 3] [4 5 6] [7 8 9]] (52-) (define find_bigger [X Y] -> X where (> X Y) [X Y] -> Y where (> Y X)) find_bigger (53-) (find_bigger [2 4]) 4 (54-) (find_bigger [4 4]) track find_bigger ? (y or n) n error: partial function find_bigger; (55-) (find_bigger [4 8]) 8 (56-) (find_bigger [4 8 6]) track find_bigger ? (y or n) n error: partial function find_bigger; (57-) (define mymapcar _ [ ] -> [ ] F [X | Y] -> [(F X) | (mymapcar F Y)]) mymapcar (58-) (mymapcar 'mymember '(1 2 3)) Cannot FUNCALL the SYMBOL-FUNCTION of special operator QUOTE. (59-) (mymapcar mymember [1 2 3]) [#<CLOSURE [LAMBDA #] {AC96AC5}> #<CLOSURE [LAMBDA #] {ACABF25}> #<CLOSURE [LAMBDA #] {ACC13A5}>] (60-) (define *n N L -> (map (/. X (* N X)) L)) *n (61-) (*n 5) #<CLOSURE [LAMBDA [X51]] {ACFA43D}> (62-) ((*n 5) 20) error: map requires a list; not 20 (63-) ((*n 5) [20 3 4 ]) [100 15 20] (0-) ; |;| (1-) (tc +) true (2+) tc tc : (symbol --> boolean) (3+) (tc -) false : boolean (4-) tc tc (5-) (tc +) true (6+) 4 4 : number (7+) (* 7) #<CLOSURE [LAMBDA [X2]] {A9DBDED}> : (number --> number) (8+) (tc -) false : boolean (9-) [1 a] [1 a] (10-) (tc +) true (11+) [1 a] error: type error (12+) [1 2 3] [1 2 3] : (list number) (13+) (spy +) true : boolean (14+) [1 2 3] ______________________________________________ 9 inferences ?- [1 2 3] : A > ______________________________________________ 28 inferences ?- 1 : V1904 > ______________________________________________ 45 inferences ?- [2 3] : (list number) > ______________________________________________ 64 inferences ?- 2 : number > ______________________________________________ 81 inferences ?- [3 | []] : (list number) > ______________________________________________ 100 inferences ?- 3 : number > ______________________________________________ 117 inferences ?- [] : (list number) > [1 2 3] : (list number) (15+) (spy -) ______________________________________________ 9 inferences ?- (spy -) : A > ______________________________________________ 27 inferences ?- spy : (V1919 --> A) > ______________________________________________ 43 inferences ?- - : symbol > false : boolean (16+) 1 1 : number (17+) (@p 1 2 23) error: type error (18+) (@p 1 2 ) (@p 1 2) : (number * number) (19+) (@p 1 "sausage") (@p 1 "sausage") : (number * string) (20+) (fst !19) error: type error (21+) (tc -) false : boolean (22-) (fst !19) The value !19 is not of type qi::TUPLE. (23-) !19 19. (@p 1 "sausage") (@p 1 "sausage") (24-) (fst (fst !19)) The value !19 is not of type qi::TUPLE. (25-) (fst (@p 1 "sausage")) 1 (26-) (snd (@p 1 "sausage")) "sausage" (27-) (tc +) true (28+) (snd (@p 1 "sausage")) "sausage" : string (29+) (fst (@p 1 "sausage")) 1 : number (30+) (define factorial {number --> number} 0 -> 1 X -> (* X (factorial (- X 1)))) factorial : (number --> number) (31+) (factorial 3) 6 : number (0-) (define mymember {A --> (list A) --> (list A)} _ [] -> [] X [X | Y] -> Y X [_ | Y] -> (mymember X Y)) mymember (1-) (tc + ) true (2+) (mymember 5 [ 1 3 4]) error: type error (3+) (mymember 5 [ 1 3 4 5 ]) error: type error (4+) (mymember 5 [1 3 4]) error: type error (5+) (define swap-order {(A * B) --> (B * A)} (@p X Y) -> (@p Y X)) swap-order : ((A * B) --> (B * A)) (6+) (swap-order (@p 1 2)) (@p 2 1) : (number * number) (7+) ------------------ ------------------ : symbol (8+) if X e {0,1} if : symbol (9+) \ hage \ 1 1 : number (10+) \1 \ 2 2 : number (datatype binary if (element? X [0 1]) _____________ X : zero-or-one; X : zero-or-one; __________________ [X] : binary; X : zero-or-one; Y : binary; ____________________________ [X | Y] : binary; X : zero-or-one, [Y | Z] : binary >> P; ___________________________________________ [X Y | Z] : binary >> P;) binary : unit (define complement \calculates the complement of a binary number\ {binary --> binary} [0] -> [1] [1] -> [0] [1 N | X] -> [0 | (complement [N | X])] [0 N | X] -> [1 | (complement [N | X])]) complement : (binary --> binary) (13+) (complement [0 1 0 1]) [1 0 1 0] : binary
This is SBCL 1.0.7, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. Qi 2007, Copyright (C) 2001-2007 Mark Tarver www.lambdassociates.org version 9.0 (Turbo-E) (0-) hello hello (1-) !0 0. hello hello (2-) (qi:quit) The value NIL is not of type CHARACTER. (2-) (quit) 2007年 8月 24日 金曜日 00:54:33 JST [2]love{rubikitch}% e ~/bin/qi [~] 2007年 8月 24日 金曜日 00:54:40 JST 31 2007年 8月 24日 金曜日 00:54:40 JST [2]love{rubikitch}% qi [~] 2007年 8月 24日 金曜日 00:54:50 JST This is SBCL 1.0.7, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. Qi 2007, Copyright (C) 2001-2007 Mark Tarver www.lambdassociates.org version 9.0 (Turbo-E) (0-) (= b b) true (1-) (= B b) false (2-) (and true false) false (3-) (or true false) true (4-) (not false) true (5-) (if true 5 6) 5 (6-) if if (7-) hage hage (8-) !a 7. hage hage (9-) %a 2. (and true false) 7. hage 8. hage (9-) 2 2 (10-) %tru (10-) %an 2. (and true false) (10-) 3 3 (11-) %an 2. (and true false) (11-) 1 1 (12-) !an 2. (and true false) false (13-) Hello Sailor Hello (14-) Sailor Sailor (15-) (= 6 ^ error: input aborted (15-) (* 7) #<CLOSURE [LAMBDA [X6]] {AA579D5}> (16-) ((* 7 ) 8) 56 (17-) (/. x x) #<FUNCTION [LAMBDA [x]] {AA79EB5}> (18-) ((/. x x) 7) 7 (19-) (/. x (/. y (+ x y))) #<FUNCTION [LAMBDA [x]] {AA9EE1D}> (20-) ((/. x (/. y (+ x y))) 3 4) 7 (21-) [1 2 3] [1 2 3] (22-) ( 1 2 3) error: Odd application; 1 to 2 (23-) (= [1 (+ 1 1) 3][1 2 3]) true (24-) (cons 1 2) [1 . 2] (25-) [1 . 2] The value 2 is not of type LIST. (25-) [1 2] [1 2] (26-) (head [1 2 3]) 1 (27-) (car [1 2 3]) The function car is undefined. (28-) (tail [1 2 3]) [2 3] (29-) [1 2 3 | [4]] [1 2 3 4] (30-) [1 | 3] [1 . 3] (31-) (define f 0 -> 1 1 -> 0) f (32-) f f (33-) (f 0) 1 (34-) (f 1) 0 (35-) (f 999) track f ? (y or n) n error: partial function f; (36-) (f 999) track f ? (y or n) y STYLE-WARNING: redefining f in DEFUN error: partial function f; (37-) (define half x -> (/ x 2)) ; in: LAMBDA NIL ; / ; ; caught WARNING: ; Asserted type NUMBER conflicts with derived type (VALUES (MEMBER x) &OPTIONAL). ; See also: ; The SBCL Manual, Node "Handling of Types" ; ; compilation unit finished ; caught 1 WARNING condition half (38-) (define half X -> (/ X 2)) STYLE-WARNING: redefining half in DEFUN half (39-) (half 8) 4 (40-) (half 8.6) 4.3 (41-) (half 7) 7/2 (42-) (total [1 2]) The function total is undefined. (43-) (define total [] -> 0 [X | Y] -> (+ X (total Y))) total (44-) (total [1 2 3 4 5 6 7 8 9 10]) 55 (45-) (define mymember _ [] -> [] X [X | Y] -> [X | Y] X [_ | Y] -> (mymember X Y)) mymember (46-) (mymember 3 [1 2 3 4]) [3 4] (47-) (member 3 [1 2 3 4]) The function member is undefined. (48-) (define triples [] -> [] [W X Y | Z] -> [[W X Y] | (triples Z)]) triples (49-) (triples [1 2 3]) [[1 2 3]] (50-) (triples [1 2 3 4 5 6 7]) track triples ? (y or n) n error: partial function triples; (51-) (triples [1 2 3 4 5 6 7 8 9]) [[1 2 3] [4 5 6] [7 8 9]] (52-) (define find_bigger [X Y] -> X where (> X Y) [X Y] -> Y where (> Y X)) find_bigger (53-) (find_bigger [2 4]) 4 (54-) (find_bigger [4 4]) track find_bigger ? (y or n) n error: partial function find_bigger; (55-) (find_bigger [4 8]) 8 (56-) (find_bigger [4 8 6]) track find_bigger ? (y or n) n error: partial function find_bigger; (57-) (define mymapcar _ [ ] -> [ ] F [X | Y] -> [(F X) | (mymapcar F Y)]) mymapcar (58-) (mymapcar 'mymember '(1 2 3)) Cannot FUNCALL the SYMBOL-FUNCTION of special operator QUOTE. (59-) (mymapcar mymember [1 2 3]) [#<CLOSURE [LAMBDA #] {AC96AC5}> #<CLOSURE [LAMBDA #] {ACABF25}> #<CLOSURE [LAMBDA #] {ACC13A5}>] (60-) (define *n N L -> (map (/. X (* N X)) L)) *n (61-) (*n 5) #<CLOSURE [LAMBDA [X51]] {ACFA43D}> (62-) ((*n 5) 20) error: map requires a list; not 20 (63-) ((*n 5) [20 3 4 ]) [100 15 20] (64-) \ hage 1 2 debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #xB7FE47F2. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C5455}> T) 0] 0 debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #x904A5DF. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C48D5}> T) 0] 2 2 0] (* 3 ) 3 0] 0 debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #x9048B23. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C5245}> T) 0] debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #xB7FE47F2. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. 1: Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C44A5}> T) 0[2] debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #xB7FE47F2. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. 1: Return from SB-UNIX:SIGINT. 2: Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C3705}> T) 0[3] debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #xB7FE47F2. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. 1: Return from SB-UNIX:SIGINT. 2: Return from SB-UNIX:SIGINT. 3: Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C2965}> T) 0[4] 1 fatal error encountered in SBCL pid 28097(tid 3085194928): interrupt already pending LDB monitor ldb> 1 unknown command: ``1'' ldb> 2007年 8月 24日 金曜日 01:22:53 JST [2]love{rubikitch}% qi [~] 2007年 8月 24日 金曜日 01:22:56 JST This is SBCL 1.0.7, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. Qi 2007, Copyright (C) 2001-2007 Mark Tarver www.lambdassociates.org version 9.0 (Turbo-E) (0-) ; |;| (1-) (tc +) true (2+) tc tc : (symbol --> boolean) (3+) (tc -) false : boolean (4-) tc tc (5-) (tc +) true (6+) 4 4 : number (7+) (* 7) #<CLOSURE [LAMBDA [X2]] {A9DBDED}> : (number --> number) (8+) (tc -) false : boolean (9-) [1 a] [1 a] (10-) (tc +) true (11+) [1 a] error: type error (12+) [1 2 3] [1 2 3] : (list number) (13+) (spy +) true : boolean (14+) [1 2 3] ______________________________________________ 9 inferences ?- [1 2 3] : A > ______________________________________________ 28 inferences ?- 1 : V1904 > ______________________________________________ 45 inferences ?- [2 3] : (list number) > ______________________________________________ 64 inferences ?- 2 : number > ______________________________________________ 81 inferences ?- [3 | []] : (list number) > ______________________________________________ 100 inferences ?- 3 : number > ______________________________________________ 117 inferences ?- [] : (list number) > [1 2 3] : (list number) (15+) (spy -) ______________________________________________ 9 inferences ?- (spy -) : A > ______________________________________________ 27 inferences ?- spy : (V1919 --> A) > ______________________________________________ 43 inferences ?- - : symbol > false : boolean (16+) 1 1 : number (17+) (@p 1 2 23) error: type error (18+) (@p 1 2 ) (@p 1 2) : (number * number) (19+) (@p 1 "sausage") (@p 1 "sausage") : (number * string) (20+) (fst !19) error: type error (21+) (tc -) false : boolean (22-) (fst !19) The value !19 is not of type qi::TUPLE. (23-) !19 19. (@p 1 "sausage") (@p 1 "sausage") (24-) (fst (fst !19)) The value !19 is not of type qi::TUPLE. (25-) (fst (@p 1 "sausage")) 1 (26-) (snd (@p 1 "sausage")) "sausage" (27-) (tc +) true (28+) (snd (@p 1 "sausage")) "sausage" : string (29+) (fst (@p 1 "sausage")) 1 : number (30+) (define factorial {number --> number} 0 -> 1 X -> (* X (factorial (- X 1)))) factorial : (number --> number) (31+) (factorial 3) 6 : number (32+) (define mymember {A --> (list A) --> (list A)} _ [] -> [] X [X | Y] -> Y X [_ | Y] -> (mymember X Y))) ) debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #xB7FE47F2. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C5455}> T) 0] debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD "initial thread" {A9B1721}>: Interactive interrupt at #xB7FE47F2. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [CONTINUE] Return from SB-UNIX:SIGINT. 1: Return from SB-UNIX:SIGINT. (SB-UNIX::CALL-WITH-INTERRUPTS #<CLOSURE (FLET SB-UNIX::WITH-INTERRUPTS-THUNK) {B79C46B5}> T) 0[2] 0 fatal error encountered in SBCL pid 28722(tid 3085194928): interrupt already pending LDB monitor ldb> 2007年 8月 24日 金曜日 01:32:51 JST [2]love{rubikitch}% qi [~] 2007年 8月 24日 金曜日 01:32:52 JST This is SBCL 1.0.7, an implementation of ANSI Common Lisp. More information about SBCL is available at <http://www.sbcl.org/>. SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. Qi 2007, Copyright (C) 2001-2007 Mark Tarver www.lambdassociates.org version 9.0 (Turbo-E) (define mymember {A --> (list A) --> (list A)} _ [] -> [] X [X | Y] -> Y X [_ | Y] -> (mymember X Y)) mymember (1-) (tc + ) true (2+) (mymember 5 [ 1 3 4]) error: type error (3+) (mymember 5 [ 1 3 4 5 ]) error: type error (4+) (mymember 5 [1 3 4]) error: type error (define swap-order {(A * B) --> (B * A)} (@p X Y) -> (@p Y X)) swap-order : ((A * B) --> (B * A)) (6+) (swap-order (@p 1 2)) (@p 2 1) : (number * number) (7+) ------------------ ------------------ : symbol (8+) if X e {0,1} if : symbol (9+) \ hage \ 1 1 : number (10+) \1 \ 2 2 : number (datatype binary if (element? X [0 1]) _____________ X : zero-or-one; X : zero-or-one; __________________ [X] : binary; X : zero-or-one; Y : binary; ____________________________ [X | Y] : binary; X : zero-or-one, [Y | Z] : binary >> P; ___________________________________________ [X Y | Z] : binary >> P;) binary : unit (define complement \calculates the complement of a binary number\ {binary --> binary} [0] -> [1] [1] -> [0] [1 N | X] -> [0 | (complement [N | X])] [0 N | X] -> [1 | (complement [N | X])]) complement : (binary --> binary) (13+) (complement [0 1 0 1]) [1 0 1 0] : binary