開発環境
- OS X El Capitan - Apple (OS)
- Emacs (Text Editor)
- Elm (プログラミング言語)
Seven More Languages in Seven Weeks (Bruce Tate (著)、Ian Dees (著)、Frederic Daoud (著)、Jack Moffitt (著)、Pragmatic Bookshelf)のChapter 3(Elm)、Day 2(Taming Callbacks)、Do (Easy)(No. 3307).を取り組んでみる。
Do (Easy)(No. 3307)
コード(Emacs)
import Graphics.Element exposing (show)
import Mouse
positionAndPressed position down =
show (if down
then ((toString position) ++ " clicked!")
else (toString position))
main = Signal.map2 positionAndPressed Mouse.position Mouse.isDown
入出力結果(Emacs, Terminal, elm repl)
$ elm-make sample_easy.elm --output sample_easy.html Success! Compiled 1 modules. Successfully generated sample_easy.html $
0 コメント:
コメントを投稿