function + action = interaction (2015)
TRANSCRIPT
www.pineapple.cc
www.pineapple.cc
Function + Action = InteractionIchiroh Kanaya*, Mayuko Kanazawa**, Masataka Imura***
*Graduate School of Engineering, Osaka University **Department of Image Arts, Kobe Design University
***School of Science and Technology, Kwansei Gakuin University
www.pineapple.cc
www.pineapple.ccArtist/Producer/Director
Scientist/Engineer/Hacker
Scientist/Engineer/Designer
Artist’s Wants
Poor Engineer
www.pineapple.cc
www.pineapple.cc
Shooting A Moving TargetShiro Kawai, Square USA
Proc. Japan Lisp User Group Meeting, 2000.
www.pineapple.cc
–Shiro Kawai
The balance of integrity and flexibility is subtle but important. In our size of production, sometimes you need to allow one part of the production to work inconsistently with another, during a transition (and if things keep changing, it is always a transition period!) If you emphasize integrity and consistency too much, things cannot change in a timely manner. If you emphasize flexibility too much and allow people work their own way, you lose integrity. In my opinion, Lisp itself keeps a good balance between these, and fits well into this type of project.
www.pineapple.cc
Programmer 1 Programmer 2 Programmer 3
Code 1Perl
Code 2Java
Code 3Visual Basic
Domain Specific LanguagePhantom Query Language
Foundation Common LISP
Architect
Not en
ough?
www.pineapple.cc
Kajiya’s Rendering Equation
Radiance
www.pineapple.cc
Coherency of Dimensions (Types in Programming)
Referential Transparency
Linearity/Symmetry
www.pineapple.cc
p(t)
ClocktowerDisplay Python/OpenGL
Sensor C++/OpenCV
Server Scheme
{x(t), p(t)}
t
u(p)x(t)+y(u) t
t
Assets JPEG
y(u)u
t
{x(t), p(t)}
u(p)
x: live video y: animation p: status t: current time u: animation time HTTP
R.T.
R.T. R.T.
www.pineapple.cc
Monad
www.pineapple.cc
==> 22
www.pineapple.cc
==> (+3)25
{$0+3}(2)// 5
www.pineapple.cc
==> Just 2Just 2
www.pineapple.cc
data Maybe a = Nothing | Just a
enum Optional<T> { case None case Some(T)}
www.pineapple.cc
==> (+3)(Just 2)ERR
www.pineapple.cc
==> fmap (+3) (Just 2)Just 5
Optional.Some(2).map{$0+3}// .Some(5)
www.pineapple.cc
www.pineapple.cc
Optional.None.map{$0+3}// .None
==> fmap (+3) NothingNothing
www.pineapple.cc
www.pineapple.cc
{$0-1}(3)// 2
==> (-1)32
www.pineapple.cc
==> let f=fmap (+3) (+2)==> f 1015
let f=map({$0+2}, {$0+3})f(10)// 15
www.pineapple.cc
www.pineapple.cc
www.pineapple.cc
half x | even x = Just (x `div` 2) | otherwise = Nothing
func half(a: Int) -> Int? { return a%2==0 ? a/2 : .None}
www.pineapple.cc
www.pineapple.cc
Optional.some(3).flatMap(half)// .NoneOptional.some(4).flatMap(half)// 2
==> Just 3 >>= halfNothing==> Just 4 >>= half2
www.pineapple.cc
www.pineapple.cc
www.pineapple.cc
www.pineapple.cc
www.pineapple.cc
www.pineapple.cc
www.pineapple.cc
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html
www.pineapple.cc
p(t)
ClocktowerDisplay Python/OpenGL
Sensor C++/OpenCV
Server Scheme
{x(t), p(t)}
t
u(p)x(t)+y(u) t
t
Assets JPEG
y(u)u
t
{x(t), p(t)}
u(p)
x: live video y: animation p: status t: current time u: animation time HTTP
R.T.
R.T. R.T.
Almost
R.T.
www.pineapple.cc
Y=FX
www.pineapple.cc
[Y]=F[X]
www.pineapple.cc
[Y, T]=F[X, S]
www.pineapple.cc
[Y, T]=F[X, S]; [Z, U]=G[Y, T]
[Z, U]=G•F[X, S]
www.pineapple.cc
Coherency of Dimensions (Types in Programming)
Automatic Deduction of Data Type (like C++14, Haskell)
Referential Transparency
Action in Function (like Haskell)
Linearity/Symmetry
…Future Work
www.pineapple.cc
Questions?@kanaya