- clique:小集団,派閥,仲間
- クラス NPの概念を理解した。
- 7.4にはいり、NP完全性のイメージはわかった。
この節はお話的な雰囲気もあり、困難もそんなになかった。またおもしろかった。
「このことは、まだわかっていない」というフレーズが徐々に増えてきて、先端に近づいている感じがした。
7.4 NP完全性のさわりだけ入った。次回は、多項式帰着可能性、から。
CL-USER(25): (time (fib 20))
; cpu time (non-gc) 110 msec user, 0 msec system
; cpu time (gc) 10 msec user, 0 msec system
; cpu time (total) 120 msec user, 0 msec system
; real time 125 msec
; space allocation:
; 527,965 cons cells, 54,642,624 other bytes, 0 static bytes
10946
CL-USER(26): (time (fib 25))
; cpu time (non-gc) 1,070 msec user, 10 msec system
; cpu time (gc) 290 msec user, 0 msec system
; cpu time (total) 1,360 msec user, 10 msec system
; real time 1,379 msec
; space allocation:
; 5,855,494 cons cells, 606,020,352 other bytes, 0 static bytes
121393
CL-USER(27): (time (fib 30))
; cpu time (non-gc) 10,990 msec user, 100 msec system
; cpu time (gc) 3,150 msec user, 20 msec system
; cpu time (total) 14,140 msec user, 120 msec system
; real time 14,273 msec
; space allocation:
; 64,938,696 cons cells, 6,720,894,720 other bytes, 0 static bytes
1346269
CL-USER(28): (compile 'fib)
FIB
NIL
NIL
CL-USER(29): (time (fib 20))
; cpu time (non-gc) 0 msec user, 0 msec system
; cpu time (gc) 0 msec user, 0 msec system
; cpu time (total) 0 msec user, 0 msec system
; real time 1 msec
; space allocation:
; 1 cons cell, 0 other bytes, 0 static bytes
10946
CL-USER(30): (time (fib 25))
; cpu time (non-gc) 10 msec user, 0 msec system
; cpu time (gc) 0 msec user, 0 msec system
; cpu time (total) 10 msec user, 0 msec system
; real time 2 msec
; space allocation:
; 1 cons cell, 0 other bytes, 0 static bytes
121393
CL-USER(31): (time (fib 30))
; cpu time (non-gc) 20 msec user, 0 msec system
; cpu time (gc) 0 msec user, 0 msec system
; cpu time (total) 20 msec user, 0 msec system
; real time 21 msec
; space allocation:
; 1 cons cell, 0 other bytes, 0 static bytes
1346269
CL-USER(32):
((lambda (B)
`(,B ((lambda () ',B))))
((lambda () '(lambda (B)
`(,B ((lambda () ',B)))))))
((lambda (B)
(list B (list (list (quote lambda) nil (list (quote quote) B)))))
((lambda () (quote (lambda (B)
(list B (list (list (quote lambda) nil (list (quote quote) B)))))))))
CL-USER(99): (concatenate 'string '(a b))
"?髓"
CL-USER(100):
CL-USER(2): (setq x 0)
0
CL-USER(3): x
0
;xという変数は、このREPLが終了するまで存在する。
CL-USER(6): (let ()
(+ x 1))
1
CL-USER(7): (let ((x 100))
(+ x 1))
101
CL-USER(10): (let ((x 100))
(+ (symbol-value 'x) 1))
1
CL-USER(11): (let ((x 10))
(let ((x 100))
(+ x 1)))
101
CL-USER(13): (setq x 10)
10
CL-USER(14): (let ((x 100))
(+ x 1))
101
CL-USER(11): (let ((x 10))
(let ((x 100))
(+ x 1)))
101
CL-USER(13): (setq x 10)
10
CL-USER(14): (let ((x 100))
(+ x 1))
101
CL-USER(15): (let ((x 100))
(+ (symbol-value 'x) 1))
11
CL-USER(57): (setq x 1)
1
CL-USER(58): (setq x (1+ x))
2
CL-USER(59): x
2
CL-USER(60): (setq x 1)
1
CL-USER(61): (let ((x 10))
(setq x (1+ x)))
11
CL-USER(62): x
1
CL-USER(63): (setq x 1)
1
CL-USER(64): (let ((x 10))
(let ((x 100))
(setq x (1+ x)))
x)
10
CL-USER(65): x
1
CL-USER(66): (set 'x 1)
1
CL-USER(67): x
1
CL-USER(68): (set 'x (1+ x))
2
CL-USER(69): x
2
CL-USER(70): (set 'x 1)
1
CL-USER(71): (let ((x 10))
(set 'x (1+ x)))
11
CL-USER(72): x
11
CL-USER(73): (set 'x 1)
1
CL-USER(74): (let ((x 10))
(let ((x 100))
(set 'x (1+ x)))
x)
10
CL-USER(75): x
101
CL-USER(78): (boundp 'y)
NIL
CL-USER(79): (let ((y 2))
(set 'y y))
2
CL-USER(80): (boundp 'y)
T
CL-USER(23): (setq x 1)
1
CL-USER(24): (defun f ()
(+ x 1))
F
CL-USER(25): x
1
CL-USER(26): (f)
2
CL-USER(27): (setq x 100)
100
CL-USER(28): x
100
CL-USER(29): (f)
101
CL-USER(30): x
100
CL-USER(35): (setq x 1)
1
CL-USER(36): (setq g #'(lambda () (+ x 1)))
#
CL-USER(37): x
1
CL-USER(38): (funcall g)
2
CL-USER(39): x
1
CL-USER(40): (setq x 100)
100
CL-USER(41): (funcall g)
101
CL-USER(42): x
100
CL-USER(45): (let* ((x 1)
(h #'(lambda () (+ x 1))))
(let ((x 100))
(funcall h)))
2
CL-USER(81): (setq x 1)
1
CL-USER(82): (defun f ()
(set 'x 2))
F
CL-USER(83): x
1
CL-USER(84): (f)
2
CL-USER(85): x
2
CL-USER(86): (setq x 1)
1
CL-USER(87): (let ((x 10))
(f))
2
CL-USER(90): x
2
CL-USER(91): (setq x 1)
1
CL-USER(92): (defun f ()
(setq x 2))
F
CL-USER(93): x
1
CL-USER(94): (f)
2
CL-USER(95): x
2
CL-USER(96): (setq x 1)
1
CL-USER(97): x
1
CL-USER(98): (let ((x 10))
(f)
x)
10
CL-USER(99): x
2
CL-USER(103): (let* ((x 10)
(g #'(lambda () (setq x 2))))
(print x)
(let ((x 100))
(print x)
(funcall g)
(print x))
(print x))
10
100
100
2
2
CL-USER(104):
CL-USER(158): (setq x 1)
1
CL-USER(159): (setq g #'(lambda () (setq x (1+ x))))
#
CL-USER(160): (setq x 10)
10
CL-USER(161): (funcall g)
11
CL-USER(162): (let ((x) (g))
(setq x 5)
(setq g #'(lambda () (setq x (1- x))))
(setq x 50)
(funcall g))
49
CL-USER(163): (funcall g)
12
CL-USER(164): (setq x 0)
0
CL-USER(165): (defun f () (setq x (1+ x)))
F
CL-USER(166): (f)
1
CL-USER(167): (progv '(x) '(100) (f) x)
101
CL-USER(168): x
1
CL-USER(169): (setq x 0)
0
CL-USER(170): (defun f () (setq x (1+ x)))
F
CL-USER(171): (f)
1
CL-USER(172): (progv '(x) '(100)
(progv '(x) '(1000)
(f) x))
1001
CL-USER(173): x
1
CL-USER(175): (progv '(x) '(100)
(progv '(x) '(1000)
(f) x)
(f) x)
101
CL-USER(176): x
1
CL-USER(179): (setq x 'top-setqed)
TOP-SETQED
CL-USER(180): (defun f () (setq x 'fun-setqed))
F
CL-USER(181): (let ((x 'letted))
(progv '(x) '('progved)
(list x (symbol-value 'x) (f))))
(LETTED 'PROGVED FUN-SETQED)
CL-USER(182): x
TOP-SETQED
CL-USER(183): (setq hoge #'(lambda ()
(let ((x 100))
#'(lambda () (setq x (1+ x))))))
#<Interpreted Function (unnamed) @ #x1000bdf1f2>
CL-USER(184): (funcall hoge)
#<Interpreted Closure (unnamed) @ #x1000bfcf92>
CL-USER(185): (setq hoge1 (funcall hoge))
#<Interpreted Closure (unnamed) @ #x1000c34fa2>
CL-USER(186): (funcall hoge1)
101
CL-USER(189): (funcall hoge1)
102
CL-USER(190): (setq hoge2 (funcall hoge))
#<Interpreted Closure (unnamed) @ #x1000cb92f2>
CL-USER(191): (funcall hoge2)
101
CL-USER(192): (funcall hoge1)
103
CL-USER(193): (setq piyo #'(lambda ()
(progv '(x) '(100)
#'(lambda () (setq x (1+ x))))))
#<Interpreted Function (unnamed) @ #x1000d98392>
CL-USER(194): (setq x 0)
0
CL-USER(195): (setq piyo1 (funcall piyo))
#<Interpreted Function (unnamed) @ #x1000e01c42>
CL-USER(196): (funcall piyo1)
1
CL-USER(197): (funcall piyo1)
2
CL-USER(198): (setq piyo2 (funcall piyo))
#<Interpreted Function (unnamed) @ #x1000e3f892>
CL-USER(199): (funcall piyo2)
3
CL-USER(200): (funcall piyo1)
4
CL-USER(201): (setq x 0)
0
CL-USER(202): (let ((x 1)))
NIL
CL-USER(203): x
0
CL-USER(207): (proclaim '(special x))
T
CL-USER(208): (let ((x 1)))
NIL
CL-USER(209): x
0
CL-USER(210):
CL-USER(210): (let ((x 1))
(setq x x))
1
CL-USER(211): x
0
CL-USER(211): x
0
CL-USER(212): (defun f ()
(setq x (1+ x)))
F
CL-USER(213): (f)
1
CL-USER(214): x
1
CL-USER(215): (let ((x 10))
(f)
x)
11
CL-USER(216): x
1
CL-USER(217): (setq y 0)
0
CL-USER(218): (defun g ()
(setq y (1+ y)))
G
CL-USER(219): (let ((y 10))
(g)
y)
10
CL-USER(220): y
1
CL-USER(2): (setq hoge #'(lambda ()
(let ((x 100))
#'(lambda () (setq x (1+ x))))))
#<Interpreted Function (unnamed) @ #x1000ae19a2>
CL-USER(3): (setq hoge1 (funcall hoge))
#<Interpreted Closure (unnamed) @ #x1000b336a2>
CL-USER(4): (funcall hoge1)
101
CL-USER(7): (funcall hoge1)
102
CL-USER(8): (setq hoge2 (funcall hoge))
#<Interpreted Closure (unnamed) @ #x1000ba3a22>
CL-USER(9): (funcall hoge2)
101
CL-USER(10): (proclaim '(special x))
T
CL-USER(11): (funcall hoge2)
102
CL-USER(12): (funcall hoge1)
103
CL-USER(13): (funcall hoge1)
104
CL-USER(14): (funcall hoge1)
105
CL-USER(15): (funcall hoge1)
106
CL-USER(17): (funcall hoge1)
107
CL-USER(18): (funcall hoge2)
103
CL-USER(19): (setq hoge3 (funcall hoge))
#<Interpreted Closure (unnamed) @ #x1000c66b72>
CL-USER(20): (funcall hoge3)
Error: Attempt to take the value of the unbound variable `X'.
[condition type: UNBOUND-VARIABLE]
Restart actions (select using :continue):
0: Try evaluating X again.
1: Use :X instead.
2: Set the symbol-value of X and use its value.
3: Use a value without setting X.
4: Return to Top Level (an "abort" restart).
5: Abort entirely from this (lisp) process.
[1] CL-USER(21): :reset
CL-USER(22): (setq x 0)
0
CL-USER(23): (funcall hoge3)
1
CL-USER(24): (funcall hoge3)
2
CL-USER(25): (funcall hoge1)
108
CL-USER(26): (funcall hoge2)
104
CL-USER(27):
CL-USER(2): (setq x 'top)
TOP
CL-USER(3): (let ((x 'local))
(let ((x 'special))
(declare (special x))
(let ((x 'local2))
)))
NIL
CL-USER(4): x
TOP
CL-USER(5): (defun f ()
(setq x (cons 'called x)))
F
CL-USER(6): (f)
(CALLED . TOP)
CL-USER(7): x
(CALLED . TOP)
CL-USER(8): (setq x 'top)
TOP
CL-USER(9): x
TOP
CL-USER(10): (let ((x 'local))
(f))
(CALLED . TOP)
CL-USER(11): x
(CALLED . TOP)
CL-USER(12): (let ((x 'special))
(declare (special x))
(f))
(CALLED . SPECIAL)
CL-USER(13): x
(CALLED . TOP)
CL-USER(16): (setq x 'top)
TOP
CL-USER(19): (proclaim '(special x))
T
CL-USER(20): x
TOP
CL-USER(21): (let ((x 'let))
(f)
x)
(CALLED . LET)
CL-USER(22): x
TOP
CL-USER(25): (macroexpand '(defvar *x*))
(PROGN (DECLAIM (SPECIAL *X*)) (RECORD-SOURCE-FILE '*X* :TYPE :SPECIAL-DECLARATION) '*X*)
T
CL-USER(26): (macroexpand '(defconstant one 1))
(PROGN (DECLAIM (SPECIAL ONE)) (EVAL-WHEN (COMPILE) (EXCL::DEFCONSTANT1 'ONE 1)) (RECORD-SOURCE-FILE 'ONE :TYPE :VARIABLE) (EXCL::DEFCONSTANT2 'ONE 1))
T
CL-USER(152): (defun cnt ()
(setq x (1+ x)))
CNT
CL-USER(153): (setq x 0)
0
CL-USER(154): (cnt)
1
CL-USER(155): x
1
CL-USER(156): (progv '(x) '(2) (cnt) x)
3
CL-USER(157): x
1
CL-USER(158): (let ((x 2))
(cnt)
x)
2
CL-USER(159): x
2
CL-USER(3): (listp (list 'a 'b))
T
CL-USER(4): (listp 'a)
NIL
CL-USER(5): (listp (cons 'a 'b))
T
CL-USER(6): (listp nil)
T
CL-USER(7): (atom nil)
T
CL-USER(8): (cons 'a 'b)
(A . B)
CL-USER(9): (consp (cons 'a 'b))
T
CL-USER(10): (consp (list 'a 'b))
T
CL-USER(11): (consp nil)
NIL
CL-USER(12): (listp nil)
T
CL-USER(78): (mapcar 'cons '(a b c) '(1 2 3 4 5 6))
((A . 1) (B . 2) (C . 3))
CL-USER(82): (mapcar #'cons '(a b c) '(1 2 3 4 5 6))
((A . 1) (B . 2) (C . 3))
CL-USER(79): (mapcar #'(lambda (x) (* x x))
'(7 2 3 8))
(mapcar #'(lambda (x) (* x x))
'(7 2 3 8))
(49 4 9 64)
CL-USER(80): (mapcar '(lambda (x) (* x x))
'(7 2 3 8))
(49 4 9 64)
CL-USER(130): (macroexpand '(incf x))
(SETQ X (+ X 1))
CL-USER(193): '`(if ,condition (progn ,@body))
`(IF ,CONDITION (PROGN ,@BODY))
CL-USER(195): (macroexpand '`(if ,condition (progn ,@body)))
(EXCL::BQ-LIST `IF CONDITION (EXCL::BQ-CONS `PROGN BODY))
CL-USER(14): (lambda (x) (* x x))
#<Interpreted Function (unnamed) @ #x1000f1e752>
CL-USER(83): (setq fdef #'foo fname 'foo)
FOO
CL-USER(84): (funcall fdef 10)
11
CL-USER(85): (funcall fname 10)
11
CL-USER(86): (defun foo (x) (1- x))
FOO
CL-USER(87): (funcall fdef 10)
11
CL-USER(88): (funcall fname 10)
9
(setq y 2)
(let ((y 4))
(funcall '(lambda (x) (* x y)) 3))
; -> 6
(setq y 2)
(let ((y 4))
((lambda (x) (* x y)) 3))
; -> 12
(setq y 2)
(let ((y 4))
(funcall #'(lambda (x) (* x y)) 3))
; -> 12
CL-USER(108): (lambda (x) (* x y))
#<Interpreted Function (unnamed) @ #x1000b40dd2>
CL-USER(109): '(lambda (x) (* x y))
(LAMBDA (X) (* X Y))
CL-USER(110): #'(lambda (x) (* x y))
#<Interpreted Function (unnamed) @ #x1000b4d732>
CL-USER(111): (let ((y 4))
#'(lambda (x) (* x y)))
#<Interpreted Closure (unnamed) @ #x1000bb8aa2>
(WE WE WE WE WE WE WE WE WE WE ...)
/usr/lib/gcc/i486-linux-gnu/4.2/include/decfloat.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/unwind.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/limits.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/linux/a.out.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/pmmintrin.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/emmintrin.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/mm3dnow.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/asm/posix_types.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/varargs.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/iso646.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/mmintrin.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/stdbool.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/float.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/omp.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/mm_malloc.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/xmmintrin.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/stdarg.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/syslimits.h
/usr/lib/gcc/i486-linux-gnu/4.2/include/stddef.h
This is a single-threaded thread-unaware GCC "mudflap" memory-checked binary.
Mudflap is Copyright (C) 2002-2004 Free Software Foundation, Inc.
The mudflap code can be controlled by an environment variable:
$ export MUDFLAP_OPTIONS=''
$
whereis a space-separated list of
any of the following options. Use `-no-OPTION' to disable options.
-mode-nop mudflaps do nothing
-mode-populate mudflaps populate object tree
-mode-check mudflaps check for memory violations [active]
-mode-violate mudflaps always cause violations (diagnostic)
-viol-nop violations do not change program execution [active]
-viol-abort violations cause a call to abort()
-viol-segv violations are promoted to SIGSEGV signals
-viol-gdb violations fork a gdb process attached to current program
-trace-calls trace calls to mudflap runtime library
-verbose-trace trace internal events within mudflap runtime library
-collect-stats collect statistics on mudflap's operation
-sigusr1-report print report upon SIGUSR1
-internal-checking perform more expensive internal checking
-print-leaks print any memory leaks at program shutdown
-check-initialization detect uninitialized object reads
-verbose-violations print verbose messages when memory violations occur [active]
-abbreviate abbreviate repetitive listings [active]
-timestamps track object lifetime timestamps [active]
-ignore-reads ignore read accesses - assume okay
-wipe-stack wipe stack objects at unwind
-wipe-heap wipe heap objects at free
-heur-proc-map support /proc/self/map heuristics
-heur-stack-bound enable a simple upper stack bound heuristic
-heur-start-end support _start.._end heuristics
-heur-stdlib register standard library data (argv, errno, stdin, ...) [active]
-free-queue-length=N queue N deferred free() calls before performing them [4]
-persistent-count=N keep a history of N unregistered regions [100]
-crumple-zone=N surround allocations with crumple zones of N bytes [32]
-lc-adapt=N adapt mask/shift parameters after N cache misses [1000003]
-backtrace=N keep an N-level stack trace of each call context [4]
*******
mudflap violation 1 (check/write): time=1220683685.027955 ptr=0x80cac98 size=4
pc=0xb7efb7bd location=`dangling.c:9 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x3d) [0xb7efb7bd]
./a.out(main+0x9a) [0x80487be]
/usr/lib/libmudflap.so.0(__wrap_main+0x49) [0xb7efb259]
Nearby object 1: checked region begins 4729B after and ends 4732B after
mudflap object 0x80ca028: name=`__mf_lookup_cache'
bounds=[0x8049a20,0x80c9a1f] size=524288 area=no-access check=0r/0w liveness=0
alloc time=1220683685.024966 pc=0xb7efb1fd
Nearby object 2: checked region begins 0B into and ends 3B into
mudflap dead object 0x80cace0: name=`malloc region'
bounds=[0x80cac98,0x80cac9b] size=4 area=heap check=0r/0w liveness=0
alloc time=1220683685.025568 pc=0xb7efb1fd
/usr/lib/libmudflap.so.0(__mf_register+0x3d) [0xb7efb1fd]
/usr/lib/libmudflap.so.0(__wrap_malloc+0xde) [0xb7efc72e]
./a.out(main+0x2c) [0x8048750]
/usr/lib/libmudflap.so.0(__wrap_main+0x49) [0xb7efb259]
dealloc time=1220683685.027660 pc=0xb7efb1a6
/usr/lib/libmudflap.so.0(__mf_unregister+0x36) [0xb7efb1a6]
/usr/lib/libmudflap.so.0(__real_free+0x88) [0xb7efbff8]
./a.out(main+0x3a) [0x804875e]
/usr/lib/libmudflap.so.0(__wrap_main+0x49) [0xb7efb259]
number of nearby objects: 2
step 1: part 1
[ # / # q0 0 1 0 0 # ]
step 2: part 2
δ(q0, 0) = (q7, 2, R)とする。
[ # / # q0 0 1 0 0 # ]
[ q0 0 / 2 q7]
結合して上下比較
# q0 0
# q0 0 1 0 0 # 2 q7
step 3: part 4
[ # / # q0 0 1 0 0 # ]
[ q0 0 / 2 q7]
[ 1 / 1 ], [ 0 / 0 ], [ 0 / 0 ]
結合して上下比較
# q0 0 1 0 0
# q0 0 1 0 0 # 2 q7 1 0 0
step 4: part 5
[ # / # q0 0 1 0 0 # ]
[ q0 0 / 2 q7]
[ 1 / 1 ], [ 0 / 0 ], [ 0 / 0 ]
[ # / # ], [ # / _ # ]
結合して上下比較
# q0 0 1 0 0 # #
# q0 0 1 0 0 # 2 q7 1 0 0 # _ #
step 5: part 2
δ(q7, 1) = (q5, 0, R)とする。
[ # / # q0 0 1 0 0 # ]
[ q0 0 / 2 q7]
[ 1 / 1 ], [ 0 / 0 ], [ 0 / 0 ]
[ # / # ], [ # / _ # ]
[ q7 1 / 0 q5]
結合して上下比較
# q0 0 1 0 0 # q7 1 #
# q0 0 1 0 0 # 2 q7 1 0 0 # 0 q5 _ #
step 6: part 4
[ # / # q0 0 1 0 0 # ]
[ q0 0 / 2 q7]
[ 1 / 1 ], [ 0 / 0 ], [ 0 / 0 ]
[ # / # ], [ # / _ # ]
[ q7 1 / 0 q5]
[ 2 / 2 ], [ 0 / 0 ], [ 0 / 0]
結合して上下比較
# q0 0 1 0 0 # 2 q7 1 0 0 #
# q0 0 1 0 0 # 2 q7 1 0 0 # 2 0 q5 0 0 _ #
step 7: part 5
[ # / # q0 0 1 0 0 # ]
[ q0 0 / 2 q7]
[ 1 / 1 ], [ 0 / 0 ], [ 0 / 0 ]
[ # / # ], [ # / _ # ]
[ q7 1 / 0 q5]
[ 2 / 2 ], [ 0 / 0 ], [ 0 / 0]
[ # / # ], [ # / _ # ]
結合して上下比較
# q0 0 1 0 0 # 2 q7 1 0 0 # # #
# q0 0 1 0 0 # 2 q7 1 0 0 # 2 0 q5 0 0 _ # # _ #
step 8: part 3
δ(q5, 0) = (q9, 2, L)とする。
[ # / # q0 0 1 0 0 # ]
[ q0 0 / 2 q7]
[ 1 / 1 ], [ 0 / 0 ], [ 0 / 0 ]
[ # / # ], [ # / _ # ]
[ q7 1 / 0 q5]
[ 2 / 2 ], [ 0 / 0 ], [ 0 / 0]
[ # / # ], [ # / _ # ]
[ 0 q5 0 / q9 0 2 ], [ 1 q5 0 / q9 1 2 ], [ 2 q5 0 / q9 2 2 ], [ _ q5 0 / q9 _ 2 ]
結合して上下比較
# q0 0 1 0 0 # 2 q7 1 0 0 # 0 q5 0# #
# q0 0 1 0 0 # 2 q7 1 0 0 # 2 0 q5 0 0 # q9 0 2 _ # _ #
保留:[ 1 q5 0 / q9 1 2 ], [ 2 q5 0 / q9 2 2 ], [ _ q5 0 / q9 _ 2 ]
int (*(*foo[])())[];
分解しながら。
int hoge; hogeはint。
int hoge[]; hogeはintの配列。
int (hoge)[];
int (*hoge)[]; hogeはintの配列のポインタ。
int (*hoge())[]; hogeはintの配列のポインタを返す関数。
int (*(*hoge)())[]; hogeはintの配列のポインタを返す関数のポインタ。
int (*(*hoge[])())[]; hogeはintの配列のポインタを返す関数のポインタの配列。
void (*signal (int sig, void (*handler)(int)))(int);
最左の識別子のみが重要。ここから考える。
void ( *signal (int sig, void (*handler) (int) ) ) (int);
*signal()を間違えないように *(signal())とする。
void ( *(signal (int sig, void (*handler) (int) ) ) ) (int);
読む。
void hoge; hogeはvoid。
void hoge (int); hogeはvoidを返す関数(引数はint)。
void (*hoge) (int); hogeはvoidを返す関数(引数はint)へのポインタ。
void (*(hoge (piyo)) (int); hogeはvoidを返す関数(引数はint)へのポインタを返す関数(引数piyo)。
void (*(hoge (int sig, void (*handler)(int))) (int); hogeはvoidを返す関数(引数はint)へのポインタを返す関数(引数は、intと、voidを返す関数(引数int)へのポインタ)。
こんな感じじゃろう。