examples
Learning Pangine from []
I find Pangine easiest to understand by beginning with literally nothing and adding one idea at a time.
Every block on this page is an actual pangine-console transcript. Text after command> is input. The indented lines are exactly what the console printed. Pangine does not give the example names a built-in meaning.
This is a walkthrough of the current prototype, not a permanent language specification. The commands and outputs are real. The detailed contextual and decision behavior is still under research.
Start with nothing
command> []
[]
command> [cat]
[cat][] is the null Concept. A bracketed name is the smallest non-null Concept, and Pangine treats the name as opaque.
Put Concepts together
command> [cat][dog]
[cat]
[dog]
command> [cat][cat][dog]
x2 [cat]
[dog]Writing Concepts next to each other makes a union. Repeated operands retain multiplicity, which canonical output shows as x2.
Group, normalize, and invert
command> [A][B][A][B]
x2 [A]
x2 [B]
command> ([A][B])([A][B])
x2 [A]
x2 [B]
command> ([A][B])*([A][B])
x2 [A]
x2 [B]
command> ([A][B])->[C]
{[A][B]->[C]}
command> ([A][B])/([A][C])
[B]
![C]
command> [cat]![cat]
[]Parentheses decide what the grammar applies together, but they do not leave one unordered Concept hidden inside another. Pangine therefore gives the first three commands the same normal form. * remains available while I audit whether it has an independent job left. A different surrounding kind, such as the ordered example, still retains the union as one position. / inversely merges the right side, so equal positive and inverted operands cancel.
Write multiplicity explicitly
command> x2[cat]x3[dog]
x3 [dog]
x2 [cat]
command> x2([cat][dog])
x2 [cat]
x2 [dog]x2[cat] is the same Concept as [cat][cat]. The prefix belongs to the next union operand. Parentheses make it apply to the whole input group, then unordered normalization multiplies it into each member. Inversion is the negative form, so x-1[cat] formats as ![cat]. The current experience implementation retains complete roots and occurrence counts.
Put Concepts in order
command> [cat]->[purrs]
{[cat]->[purrs]}
command> [cat]->[purrs]->[soft]
{[cat]->[purrs]->[soft]}
command> ([cat]->[purrs])->[soft]
{{[cat]->[purrs]}->[soft]}-> creates one ordered composition, and the console adds its canonical braces. A three-part chain is flat: it has three ordered component occurrences rather than an implicit binary grouping. Parentheses can explicitly make one ordered composition a component of another.
Give a Percept mutable state
command> ['memory']
['memory']
command> $['memory']
[]
command> ['memory'] = {[cat]->[purrs]}
{[cat]->[purrs]}
command> $['memory']
{[cat]->[purrs]}A quoted name is a Percept reference. The reference remains ['memory']; $ evaluates its current materialized value. Before assignment that value is null.
command> ['state'] = [A]
[A]
command> ['state'] += [B]
[A]
[B]
command> ['state'] -= [A]
[B]
command> ['state'] *= [C]
[B]
[C]
command> ['state'] /= [C]
[B]Assignment and the ordinary mutation operators replace the Percept with zero or one resulting root.
Turn a Percept into a source of experience
command> ['Alice'] ~= {[cat]->[purrs]}
{[cat]->[purrs]}
command> ['Bob'] ~= {[cat]->[meows]}
{[cat]->[meows]}Each ~= command records one experience whose boundary is the complete exact root. Repeating an equal root increments its occurrence count. The root stays an ordinary Concept.
Understand the materialized view
command> ['whole'] = [A][B]
[A]
[B]
command> ['split'] ~= [A]
[A]
command> ['split'] ~= [B]
[A]
[B]
command> $['whole']
[A]
[B]
command> $['split']
[A]
[B]One complete [A][B] root and two separate roots, [A] and [B], can display the same combined value. Pangine retains the exact root boundary and occurrence count internally. The engine API exposes those through get_percept_roots and get_percept_root_count. $ is the convenient combined view, not a lossless root listing.
Ask Alice and Bob separately
command> ['Alice'] @ {[cat]->['sound']}
{[cat]->['sound']}
command> $['sound']
[purrs]
command> ['Bob'] @ {[cat]->['sound']}
{[cat]->['sound']}
command> $['sound']
[meows]A Percept inside the question is an output position. The immediate result preserves the unresolved question shape. Evaluating the output first shows the candidate derived from Alice's experience, then the candidate derived from Bob's. Asking one source replaces the output from the previous question; it does not mix the sources together implicitly.
Ask several sources together
command> ['Alice']['Bob'] @ {[cat]->['sound']}
{[cat]->['sound']}
command> $['sound']
[meows]
[purrs]
command> ^['sound']
[meows]@ applies after the complete expression on its left. The unparenthesized['Alice']['Bob'] @ ... form therefore selects both sources. Parentheses are allowed but unnecessary. Experiencing an equal root twice within Alice contributes twice. Experiencing it once under Alice and once under Bob also contributes twice.
Match only what the question leaves open
command> ['Sequence'] ~= [cat]->[eats]->[cat_food]
{[cat]->[eats]->[cat_food]}
command> ['Sequence'] @ ['what']->[eats]
{['what']->[eats]}
command> $['what']
[cat]Ordinary Concepts in a question are exact constraints; only Percepts inside the question are wildcard positions.cat -> eats is an exact contiguous path in the longer root, so what becomes cat. Pangine does not also return eats, because that would require an eats -> eats path that was never experienced.
Let represented context widen an answer
command> ['Room'] ~= [kitchen]->[connected-to]->[living-room]
{[kitchen]->[connected-to]->[living-room]}
command> ['Room'] ~= [kitchen]->[sound]->[fridge-hum]
{[kitchen]->[connected-to]->[living-room]}
{[kitchen]->[sound]->[fridge-hum]}
command> ['Room'] ~= [living-room]->[sound]->[music]
{[kitchen]->[connected-to]->[living-room]}
{[kitchen]->[sound]->[fridge-hum]}
{[living-room]->[sound]->[music]}
command> ['Room'] @ [kitchen]->[sound]->['answer']
{[kitchen]->[sound]->['answer']}
command> $['answer']
[fridge-hum]
[music]fridge-hum is the direct answer. music is also eligible because the selected roots contain a represented path from kitchen to living-room, whose sound relationship otherwise matches the question exactly. The current experiment lets the starting kitchen position follow context while the later fixed sound position remains exact.
Pangine has not decided that music is correct. The prototype has kept an indirect candidate alongside the direct answer. Its current reduction gives both one root occurrence and ignores directness, route shape, and wider surroundings when choosing. That reduction is provisional because those relationships may eventually be important.
Let experience counts change the choice
command> ['world'] ~= [morning][birds]
[birds]
[morning]
command> ['world'] ~= [morning][birds]
x2 [birds]
x2 [morning]
command> ['world'] ~= [morning][traffic]
x3 [morning]
x2 [birds]
[traffic]
command> ['world'] @ [morning]['answer']
['answer']
[morning]
command> $['answer']
x2 [birds]
[traffic]
command> ^['answer']
[birds]In this prototype, each complete ~= input acts as one experience. The equal bird root was experienced twice, so the current answer projection gives birds a total of two. The traffic root was experienced once. That difference is enough for the placeholder ^ rule to choose birds, without user-written event IDs.
The current implementation counts one root once even if several recursive or contextual routes find the same answer. It adds unequal roots separately and increases the stored count when an equal root is repeated. The x2 output is a temporary exposure of that calculation, not a definition of relevance or a general truth score.
Reuse one output identity
command> ['reviewer'] ~= {[review]->[review]}
{[review]->[review]}
command> ['shipper'] ~= {[prepare]->[ship]}
{[prepare]->[ship]}
command> ['reviewer']['shipper'] @ {['same']->['same']}
{['same']->['same']}
command> ^['same']
[review]Repeating ['same'] asks for one Concept that can occupy both positions. Different output Percepts would allow independent answers.
Choose or decline a decision
command> ['tie'] = [tea][coffee]
[coffee]
[tea]
command> ^['tie']
[coffee]
command> ['opposed'] = ![tea]![coffee]
![coffee]
![tea]
command> ^['opposed']
[]The current ^ placeholder selects the greatest finite positive coefficient. An exact tie uses canonical Concept spelling, so the output is repeatable. If there is no positive candidate, it returns []. These are implementation choices for the present experiment, not a finished sampler.
Use scripts and comments
command> ['steps'] = [draft]; ['steps'] += [review]; $['steps']
[draft]
[review]
command> [cat] // the rest of this line is a comment
[cat]
command> /* comments can also sit inside a line */ [dog]
[dog]Separate statements with semicolons. The parser accepts // line comments and /* */ block comments.
Inspect the live ordinary Concepts
A fresh console keeps this inspection example small:
command> ['one'] = [A]
[A]
command> ['two'] = {[A]->[B]}
{[A]->[B]}
command> $['*']
[A]
[B]
{[A]->[B]}$['*'] is a read-only computed view of every ordinary Concept currently retained by the engine. It is useful for inspecting a session, but it is not persistence.
A deeper example: choosing a build route
This example starts with a fresh console. The Percept itself identifies the source:
command> ['Maintainer'] ~= {[full-test]->[cli-runner]}
{[full-test]->[cli-runner]}
command> ['Maintainer'] ~= {[lint]->[clippy]}
{[full-test]->[cli-runner]}
{[lint]->[clippy]}
command> ['Legacy-note'] ~= {[full-test]->[cargo]}
{[full-test]->[cargo]}Asking both sources retains both exact answers. The unrelated lint root does not match the fixed full-test Concept:
command> ['Maintainer']['Legacy-note'] @ {[full-test]->['route']}
{[full-test]->['route']}
command> $['route']
[cargo]
[cli-runner]
command> ^['route']
[cargo]Pangine does not infer that the maintainer is more authoritative, that the legacy note is older, or that either route should overwrite the other. The cargo decision is only the deterministic tie rule.
The caller can instead choose one source explicitly:
command> ['Maintainer'] @ {[full-test]->['maintainer-route']}
{[full-test]->['maintainer-route']}
command> $['maintainer-route']
[cli-runner]
command> ^['maintainer-route']
[cli-runner]Pangine answers from the selected Percept roots. Source names remain opaque, and source selection stays visible in the question.
Continue locally
Start the console with cargo run --bin pangine-console. Enter help for the compact syntax summary and quit to exit. TheREADME walkthrough contains the same progressive console path in repository form.
This walkthrough does not establish how a later decision should use accumulated evidence. The current xstorage also uses a floating-point value and cannot preserve arbitrarily large integer totals exactly. Persistence, distributed execution, a numeric or temporal domain grammar, and richer sampler behavior remain open.