Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/datastructures/gap/   (GAP Algebra Version 4.15.1©)  Datei vom 14.9.2025 mit Größe 1 kB image not shown  

Quellcode-Bibliothek stack.gd   Sprache: Shell

 

##
##  Datastructures: GAP package providing common datastructures.
##
##  Copyright (C) 2015-2017  The datastructures team.
##  For list of the team members, please refer to the COPYRIGHT file.
##
##  This package is licensed under the GPL 2 or later, please refer
##  to the COPYRIGHT.md and LICENSE files for details.
##

#! @Chapter Stacks
#!
#! A stack is a deque where items can be <C>Push</C>ed onto the stack, and
#! the top item can be <C>Pop</C>ped off the stack.
#!
#! Stacks are wrapped GAP plain lists.


#! @Section API
#!
#! @Description
#! Constructor for stacks
#! @Arguments
#! @Returns stack
DeclareGlobalFunction("Stack");

#! @Description
#! Category of heaps
DeclareCategory("IsStack", IsObject);
BindGlobal( "StackFamily", NewFamily("StackFamily") );

#! @Description
#! Puts <A>object</A> onto <A>stack</A>.
#!
#! @Arguments stack, object
DeclareOperation("Push", [IsStack, IsObject]);

#! @Description
#! Return the object at the top of <A>stack</A>. If <A>stack</A> is empty,
#! returns <K>fail</K>
#! @Arguments stack
#! @Returns object or <K>fail</K>
DeclareOperation("Peek", [IsStack]);

#! @Description
#! Remove the top item from <A>stack</A> and return it.
#! If <A>stack</A> is empty, this function returns fail.
#! @Arguments stack
#! @Returns object or <K>fail</K>
DeclareOperation("Pop", [IsStack]);

#
DeclareRepresentation( "IsStackPlistRep", IsStack and IsPositionalObjectRep, []);
BindGlobal( "StackType", NewType(StackFamily, IsStackPlistRep));
BindGlobal( "StackTypeMutable", NewType(StackFamily,
                                        IsStackPlistRep and IsMutable));
#! @Description
#! Number of elements on <A>stack</A>
#DeclareAttribute(Size, [IsStack]);


¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.18Bemerkung:  (vorverarbeitet am  2026-10-11) ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.