Stack: Difference between revisions

294 bytes added ,  1 year ago
(→‎{{header|Diego}}: Added Diego entry)
Line 4,388:
 
Note also that while pop/3 has three parameters, the function implementation looks like it has two. This is because the !Stack "parameter" is actually a ''pair'' of parameters using Mercury's state variable notation. !Stack is, in effect, two variables: !.Stack and !:Stack, input and output respectively. Using state variable notation here is a bit of overkill but again was brought in for pedagogical reasons to show the syntax.
 
=={{header|MIPS Assembly}}==
 
<lang MIPS>
addi sp,sp,-4
sw t0,0(sp) ;push
 
lw t0,0(sp)
addi sp,sp,4 ;pop
 
lw t0,0(sp) ;top</lang>
 
"Empty" requires you to know the starting value of <code>SP</code>. Since it's hardware-dependent, there's no one answer for this part of the task.
 
=={{header|MiniScript}}==
1,489

edits