Your SlideShare is downloading. ×
NOTE




Wednesday, March 4, 2009
NOTE
                           id:mickey24




Wednesday, March 4, 2009
R             Brainf*ck
                               2009/03/01 id:mickey24




Wednesday, March 4, 2009
id: mickey24 (@mickey24)




Wednesday, March 4, 2009
id: mickey24 (@mickey24)




Wednesday, March 4, 2009
Wednesday, March 4, 2009
R           Brainf*ck




Wednesday, March 4, 2009
• Brainf*ck
                   •
                   •
                   •

Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck
                   •




Wednesday, March 4, 2009
Brainf*ck
                   •
                           •   Urban Müller, 1993




Wednesday, March 4, 2009
Brainf*ck
                   •
                           •   Urban Müller, 1993
                   •



Wednesday, March ...
Brainf*ck
                   •
                           •   Urban Müller, 1993
                   •
                    ...
Brainf*ck
                   •
                           •   Urban Müller, 1993
                   •
                    ...
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck


                                   8



Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck
                           >
                   •
                           <
                   •
            ...
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Hello, World!

                      +++++++++[>++++++++>++++++++++
                      +>+++++<<<-]>.>++.+++++++..+++
 ...
FizzBuzz
                      ++++++[->++++>>+>+>-<<<<<]>[<++++>>++
                      +>++++>>+++>+++++>+++++>>>>>>++...
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck

                   •




Wednesday, March 4, 2009
Brainf*ck

                   •
                           •           mem




Wednesday, March 4, 2009
Brainf*ck

                   •
                           •           mem

                           •           ptr



...
1   2   3   4   5   6   7   8


   mem                     0   0   0   0   0   0   0   0



                     ptr



We...
Brainf*ck
                           ptr
                   •

                             > : ptr++;
                   ...
Brainf*ck
                           ptr               (mem)
                   •



                             + : (*pt...
Brainf*ck
                           while
                   •

                            [ : while (*ptr) {
          ...
Brainf*ck
                           ptr               (mem)
                   •

                               or
     ...
ASCII




Wednesday, March 4, 2009
A

                   ++++++++++ ++++++++++ ++++++++++
                   ++++++++++ ++++++++++ ++++++++++
               ...
A
                    1      2       3   4   5     6    7       8


                   0       0    0      0   0    0     ...
A
                    1      2       3   4   5     6    7       8


                   1       0    0      0   0    0     ...
A
                    1      2       3   4   5     6    7       8


                   2       0    0      0   0    0     ...
A
                    1      2       3   4   5     6    7       8


                 65        0    0      0   0    0     ...
A
                    1      2       3   4   5     6    7       8


                 65        0    0      0   0    0     ...
++++++++[>++++++++<-]>+.




Wednesday, March 4, 2009
• Brainf*ck
                   •
                   •
                   •

Wednesday, March 4, 2009
Wednesday, March 4, 2009
•R      Brainf*ck




Wednesday, March 4, 2009
•R      Brainf*ck

                    •


Wednesday, March 4, 2009
Wednesday, March 4, 2009
• Brainf*ck
                   •
                   •
                   •

Wednesday, March 4, 2009
•                   ↓

                   • http://d.hatena.ne.jp/mickey24/20090301/
                           rdebrainfx...
brainfxxk <- function(code) {
                        #
                           #
                           #
        ...
code <- strsplit(code,quot;quot;)[[1]]
                      len <- length(code)
                      pc <- 1
           ...
while (pc <= len) {
                        switch(code[pc],
                                quot;>quot; = inc_ptr(),
    ...
> and <
                           #>
                           inc_ptr <- function() {
                             ptr ...
+ and -
                           #+
                           inc_mem <- function() {
                             mem[...
[
                    #[
                    wstart <- function() {
                      if (mem[ptr] == 0) {
           ...
]
                    #]
                    wend <- function() {
                      if (mem[ptr] != 0) {
             ...
. and ,




Wednesday, March 4, 2009
• Brainf*ck
                   •
                   •
                   •

Wednesday, March 4, 2009
•.
                   •,
                   •1
                   •

Wednesday, March 4, 2009
.




Wednesday, March 4, 2009
.

                   •       →ASCII




Wednesday, March 4, 2009
.

                   •           →ASCII



                   •       .




Wednesday, March 4, 2009
sprintf




Wednesday, March 4, 2009
sprintf
                   •C         %c




Wednesday, March 4, 2009
sprintf
                   •C         %c

                   • %s




Wednesday, March 4, 2009
sprintf
                   •C               %c

                   • %s

                           > sprintf(quot;%squot;...
Wednesday, March 4, 2009
•




Wednesday, March 4, 2009
•

             •             Tsukuba.R#4




Wednesday, March 4, 2009
to_ascii <- function (x) {
                      c(quot;quot;,quot;x1quot;,quot;x2quot;,quot;x3quot;,quot;x4quot;,quot;x5q...
to_ascii <- function (x) {
                      c(quot;quot;,quot;x1quot;,quot;x2quot;,quot;x3quot;,quot;x4quot;,quot;x5q...
Ruby


                      $ ruby -e '(0..255).each do
                      |i| print quot;x%x,quot; % i end'




Wedne...
> paste(mapply(to_ascii,c(72,101,
                      108,108,111,44,32,119,111,114,108,
                      100,33)),...
Wednesday, March 4, 2009
• intToUtf8   utf8ToInt




Wednesday, March 4, 2009
• intToUtf8   utf8ToInt



                   • Ω ΩΩ                d(ry




Wednesday, March 4, 2009
> paste(mapply(intToUtf8,c(72,101,
                      108,108,111,44,32,119,111,114,108,
                      100,33))...
> paste(mapply(intToUtf8,c(72,101,
                      108,108,111,44,32,119,111,114,108,
                      100,33))...
.

                      #.
                      putc <- function() {
                        cat(intToUtf8(mem[ptr]))
  ...
,




Wednesday, March 4, 2009
,

                   •
                           (ry




Wednesday, March 4, 2009
,

                   •
                                     (ry

                   •       ,   (ry




Wednesday, March ...
,

                   •
                                     (ry

                   •       ,   (ry

                   •...
,




Wednesday, March 4, 2009
,

                   •       →




Wednesday, March 4, 2009
,

                   •              →

                           • utf8ToInt



Wednesday, March 4, 2009
,

                   •              →

                           • utf8ToInt
                   •


Wednesday, March 4, ...
,
              #,
              buf <- quot;quot;    #          1


              getc <- function() {
                if...
1




Wednesday, March 4, 2009
1




Wednesday, March 4, 2009
Wednesday, March 4, 2009
•      <<-




Wednesday, March 4, 2009
•      <<-

              •
                     (<-   NG)




Wednesday, March 4, 2009
•      <<-

              •
                     (<-   NG)

              •            http://cse.naro.affrc.go.jp/takezaw...
•      <<-

              •
                     (<-   NG)

              •            http://cse.naro.affrc.go.jp/takezaw...
> x <- 1

                      > inc_x <- function() { x <- x + 1 }

                      > inc_x()




Wednesday, March...
> x <- 1

                      > inc_x <- function() { x <- x + 1 }

                      > inc_x()

                   ...
OK

                      > x <- 1

                      > inc_x <- function() { x <<- x + 1 }

                      > i...
OK

                      > x <- 1

                      > inc_x <- function() { x <<- x + 1 }

                      > i...
•
                   •           GIF



                           •
                   •
Wednesday, March 4, 2009
•                 (2008)   Ruby



         •      R-Tips http://cse.naro.affrc.go.jp/takezawa/r-tips/r.html

         •  ...
Wednesday, March 4, 2009
Upcoming SlideShare
Loading in...5
×

Rで学ぶBrainf*ck

1,060

Published on

+++++++++[>++++++++>+++++++++++>+++++<<.>++.+++++++..+++.>-.------------.<++++++++.--------.+++.------.--------.>+.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,060
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
















































































  • Transcript of "Rで学ぶBrainf*ck"

    1. 1. NOTE Wednesday, March 4, 2009
    2. 2. NOTE id:mickey24 Wednesday, March 4, 2009
    3. 3. R Brainf*ck 2009/03/01 id:mickey24 Wednesday, March 4, 2009
    4. 4. id: mickey24 (@mickey24) Wednesday, March 4, 2009
    5. 5. id: mickey24 (@mickey24) Wednesday, March 4, 2009
    6. 6. Wednesday, March 4, 2009
    7. 7. R Brainf*ck Wednesday, March 4, 2009
    8. 8. • Brainf*ck • • • Wednesday, March 4, 2009
    9. 9. Brainf*ck Wednesday, March 4, 2009
    10. 10. Brainf*ck • Wednesday, March 4, 2009
    11. 11. Brainf*ck • • Urban Müller, 1993 Wednesday, March 4, 2009
    12. 12. Brainf*ck • • Urban Müller, 1993 • Wednesday, March 4, 2009
    13. 13. Brainf*ck • • Urban Müller, 1993 • • Brainf*ck Wednesday, March 4, 2009
    14. 14. Brainf*ck • • Urban Müller, 1993 • • Brainf*ck • Brainfu*k Wednesday, March 4, 2009
    15. 15. Brainf*ck Wednesday, March 4, 2009
    16. 16. Brainf*ck 8 Wednesday, March 4, 2009
    17. 17. Brainf*ck Wednesday, March 4, 2009
    18. 18. Brainf*ck > • < • + • - • . • , • [ • ] • Wednesday, March 4, 2009
    19. 19. Brainf*ck Wednesday, March 4, 2009
    20. 20. Brainf*ck Wednesday, March 4, 2009
    21. 21. Hello, World! +++++++++[>++++++++>++++++++++ +>+++++<<<-]>.>++.+++++++..+++ .>-.------------.<++++++++.--- -----.+++.------.--------.>+. Wednesday, March 4, 2009
    22. 22. FizzBuzz ++++++[->++++>>+>+>-<<<<<]>[<++++>>++ +>++++>>+++>+++++>+++++>>>>>>++>>++<< <<<<<<<<<<<<-]<++++>+++>-->+++>->>--- >++>>>+++++[->++>++<<]<<<<<<<<<<[->-[ >>>>>>>]>[<+++>.>.>>>>..>>>+<]<<<<<-[ >>>>]>[<+++++>.>.>..>>>+<]>>>>+<-[<<< ]<[[-<<+>>]>>>+>+<<<<<<[->>+>+>-<<<<] <]>>[[-]<]>[>>>[>.<<.<<<]<[.<<<<]>]>. <<<<<<<<<<<] Wednesday, March 4, 2009
    23. 23. Brainf*ck Wednesday, March 4, 2009
    24. 24. Brainf*ck • Wednesday, March 4, 2009
    25. 25. Brainf*ck • • mem Wednesday, March 4, 2009
    26. 26. Brainf*ck • • mem • ptr Wednesday, March 4, 2009
    27. 27. 1 2 3 4 5 6 7 8 mem 0 0 0 0 0 0 0 0 ptr Wednesday, March 4, 2009
    28. 28. Brainf*ck ptr • > : ptr++; • • < : ptr--; Wednesday, March 4, 2009
    29. 29. Brainf*ck ptr (mem) • + : (*ptr)++; • • - : (*ptr)--; Wednesday, March 4, 2009
    30. 30. Brainf*ck while • [ : while (*ptr) { • •]:} Wednesday, March 4, 2009
    31. 31. Brainf*ck ptr (mem) • or . : putchar(*ptr); • • , : *ptr = getchar(); Wednesday, March 4, 2009
    32. 32. ASCII Wednesday, March 4, 2009
    33. 33. A ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
    34. 34. A 1 2 3 4 5 6 7 8 0 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
    35. 35. A 1 2 3 4 5 6 7 8 1 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
    36. 36. A 1 2 3 4 5 6 7 8 2 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
    37. 37. A 1 2 3 4 5 6 7 8 65 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
    38. 38. A 1 2 3 4 5 6 7 8 65 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. A Wednesday, March 4, 2009
    39. 39. ++++++++[>++++++++<-]>+. Wednesday, March 4, 2009
    40. 40. • Brainf*ck • • • Wednesday, March 4, 2009
    41. 41. Wednesday, March 4, 2009
    42. 42. •R Brainf*ck Wednesday, March 4, 2009
    43. 43. •R Brainf*ck • Wednesday, March 4, 2009
    44. 44. Wednesday, March 4, 2009
    45. 45. • Brainf*ck • • • Wednesday, March 4, 2009
    46. 46. • ↓ • http://d.hatena.ne.jp/mickey24/20090301/ rdebrainfxxk Wednesday, March 4, 2009
    47. 47. brainfxxk <- function(code) { # # # } code <- quot;++++++++[>++++++++<-]>+.quot; brainfxxk(code) Wednesday, March 4, 2009
    48. 48. code <- strsplit(code,quot;quot;)[[1]] len <- length(code) pc <- 1 ptr <- 1 mem <- rep(0, 128) Wednesday, March 4, 2009
    49. 49. while (pc <= len) { switch(code[pc], quot;>quot; = inc_ptr(), quot;<quot; = dec_ptr(), quot;+quot; = inc_mem(), quot;-quot; = dec_mem(), quot;[quot; = wstart(), quot;]quot; = wend(), quot;.quot; = putc(), quot;,quot; = getc() ) pc <- pc + 1 } cat(quot;nquot;) Wednesday, March 4, 2009
    50. 50. > and < #> inc_ptr <- function() { ptr <<- ptr + 1 } #< dec_ptr <- function() { ptr <<- ptr - 1 } Wednesday, March 4, 2009
    51. 51. + and - #+ inc_mem <- function() { mem[ptr] <<- mem[ptr] + 1 } #- dec_mem <- function() { mem[ptr] <<- mem[ptr] - 1 } Wednesday, March 4, 2009
    52. 52. [ #[ wstart <- function() { if (mem[ptr] == 0) { count <- 1 pc <<- pc + 1 while (count > 0) { if (code[pc] == quot;[quot;) { count <- count + 1; } if (code[pc] == quot;]quot;) { count <- count - 1; } pc <<- pc + 1 } pc <<- pc - 1 } } Wednesday, March 4, 2009
    53. 53. ] #] wend <- function() { if (mem[ptr] != 0) { count <- 1 pc <<- pc - 1 while (count > 0) { if (code[pc] == quot;[quot;) { count <- count - 1; } if (code[pc] == quot;]quot;) { count <- count + 1; } pc <<- pc - 1 } pc <<- pc + 1 } } Wednesday, March 4, 2009
    54. 54. . and , Wednesday, March 4, 2009
    55. 55. • Brainf*ck • • • Wednesday, March 4, 2009
    56. 56. •. •, •1 • Wednesday, March 4, 2009
    57. 57. . Wednesday, March 4, 2009
    58. 58. . • →ASCII Wednesday, March 4, 2009
    59. 59. . • →ASCII • . Wednesday, March 4, 2009
    60. 60. sprintf Wednesday, March 4, 2009
    61. 61. sprintf •C %c Wednesday, March 4, 2009
    62. 62. sprintf •C %c • %s Wednesday, March 4, 2009
    63. 63. sprintf •C %c • %s > sprintf(quot;%squot;,34) [1] quot;34quot; Wednesday, March 4, 2009
    64. 64. Wednesday, March 4, 2009
    65. 65. • Wednesday, March 4, 2009
    66. 66. • • Tsukuba.R#4 Wednesday, March 4, 2009
    67. 67. to_ascii <- function (x) { c(quot;quot;,quot;x1quot;,quot;x2quot;,quot;x3quot;,quot;x4quot;,quot;x5quot;,quot;x6quot;,quot;x7quot;,quot;x8quot;,quot;x9quot;,quot;xaquot;,quot;xbquot;,quot;xcquot;,quot;xdquot;,quot;xequot;,quot;xfquot;,quot;x10quot;,quot;x11quot;, quot;x12quot;,quot;x13quot;,quot;x14quot;,quot;x15quot;,quot;x16quot;,quot;x17quot;,quot;x18quot;,quot;x19quot;,quot;x1aquot;,quot;x1bquot;,quot;x1cquot;,quot;x1dquot;,quot;x1equot;,quot;x1fquot;,quot;x20 quot;,quot;x21quot;,quot;x22quot;,quot;x23quot;,quot;x24quot;,quot;x25quot;,quot;x26quot;,quot;x27quot;,quot;x28quot;,quot;x29quot;,quot;x2aquot;,quot;x2bquot;,quot;x2cquot;,quot;x2dquot;,quot;x2equot;,quot;x 2fquot;,quot;x30quot;,quot;x31quot;,quot;x32quot;,quot;x33quot;,quot;x34quot;,quot;x35quot;,quot;x36quot;,quot;x37quot;,quot;x38quot;,quot;x39quot;,quot;x3aquot;,quot;x3bquot;,quot;x3cquot;,quot;x3dquot;,quot; x3equot;,quot;x3fquot;,quot;x40quot;,quot;x41quot;,quot;x42quot;,quot;x43quot;,quot;x44quot;,quot;x45quot;,quot;x46quot;,quot;x47quot;,quot;x48quot;,quot;x49quot;,quot;x4aquot;,quot;x4bquot;,quot;x4cquot;, quot;x4dquot;,quot;x4equot;,quot;x4fquot;,quot;x50quot;,quot;x51quot;,quot;x52quot;,quot;x53quot;,quot;x54quot;,quot;x55quot;,quot;x56quot;,quot;x57quot;,quot;x58quot;,quot;x59quot;,quot;x5aquot;,quot;x5b quot;,quot;x5cquot;,quot;x5dquot;,quot;x5equot;,quot;x5fquot;,quot;x60quot;,quot;x61quot;,quot;x62quot;,quot;x63quot;,quot;x64quot;,quot;x65quot;,quot;x66quot;,quot;x67quot;,quot;x68quot;,quot;x69quot;,quot;x6 aquot;,quot;x6bquot;,quot;x6cquot;,quot;x6dquot;,quot;x6equot;,quot;x6fquot;,quot;x70quot;,quot;x71quot;,quot;x72quot;,quot;x73quot;,quot;x74quot;,quot;x75quot;,quot;x76quot;,quot;x77quot;,quot;x78quot;,quot;x 79quot;,quot;x7aquot;,quot;x7bquot;,quot;x7cquot;,quot;x7dquot;,quot;x7equot;,quot;x7fquot;,quot;x80quot;,quot;x81quot;,quot;x82quot;,quot;x83quot;,quot;x84quot;,quot;x85quot;,quot;x86quot;,quot;x87quot;,quot; x88quot;,quot;x89quot;,quot;x8aquot;,quot;x8bquot;,quot;x8cquot;,quot;x8dquot;,quot;x8equot;,quot;x8fquot;,quot;x90quot;,quot;x91quot;,quot;x92quot;,quot;x93quot;,quot;x94quot;,quot;x95quot;,quot;x96quot;, quot;x97quot;,quot;x98quot;,quot;x99quot;,quot;x9aquot;,quot;x9bquot;,quot;x9cquot;,quot;x9dquot;,quot;x9equot;,quot;x9fquot;,quot;xa0quot;,quot;xa1quot;,quot;xa2quot;,quot;xa3quot;,quot;xa4quot;,quot;xa5quot;, quot;xa6quot;,quot;xa7quot;,quot;xa8quot;,quot;xa9quot;,quot;xaaquot;,quot;xabquot;,quot;xacquot;,quot;xadquot;,quot;xaequot;,quot;xafquot;,quot;xb0quot;,quot;xb1quot;,quot;xb2quot;,quot;xb3quot;,quot;xb4quot;,quot; xb5quot;,quot;xb6quot;,quot;xb7quot;,quot;xb8quot;,quot;xb9quot;,quot;xbaquot;,quot;xbbquot;,quot;xbcquot;,quot;xbdquot;,quot;xbequot;,quot;xbfquot;,quot;xc0quot;,quot;xc1quot;,quot;xc2quot;,quot;xc3quot;, quot;xc4quot;,quot;xc5quot;,quot;xc6quot;,quot;xc7quot;,quot;xc8quot;,quot;xc9quot;,quot;xcaquot;,quot;xcbquot;,quot;xccquot;,quot;xcdquot;,quot;xcequot;,quot;xcfquot;,quot;xd0quot;,quot;xd1quot;,quot;xd2quot;,quot; xd3quot;,quot;xd4quot;,quot;xd5quot;,quot;xd6quot;,quot;xd7quot;,quot;xd8quot;,quot;xd9quot;,quot;xdaquot;,quot;xdbquot;,quot;xdcquot;,quot;xddquot;,quot;xdequot;,quot;xdfquot;,quot;xe0quot;,quot;xe1quot;, quot;xe2quot;,quot;xe3quot;,quot;xe4quot;,quot;xe5quot;,quot;xe6quot;,quot;xe7quot;,quot;xe8quot;,quot;xe9quot;,quot;xeaquot;,quot;xebquot;,quot;xecquot;,quot;xedquot;,quot;xeequot;,quot;xefquot;,quot;xf0quot;,quot; xf1quot;,quot;xf2quot;,quot;xf3quot;,quot;xf4quot;,quot;xf5quot;,quot;xf6quot;,quot;xf7quot;,quot;xf8quot;,quot;xf9quot;,quot;xfaquot;,quot;xfbquot;,quot;xfcquot;,quot;xfdquot;,quot;xfequot;,quot;xffquot;)[x+1] } Wednesday, March 4, 2009
    68. 68. to_ascii <- function (x) { c(quot;quot;,quot;x1quot;,quot;x2quot;,quot;x3quot;,quot;x4quot;,quot;x5quot;,quot;x6quot;,quot;x7quot;,quot;x 8quot;,quot;x9quot;,quot;xaquot;,quot;xbquot;,quot;xcquot;,quot;xdquot;,quot;xequot;,quot;xfquot;,quot;x10 ... quot;xf2quot;,quot;xf3quot;,quot;xf4quot;,quot;xf5quot;,quot;xf6quot;,quot;xf7quot;,quot;xf8quot;,quot;x f9quot;,quot;xfaquot;,quot;xfbquot;,quot;xfcquot;,quot;xfdquot;,quot;xfequot;,quot;xffquot;)[x+1] } Wednesday, March 4, 2009
    69. 69. Ruby $ ruby -e '(0..255).each do |i| print quot;x%x,quot; % i end' Wednesday, March 4, 2009
    70. 70. > paste(mapply(to_ascii,c(72,101, 108,108,111,44,32,119,111,114,108, 100,33)),collapse=quot;quot;) [1] quot;Hello, world!quot; Wednesday, March 4, 2009
    71. 71. Wednesday, March 4, 2009
    72. 72. • intToUtf8 utf8ToInt Wednesday, March 4, 2009
    73. 73. • intToUtf8 utf8ToInt • Ω ΩΩ d(ry Wednesday, March 4, 2009
    74. 74. > paste(mapply(intToUtf8,c(72,101, 108,108,111,44,32,119,111,114,108, 100,33)),collapse=quot;quot;) [1] quot;Hello, world!quot; Wednesday, March 4, 2009
    75. 75. > paste(mapply(intToUtf8,c(72,101, 108,108,111,44,32,119,111,114,108, 100,33)),collapse=quot;quot;) [1] quot;Hello, world!quot; @twittoru++ Wednesday, March 4, 2009
    76. 76. . #. putc <- function() { cat(intToUtf8(mem[ptr])) } Wednesday, March 4, 2009
    77. 77. , Wednesday, March 4, 2009
    78. 78. , • (ry Wednesday, March 4, 2009
    79. 79. , • (ry • , (ry Wednesday, March 4, 2009
    80. 80. , • (ry • , (ry • Wednesday, March 4, 2009
    81. 81. , Wednesday, March 4, 2009
    82. 82. , • → Wednesday, March 4, 2009
    83. 83. , • → • utf8ToInt Wednesday, March 4, 2009
    84. 84. , • → • utf8ToInt • Wednesday, March 4, 2009
    85. 85. , #, buf <- quot;quot; # 1 getc <- function() { if (nchar(buf) == 0) { buf <<- readline() } mem[ptr] <<- utf8ToInt(substring(buf, 1, 1)) buf <<- substring(buf, 2) } Wednesday, March 4, 2009
    86. 86. 1 Wednesday, March 4, 2009
    87. 87. 1 Wednesday, March 4, 2009
    88. 88. Wednesday, March 4, 2009
    89. 89. • <<- Wednesday, March 4, 2009
    90. 90. • <<- • (<- NG) Wednesday, March 4, 2009
    91. 91. • <<- • (<- NG) • http://cse.naro.affrc.go.jp/takezawa/r-tips/r/32.html Wednesday, March 4, 2009
    92. 92. • <<- • (<- NG) • http://cse.naro.affrc.go.jp/takezawa/r-tips/r/32.html • Wednesday, March 4, 2009
    93. 93. > x <- 1 > inc_x <- function() { x <- x + 1 } > inc_x() Wednesday, March 4, 2009
    94. 94. > x <- 1 > inc_x <- function() { x <- x + 1 } > inc_x() >x [1] 1 # Wednesday, March 4, 2009
    95. 95. OK > x <- 1 > inc_x <- function() { x <<- x + 1 } > inc_x() Wednesday, March 4, 2009
    96. 96. OK > x <- 1 > inc_x <- function() { x <<- x + 1 } > inc_x() >x [1] 2 # OK! Wednesday, March 4, 2009
    97. 97. • • GIF • • Wednesday, March 4, 2009
    98. 98. • (2008) Ruby • R-Tips http://cse.naro.affrc.go.jp/takezawa/r-tips/r.html • RjpWiki http://www.okada.jp.org/RWiki/ Wednesday, March 4, 2009
    99. 99. Wednesday, March 4, 2009

    ×