Split syntax and functionality

Split syntax and functionality

PostPosted by gar37bic » Sat Sep 04, 2010 12:43 pm

This may seem like sacrilege, but I think it might be useful to consider the possibility of supporting different syntactic front ends the the system. For the most egregiously non-APL example the system might support three or four-letter function names as an alternative to the APL characters. This way a programmer not familiar with APL could start off by writing '3 iota 6', for example, and the system could display the code that way. As the functions became more familiar the programmer could migrate more to the APL set. The same programmer might have an easier time learning to read existing programs as well. A system function or variable could control which type of display to use - or even allow both in a 'learning mode', one above the other for a selected line. Or, the editor could replace the 'iota' with the symbol.

Since most programmers are used to writing a lot of function names, this would provide a very handy 'baby-step', allowing them to learn the functionality and the syntax separately.
gar37bic
 
Posts: 5
Joined: Sat Sep 04, 2010 11:59 am

Last APL Error Msg displayed when halting session output

PostPosted by forummaster » Sun Nov 07, 2010 10:25 am

{99.223}gar37bic wrote:
{99.223}gar37bic wrote:
This may seem like sacrilege, but I think it might be useful to consider the possibility of supporting different syntactic front ends the the system. For the most egregiously non-APL example the system might support three or four-letter function names as an alternative to the APL characters. This way a programmer not familiar with APL could start off by writing '3 iota 6', for example, and the system could display the code that way. As the functions became more familiar the programmer could migrate more to the APL set. The same programmer might have an easier time learning to read existing programs as well. A system function or variable could control which type of display to use - or even allow both in a 'learning mode', one above the other for a selected line. Or, the editor could replace the 'iota' with the symbol.

Since most programmers are used to writing a lot of function names, this would provide a very handy 'baby-step', allowing them to learn the functionality and the syntax separately.

This is a useful goal that can be combined with separating out the GUI front end as well as a browser front end, etc. So much to do. I really need more people to help with putting these good ideas into code.
forummaster
 
Posts: 567
Joined: Wed Jan 23, 2013 1:00 pm

Re: Split syntax and functionality

PostPosted by Paul Robinson » Fri Feb 22, 2013 9:32 pm

gar37bic wrote:This may seem like sacrilege, but I think it might be useful to consider the possibility of supporting different syntactic front ends the the system. For the most egregiously non-APL example the system might support three or four-letter function names as an alternative to the APL characters. This way a programmer not familiar with APL could start off by writing '3 iota 6', for example.

I have been thinking that the session manager should allow use of the {name} descriptors for APL symbols; when you )SAVE a workspace the APL symbols are written as tokens, so that ⎕ appears as {quad}. The Nars2000 Wiki supports these for writing examples, and they are read when someone )LOADs a workspace, since they are already defined and I don't think { is an APL operator, it wouldn't be that hard to allow a token delimited by { and ending with } to be treated as an APL symbol since the interpreter already knows the symbols. It would convert the symbol to the internal representation.

In your example, they'd do 3{iota}6 and it would translate it internally to 3⍳6.
Paul Robinson
 
Posts: 11
Joined: Fri Feb 22, 2013 12:57 am

Re: Split syntax and functionality

PostPosted by sudleyplace » Tue Mar 05, 2013 5:38 pm

Paul Robinson wrote:
gar37bic wrote:This may seem like sacrilege, but I think it might be useful to consider the possibility of supporting different syntactic front ends the the system. For the most egregiously non-APL example the system might support three or four-letter function names as an alternative to the APL characters. This way a programmer not familiar with APL could start off by writing '3 iota 6', for example.

I have been thinking that the session manager should allow use of the {name} descriptors for APL symbols; when you )SAVE a workspace the APL symbols are written as tokens, so that ⎕ appears as {quad}. The Nars2000 Wiki supports these for writing examples, and they are read when someone )LOADs a workspace, since they are already defined and I don't think { is an APL operator, it wouldn't be that hard to allow a token delimited by { and ending with } to be treated as an APL symbol since the interpreter already knows the symbols. It would convert the symbol to the internal representation.

In your example, they'd do 3{iota}6 and it would translate it internally to 3⍳6.

This is a good idea and I'd like to implement it -- just using a different mechanism such as, perhaps, double braces as in {{iota}} or another pair of grouping symbols all together.

Braces are a future feature for NARS2000 as direct definition as in {⍺+.×⍉⍵} used to define anonymous functions. This notation has been extended by the Dyalog folks in a couple of different directions and I'd like to include one such extension someday. Before we do that, we'll need to extend plain text workspaces to support Unicode characters directly so we may use braces for direct definition functions.
sudleyplace
 
Posts: 2
Joined: Thu Jan 24, 2013 11:12 am

Re: Split syntax and functionality

PostPosted by drab » Wed Oct 22, 2014 5:57 am

Using double braces goes against the original intent of making it simpler. Besides, it's cumbersome to type and ugly to read. Besides, it's not exclusively safe anyway, since an expression for direct definition could easily contain double braces itself.

You could probably get away with using single braces without conflict. Simple alphabetic character names would not be easily confused with function expressions.
drab
 
Posts: 315
Joined: Thu Oct 09, 2014 6:23 am

Re: Split syntax and functionality

PostPosted by FDA OSInet » Tue Sep 08, 2015 10:21 am

I am not 100% sure that it would work in all cases, but it might help beginners a lot : what about providing with NARS2000 a sample workspace named for instance keywords where each and every APL primitive is defined as an APL function ?

Plus some goodies : a if b <=> b/a

So any beginner can start practicing APL everywhere without losing concentration about where the hell is a given non-basic-ASCII symbol. Of course, whatever already exists on standard keyboards, like (["'])/\... would be honored. A command )ASCII / )NOASCII may even be added.

I would be glad to start writing such a workspace - or at least a subset of it, just to test feasibility and usability, and upload it anywhere on the NARS2000 site it it can help beginners. It would be a little like the two side wheels on a child's bike : just to help the beginnings ;)

Now I agree that the "del" to define a function might be a problem, but I wonder if a "del" or "def" or "nabla" function written using quotequad and execute would not be a fine help, even if limited. Let us remember thay it is just a matter of helping people to begin APL by concentrating at first on only one thing at a time.

Transformation of a "keyworded" workspace into a regular APL workspace when the user is ready should be rather straightworward, though not mandatory in the learning phase.

Just my two euro cents :|

FDA
FDA OSInet
 
Posts: 29
Joined: Sun Aug 30, 2015 5:07 am

Re: Split syntax and functionality

PostPosted by FDA OSInet » Tue Sep 08, 2015 10:38 am

It's too much fun. I have begun writing it. :D

I now realize that I do not (yet) know how to test within a function whether it is called as monadically or dyadically, because I never needed it. Any hint or link would be welcome.

A also realize, while writing the quad function, that a problem may arise for the equivalent of what is called L-values in C.

Here again, any suggestion will be welcomed. As well a suggestions for the function names ("rho" ? or just "ro" ?). All suggestions accepted.
FDA OSInet
 
Posts: 29
Joined: Sun Aug 30, 2015 5:07 am

Re: Split syntax and functionality

PostPosted by forummaster » Fri Oct 30, 2015 6:03 pm

Thanks for your interest in NARS2000 -- sorry for the delayed replay -- I spend most of time writing code for NARS2000.

You can indicate that a function is ambivalent by enclosing the left arg in braces as in
Code: Select all
∇Z←{L} foo R
and then test for the presence of the left arg using ⎕NC as in
Code: Select all
:if 0=⎕NC 'L' ⋄ L←... ⋄ :end
which provides a default value for L, but can be modified to do something else.
forummaster
 
Posts: 567
Joined: Wed Jan 23, 2013 1:00 pm


Return to New Syntax

Who is online

Users browsing this forum: No registered users and 1 guest

cron