Deprecated: Creation of dynamic property wpdb::$categories is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 668
Deprecated: Creation of dynamic property wpdb::$post2cat is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 668
Deprecated: Creation of dynamic property wpdb::$link2cat is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 668
Deprecated: Return type of WP_Theme::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 554
Deprecated: Return type of WP_Theme::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 595
Deprecated: Return type of WP_Theme::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 535
Deprecated: Return type of WP_Theme::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 544
Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /usr/home/bugyo/public_html/b-log/wp-includes/comment-template.php on line 1739
Deprecated: Return type of WP_REST_Request::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 960
Deprecated: Return type of WP_REST_Request::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 980
Deprecated: Return type of WP_REST_Request::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 992
Deprecated: Return type of WP_REST_Request::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 1003
Deprecated: Return type of WP_Block_List::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 151
Deprecated: Return type of WP_Block_List::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 175
Deprecated: Return type of WP_Block_List::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 164
Deprecated: Return type of WP_Block_List::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 186
Deprecated: Return type of WP_Block_List::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 138
Deprecated: Return type of WP_Block_List::offsetExists($index) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 75
Deprecated: Return type of WP_Block_List::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 89
Deprecated: Return type of WP_Block_List::offsetSet($index, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 110
Deprecated: Return type of WP_Block_List::offsetUnset($index) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 127
Deprecated: Return type of WP_Block_List::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 199
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 3030
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
{"id":859,"date":"2012-08-26T19:46:23","date_gmt":"2012-08-26T10:46:23","guid":{"rendered":"http:\/\/blog.bugyo.tk\/b-log\/?p=859"},"modified":"2012-08-26T22:44:18","modified_gmt":"2012-08-26T13:44:18","slug":"haskell-%e3%80%8e%e3%81%99%e3%81%94%e3%81%84haskell-%e3%81%9f%e3%81%ae%e3%81%97%e3%81%8f%e5%ad%a6%e3%81%bc%e3%81%86%e3%80%8f13-6%e7%af%80%e3%81%ae%e6%bc%94%e7%bf%92","status":"publish","type":"post","link":"https:\/\/blog.bugyo.tk\/b-log\/archives\/859","title":{"rendered":"[Haskell] \u300e\u3059\u3054\u3044Haskell \u305f\u306e\u3057\u304f\u5b66\u307c\u3046!\u300f13.6\u7bc0\u306e\u6f14\u7fd2"},"content":{"rendered":"\u300e\u3059\u3054\u3044Haskell \u305f\u306e\u3057\u304f\u5b66\u307c\u3046!\u300f\u306e13.6\u7bc0\u3067\u306f\u30ea\u30b9\u30c8\u30e2\u30ca\u30c9\u306b\u3088\u308b\u975e\u6c7a\u5b9a\u6027\u8a08\u7b97\u3092\u4f7f\u3063\u3066\u30c1\u30a7\u30b9\u306e\u30ca\u30a4\u30c8\u304c3\u624b\u3067\u6307\u5b9a\u3057\u305f\u30de\u30b9\u306b\u5230\u9054\u3067\u304d\u308b\u304b\u3092\u8a08\u7b97\u3059\u308b\u95a2\u6570\u304c\u7d39\u4ecb\u3055\u308c\u305f\u3002<\/p>\n
\r\nghci> (6, 2) `canReachIn3` (6, 1)\r\nTrue\r\n<\/pre>\n\u306e\u3088\u3046\u306b\u59cb\u70b9\u3068\u7d42\u70b9\u3092\u6307\u5b9a\u3059\u308b\u3068\u5230\u9054\u306e\u53ef\u5426\u304c\u304b\u3048\u3063\u3066\u304f\u308b\u3002<\/p>\n
\u7bc0\u5c3e\u306e\u6f14\u7fd2\u306b\u3069\u306e\u3088\u3046\u306b\u5230\u9054\u3067\u304d\u308b\u304b\u6559\u3048\u3066\u304f\u308c\u308b\u3088\u3046\u306b\u305b\u3088\u3068\u3042\u3063\u305f\u306e\u3067\u66f8\u3044\u3066\u307f\u308b\u3002<\/p>\n
\r\nimport Monad\r\n\r\ntype KnightPos = (Int, Int)\r\ntype KnightTrack = [KnightPos]\r\n\r\nmoveKnight :: KnightTrack -> [KnightTrack]\r\nmoveKnight ((c, r) : xs) = \r\n map addLog $\r\n filter onBoard [(c+2,r-1), (c+2,r+1), (c-2,r-1), (c-2,r+1)\r\n ,(c+1,r-2), (c+1,r+2), (c-1,r-2), (c-1,r+2)]\r\n where onBoard (c, r) = c `elem` [1..8] && r `elem` [1..8]\r\n addLog pos = pos : (c, r) : xs\r\n\r\nin3 :: KnightTrack -> [KnightTrack]\r\nin3 start = return start >>= moveKnight >>= moveKnight >>= moveKnight\r\n\r\ncanReachIn3 :: KnightPos -> KnightPos -> [KnightTrack]\r\ncanReachIn3 start end = \r\n filter (\\(pos : track) -> pos == end) $ in3 [start]\r\n<\/pre>\ncanReachIn3\u306f\u771f\u507d\u5024\u3067\u306a\u304f\u30ca\u30a4\u30c8\u306e\u8ecc\u8de1\u3092\u8fd4\u3059\u3088\u3046\u306b\u5909\u66f4\u3057\u305f\u3002\u5230\u9054\u3067\u304d\u306a\u3044\u3068\u304d\u306f [] \u304c\u5e30\u308b\u3002<\/p>\n
\r\nghci>canReachIn3 (6,2) (6,1)\r\n[[(6,1),(7,3),(8,1),(6,2)],[(6,1),(5,3),(4,1),(6,2)],[(6,1),(5,3),(7,4),(6,2)],\r\n[(6,1),(8,2),(7,4),(6,2)],[(6,1),(7,3),(5,4),(6,2)],[(6,1),(4,2),(5,4),(6,2)]]\r\nghci>canReachIn3 (6,2) (7,3)\r\n[]\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"\u300e\u3059\u3054\u3044Haskell \u305f\u306e\u3057\u304f\u5b66\u307c\u3046!\u300f\u306e13.6\u7bc0\u3067\u306f\u30ea\u30b9\u30c8\u30e2\u30ca\u30c9\u306b\u3088\u308b\u975e\u6c7a\u5b9a\u6027\u8a08\u7b97\u3092\u4f7f\u3063\u3066\u30c1\u30a7\u30b9\u306e\u30ca\u30a4\u30c8\u304c3\u624b\u3067\u6307\u5b9a\u3057\u305f\u30de\u30b9\u306b\u5230\u9054\u3067\u304d\u308b\u304b\u3092\u8a08\u7b97\u3059\u308b\u95a2\u6570\u304c\u7d39\u4ecb\u3055\u308c\u305f\u3002 ghci> (6, 2) `canReachIn3` (6, 1) True \u306e\u3088\u3046\u306b\u59cb\u70b9\u3068\u7d42\u70b9\u3092\u6307\u5b9a\u3059\u308b\u3068\u5230\u9054\u306e\u53ef\u5426\u304c\u304b\u3048\u3063\u3066\u304f\u308b\u3002 \u7bc0\u5c3e\u306e\u6f14\u7fd2\u306b\u3069\u306e\u3088\u3046\u306b\u5230\u9054\u3067\u304d\u308b\u304b\u6559\u3048\u3066\u304f\u308c\u308b\u3088\u3046\u306b\u305b\u3088\u3068\u3042\u3063\u305f\u306e\u3067\u66f8\u3044\u3066\u307f\u308b\u3002 import Monad type KnightPos = (Int, Int) type KnightTrack = [KnightPos] moveKnight :: KnightTrack -> [KnightTrack] moveKnight ((c, r) : xs) = map addLog $ filter onBoard [(c+2,r-1), (c+2,r+1), Continue reading [Haskell] \u300e\u3059\u3054\u3044Haskell \u305f\u306e\u3057\u304f\u5b66\u307c\u3046!\u300f13.6\u7bc0\u306e\u6f14\u7fd2<\/span>→<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts\/859"}],"collection":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/comments?post=859"}],"version-history":[{"count":8,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts\/859\/revisions"}],"predecessor-version":[{"id":868,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts\/859\/revisions\/868"}],"wp:attachment":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/media?parent=859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/categories?post=859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/tags?post=859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}