??Spoken Form Programming

??Spoken Form Programming

There are well known impediments for novice programmers to continue developing their programming and algorithmic skills:

  1. Parentheses matching and closures?
  2. If-conditionals?
  3. Do, For, While, loops?
  4. Types and data structures?
  5. Selection operators e.g. ‘.’??

to name a few.

Most novice programmers are unable to overcome these archaic structures and the difficulties they present which require careful manipulation of symbols and countless hours of debugging to learn how to manage their rigid structures.

In this article we focus on our attention on applications of Spoken Form Programming for for( ) statements.?

For weekly API and programming updates and discussions and example please join Linked In group:

https://www.dhirubhai.net/groups/13085485/


Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License


To enquire about the Free Form Programming Language and CCN’s certified training including Unity certification please contact [email protected]


for( ) in C#

Simplest possible example of for( ) statement in C#:

for (int i = 0; i < 10; i++)
{
    //do something for each +1 increment of i
    foo(i);
}        

Source: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/iteration-statements

Gets far worse if increments are fractional and between two arbitrary numbers:

float a, b;
d = (b-a)/10f;

for (int i = 0; i < 10; i++)
{
    //do something fractional increment d between a and b
    foo(a + i*d);
}        

While Free Form Programming Language does provide such primitive syntax, it offers a Free Form alternative version:

https://wiki.ccnstudios.com/en/freeform/algebras/vectors/do_spoken_form

list = in the -5 to 7 range at increments of 0.02 evaluate foo;

list = evaluate foo in the -5 to 7 range at increments of 0.02;

list = in the -5 to 7 interval evaluate foo at increments of 0.02;

list = at increments of 0.02 evaluate foo in the -5 to 7 range;

list = from -5 to 7 at increments of 0.02 evaluate foo;

list = in the -5 to 7 interval evaluate foo at increments of 0.02;

list = in -5 to 7 range at increments of 0.02 evaluate foo;
        

  1. foo’ is treated as a Pure Function and does not require explicit passing of arguments. The grammar that parses this Free Form expression is able to construct the final functional form with proper argument lists and operators.?
  2. There are very many variations to how a person describes such a looping process, just try in a daily normal sentence or two and you immediately uncover the above variations.
  3. 'evaluate' is one of many words which could call up functions of different input and output e.g. place as in put in a location or construct or move or rotate
  4. Notice that Free Form language allows for entering mathematical expressions and equations?in the midst of Free Form spoken fragments!

...'s action

Spoken Form has no boundary thanks to the human reuse of Free Form expressions. For example we tasked our students to design different styles of stairways. Spiral stairways is one of many and delivers good challenges to the novice designers.

  1. Define a single 'stair' as a cuboid

https://wiki.ccnstudios.com/en/freeform/programmable_design/geometric_privimitives/cuboid

stair = cuboid with pmin at ({4., 0., 0.}),  pmax at ({8., 2.4, 0.8});        

2. '...'s action' is an innovative lingual construct to a) clarify the actions applied to an object e.g. make it animate , b) describes the actions in Spoken Form:

stair's action = rotate around z by t then move along z by 2.5*t;        

Free Form programmers are taught as any engineering or physics or math students are taught to envisage the parameter ‘t’ as passage of time , in our case time in the sense of animation.

3. '0 to 10 range' is the range for the parameter 't' of the animation and yet no need for the Free Form programmers to bother with their redundant mention.

stairs =  place 100 stair in the 0 to 10 range;        


A few Spoken Form phrases compute such an elaborate geometry



The layout of the spiral stairs is animated for the Free Form designers


Students at first design a simple movement of a 2D rectangle along the x-axis. Quickly they do realize that manually moving the objects is tedious with unnecessary repetitive code.



And they also learned how to rotate an object around a point and again the same observation that without using a proper abstract for looping such repetitive applications are impossible to? manually manage.





要查看或添加评论,请登录

Darragh O'Sheada的更多文章

社区洞察

其他会员也浏览了