Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[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, {{(TOS ... BOS)}}. === stack? <procedure>(stack? OBJECT) -> boolean</procedure> Is {{OBJECT}} a stack? ===== check-stack <procedure>(check-stack LOC OBJ [ARGNAM]) -> stack</procedure> ===== error-stack <procedure>(error-stack LOC OBJ [ARGNAM])</procedure> === stack-empty? <procedure>(stack-empty? STACK) -> boolean</procedure> Returns #t for an empty {{stack}}, #f otherwise. === stack-count <procedure>(stack-count STACK) -> fixnum</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]) -> *</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) -> *</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) -> *</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> (import stack) </enscript> == Requirements [[record-variants]] [[check-errors]] [[test]] [[test-utils]] == Author [[/users/kon-lovett|Kon Lovett]] == Repository This egg is hosted on the CHICKEN Subversion repository: [[https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/stack|https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/stack]] If you want to check out the source code repository of this egg and you are not familiar with Subversion, see [[/egg-svn-checkout|this page]]. == Version history ; 3.2.0 : Add {{check-stack}} & {{error-stack}}. ; 3.1.0 : Newer dependency (smaller binary). ; 3.0.11 : . ; 3.0.10 : . ; 3.0.9 : . ; 3.0.8 : Query & access routines are pure. ; 3.0.7 : . ; 3.0.6 : Fix {{stack}} printing. ; 3.0.5 : Export {{stack-fold}}. ; 3.0.4 : Use -strict-types. ; 3.0.3 : . ; 3.0.2 : . ; 3.0.1 : Fix category. ; 3.0.0 : CHICKEN 5 release. == License Copyright (C) 2009-2024 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 add 16 to 9?