2016年3月9日水曜日

開発環境

  • OS X El Capitan - Apple (OS)
  • Emacs (Text Editor)
  • Factor (プログラミング言語)

Seven More Languages in Seven Weeks (Bruce Tate (著)、Ian Dees (著)、Frederic Daoud (著)、Jack Moffitt (著)、Pragmatic Bookshelf)のChapter 2(Factor)、Day 1(Stack On, Stack Off)、Do (Hard)(No. 2019).を取り組んでみる。

Do (Hard)(No. 2019)

コード、入出力結果(Emacs, Terminal)

$ /Applications/MacPorts/Factor-0.97/Factor.app/Contents/MacOS/factor -run=listener
IN: scratchpad 42 [ 10 /i ] [ 10 mod ] bi

--- Data stack:
4
2
IN: scratchpad clear
IN: scratchpad 12345

--- Data stack:
12345
IN: scratchpad number>string
1: number>string
                ^
No word named “number>string” found in current vocabulary search path

The following restarts are available:

:1      Use the math.parser vocabulary
:2      Defer word in current vocabulary

Type :help for debugging help.

--- Data stack:
12345
IN: scratchpad USE: math.parser

--- Data stack:
12345
IN: scratchpad number>string

--- Data stack:
"12345"
IN: scratchpad [ 1string string>number ] each

--- Data stack:
1
2
3
4
5
IN: scratchpad $

0 コメント:

コメントを投稿

Comments on Google+: