Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-docgen

Documentation publishing for Pudu: articles, API references, navigation, search, and static websites

0.1.0Apache-2.01

InstallClose

getting-started.md

Markdown49 lines827 B

GitHub ↗

Getting started


uid: guide.start


The library keeps stock as <xref:Inventory.Item> values and changes them with <xref:Inventory.apply>.

[!TIP] Counts replace quantities; receipts and sales adjust them.

Install

pudu.toml

[dependencies]
"@example/inventory" = "0.1.0"

Command line

pudu add @example/inventory

Record a sale

let item = Inventory.apply(Inventory.empty("A-1"), Inventory.Received(5))
let after = Inventory.apply(item, Inventory.Sold(2))
ChangeEffect
Received(n)adds n units
Sold(n)removes n units
Counted(n)sets the quantity to n

The quantity after a sale is $q - n$.[^units]

[^units]: Quantities are whole units.

Next steps

Read about reports.