2016年3月7日月曜日

開発環境

  • 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 (Medium)(No. 2010).を取り組んでみる。

Do (Medium)(No. 2010)

入出力結果(Emacs, Terminal)

$ /Applications/MacPorts/Factor-0.97/Factor.app/Contents/MacOS/factor -run=listener
IN: scratchpad { 1 4 17 9 11 } 0 [ + ] reduce

--- Data stack:
42
IN: scratchpad clear
IN: scratchpad 100 [1,b] 0 [ + ] reduce
1: 100 [1,b] 0 [ + ] reduce
            ^
No word named “[1,b]” found in current vocabulary search path

The following restarts are available:

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

Type :help for debugging help.
IN: scratchpad USE: math.ranges
IN: scratchpad 100 [1,b] 0 [ + ] reduce

--- Data stack:
5050
IN: scratchpad 10 [1,b] [ dup * ] map

--- Data stack:
5050
{ 1 4 9 16 25 36 49 64 81 100 }
IN: scratchpad $ 

0 コメント:

コメントを投稿

Comments on Google+: