2017年4月2日日曜日

開発環境

Head First JavaScript Programming (Eric T. Freeman (著)、Elisabeth Robson (著)、O'Reilly Media)の Chapter 1.(Getting your feet wet)、How the while loop works の CODE MAGNETS(No. 765) を Scheme で取り組んでみる。

CODE MAGNETS(No. 765)

コード(Emacs)

(begin
  (define i 0)
  (define (p n) (if (< n 2)
                    (begin
                      (display "Happy birthday to you.")
                      (newline)
                      (p (+ n 1)))))
  (p i)
  (define name "Joe")
  (display (string-append "Happy birthday to " name "."))
  (newline)
  (display "Happy birthday to you.")
  (newline)
  'done)

入出力結果(Terminal, REPL)

$ ./ksi < temp.scm
> Happy birthday to you.
Happy birthday to you.
Happy birthday to Joe.
Happy birthday to you.
=> done
> $

0 コメント:

コメントを投稿

Comments on Google+: