Your SlideShare is downloading. ×
0
State

                    2009   5   31   id:hiratara




2009   5   31
•
                          =   +

                • State

2009   5   31
(1) State



2009   5   31
State                                  →


                             State Int



                  String             ...
State Int



                String                State Int String

                 quot;ABCquot;
                quot;1...
State

                           State Int



                  String               State Int String

                  ...
A). counter
       B).           counter   1
2009   5   31
A)   B)                 State




       A). counter
       B).                counter   1
2009   5   31
A).


                 1          quot;aquot;
                 2          quot;aaquot;
                 3          quot;aa...
B).


                1          (quot;aquot;, 2)
                2          (quot;aaquot;, 3)
                3          ...
State Int String


                                         1           (quot;bquot;, 2)
                chars ‘b’        ...
State




                State Int String   Int -> (String, Int)

                                   1         (quot;*quo...
State



                    s0                  v(s0)
                                                       (v(s0), s(s0...
(2) return



2009   5   31
return                              State

                          State Int



                String    return        ...
State Int



                String    return      State Int String

                 quot;ABCquot;                      ?...
State

                          State Int



                String    return      State Int String

                 quo...
State Int



                String    return      State Int String

                 quot;ABCquot;                 (“ABC”...
• State                     s0
                    s0              v(s0)
                    s0                   s(s0)
  ...
• State
                •                  State
                          State




                •                    ...
Upcoming SlideShare
Loading in...5
×

Stateモナドの解説 中編

987

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
987
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
21
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "Stateモナドの解説 中編"

  1. 1. State 2009 5 31 id:hiratara 2009 5 31
  2. 2. • = + • State 2009 5 31
  3. 3. (1) State 2009 5 31
  4. 4. State → State Int String State Int String State Int Int State Int Int State Int MyType State Int MyType State Int Maybe Bool State Int (Maybe Bool) 2009 5 31
  5. 5. State Int String State Int String quot;ABCquot; quot;12345quot; quot;hogequot; State Int Int State Int Int 236 8974 2009 5 31
  6. 6. State State Int String State Int String quot;ABCquot; ??? quot;12345quot; ??? quot;hogequot; State Int ??? Int State Int Int 236 ??? 8974 ??? 2009 5 31
  7. 7. A). counter B). counter 1 2009 5 31
  8. 8. A) B) State A). counter B). counter 1 2009 5 31
  9. 9. A). 1 quot;aquot; 2 quot;aaquot; 3 quot;aaaquot; ... 2009 5 31
  10. 10. B). 1 (quot;aquot;, 2) 2 (quot;aaquot;, 3) 3 (quot;aaaquot;, 4) ... 2009 5 31
  11. 11. State Int String 1 (quot;bquot;, 2) chars ‘b’ = 2 (quot;bbquot;, 3) 3 (quot;bbbquot;, 4) ... 1 (quot;*quot;, 2) chars ‘*’ = 2 (quot;**quot;, 3) 3 (quot;***quot;, 4) ... 1 (quot; quot;, 2) chars ‘ ’ = 2 (quot; quot;, 3) 3 (quot; quot;, 4) ... 2009 5 31
  12. 12. State State Int String Int -> (String, Int) 1 (quot;*quot;, 2) 2 (quot;**quot;, 3) 3 (quot;***quot;, 4) ... 2009 5 31
  13. 13. State s0 v(s0) (v(s0), s(s0)) s(s0) : Int -> (String, Int) 1 (quot;*quot;, 2) 2 (quot;**quot;, 3) (‘*’ s0 , s0 + 1) 3 (quot;***quot;, 4) ... 2009 5 31
  14. 14. (2) return 2009 5 31
  15. 15. return State State Int String return State Int String quot;ABCquot; ??? quot;12345quot; ??? State Int ??? Int return State Int Int 236 ??? ??? 2009 5 31
  16. 16. State Int String return State Int String quot;ABCquot; ??? quot;12345quot; ??? State Int ??? Int return State Int Int 236 ??? ??? 2009 5 31
  17. 17. State State Int String return State Int String quot;ABCquot; (“ABC”, s0) quot;12345quot; (“12345, s0) State Int ??? Int return State Int Int 236 (236, s0) ??? 2009 5 31
  18. 18. State Int String return State Int String quot;ABCquot; (“ABC”, s0) quot;12345quot; (“12345, s0) State Int (v(s0), s(s0)) Int return State Int Int 236 (236, s0) (v’(s0), s’(s0)) 2009 5 31
  19. 19. • State s0 s0 v(s0) s0 s(s0) 2 • a State (a, s0) ( return ) 2009 5 31
  20. 20. • State • State State • State ( >>= ) 2009 5 31
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×