Oh... We have...
DequeueAggregate(S : Type):
Category == Join(StackAggregate S, QueueAggregate S) with
dequeue : () -> %
++ dequeue()$D creates an empty dequeue of type D.
dequeue : List S -> %
++ dequeue([x, y, ..., z]) creates a dequeue with first (top or front)
++ element x, second element y, ..., and last (bottom or back)
element z.
.......
top! : % -> S
++ top!(d) returns the element at the top (front) of the dequeue.
bottom! : % -> S
++ bottom!(d) returns the element at the bottom (back) of the dequeue.
Why would top! and bottom! need an exclamation mark in their names? They
are obviously non-destructive. I'm for removing the !. And then there is
also already a function implementation for "top".
Waldek, with your commit from today, would that also mean that we should
replace
dequeue() by empty()
and
dequeue(list) by construct(list)
?
Ralf
On 11/16/2013 10:58 AM, jiazhaoconga wrote:
> (1) -> a:Dequeue INT:= dequeue [1,2,3,4,5]
>
> (1) [1,2,3,4,5]
> Type:
> Dequeue(Integer)
> (2) -> depth a
> Internal Error
> The function depth with signature hashcode is missing from domain
> Dequeue(Integer)
>
> (2) -> top! a
> Internal Error
> The function top! with signature hashcode is missing from domain
> Dequeue(Integer)
>
> (2) -> bottom! a
>
> (2) 5
> Type:
> PositiveInteger
> (3) -> a
>
> (3) [1,2,3,4,5]
> Type:
> Dequeue(Integer)
>
> 1. lack of function 'depth' and 'top!'
> 2. 'bottom!' should change its parameter.
>
> I am typing all commands in axiom book volume 0, using TeXmacs as
> front end of fricas. These bugs are found in chapter 9 section 18: Dequeue.
> Here are the TeXmacs format files hold axiom session, they are runnable:
> https://github.com/ustcscgy/Exercising/tree/master/Axiom.Book
>
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/groups/opt_out.