Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Add Stack datatype #74

Open
jdan opened this issue Feb 11, 2021 · 1 comment
Open

Add Stack datatype #74

jdan opened this issue Feb 11, 2021 · 1 comment

Comments

@jdan
Copy link

jdan commented Feb 11, 2021

This changeset proposes a new Stack datatype for first-in-last-out data. It was mostly inspired by OCaml's Stack implementation.

Code review

The changes summarized below are available for you to review, using the
following command:

pull-request.load https://github.com/unisonweb/base:.trunk https://github.com/jdan/unisoncode:.prs.base.stack

Added definitions:

 type Stack a (+1 metadata)
 Stack.Stack                          : [a] -> Stack a
 Stack.doc                            : Doc (+1 metadata)
 Stack.empty                          : Stack a (+1 metadata)
 Stack.empty.doc                      : Doc
 Stack.fromList                       : [a] -> Stack a (+1 metadata)
 Stack.fromList.doc                   : Doc (+1 metadata)
 Stack.isEmpty                        : Stack a
                                      -> Boolean (+1 metadata)
 Stack.isEmpty.doc                    : Doc (+1 metadata)
 Stack.metadata.authors.jdan          : Author
 Stack.metadata.authors.jdan.guid     : GUID
 Stack.metadata.copyrightHolders.jdan : CopyrightHolder
 Stack.pop                            : Stack a
                                      -> Optional (Stack a) (+1 metadata)
 Stack.pop.doc                        : Doc (+1 metadata)
 Stack.push                           : v
                                      -> Stack v
                                      -> Stack v (+1 metadata)
 Stack.push.doc                       : Doc (+1 metadata)
 Stack.singleton                      : a -> Stack a (+1 metadata)
 Stack.singleton.doc                  : Doc
 Stack.size                           : Stack a -> Nat (+1 metadata)
 Stack.size.doc                       : Doc (+1 metadata)
 Stack.top                            : Stack v
                                      -> Optional v (+1 metadata)
 Stack.top.doc                        : Doc (+1 metadata)
@jdan
Copy link
Author

jdan commented Feb 11, 2021

No hard feelings if this is too trivial, as it's really just... List.+: and List.head :) Just wanted to try out the pull request flow and docs features (thanks @runarorama for your wonderful Bag docs)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant