~subsetpark/erasmus

e34130f6fec9bfed743f02b84aa3aa6f3acbd0d8 — Zach Smith 2 months ago 407cdb0
Update pant
1 files changed, 15 insertions(+), 10 deletions(-)

M priv/zk.pant
M priv/zk.pant => priv/zk.pant +15 -10
@@ 2,8 2,8 @@ module ZK.

// Notes on a note-taking system, inspired by Zettelkasten.

Line <= String.
Note <= [Line].
Line = String.
Note = [Line].

// The basic operation we're describing is *indexing*: taking all the notes in
// our set and updating them with references to other notes. That's all this


@@ 22,7 22,7 @@ index notes: [Note].
// the beginning of it, and all references contained within it are placed at
// the end.

all n: notes =>
all n<: notes =>
        n' = backlinks n + body n + references n
        and name n' = name n.



@@ 31,18 31,18 @@ all n: notes =>
// set, ordered by creation time.

some1 i: Index =>
        all n: notes' => ref_note n in i
        and all (n, m): notes' =>
        all n<: notes' => ref_note n in i
        and all (n, m)<: notes' =>
                created_at n < created_at m -> i (ref_note n) < i (ref_note m).

;

Index <= [Line].
Index = [Line].

// A Reference is a line of text that's read and written by the system. Both
// backlinks and (forward) references are simply collections of References.

Reference <= Line.
Reference = Line.
backlinks n: Note => {Reference}.
references n: Note => [Reference].



@@ 67,7 67,7 @@ ref s = "%ref:" + escape s + "\n".

ref_note n = ref (name n).

body n = [all line: n, ~(line in Reference) => line].
body n = [all line<: n, ~(line in (references n)) => line].

// As mentioned above, to *index* a note is to take the note body, prepend all
// of the backlinks to that note, and append all the references to other notes


@@ 81,8 81,11 @@ references n = [all s: String, (bracketed s) in n => ref s].
// It's worth noting that references can be ordered as they appear in the note
// body; but backlinks have no defined order.

all (r, s): references n =>
        n (bracketed (name r)) < n (bracketed (name s)) -> references r < references s.
n (bracketed (name (referent rr))).

all (r, rr)<: references n =>
        n (bracketed (name (referent r))) < n (bracketed (name (referent rr))) ->
                (references n) r < (references n) rr.

;



@@ 90,6 93,8 @@ all (r, s): references n =>

escape s: String => String.
bracketed s: String => String.

referent r: Reference => Note.
---

bracketed s = "[" + s + "]".