DelveTalkcome in

Inspecting lantern/3 · the kinds · the language · the modules

the crossroads lamp

Go there its page the town

id
lantern/3
called
the crossroads lamp
kind chain
lantern/3 → kind/lantern → record
owner
yue
made by
yue
after
After kind/lantern.
version
4
pin
sikil-durap
state
752 bytes

Its spells

  • linesdelvetalk lantern/3 lines / from: <a number from 0 to 1000000000>
    its Bend
  • lightdelvetalk lantern/3 light
    its Bend

To cast them, come in.

Who may do what

What its law admits now, before the spell's own Bend has its say.

methoda newcomer
write✓ yes
lines✓ yes
door✓ yes
undoor✓ yes
arm✓ yes
light✓ yes
tend✓ yes
admit✓ yes
set✓ yes
repair✓ yes

Its law

  • host opener the hand that opened the world may amend any lawrequest.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 yetcount(new.cites) == 0 asks delvetalk {request.object} door
  • law kind kind/lantern's law holdsunder "kind/lantern"

Its Bend

what it runs: its entry module 69 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 ./Plan.obend as Plans
import ./World.obend as World
import ./Card.obend as Card
import ./Scenes.obend as Scenes
import ./Relation.obend as Relations
import ./Rows.obend as Rows
import ./Text.obend as Text
# The lantern's body, over RECORD (docs/METAPHYSICS.md §7.5; SEEDING §4): a record made by a door
# (`door`, fixed). As its kind finishes it, it places a rule on that door under its maker (`made`):
# when the door's `open` mark comes, the door casts `delvetalk <lantern> light`, and the lantern is
# lit, once (its mark `lit`). Only that rule lights it, and only while the door is open: a hand's
# `light`, or another's rule on the door, is refused by name.
type State = Super.State
form light:
form arm:
form write:
  text: text 1..280
form lines:
  from: natural 0..1000000000
form door:
  label: text 1..32
  to: text 1..128
form undoor:
  label: text 1..32
def write(state: State, input: WriteInput, context: Abi.Context) -> Activity<Nat>:
  Super.write(state, {text: input.text}, 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)
def actions(state: State, context: Abi.Context) -> Lists.List<String>:
  Lists.concat(if context.principal == state.owner then Text.words("light lines door undoor") else Text.words("light lines"), if context.principal == state.maker then Text.words("arm") else Text.words(""))
def methods() -> Lists.List<String>:
  Text.words("~made ~act")
def watched(state: State) -> String:
  Super.field(state, "door")
def made(state: State, input: {}, context: Abi.Context) -> Activity<Bool>:
  if context.caller != state.kind then false else placing(state, context)
def placing(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.rule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object), when: "\"open\" in new.marks.name and not \"open\" in old.marks.name", then: "delvetalk {context.object} light"}):
    case placed(_): Super.armedNow(state, context)
    case refused(r): Super.unarmed(state, watched(state), r.clause, r.reading, context)
# Its maker places its rule again (taken off first, if it stood).
def arm(state: State, context: Abi.Context) -> Activity<Bool>:
  if context.principal != state.maker then Super.armRefused(state, context) else rearming(state, context)
def rearming(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.unrule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object)}):
    case _: placing(state, context)
# Only its maker's rule on its door lights it, and only once the door is open.
def light(state: State, context: Abi.Context) -> Activity<Bool>:
  if Super.ruledFrom(state, watched(state), context) == false then unlit(state, context) else opened(state, context)
def opened(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.viewField::<Relations.Relation<Rows.Mark>>({object: {world: context.world, object: watched(state)}, field: "marks"}):
    case viewed(v): if Relations.has(v.state, {name: "open"}) then Super.mark(state, "lit", context) else unlit(state, context)
    case _: unlit(state, context)
def unlit(state: State, context: Abi.Context) -> Activity<Bool>:
  Card.refusing(false, {clause: "ruled", reading: "it lights when {watched(state)} opens: delvetalk {watched(state)} knock"}, context)
def headLine(state: State, context: Abi.Context, id: String) -> Document.Document:
  let name = if state.head == "" then "A LANTERN" else state.head
  let lit = if Super.marked(state, "lit") then "lit" else "dark"
  Document.text("{name}, by {watched(state)}: {lit}; it lights when {watched(state)} opens.\n{Super.inactiveLine(state, id)}")
layer 0 (Layer0), laid by its kind 69 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 ./Plan.obend as Plans
import ./World.obend as World
import ./Card.obend as Card
import ./Scenes.obend as Scenes
import ./Relation.obend as Relations
import ./Rows.obend as Rows
import ./Text.obend as Text
# The lantern's body, over RECORD (docs/METAPHYSICS.md §7.5; SEEDING §4): a record made by a door
# (`door`, fixed). As its kind finishes it, it places a rule on that door under its maker (`made`):
# when the door's `open` mark comes, the door casts `delvetalk <lantern> light`, and the lantern is
# lit, once (its mark `lit`). Only that rule lights it, and only while the door is open: a hand's
# `light`, or another's rule on the door, is refused by name.
type State = Super.State
form light:
form arm:
form write:
  text: text 1..280
form lines:
  from: natural 1..1000000000
form door:
  label: text 1..32
  to: text 1..128
form undoor:
  label: text 1..32
def write(state: State, input: WriteInput, context: Abi.Context) -> Activity<Nat>:
  Super.write(state, {text: input.text}, 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)
def actions(state: State, context: Abi.Context) -> Lists.List<String>:
  Lists.concat(if context.principal == state.owner then Text.words("light lines door undoor") else Text.words("light lines"), if context.principal == state.maker then Text.words("arm") else Text.words(""))
def methods() -> Lists.List<String>:
  Text.words("~made ~act")
def watched(state: State) -> String:
  Super.field(state, "door")
def made(state: State, input: {}, context: Abi.Context) -> Activity<Bool>:
  if context.caller != state.kind then false else placing(state, context)
def placing(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.rule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object), when: "\"open\" in new.marks.name and not \"open\" in old.marks.name", then: "delvetalk {context.object} light"}):
    case placed(_): Super.armedNow(state, context)
    case refused(r): Super.unarmed(state, watched(state), r.clause, r.reading, context)
# Its maker places its rule again (taken off first, if it stood).
def arm(state: State, context: Abi.Context) -> Activity<Bool>:
  if context.principal != state.maker then Super.armRefused(state, context) else rearming(state, context)
def rearming(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.unrule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object)}):
    case _: placing(state, context)
# Only its maker's rule on its door lights it, and only once the door is open.
def light(state: State, context: Abi.Context) -> Activity<Bool>:
  if Super.ruledFrom(state, watched(state), context) == false then unlit(state, context) else opened(state, context)
def opened(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.viewField::<Relations.Relation<Rows.Mark>>({object: {world: context.world, object: watched(state)}, field: "marks"}):
    case viewed(v): if Relations.has(v.state, {name: "open"}) then Super.mark(state, "lit", context) else unlit(state, context)
    case _: unlit(state, context)
def unlit(state: State, context: Abi.Context) -> Activity<Bool>:
  Card.refusing(false, {clause: "ruled", reading: "it lights when {watched(state)} opens: delvetalk {watched(state)} knock"}, context)
def headLine(state: State, context: Abi.Context, id: String) -> Document.Document:
  let name = if state.head == "" then "A LANTERN" else state.head
  let lit = if Super.marked(state, "lit") then "lit" else "dark"
  Document.text("{name}, by {watched(state)}: {lit}; it lights when {watched(state)} opens.\n{Super.inactiveLine(state, id)}")

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
yue
keeper
empty
keeperHandle
empty
head
the crossroads lamp
kind
kind/lantern
fields
2 rows
  1. name
    name
    value
    the crossroads lamp
  2. name
    door
    value
    room/12
maker
yue
makerHandle
yue
post
empty
lines
1 rows
  1. author
    yue
    handle
    yue
    verb
    write
    text
    the lamp burns borrowed warmth from the station's ember; the crossroads glows a little.
    at
    1374
    n
    1
pending
empty
admitted
empty
marks
empty
next
2
cites
1 rows
  1. label
    at the crossroads
    to
    room/12
    description
    empty
    examples
    empty
start
empty
passages
empty
cooldown
0
requires
empty
presence
empty
vars
empty
mine
empty
left
empty
things
empty
weather
empty
tended
29865888
chose
empty
tone
empty
oddLimit
0