ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
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 4, 2009
Brainf*ck
                   •
                           •   Urban Müller, 1993
                   •
                           •   Brainf*ck




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



Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck


                                   8



Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck
                           >
                   •
                           <
                   •
                           +
                   •
                           -
                   •
                           .
                   •
                           ,
                   •
                           [
                   •
                           ]
                   •


Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Hello, World!

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




Wednesday, March 4, 2009
FizzBuzz
                      ++++++[->++++>>+>+>-<<<<<]>[<++++>>++
                      +>++++>>+++>+++++>+++++>>>>>>++>>++<<
                      <<<<<<<<<<<<-]<++++>+++>-->+++>->>---
                      >++>>>+++++[->++>++<<]<<<<<<<<<<[->-[
                      >>>>>>>]>[<+++>.>.>>>>..>>>+<]<<<<<-[
                      >>>>]>[<+++++>.>.>..>>>+<]>>>>+<-[<<<
                      ]<[[-<<+>>]>>>+>+<<<<<<[->>+>+>-<<<<]
                      <]>>[[-]<]>[>>>[>.<<.<<<]<[.<<<<]>]>.
                      <<<<<<<<<<<]



Wednesday, March 4, 2009
Brainf*ck




Wednesday, March 4, 2009
Brainf*ck

                   •




Wednesday, March 4, 2009
Brainf*ck

                   •
                           •           mem




Wednesday, March 4, 2009
Brainf*ck

                   •
                           •           mem

                           •           ptr




Wednesday, March 4, 2009
1   2   3   4   5   6   7   8


   mem                     0   0   0   0   0   0   0   0



                     ptr



Wednesday, March 4, 2009
Brainf*ck
                           ptr
                   •

                             > : ptr++;
                           •
                           • < : ptr--;




Wednesday, March 4, 2009
Brainf*ck
                           ptr               (mem)
                   •



                             + : (*ptr)++;
                           •
                           • - : (*ptr)--;




Wednesday, March 4, 2009
Brainf*ck
                           while
                   •

                            [ : while (*ptr) {
                           •
                           •]:}




Wednesday, March 4, 2009
Brainf*ck
                           ptr               (mem)
                   •

                               or
                             . : putchar(*ptr);
                           •
                           • , : *ptr = getchar();




Wednesday, March 4, 2009
ASCII




Wednesday, March 4, 2009
A

                   ++++++++++ ++++++++++ ++++++++++
                   ++++++++++ ++++++++++ ++++++++++
                   +++++.




Wednesday, March 4, 2009
A
                    1      2       3   4   5     6    7       8


                   0       0    0      0   0    0     0       0



                           ++++++++++ ++++++++++ ++++++++++
                           ++++++++++ ++++++++++ ++++++++++
                           +++++.



Wednesday, March 4, 2009
A
                    1      2       3   4   5     6    7       8


                   1       0    0      0   0    0     0       0



                           ++++++++++ ++++++++++ ++++++++++
                           ++++++++++ ++++++++++ ++++++++++
                           +++++.



Wednesday, March 4, 2009
A
                    1      2       3   4   5     6    7       8


                   2       0    0      0   0    0     0       0



                           ++++++++++ ++++++++++ ++++++++++
                           ++++++++++ ++++++++++ ++++++++++
                           +++++.



Wednesday, March 4, 2009
A
                    1      2       3   4   5     6    7       8


                 65        0    0      0   0    0     0       0



                           ++++++++++ ++++++++++ ++++++++++
                           ++++++++++ ++++++++++ ++++++++++
                           +++++.



Wednesday, March 4, 2009
A
                    1      2       3   4   5     6    7       8


                 65        0    0      0   0    0     0       0



                           ++++++++++ ++++++++++ ++++++++++
                           ++++++++++ ++++++++++ ++++++++++
                           +++++.

                  A
Wednesday, March 4, 2009
++++++++[>++++++++<-]>+.




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/
                           rdebrainfxxk




Wednesday, March 4, 2009
brainfxxk <- function(code) {
                        #
                           #
                           #
                      }

                      code <- quot;++++++++[>++++++++<-]>+.quot;
                      brainfxxk(code)

Wednesday, March 4, 2009
code <- strsplit(code,quot;quot;)[[1]]
                      len <- length(code)
                      pc <- 1
                      ptr <- 1
                      mem <- rep(0, 128)




Wednesday, March 4, 2009
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
> and <
                           #>
                           inc_ptr <- function() {
                             ptr <<- ptr + 1
                           }

                           #<
                           dec_ptr <- function() {
                             ptr <<- ptr - 1
                           }


Wednesday, March 4, 2009
+ and -
                           #+
                           inc_mem <- function() {
                             mem[ptr] <<- mem[ptr] + 1
                           }

                           #-
                           dec_mem <- function() {
                             mem[ptr] <<- mem[ptr] - 1
                           }


Wednesday, March 4, 2009
[
                    #[
                    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
]
                    #]
                    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
. 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;,34)
                           [1] quot;34quot;



Wednesday, March 4, 2009
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;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
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
Ruby


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




Wednesday, March 4, 2009
> 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
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)),collapse=quot;quot;)

                      [1] quot;Hello, world!quot;




Wednesday, March 4, 2009
> 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
.

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




Wednesday, March 4, 2009
,




Wednesday, March 4, 2009
,

                   •
                           (ry




Wednesday, March 4, 2009
,

                   •
                                     (ry

                   •       ,   (ry




Wednesday, March 4, 2009
,

                   •
                                     (ry

                   •       ,   (ry

                   •

Wednesday, March 4, 2009
,




Wednesday, March 4, 2009
,

                   •       →




Wednesday, March 4, 2009
,

                   •              →

                           • utf8ToInt



Wednesday, March 4, 2009
,

                   •              →

                           • utf8ToInt
                   •


Wednesday, March 4, 2009
,
              #,
              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
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/takezawa/r-tips/r/32.html




Wednesday, March 4, 2009
•      <<-

              •
                     (<-   NG)

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

              •

Wednesday, March 4, 2009
> x <- 1

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

                      > inc_x()




Wednesday, March 4, 2009
> x <- 1

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

                      > inc_x()

                      >x

                      [1] 1       #


Wednesday, March 4, 2009
OK

                      > x <- 1

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

                      > inc_x()




Wednesday, March 4, 2009
OK

                      > x <- 1

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

                      > inc_x()

                      >x

                      [1] 2       # OK!


Wednesday, March 4, 2009
•
                   •           GIF



                           •
                   •
Wednesday, March 4, 2009
•                 (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
Wednesday, March 4, 2009

More Related Content

¸éã§å­¦ã¶B°ù²¹¾±²Ô´Ú*³¦°ì

  • 2. NOTE id:mickey24 Wednesday, March 4, 2009
  • 3. R Brainf*ck 2009/03/01 id:mickey24 Wednesday, March 4, 2009
  • 7. R Brainf*ck Wednesday, March 4, 2009
  • 8. • Brainf*ck • • • Wednesday, March 4, 2009
  • 10. Brainf*ck • Wednesday, March 4, 2009
  • 11. Brainf*ck • • Urban Müller, 1993 Wednesday, March 4, 2009
  • 12. Brainf*ck • • Urban Müller, 1993 • Wednesday, March 4, 2009
  • 13. Brainf*ck • • Urban Müller, 1993 • • Brainf*ck Wednesday, March 4, 2009
  • 14. Brainf*ck • • Urban Müller, 1993 • • Brainf*ck • Brainfu*k Wednesday, March 4, 2009
  • 16. Brainf*ck 8 Wednesday, March 4, 2009
  • 18. Brainf*ck > • < • + • - • . • , • [ • ] • Wednesday, March 4, 2009
  • 21. Hello, World! +++++++++[>++++++++>++++++++++ +>+++++<<<-]>.>++.+++++++..+++ .>-.------------.<++++++++.--- -----.+++.------.--------.>+. Wednesday, March 4, 2009
  • 22. FizzBuzz ++++++[->++++>>+>+>-<<<<<]>[<++++>>++ +>++++>>+++>+++++>+++++>>>>>>++>>++<< <<<<<<<<<<<<-]<++++>+++>-->+++>->>--- >++>>>+++++[->++>++<<]<<<<<<<<<<[->-[ >>>>>>>]>[<+++>.>.>>>>..>>>+<]<<<<<-[ >>>>]>[<+++++>.>.>..>>>+<]>>>>+<-[<<< ]<[[-<<+>>]>>>+>+<<<<<<[->>+>+>-<<<<] <]>>[[-]<]>[>>>[>.<<.<<<]<[.<<<<]>]>. <<<<<<<<<<<] Wednesday, March 4, 2009
  • 24. Brainf*ck • Wednesday, March 4, 2009
  • 25. Brainf*ck • • mem Wednesday, March 4, 2009
  • 26. Brainf*ck • • mem • ptr Wednesday, March 4, 2009
  • 27. 1 2 3 4 5 6 7 8 mem 0 0 0 0 0 0 0 0 ptr Wednesday, March 4, 2009
  • 28. Brainf*ck ptr • > : ptr++; • • < : ptr--; Wednesday, March 4, 2009
  • 29. Brainf*ck ptr (mem) • + : (*ptr)++; • • - : (*ptr)--; Wednesday, March 4, 2009
  • 30. Brainf*ck while • [ : while (*ptr) { • •]:} Wednesday, March 4, 2009
  • 31. Brainf*ck ptr (mem) • or . : putchar(*ptr); • • , : *ptr = getchar(); Wednesday, March 4, 2009
  • 33. A ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
  • 34. A 1 2 3 4 5 6 7 8 0 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
  • 35. A 1 2 3 4 5 6 7 8 1 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
  • 36. A 1 2 3 4 5 6 7 8 2 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
  • 37. A 1 2 3 4 5 6 7 8 65 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. Wednesday, March 4, 2009
  • 38. A 1 2 3 4 5 6 7 8 65 0 0 0 0 0 0 0 ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++. A Wednesday, March 4, 2009
  • 40. • Brainf*ck • • • Wednesday, March 4, 2009
  • 42. •R Brainf*ck Wednesday, March 4, 2009
  • 43. •R Brainf*ck • Wednesday, March 4, 2009
  • 45. • Brainf*ck • • • Wednesday, March 4, 2009
  • 46. • ↓ • http://d.hatena.ne.jp/mickey24/20090301/ rdebrainfxxk Wednesday, March 4, 2009
  • 47. brainfxxk <- function(code) { # # # } code <- quot;++++++++[>++++++++<-]>+.quot; brainfxxk(code) Wednesday, March 4, 2009
  • 48. code <- strsplit(code,quot;quot;)[[1]] len <- length(code) pc <- 1 ptr <- 1 mem <- rep(0, 128) Wednesday, March 4, 2009
  • 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. > and < #> inc_ptr <- function() { ptr <<- ptr + 1 } #< dec_ptr <- function() { ptr <<- ptr - 1 } Wednesday, March 4, 2009
  • 51. + and - #+ inc_mem <- function() { mem[ptr] <<- mem[ptr] + 1 } #- dec_mem <- function() { mem[ptr] <<- mem[ptr] - 1 } Wednesday, March 4, 2009
  • 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. ] #] 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. . and , Wednesday, March 4, 2009
  • 55. • Brainf*ck • • • Wednesday, March 4, 2009
  • 56. •. •, •1 • Wednesday, March 4, 2009
  • 58. . • →ASCII Wednesday, March 4, 2009
  • 59. . • →ASCII • . Wednesday, March 4, 2009
  • 61. sprintf •C %c Wednesday, March 4, 2009
  • 62. sprintf •C %c • %s Wednesday, March 4, 2009
  • 63. sprintf •C %c • %s > sprintf(quot;%squot;,34) [1] quot;34quot; Wednesday, March 4, 2009
  • 66. • • Tsukuba.R#4 Wednesday, March 4, 2009
  • 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. 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. Ruby $ ruby -e '(0..255).each do |i| print quot;x%x,quot; % i end' Wednesday, March 4, 2009
  • 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
  • 72. • intToUtf8 utf8ToInt Wednesday, March 4, 2009
  • 73. • intToUtf8 utf8ToInt • Ω ΩΩ d(ry Wednesday, March 4, 2009
  • 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. > 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. . #. putc <- function() { cat(intToUtf8(mem[ptr])) } Wednesday, March 4, 2009
  • 78. , • (ry Wednesday, March 4, 2009
  • 79. , • (ry • , (ry Wednesday, March 4, 2009
  • 80. , • (ry • , (ry • Wednesday, March 4, 2009
  • 82. , • → Wednesday, March 4, 2009
  • 83. , • → • utf8ToInt Wednesday, March 4, 2009
  • 84. , • → • utf8ToInt • Wednesday, March 4, 2009
  • 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
  • 89. • <<- Wednesday, March 4, 2009
  • 90. • <<- • (<- NG) Wednesday, March 4, 2009
  • 91. • <<- • (<- NG) • http://cse.naro.affrc.go.jp/takezawa/r-tips/r/32.html Wednesday, March 4, 2009
  • 92. • <<- • (<- NG) • http://cse.naro.affrc.go.jp/takezawa/r-tips/r/32.html • Wednesday, March 4, 2009
  • 93. > x <- 1 > inc_x <- function() { x <- x + 1 } > inc_x() Wednesday, March 4, 2009
  • 94. > x <- 1 > inc_x <- function() { x <- x + 1 } > inc_x() >x [1] 1 # Wednesday, March 4, 2009
  • 95. OK > x <- 1 > inc_x <- function() { x <<- x + 1 } > inc_x() Wednesday, March 4, 2009
  • 96. OK > x <- 1 > inc_x <- function() { x <<- x + 1 } > inc_x() >x [1] 2 # OK! Wednesday, March 4, 2009
  • 97. • • GIF • • Wednesday, March 4, 2009
  • 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