hi apl apl ideas
play

Hi APL APL Ideas Precedence rules Array oriented Concise - PowerPoint PPT Presentation

Hi APL APL Ideas Precedence rules Array oriented Concise Functions Interactive environment 10 2 4 + 1 = ? 10 2 4 + 1 21 10 (2 (4 + 1)) = 1 10 2 4 + 1 = 1 Array Oriented 1 + 4 = 5 2 + 5 = 7 3


  1. Hi

  2. APL

  3. APL

  4. Ideas • Precedence rules • Array oriented • Concise • Functions • Interactive environment

  5. 10 ÷ 2 × 4 + 1 = ?

  6. 10 ÷ 2 × 4 + 1 ≠ 21

  7. 10 ÷(2 × (4 + 1)) = 1

  8. 10 ÷ 2 × 4 + 1 = 1

  9. Array Oriented

  10. 1 + 4 = 5 2 + 5 = 7 3 + 6 = 9

  11. 1 2 3 + 4 5 6 = 5 7 9

  12. Concise • Symbols! • Composition

  13. Symbols! + - × ÷

  14. Bonus Feature! -Language Bar-

  15. In case of “ Symbol Crisis ” ¡

  16. In case of “ Symbol Crisis ” ¡

  17. Composition

  18. 1 2 3 ∘ . × 4 5 6

  19. 1 2 3 ∘ . × 4 5 6 4 ¡

  20. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡

  21. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡ 6 ¡

  22. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡ 6 ¡ 8 ¡

  23. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡ 6 ¡ 8 ¡ 10 ¡

  24. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡ 6 ¡ 8 ¡ 10 ¡ 12 ¡

  25. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡ 6 ¡ 8 ¡ 10 ¡ 12 ¡ 12 ¡

  26. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡ 6 ¡ 8 ¡ 10 ¡ 12 ¡ 12 ¡ 15 ¡

  27. 1 2 3 ∘ . × 4 5 6 4 ¡ 5 ¡ 6 ¡ 8 ¡ 10 ¡ 12 ¡ 12 ¡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 0 ¡

  72. TwoHops ← OneHop ∨ . ∧ OneHop To ¡ LAX ¡ SFO ¡ SAN ¡ OAK ¡ LAX ¡ 1 ¡ 0 ¡ 1 ¡ 0 ¡ SFO ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ From ¡ SAN ¡ 1 ¡ 0 ¡ 1 ¡ 0 ¡ OAK ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡

  73. ThreeHops ← OneHop ∨ . ∧ TwoHops To ¡ LAX ¡ SFO ¡ SAN ¡ OAK ¡ LAX ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ SFO ¡ 1 ¡ 0 ¡ 1 ¡ 0 ¡ From ¡ SAN ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ OAK ¡ 1 ¡ 0 ¡ 1 ¡ 0 ¡

  74. AllTrips ← OneHop ∨ TwoHops ∨ ThreeHops To ¡ LAX ¡ SFO ¡ SAN ¡ OAK ¡ LAX ¡ 1 ¡ 1 ¡ 1 ¡ 0 ¡ SFO ¡ 1 ¡ 1 ¡ 1 ¡ 0 ¡ From ¡ SAN ¡ 1 ¡ 1 ¡ 1 ¡ 0 ¡ OAK ¡ 1 ¡ 1 ¡ 1 ¡ 0 ¡

  75. ThreeHops ← OneHop ∨ OneHop ∨ . ∧ TwoHops NextHops ← PrevHops ∨ PrevHops ∨ . ∧ ThisHops NextHops ← PrevHops { ⍺ ∨ ⍺ ∨ . ∧ ⍵ } ThisHops

  76. ThreeHops ← OneHop ∨ OneHop ∨ . ∧ TwoHops NextHops ← PrevHops ∨ PrevHops ∨ . ∧ ThisHops NextHops ← PrevHops { ⍺ ∨ ⍺ ∨ . ∧ ⍵ } ThisHops AllTrips ← OneHop ({ ⍺ ∨ ⍺ ∨ . ∧ ⍵ } ⍣ 3) OneHop AllTrips ← OneHop ({ ⍺ ∨ ⍺ ∨ . ∧ ⍵ } ⍣ ≡ ) OneHop AllTripsFor ← { ⍵ ({ ⍺ ∨ ⍺ ∨ . ∧ ⍵ } ⍣ ≡ ) ⍵ }

  77. AllTripsFor ← { ⍵ ({ ⍺ ∨ ⍺ ∨ . ∧ ⍵ } ⍣ ≡ ) ⍵ } Or ← ∨ ConnectedTo ← ∨ . ∧ UntilNoChange ← { ⍺ ⍺⍺ ⍣ ≡ ⍵ } AppliedTo ← { ⍵ ⍺⍺ ⍵ } AllTripsFor ← ({ ⍺ Or ⍺ ConnectedTo ⍵ } UntilNoChange) AppliedTo AllTripsFor Flights

  78. What I covered • Precedence rules • Array oriented • Concise • Functions • Interactive environment

  79. Things you didn ’ t see • Memory allocation • For loops • A source file • Types

  80. Joel@JoelHough.com

  81. The ¡old ¡guy ¡with ¡no ¡hat ¡... ¡ • Morten ¡Kromberg, ¡CTO ¡of ¡Dyalog ¡Ltd. ¡ – Dyalog ¡is ¡the ¡leader ¡of ¡the ¡[sMll] ¡emerging ¡APL ¡Market ¡  ¡ – Basingstoke ¡(UK) ¡+ ¡Canada, ¡DK, ¡France, ¡USA ¡ • 1 ¡year ¡Z80, ¡1 ¡year ¡Commodore ¡BASIC, ¡33 ¡yrs ¡APL ¡ – IBM ¡5100 ¡APL, ¡SHARP ¡APL, ¡IBM ¡VSAPL ¡and ¡APLSV, ¡ DEC ¡APL/SF, ¡MIPS ¡APL ¡(Prime), ¡Data ¡General ¡APL, ¡ IBM ¡APL2, ¡APL*PLUS/PC, ¡APL+Win, ¡and ¡now ¡Dyalog ¡APL ¡ • Wrote ¡at ¡least ¡one ¡program ¡that ¡I ¡understood ¡in ¡each ¡of: ¡ – 6502 ¡and ¡Z80 ¡Machine ¡code, ¡JCL ¡ – Simula, ¡Pascal, ¡COBOL, ¡C, ¡C#, ¡Java ¡ • ... ¡(Plus ¡one ¡program ¡in ¡Prolog) ¡ • CTO ¡of ¡Adaytum, ¡BI ¡”startup” ¡based ¡on ¡APL ¡ – Sold ¡to ¡Cognos ¡in ¡2000 ¡for ¡$160M ¡

  82. InteracMve ¡Demo ¡ • A ¡Day ¡in ¡the ¡Life ¡of ¡a ¡Domain ¡Expert ¡ – Domain: ¡History ¡ • Build ¡a ¡DSL ¡for ¡Playing ¡with ¡Tables ¡ • Do ¡something ¡that ¡might ¡be ¡hard ¡in ¡SQL ¡

  83. What ¡I ¡Hope ¡to ¡Show ¡You... ¡ • That ¡APL ¡is ¡an ¡inherently ¡parallel ¡notaMon ¡which ¡ makes ¡it ¡easy ¡to ¡think ¡about, ¡and ¡”crunch”, ¡arrays ¡ • That ¡APL ¡encourages ¡the ¡construcMon ¡of ¡funcMonal ¡ DSL’s ¡– ¡without ¡demanding ¡a ¡purely ¡funcMonal ¡ approach ¡to ¡coding ¡ • That ¡APL ¡is ¡a ¡”tool ¡of ¡thought”, ¡which ¡helps ¡us ¡ discover ¡suitable ¡algorithms ¡and ¡soluMons ¡through ¡ experimentaMon ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend