Difference between revisions of "Activities/Turtle Art/Tutorials/Stack Programming"

From Sugar Labs
Jump to navigation Jump to search
(Migrate to GitHub)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The Forth programming language uses a stack for computations.
+
== Turtle Art/Tutorials/Stack Programming ==
  
On the right of the screen, the Forth words + - x / DUP and SWAP are implemented with blocks.
+
Read at https://help.sugarlabs.org/turtleart_tutorials/stack_programming.html
  
On the left, a Forth like program to compute 3^2 +4^2 = 25
+
The source file has been moved to [https://github.com/godiard/help-activity/blob/master/source/turtleart_tutorials/stack_programming.rst GitHub]
 
 
 
 
[[File:Screenshot of Turtle Art Activity forth.png|600px]]
 
 
 
[[File:Turtle Art Activity forth.ta]]
 
 
 
What computations can you make with this set of words?
 
 
 
Make additional words with Turtle blocks
 
 
 
The - and / words process the operands on the stack in the reverse order to Forth, you can fix the word definitions on the right with SWAP
 

Latest revision as of 05:57, 30 July 2018

Turtle Art/Tutorials/Stack Programming

Read at https://help.sugarlabs.org/turtleart_tutorials/stack_programming.html

The source file has been moved to GitHub