User:Albedo: Difference between revisions

From Rosetta Code
Content added Content deleted
(new)
 
No edit summary
Line 3: Line 3:
{{mylang|Julia|Beginner}}
{{mylang|Julia|Beginner}}
{{mylangend}}
{{mylangend}}

There aren’t any ways to upload images at the moment, so I’ll post links to the cloud storage place of my Piet examples on my user page, with explanations how they work—hopefully for later integration in the appropriate places on Rosettacode.

To shrink down the size of larger problems, I invented a shorthand text version for explaining the general program flow in a more compact form:

NOP ADD DIV GRT DUP INC END
0 + / > = c ~
PSH SUB MOD PTR ROL OUN
X - % # @ N
POP MUL NOT SWI INN OUC
? * ! $ n C


== Integer Sequence ==
[Link:http://rosettacode.org/wiki/Integer_sequence]

[Image:https://copy.com/TQuwy3dwBRl7nEOL]

(7x3 codels)

Opcodes:

1 PSH DUP OUN 5 PSH
ROL
ADD DUP
PSH 1 OUC ADD

Shorthand:

1 X = N 5 X
@ 0
+ =
X 1 C +


0 \n 1 \n 2 \n 3 OUTPUT
—————————————————————————————————————————————————————————————————————————————
5 5 5
0 5 5 10 1 1 5 5 10 1 2 5 5 10 1 3 STACK
1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 ...
—————————————————————————————————————————————————————————————————————————————
1X ! = N 5X = + C 1X + @ = N 5X = + C 1X + @ = N 5X = + C 1X + @ = N ...
| \_____/ | | |
| | | | +—————————— Repeating the Loop
| | | |
| | | +———————————— ROL acting as NOP (stack too small), needed to guide the codel chooser
| | |
| | +—————————————— Count up
| |
| +———————————————————————— 10 = ASCII for \n (newline)
|
+————————————————————————————————— !1=0 (Sequence begins at 0)

Revision as of 23:18, 26 June 2015

My Favorite Languages
Language Proficiency
Piet Intermediate
Julia Beginner

There aren’t any ways to upload images at the moment, so I’ll post links to the cloud storage place of my Piet examples on my user page, with explanations how they work—hopefully for later integration in the appropriate places on Rosettacode.

To shrink down the size of larger problems, I invented a shorthand text version for explaining the general program flow in a more compact form:

NOP ADD DIV GRT DUP INC END
 0   +   /   >   =   c   ~
PSH SUB MOD PTR ROL OUN
 X   -   %   #   @   N
POP MUL NOT SWI INN OUC
 ?   *   !   $   n   C


Integer Sequence

[Link:http://rosettacode.org/wiki/Integer_sequence]

[Image:https://copy.com/TQuwy3dwBRl7nEOL]

(7x3 codels)

Opcodes:

 1 PSH DUP OUN  5  PSH
       ROL         
       ADD         DUP
       PSH  1  OUC ADD

Shorthand:

 1 X = N 5 X
     @     0
     +     =
     X 1 C +


          0         \n         1         \n         2         \n         3         OUTPUT
   —————————————————————————————————————————————————————————————————————————————
               5                    5                    5
        0    5 5 10    1     1    5 5 10    1     2    5 5 10    1     3           STACK
    1 0 0 0  0 0  0 0  0 1 1 1 1  1 1  1 1  1 2 2 2 2  2 2  2 2  2 3 3 3 3 ...
   —————————————————————————————————————————————————————————————————————————————
   1X ! = N 5X =  + C 1X + @ = N 5X =  + C 1X + @ = N 5X =  + C 1X + @ = N ...
      |     \_____/      | | |
      |        |         | | +—————————— Repeating the Loop 
      |        |         | |
      |        |         | +———————————— ROL acting as NOP (stack too small), needed to guide the codel chooser
      |        |         |
      |        |         +—————————————— Count up
      |        |
      |        +———————————————————————— 10 = ASCII for \n (newline)
      |
      +————————————————————————————————— !1=0 (Sequence begins at 0)