Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could APL be implemented in Scala as a DSL?

Tags:

scala

dsl

apl

There is a old computer language called APL. Could this be implemented in Scala as a DSL?

http://en.wikipedia.org/wiki/APL_%28programming_language%29

like image 561
Phil Avatar asked Oct 16 '11 06:10

Phil


2 Answers

Someone could probably give a better answer than this, but this is my initial thought:

  1. A Scala DSL should in theory be able to implement any programming language because it could build up an arbitrary structure representing the syntax, and then evaluate that.

  2. A Scala DSL could not exactly replicate APL syntax for many reasons, one of which is that

    'single quotes'

can denote a string in APL, but not in Scala. Also (from the wikipedia page)

×/2 3 4

wouldn't be valid Scala.

I don't know how close you could get, though...

like image 123
Owen Avatar answered Nov 03 '22 14:11

Owen


A Javascript implementation exists here: https://github.com/ngn/apl

like image 1
Phil Avatar answered Nov 03 '22 15:11

Phil