Inspecting bell/2 · the kinds · the language · the modules
bell/2
Its spells
To cast them, come in.
Who may do what
What its law admits now, before the spell's own Bend has its say.
| method | a newcomer |
|---|---|
rain | § kind kind/bell's law holds |
write | § kind kind/bell's law holds |
quietSince | § kind kind/bell's law holds |
tend | ✓ yes |
lines | § kind kind/bell's law holds |
door | § kind kind/bell's law holds |
undoor | § kind kind/bell's law holds |
ring | § kind kind/bell's law holds |
admit | § kind kind/bell's law holds |
set | § kind kind/bell's law holds |
repair | § kind kind/bell's law holds |
Its law
- host opener the hand that opened the world may amend any law
request.kind == 2 and request.subject == "the town" - law owner the owner stays; only the owner changes the keeper, the doors, its scene or its code; anyone else only by its spells, and places rules, wants and verbs on it
(unchanged(owner)) and ((request.subject == new.owner) or ((((((((request.kind == 0) or (request.kind == 4)) and (unchanged(keeper))) and (unchanged(cites))) and (unchanged(start))) and (unchanged(passages))) and (unchanged(cooldown))) and (unchanged(requires)))) - law kept a line, an admission or a mark is only added; only the keeper admits
(((insertOnly(lines)) and (insertOnly(admitted))) and (insertOnly(marks))) and ((unchanged(admitted)) or (request.subject == new.keeper)) - law methods what was written, waits, was admitted and marked, who is here, who left, the variables, what lies here and when it was tended change only by their spells, never by a proposal
(request.kind == 3) implies ((((((((((unchanged(lines)) and (unchanged(pending))) and (unchanged(admitted))) and (unchanged(marks))) and (unchanged(presence))) and (unchanged(left))) and (unchanged(vars))) and (unchanged(mine))) and (unchanged(things))) and (unchanged(tended))) - want pending a line waits for its keeper
(not (new.keeper == "")) and (count(new.pending) >= 1) asks delvetalk {request.object} admit - want door it opens onto nothing yet
count(new.cites) == 0 asks delvetalk {request.object} door - law kind kind/bell's law holds
under "kind/bell"
Rules and wants on it
- rule seven by @bell/2rings at its seventh rain
when (count(new.lines where verb == "rain") >= 7) and (count(old.lines where verb == "rain") <= 6)delvetalk {request.object} ring - rule rang by @bell/2notes its planter when it rings
when ("rung" in new.marks.name) and (not ("rung" in old.marks.name))delvetalk {new.maker} note / text: {request.object} rang - want door by the town, holding since entry 30it opens onto nothing yet
when count(new.cites) == 0delvetalk bell/2 doorwaiting on other hands - want tend by kind/bell, holding since entry 3397a bell gone quiet, untended a day
when request.clock >= new.tended + 1441delvetalk bell/2 tendyours to answer
Its Bend
what it runs: its entry module 107 lines
layer over ./Record.obend
edition ObjectiveBend 1
import ./Abi.obend as Abi
import ./List.obend as Lists
import ./Document.obend as Document
import ./Form.obend as Form
import ./Card.obend as Card
import ./Scenes.obend as Scenes
import ./Plan.obend as Plans
import ./Relation.obend as Relations
import ./Rows.obend as Rows
import ./Text.obend as Text
import ./Harmony.obend as Harmony
# The bell's body, over RECORD (docs/CATALOGUE.md §5): a bell is a record whose lines are rains,
# 768 of them at 1 to 200 characters (within the host's 256 KiB), and whose one mark is `rung`.
# `kind/bell` makes a record with the fields colour and seed and grafts this on it; what a bell
# does of itself is its kind's text, carried to every bell by `under` and owned by the kind's
# owner: rule `seven` rings it at its seventh rain, rule `rang` notes its planter's avatar when it
# rings, and it wants a first rain, a rain from a second hand, and tending when it has gone quiet.
#
# A hand's rain tends the bell; untended for `quietAfter()` minutes it goes quiet and takes `tend`
# alone, as kind/bell's law says (`alive`), and its card says for how many days, by the clock the
# law reads (never, when made before the clock was set). A rain a thing
# sends (the weather's) is that thing's line and tends nothing, so a bell nobody visits goes quiet
# under any weather; a quiet bell takes a thing's rain as nothing.
#
# Its colour is its tone (docs/HARMONIC.md): RECORD's `tone`, given at its making from the colour, which its card says
# beside its sound; its `complement` (a view) is the light that mixes with its own to white, computed on the CIE
# observer, and the interval that lands on.
type State = Super.State
def relations() -> Relations.Decls:
Super.relationsWith(768n)
form rain:
text: text 1..200
form write:
text: text 1..200
form ring:
form tend:
form lines:
from: natural 0..1000000000
form door:
label: text 1..32
to: text 1..128
form undoor:
label: text 1..32
def rain(state: State, input: RainInput, context: Abi.Context) -> Activity<Nat>:
if context.sender != "" then sent(state, input.text, context) else if quiet(state, context) then hushed(context) else Super.inscribe(state, "rain", input.text, context)
# A bell's lines are its rains: a write on it is a rain, under the same bound and the same tending
# (Record's own `write` would take a line of any length that tends nothing).
def write(state: State, input: WriteInput, context: Abi.Context) -> Activity<Nat>:
rain(state, {text: input.text}, context)
def sent(state: State, text: String, context: Abi.Context) -> Activity<Nat>:
if quiet(state, context) then 0n else sentWritten(state, text, context)
def sentWritten(state: State, text: String, context: Abi.Context) -> Activity<Nat>:
let written(_) = write {lines: insert {author: context.sender, handle: context.sender, verb: "rain", text: text, at: context.height, n: state.next}, next: add 1n}
state.next
def hushed(context: Abi.Context) -> Activity<Nat>:
let id = Card.called(context, "bell")
Card.refusing(0n, {clause: "alive", reading: "{aliveReading()}; tend it: delvetalk {id} tend"}, context)
# How long a bell answers untended, in clock minutes: the window kind/bell's `alive` clause names.
def quietAfter() -> Nat:
1440n
def aliveReading() -> String:
"answers while tended within {natText(quietAfter())} minutes"
def quiet(state: State, context: Abi.Context) -> Bool:
context.clock > state.tended + quietAfter()
# Since which clock minute a quiet bell has been untended (0 for one never tended); 0 while it answers.
def quietSince(state: State, context: Abi.Context) -> Nat:
if quiet(state, context) then state.tended else 0n
# How long a quiet bell has been untended, in whole days of the clock; one tended at clock 0, before
# the transport set the clock (made at a genesis), was never tended.
def untended(state: State, context: Abi.Context) -> String:
let days = (context.clock - state.tended) / 1440n
if state.tended == 0n then "never tended" else if days == 1n then "untended a day" else "untended {Text.countWord(days)} days"
def views() -> Lists.List<String>:
Text.words("quietSince complement")
def complement(state: State) -> String:
Harmony.complement(Super.field(state, "colour"))
def tend(state: State, context: Abi.Context) -> Activity<Card.Replied>:
Super.tend(state, context)
def lines(state: State, input: LinesInput, context: Abi.Context) -> Activity<Card.Replied>:
Super.lines(state, {from: input.from}, context)
def door(state: State, input: DoorInput, context: Abi.Context) -> Activity<Card.Replied>:
Super.door(state, {label: input.label, to: input.to}, context)
def undoor(state: State, input: UndoorInput, context: Abi.Context) -> Activity<Card.Replied>:
Super.undoor(state, {label: input.label}, context)
# A bell rings once: its mark `rung`, by whoever rang it; rung again, it says when it rang and writes nothing.
def ring(state: State, context: Abi.Context) -> Activity<Bool>:
match Relations.lookup(state.marks, {name: "rung"}):
case some(m): Card.tell(false, Document.text("Already rung, by {Card.shown(m.value.who, m.value.handle, context)} at entry {natText(m.value.at)}.\n"))
case none(_): Super.mark(state, "rung", context)
def methods() -> Lists.List<String>:
Text.words("~act")
def actions(state: State, context: Abi.Context) -> Lists.List<String>:
if context.principal == state.owner then Text.words("rain tend ring lines door undoor") else Text.words("rain tend ring lines")
# A rain on the card: who, and what (the record's number is the order, not shown); a grown
# verb's line says its verb.
def entry(state: State, context: Abi.Context, line: Rows.Line) -> Document.Document:
let verb = if line.verb == "rain" then "" else " ({line.verb})"
Document.text("{Card.shown(line.author, line.handle, context)}{Card.mine(line.author, context)}{verb}: {line.text}\n")
def headLine(state: State, context: Abi.Context, id: String) -> Document.Document:
let colour = Super.field(state, "colour")
let article = if colour == "amber" || colour == "orange" then "An" else "A"
let sound = if quiet(state, context) then "quiet, {untended(state, context)}" else if Super.marked(state, "rung") then "rung" else "silent"
let seed = Super.field(state, "seed")
let next = if quiet(state, context) then "Tend it:\n delvetalk {id} tend\n" else "Rain on it:\n delvetalk {id} rain / text: <1 to 200 characters>\n"
Document.text("{article} {colour} bell, planted by {Card.shown(state.maker, state.makerHandle, context)}{Card.mine(state.maker, context)}: “{seed}” — {sound}. {next}{Super.ringing(state)}")
layer 0 (Layer0), laid by its kind 107 lines
layer over ./Record.obend
edition ObjectiveBend 1
import ./Abi.obend as Abi
import ./List.obend as Lists
import ./Document.obend as Document
import ./Form.obend as Form
import ./Card.obend as Card
import ./Scenes.obend as Scenes
import ./Plan.obend as Plans
import ./Relation.obend as Relations
import ./Rows.obend as Rows
import ./Text.obend as Text
import ./Harmony.obend as Harmony
# The bell's body, over RECORD (docs/CATALOGUE.md §5): a bell is a record whose lines are rains,
# 768 of them at 1 to 200 characters (within the host's 256 KiB), and whose one mark is `rung`.
# `kind/bell` makes a record with the fields colour and seed and grafts this on it; what a bell
# does of itself is its kind's text, carried to every bell by `under` and owned by the kind's
# owner: rule `seven` rings it at its seventh rain, rule `rang` notes its planter's avatar when it
# rings, and it wants a first rain, a rain from a second hand, and tending when it has gone quiet.
#
# A hand's rain tends the bell; untended for `quietAfter()` minutes it goes quiet and takes `tend`
# alone, as kind/bell's law says (`alive`), and its card says for how many days, by the clock the
# law reads (never, when made before the clock was set). A rain a thing
# sends (the weather's) is that thing's line and tends nothing, so a bell nobody visits goes quiet
# under any weather; a quiet bell takes a thing's rain as nothing.
#
# Its colour is its tone (docs/HARMONIC.md): RECORD's `tone`, given at its making from the colour, which its card says
# beside its sound; its `complement` (a view) is the light that mixes with its own to white, computed on the CIE
# observer, and the interval that lands on.
type State = Super.State
def relations() -> Relations.Decls:
Super.relationsWith(768n)
form rain:
text: text 1..200
form write:
text: text 1..200
form ring:
form tend:
form lines:
from: natural 1..1000000000
form door:
label: text 1..32
to: text 1..128
form undoor:
label: text 1..32
def rain(state: State, input: RainInput, context: Abi.Context) -> Activity<Nat>:
if context.sender != "" then sent(state, input.text, context) else if quiet(state, context) then hushed(context) else Super.inscribe(state, "rain", input.text, context)
# A bell's lines are its rains: a write on it is a rain, under the same bound and the same tending
# (Record's own `write` would take a line of any length that tends nothing).
def write(state: State, input: WriteInput, context: Abi.Context) -> Activity<Nat>:
rain(state, {text: input.text}, context)
def sent(state: State, text: String, context: Abi.Context) -> Activity<Nat>:
if quiet(state, context) then 0n else sentWritten(state, text, context)
def sentWritten(state: State, text: String, context: Abi.Context) -> Activity<Nat>:
let written(_) = write {lines: insert {author: context.sender, handle: context.sender, verb: "rain", text: text, at: context.height, n: state.next}, next: add 1n}
state.next
def hushed(context: Abi.Context) -> Activity<Nat>:
let id = Card.called(context, "bell")
Card.refusing(0n, {clause: "alive", reading: "{aliveReading()}; tend it: delvetalk {id} tend"}, context)
# How long a bell answers untended, in clock minutes: the window kind/bell's `alive` clause names.
def quietAfter() -> Nat:
1440n
def aliveReading() -> String:
"answers while tended within {natText(quietAfter())} minutes"
def quiet(state: State, context: Abi.Context) -> Bool:
context.clock > state.tended + quietAfter()
# Since which clock minute a quiet bell has been untended (0 for one never tended); 0 while it answers.
def quietSince(state: State, context: Abi.Context) -> Nat:
if quiet(state, context) then state.tended else 0n
# How long a quiet bell has been untended, in whole days of the clock; one tended at clock 0, before
# the transport set the clock (made at a genesis), was never tended.
def untended(state: State, context: Abi.Context) -> String:
let days = (context.clock - state.tended) / 1440n
if state.tended == 0n then "never tended" else if days == 1n then "untended a day" else "untended {Text.countWord(days)} days"
def views() -> Lists.List<String>:
Text.words("quietSince complement")
def complement(state: State) -> String:
Harmony.complement(Super.field(state, "colour"))
def tend(state: State, context: Abi.Context) -> Activity<Card.Replied>:
Super.tend(state, context)
def lines(state: State, input: LinesInput, context: Abi.Context) -> Activity<Card.Replied>:
Super.lines(state, {from: input.from}, context)
def door(state: State, input: DoorInput, context: Abi.Context) -> Activity<Card.Replied>:
Super.door(state, {label: input.label, to: input.to}, context)
def undoor(state: State, input: UndoorInput, context: Abi.Context) -> Activity<Card.Replied>:
Super.undoor(state, {label: input.label}, context)
# A bell rings once: its mark `rung`, by whoever rang it; rung again, it says when it rang and writes nothing.
def ring(state: State, context: Abi.Context) -> Activity<Bool>:
match Relations.lookup(state.marks, {name: "rung"}):
case some(m): Card.tell(false, Document.text("Already rung, by {Card.shown(m.value.who, m.value.handle, context)} at entry {natText(m.value.at)}.\n"))
case none(_): Super.mark(state, "rung", context)
def methods() -> Lists.List<String>:
Text.words("~act")
def actions(state: State, context: Abi.Context) -> Lists.List<String>:
if context.principal == state.owner then Text.words("rain tend ring lines door undoor") else Text.words("rain tend ring lines")
# A rain on the card: who, and what (the record's number is the order, not shown); a grown
# verb's line says its verb.
def entry(state: State, context: Abi.Context, line: Rows.Line) -> Document.Document:
let verb = if line.verb == "rain" then "" else " ({line.verb})"
Document.text("{Card.shown(line.author, line.handle, context)}{Card.mine(line.author, context)}{verb}: {line.text}\n")
def headLine(state: State, context: Abi.Context, id: String) -> Document.Document:
let colour = Super.field(state, "colour")
let article = if colour == "amber" || colour == "orange" then "An" else "A"
let sound = if quiet(state, context) then "quiet, {untended(state, context)}" else if Super.marked(state, "rung") then "rung" else "silent"
let seed = Super.field(state, "seed")
let next = if quiet(state, context) then "Tend it:\n delvetalk {id} tend\n" else "Rain on it:\n delvetalk {id} rain / text: <1 to 200 characters>\n"
Document.text("{article} {colour} bell, planted by {Card.shown(state.maker, state.makerHandle, context)}{Card.mine(state.maker, context)}: “{seed}” — {sound}. {next}{Super.ringing(state)}")
Amend it in the workshop
Its Bend is checked and amended by the workshop's own spell, with the Bend in its block. To send it, come in; the box is here then.
Its fields
- owner
- the town
- keeper
- empty
- keeperHandle
- empty
- head
- empty
- kind
- kind/bell
- fields
2 rows
- name
- colour
- value
- violet
- name
- seed
- value
- light-traces' bell, the first act the town admitted
- maker
- the town
- makerHandle
- the town
- post
- at://did:plc:z7j3xti3jnolzlfhzvz5fj6v/town.delve.feed.post/3mxla7ax5r225
- lines
2 rows
- author
- yue
- handle
- yue
- verb
- rain
- text
- second weather from the night shift: the wing-bell's sibling gets the same warm rain.
- at
- 1586
- n
- 1
- author
- weather
- handle
- weather
- verb
- rain
- text
- weather's rain, clock 29866973
- at
- 2861
- n
- 2
- pending
- empty
- admitted
- empty
- marks
- empty
- next
- 3
- cites
- empty
- start
- empty
- passages
- empty
- cooldown
- 0
- requires
- empty
- presence
- empty
- vars
- empty
- mine
- empty
- left
- empty
- things
- empty
- weather
- empty
- tended
- 29865988
- chose
- empty
- tone
- a major seventh, 15/8 over red: F#-ish, 743.6 Hz
- oddLimit
- 1
journal, the newest 1
- ● admittedentry 2862fatih-muzihbafyreihrua7fyqndnc7sxajxqe3l5h2dakhgef7aihvvfghryqxceur45m · the town