Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/stack|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == stack [[toc:]] == Documentation The '''stack''' extension is a set of procedures and macros supporting LIFO queue operations. === make-stack <procedure>(make-stack) => STACK</procedure> Returns a new {{STACK}} object. === list->stack <procedure>(list->stack LIST) => STACK</procedure> Returns a new {{STACK}} object with initial elements from the {{LIST}}. The stack order is as {{(apply stack-push! STACK (reverse LIST))}}. In other words {{LIST}} should be in the desired LIFO order. === stack? <procedure>(stack? OBJECT) => BOOLEAN</procedure> Is {{OBJECT}} a stack? === stack-empty? <procedure>(stack-empty? STACK) => BOOLEAN</procedure> Returns #t for an empty {{STACK}}, #f otherwise. === stack-count <procedure>(stack-count STACK) => NUMBER</procedure> Returns the count of elements on the {{STACK}}. === stack-empty! <procedure>(stack-empty! STACK)</procedure> Make {{STACK}} empty. === stack-peek <procedure>(stack-peek STACK [INDEX]) => OBJECT</procedure> Returns the element in {{STACK}} at {{INDEX}}. {{INDEX}} must be in [0 {{(stack-count) - 1}}]. {{INDEX}} defaults to 0. === stack-poke! <procedure>(stack-poke! STACK OBJECT [INDEX])</procedure> Changes the {{STACK}} element at {{INDEX}} to {{OBJECT}}. {{INDEX}} must be in [0 {{(stack-count) - 1}}]. {{INDEX}} defaults to 0. The stack is modified in place. === stack-push! <procedure>(stack-push! STACK OBJECT ...)</procedure> Pushes {{OBJECT ...}} onto the {{STACK}}. The stack is modified in place. === stack-pop! <procedure>(stack-pop! STACK) => OBJECT</procedure> Removes the top element from the {{STACK}} and returns it. The stack is modified in place. === stack-cut! <procedure>(stack-cut! STACK START [END]) => LIST</procedure> Removes the {{STACK}} elements from the indexes {{START}} upto {{END}} and returns a list of the stack elements. The {{START}} must be in [0 {{(stack-count) - 1}}]. The {{END}} must be in [{{START}} {{(stack-count)}}]. {{END}} defaults to {{(stack-count)}}. The stack is modified in place. === stack->list <procedure>(stack->list STACK) => LIST</procedure> Returns the {{STACK}} as a new list, where the first element of the list is the top element of the stack. === stack-fold <procedure>(stack-fold STACK PROCEDURE INITIAL) => OBJECT</procedure> Invokes the {{PROCEDURE}} on each element of the {{STACK}} and the accumulated result. Returns the accumulated result. The initial accumulated result is {{INITIAL}}. Processing of the {{STACK}} elements in order of top to bottom. === stack-for-each <procedure>(stack-for-each STACK PROCEDURE)</procedure> Invokes the {{PROCEDURE}} on each element of the {{STACK}}. Processing of the {{STACK}} elements in order of top to bottom. === stack-map <procedure>(stack-map STACK PROCEDURE) => LIST</procedure> Invokes the {{PROCEDURE}} on each element of the {{STACK}}, collecting in a result {{LIST}}. Processing of the {{STACK}} elements in order of top to bottom. == Usage <enscript language=scheme> (require-extension stack) </enscript> or <enscript language=scheme> (require-library stack) ... (import stack) </enscript> == Examples == Notes == Requirements [[setup-helper]] [[check-errors]] == Bugs and Limitations == Author [[/users/kon-lovett|Kon Lovett]] == Version history ; 2.3.0 : Drop ''typed-modules''. ; 2.2.1 : Fix type. ; 2.2.0 : Uses {{typed-modules}} egg. Slightly faster. ; 2.1.4 : Fix for ticket #630. ; 2.1.3 : ; 2.1.2 : ; 2.1.1 : ; 2.1.0 : ; 2.0.0 : Port to hygienic Chicken. == License Copyright (C) 2009-2017 Kon Lovett. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 2 by 2?