Function prototype: Difference between revisions

Added Quackery.
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
(Added Quackery.)
Line 1,318:
12.00 ? 5.00 ? 9.00 = 69.00
12.00 ? 5.00 = 60.00</pre>
 
=={{header|Quackery}}==
 
In Quackery a "word" corresponds to a function or subroutine. If you want to make a forward declaration (typically but not exclusively for recursive or mutually recursive words) you would use <code>forward is</code>, and resolve the forward declaration with <code>resolves</code>.
 
For example, the naive recursive Fibonacci function. (Note that the texts in parentheses are stack comments and can be omitted. Their inclusion is good practice. No declaration of parameters or arguments is required in Quackery.)
 
<lang> forward is fibonacci ( n --> n )
 
[ dup 2 < if done
dup 1 - fibonacci
swap 2 - fibonacci + ] resolves fibonacci ( n --> n )</lang>
 
=={{header|Racket}}==
1,462

edits