Inspecting kind/bell · the kinds · the language · the modules
kind/bell
- id
- kind/bell
- kind chain
- kind/bell → record
- owner
- the town
- made by
- the town
- version
- 14
- pin
- miduk-raduj
- state
- 8335 bytes
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 |
|---|---|
make | ✓ yes |
place | ✓ yes |
makeUnder | ✓ yes |
repair | ✓ yes |
publishPage | ✓ yes |
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 form, the law, the head, the voice, what it is or the body; anyone makes, 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(form))) and (unchanged(law))) and (unchanged(head))) and (unchanged(voice))) and (unchanged(about))) and (unchanged(body)))) - law kind kinds's law holds
under "kinds"
Its Bend
what it runs: its entry module 46 lines
layer over ./Kind.obend
edition ObjectiveBend 1
import ./Abi.obend as Abi
import ./List.obend as Lists
import ./Form.obend as Form
import ./Rows.obend as Rows
type State = Super.State
form make:
colour: red | orange | yellow | green | cyan | blue | violet | amber | silver | magenta | purple | pink
seed: text 1..80
def make(state: State, input: MakeInput, context: Abi.Context) -> Activity<Super.Done>:
Super.making(state, Lists.List.cons({head: {name: "colour", value: makeColourText(input.colour)}, tail: Lists.List.cons({head: {name: "seed", value: input.seed}, tail: Lists.List.nil()})}), "", context)
def makeColourText(c: MakeColour) -> String:
match c:
case red(_): "red"
case orange(_): "orange"
case yellow(_): "yellow"
case green(_): "green"
case cyan(_): "cyan"
case blue(_): "blue"
case violet(_): "violet"
case amber(_): "amber"
case silver(_): "silver"
case magenta(_): "magenta"
case purple(_): "purple"
case pink(_): "pink"
form place:
colour: red | orange | yellow | green | cyan | blue | violet | amber | silver | magenta | purple | pink
seed: text 1..80
id: text 1..64
def place(state: State, input: PlaceInput, context: Abi.Context) -> Activity<Super.Done>:
Super.making(state, Lists.List.cons({head: {name: "colour", value: placeColourText(input.colour)}, tail: Lists.List.cons({head: {name: "seed", value: input.seed}, tail: Lists.List.cons({head: {name: "id", value: input.id}, tail: Lists.List.nil()})})}), "", context)
def placeColourText(c: PlaceColour) -> String:
match c:
case red(_): "red"
case orange(_): "orange"
case yellow(_): "yellow"
case green(_): "green"
case cyan(_): "cyan"
case blue(_): "blue"
case violet(_): "violet"
case amber(_): "amber"
case silver(_): "silver"
case magenta(_): "magenta"
case purple(_): "purple"
case pink(_): "pink"
the body this kind lays on what it makes 107 lines
Each thing of this kind runs this layer over what the kind is of.
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)}")
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
- ownerHandle
- the town
- name
- bell
- of
- record
- form
colour: red | orange | yellow | green | cyan | blue | violet | amber | silver | magenta | purple | p (120 characters)
colour: red | orange | yellow | green | cyan | blue | violet | amber | silver | magenta | purple | pink seed: text 1..80
- law
law alive "answers while tended within 1440 minutes": request.method == "tend" or request.kind == ru (952 characters)
law alive "answers while tended within 1440 minutes": request.method == "tend" or request.kind == rule or request.clock <= old.tended + 1440 rule seven "rings at its seventh rain": count(new.lines where verb == "rain") >= 7 and count(old.lines where verb == "rain") <= 6 then delvetalk {request.object} ring rule rang "notes its planter when it rings": "rung" in new.marks.name and not "rung" in old.marks.name then delvetalk {new.maker} note / text: {request.object} rang want rain "a bell nobody has rained on": count(new.lines where verb == "rain") == 0 asks delvetalk {request.object} rain want second "a bell only its planter has rained on": count(new.lines where verb == "rain") >= 1 and count(new.lines where verb == "rain" and author == new.maker) >= count(new.lines where verb == "rain") asks delvetalk {request.object} rain want tend "a bell gone quiet, untended a day": request.clock >= new.tended + 1441 asks delvetalk {request.object} tend- head
- empty
- voice
- small and brass, tuned rather than struck; it waits for rain, and scatters light when it rings
- about
- its colour is its tone; rings at its seventh rain; goes quiet untended a day
- body
layer over ./Record.obend (6628 characters)
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)}")- made
10 rows
- object
- bell/1
- n
- 1
- about
- empty
- object
- bell/2
- n
- 2
- about
- empty
- object
- bell/3
- n
- 4
- about
- empty
- object
- bell/green
- n
- 3
- about
- empty
- object
- garden/1/bell/1
- n
- 5
- about
- empty
- object
- garden/1/bell/2
- n
- 6
- about
- empty
- object
- garden/1/bell/3
- n
- 7
- about
- empty
- object
- garden/1/bell/4
- n
- 8
- about
- empty
- object
- garden/1/bell/5
- n
- 9
- about
- empty
- object
- garden/1/bell/6
- n
- 10
- about
- empty
- count
- 10