APL#
h
[eɪ p iː ɛl ʃɑ:p]
Morten Kromberg
CTO, Dyalog Ltd.
[email protected]
SDC 2011
Agenda
• Some Well Rationalized History
• Try to convince you that my personal
addiction is ”reasonable”
• Develop a couple of small DSL’s ”on the fly”
• Introduce APL#, a modern dialect of APL
targeting the Microsoft.Net Framework
• Demonstrate Dyalog APL and APL# working
together to produce a SilverLight App
APL#
SDC 2011
2
History
APL#
SDC 2011
3
Who Stole The Mainframe?
• APL users felt that the Mainframe was a high
productivity environment for personal computing – in
1970!
• APL was used to prototype every component of current
ERP systems and experienced its First Golden Age
• APL vendors and users were all convinced those
obviously impractical Personal Computers would
disappear fast
• 40 years later, everyone is starting to agree
• APL users don’t enjoy studying the computer, they have
work to do!
APL#
SDC 2011
4
Customer Profile
• Domain Expert (Financial Analyst, Bond Trader,
Chemical Engineer, Biologist, Health Care Provider, ...)
– Sometimes a ”semi-computer litterate” friend
• Build a sometimes Hideous, but
Uniquely Competitive and Timely Product
• If Successful, Build a Company
– Learn to combine APL with ”Software Engineering”
• Today, 8 of our 10 largest customers are ”Software
Vendors” employing many Software Engineers, but...
– ... in markets where product enhancements require
active participation by Domain Experts
APL#
SDC 2011
5
Some Examples …
APL#
SDC 2011
6
Production Planning
GUI Examples
Dyalog APL
7
Largest Patient Journal
System in Sweden
GUI Examples
Dyalog APL
8
Nutrition Management
(Windows Mobile - handheld)
APL Borealis - Canada
GUI Examples
Dyalog APL
9
Job Ads (1)
APL#
SDC 2011
10
Job Ads (2)
APL#
SDC 2011
11
APL Intro ...
•
•
•
•
APL is a General-Purpose DSL
(Domain = Arrays)
(Everything is a Nail an Array)
It’s interactive, and highly addictive...
APL#
SDC 2011
12
Data Exploration with APL
• A Tool of Thought for exploring data
and algorithms interactively...
– Knowledge Acquisition
• APL provides a framework for the
Domain Expert to extend APL with his
or her own more specific DSL ...
• A day in the life of a Historian ...
APL#
SDC 2011
13
The APL Vendors Task
• Support ALL steps from prototyping to deployment of
high performance commercial software
• Provide easy access to all the tools in the environment
– So the Software Engineer CAN
• Use them
• Build wrappers for Domain Experts
– But WITHOUT demanding that the Domain Expert master them
• Maintain the unique selling points of the Notation as a
Tool of Thought
APL#
SDC 2011
14
Recent History
• v11.0 Object Orientation + .Net Integration
– Full (but ”unmanaged”) integration with .Net Class
Hierarchies: Consume, Provide, Inherit
– WPF, WCF, MS Office Plugins, ASP.Net ...
• v11.0: 64-bit Version
• v12.0: Full Unicode Support
– APL code in mainstream source code mgt tools
• v13.0: RegExs
• V13.0: Complex Nums & 128-bit Decimal FP
APL#
SDC 2011
15
The Next Challenge
• APL has been ”fully managed” since 1966
– Self-describing arrays, no pointers, garbage collection
• Now Microsoft and Sun Oracle want to do the
managing (on some platforms)
– But with a different view of data types and what ”stack” is
– In particular: No efficient mutable arrays with value
semantics, and no way to ”cheat” in order to provide them

– No way to make names visible to all called functions
• We could wait for the next generation of VMs and
hope, but decided to ”engage” now
APL#
SDC 2011
16
What is APL#
• An attempt to design a new dialect which is…
• A first-class citizen of the CLR (JVM, etc)
•
•
•
Dyalog APL has full “.Net Interop” but is unmanaged
We want to run in the browser, have a zero footprint
Seamlessly integrated with all available tools
• Make Software Engineers more comfortable
• BUT: Must be as good a Tool of Thought as APL
•
•
Value rather than Reference semantics for Arrays
Illusion that there is only one numeric type
(OK, possibly TWO: “Exact” and “Inexact” numbers, but
2 = +/ TRUE FALSE TRUE
)
APL#
SDC 2011
17
Implementation Goals
• APL# should be a fully-paid-up citizen of the
Microsoft.Net platform, BUT
• No language feature may DEPEND on .NET
• APL# must be portable to other AVMs
• It should be possible to compile “native”
versions of APL# for use on highperformance hardware
• APL# is expected to outlive the current
generation of AVMs (.NET, JVM)
APL#
SDC 2011
18
Initial Target Platforms
•
•
•
•
•
Microsoft.Net under Microsoft Windows
Mono (Open Source .Net - Linux and other ‘Nixes)
SilverLight (Web Browser plug-in for Windows and
Mac OS/X)
MoonLight (Open Source Web Browser plug-in)
APL# will be available as an interpreter, but there will also be a
compiler for code which does not use ⍎. This will produce code
which is faster, and can run on embedded/mobile platforms
which do not support dynamic code generation.
APL#
SDC 2011
19
APL# vs Dyalog APL
Key Differences:
• APL# uses lexical (static) scoping rules
• “Functional” is the default function style (with
procedural extensions)
• ABLE to pass arrays “by reference”
• Fixes index origin at zero (at least on the .NET
framework). THIS DOES interfere with the “Tool of
Thoughtness”.
• Does not guarantee order-of-execution of primitive
parallel higher-order functions (each, rank)
APL#
SDC 2011
20
APL# + Dyalog APL
Integration / Migration
• A single new IDE will service both systems
– Visual Studio required to debug compiled APL#
• Full interop via existing Microsoft.Net Bridge
• Will share the Dyalog APL “Object Store” (aka
“Component Files”)
• Share values of APL arrays via TCP sockets
• We expect users to build systems using APL# on the
Client and Dyalog APL on the server
• Time for a final demo…
APL#
SDC 2011
21
Rules of ”Go Fish” (English)
•
•
•
•
•
•
A standard 52 card deck is used. The dealer deals 5 cards to each player (7 each for
2 players). The remaining cards are placed face down to form a stock.
A turn consists of asking a specific player for a specific rank. For example, if it is my
turn I might say: 'Mary, please give me your jacks'. The player who asks must already
hold at least one card of the requested rank.
If the player who was asked (Mary) has cards of the named rank (jacks in this case),
she must give all her cards of this rank to the player who asked for them. That player
then gets another turn and may again ask any player for any rank already held by the
asker.
If the person asked does not have any cards of the named rank, they say 'Go fish!'.
The asker must then draw the top card of the undealt stock. If the drawn card is the
rank asked for, the asker shows it and gets another turn. If the drawn card is not the
rank asked for, the asker keeps it, but the turn now passes to the player who said 'Go
fish!'.
As soon as a player collects a book of 4 cards of the same rank, this must be shown
and discarded face down.
The game continues until either someone has no cards left in their hand or the stock
runs out. The winner is the player who then has the most books.
APL#
SDC 2011
22
APL# In Action...
APL#
SDC 2011
23
Clientside Code (APL#)
APL#
SDC 2011
24
Clientside Code (APL#)
APL#
SDC 2011
25
What was that again ...?
• Prototype of APL# embedded in our
”Light Execution Module” (LEM)
• LEM talks to HTTP server written in
Dyalog APL, which downloads
packages of XAML + APL# Script
• GoFishGame runs in Dyalog APL on
server, downloads game data
• Results of simulation viewed ”off line”
APL#
SDC 2011
26
Wrapping Up...
• Need for “Tools of Thought” is greater than ever
– APL integrates Functional, Array and Object
Oriented paradigms into a single package
•
Choose the best one for each task
– APL is a natural language for many Domain Experts
– APL# makes it possible for APL to run in new
environments; in the browser, on cell phones, as
SQL stored procedures, etc.
– Prototypes available “after the summer”
•
APL#
Dyalog APL available now 
SDC 2011
27
Other APL Futures
•
•
•
•
Compiled (Optionally Typed) APL shows promise as a
tool for harnessing highly parallel hardware:
–
–
“Map” is the default way to apply functions in APL
Many different forms of “Reduce” are available (APL has used
the name “Reduce” for the / in (+/) since the 1960’s)
–
We are hoping to work with Robert Bernecky and Sven-Bodo
Scholz on compiling APL to Single Assignment C (SAC)
Greater emphasis on functional programming style
More Integration: Mono an Java Bridges for Dyalog APL
“Plugins” for Eclipse and Visual Studio
APL#
SDC 2011
28
50th Anniversary
Kenneth E. Iverson's book
“A Programming Language”
in 2012
APL: Still an Emerging Technology
APL#
SDC 2011
29
More Reading
•
“Arrays of Objects” (OOPSLA DSL paper)
DLS '07 Proceedings of the 2007 symposium on Dynamic
languages
•
•
•
•
•
http://www.aplsharp.com
http://forums.dyalog.com
Twitter & Facebook: dyalogapl
Apply for a non-commercial licence in the “Download
Zone” at dyalog.com and mention “SDC 2011”
Come to Dyalog’11 in Boston, October 2-5
APL#
SDC 2011
30
Descargar

Rolling the Process