slicing functional programs a suspicion
play

Slicing Functional Programs: A Suspicion 10th CREST Open Workshop - PowerPoint PPT Presentation

Slicing Functional Programs: A Suspicion 10th CREST Open Workshop on Program Analysis and Slicing Henrik Nilsson School of Computer Science The University of Nottingham, UK Slicing Functional Programs: A Suspicion p.1/6 Slicing


  1. Slicing Functional Programs: A Suspicion 10th CREST Open Workshop on Program Analysis and Slicing Henrik Nilsson School of Computer Science The University of Nottingham, UK Slicing Functional Programs: A Suspicion – p.1/6

  2. Slicing Functional Programs? 0 oscSine 3.0 *0.2 + oscSine f -0.25 +1.0 sciFi :: SF () Sample sciFi = proc () → do und ← arr ( ∗ 0 . 2) ≪ oscSine 3 . 0 − ≺ 0 swp ← arr (+1 . 0) ≪ integral ≺ − 0 . 25 − audio ← oscSine 440 ≺ und + swp − returnA − ≺ audio Slicing Functional Programs: A Suspicion – p.2/6

  3. Behind the Scenes A signal function (SF) is roughly represented as: data SF a b = SF ( DTime → a → ( b , SF a b )) Slicing Functional Programs: A Suspicion – p.3/6

  4. Behind the Scenes A signal function (SF) is roughly represented as: data SF a b = SF ( DTime → a → ( b , SF a b )) • Top level loop repeatedly apply the system SF to input, computing output at that point in time and next system SF . Slicing Functional Programs: A Suspicion – p.3/6

  5. Behind the Scenes A signal function (SF) is roughly represented as: data SF a b = SF ( DTime → a → ( b , SF a b )) • Top level loop repeatedly apply the system SF to input, computing output at that point in time and next system SF . • Output depends on the entire SF computed at the previous step. Slicing Functional Programs: A Suspicion – p.3/6

  6. Behind the Scenes A signal function (SF) is roughly represented as: data SF a b = SF ( DTime → a → ( b , SF a b )) • Top level loop repeatedly apply the system SF to input, computing output at that point in time and next system SF . • Output depends on the entire SF computed at the previous step. Arguably a somewhat flamboyant (even frivolous?) style of programming! Slicing Functional Programs: A Suspicion – p.3/6

  7. A Suspicion Slicing Functional Programs: A Suspicion – p.4/6

  8. A Suspicion Style matters! Slicing Functional Programs: A Suspicion – p.4/6

  9. Higher-order Abstractions Higher-order abstractions are a staple of modern functional programming: • Monads • Arrows • Applicative functors • Continuation Passing Style (CPS) • . . . Slicing Functional Programs: A Suspicion – p.5/6

  10. Higher-order Abstractions Higher-order abstractions are a staple of modern functional programming: • Monads • Arrows • Applicative functors • Continuation Passing Style (CPS) • . . . Flamboyance to be expected! Slicing Functional Programs: A Suspicion – p.5/6

  11. Accounting for Style Lost cause? Slicing Functional Programs: A Suspicion – p.6/6

  12. Accounting for Style Lost cause? Maybe not: these abstractions: • are principled • satisfy useful mathematical laws • capture simple ideas Ought to be possible to exploit! Slicing Functional Programs: A Suspicion – p.6/6

  13. Accounting for Style Lost cause? Maybe not: these abstractions: • are principled • satisfy useful mathematical laws • capture simple ideas Ought to be possible to exploit! Perhaps we need Stylish Slicing : extensible slicing tools capable of slicing with style! Slicing Functional Programs: A Suspicion – p.6/6

Recommend


More recommend