Basics is a collection of largely standalone Swift abstractions for Bag type.
A Bag
defines a minimalistic, narrowly-interfaced container protocol for an arbitrary number
of specifically typed but otherwise arbitary Items. A Bag may hold numerous 'duplicate' items.
Generally the ordering of items in a bag is upspecified and the contents of the bag are (meant
to be) invisible. One does not sequence through the bag contents nor does one index into the
bag. There are other Swift data structures that allow for sequencing and indexing.
A Stack
holds elements according to a LIFO discipline. Elements are pushed onto the top of
a stack and popped off of the top.
A Queue
holds elements according to a FIFO discipline. Elements are enqueued and dequeued.
A List
holds elements according to a LIST discipline whereby the list is wither Empty or
contains an Item as the car
(aka head) and another list as the cdr
(tail).
A Heap
stores items according to a 'Priority Heap' discipline based on a ordering defined for
Comparable
items
A Ring
hold items according to a RING discipline whereby items are put
to the tail of the ring
and get
from the head of the ring. If the ring is filled to capacity, then put
will discard
the oldest item.
A Tree
holds items items according to a rooted TREE discipline.
A Graph
is a set of Items (as Nodes) connected to one anther (with Edges, possibly weighted).
Access the framework with
import SBBasics
Three easy installation options:
In your Package.swift file, add a dependency on SBBasics:
import PackageDescription
let package = Package (
name: "<your package>",
dependencies: [
// ...
.Package (url: "https://github.com/EBGToo/SBBasics.git", majorVersion: 0),
// ...
]
)
pod 'SBBasics', '~> 0.1'
$ git clone https://github.com/EBGToo/SBBasics.git SBBasics
Add the SBBasics Xcode Project to your Xcode Workspace; you'll also need the SBCommons package as well