From d9ea073bb2410bbe0bffaa317d3405da0bca5413 Mon Sep 17 00:00:00 2001 From: Arthur Paulino Date: Thu, 5 Sep 2024 10:13:31 -0300 Subject: [PATCH] chore: update comm syntax --- src/04-types.md | 2 +- src/05-commits.md | 14 +++++++------- src/07-reference.md | 20 ++++++++++---------- src/08-repl.md | 10 +++++----- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/04-types.md b/src/04-types.md index 778bc86..fc18948 100644 --- a/src/04-types.md +++ b/src/04-types.md @@ -50,7 +50,7 @@ It has the same domain range of big nums. ``` user> (comm #0x0) -[2 iterations] => (comm #0x0) +[2 iterations] => #c0x0 ``` ### Characters diff --git a/src/05-commits.md b/src/05-commits.md index 0bfc598..ecf3d03 100644 --- a/src/05-commits.md +++ b/src/05-commits.md @@ -6,13 +6,13 @@ We can create a commitment to any Lurk data with `commit`. ``` user> (commit 123) -[2 iterations] => (comm #0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450) +[2 iterations] => #c0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450 ``` -Now Lurk knows that `(comm #0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450)` is a commitment to `123` and can successfully open it. +Now Lurk knows that `#c0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450` is a commitment to `123` and can successfully open it. ``` -user> (open (comm #0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450)) +user> (open #c0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450) [2 iterations] => 123 ``` @@ -32,14 +32,14 @@ The hiding *secret* must be a big num. ``` user> (hide #0x1 123) -[3 iterations] => (comm #0x7e14ff1d0f6c3844f57c9120786d54256e73c8f08a80f31d6502d87884b3d4) +[3 iterations] => #c0x7e14ff1d0f6c3844f57c9120786d54256e73c8f08a80f31d6502d87884b3d4 ``` For when hiding is unimportant, `commit` creates commitments with a default secret of `#0x0`. ``` user> (hide #0x0 123) -[3 iterations] => (comm #0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450) +[3 iterations] => #c0x3719f5d02845123a80da4f5077c803ba0ce1964e08289a9d020603c1f3c450 ``` And both hashes above open to the same value `123`. @@ -57,7 +57,7 @@ Again, we can commit to *any* Lurk data, including functions. ``` user> (commit (lambda (x) (+ 7 (* x x)))) -[2 iterations] => (comm #0x84a0ebe63fadc8a5e8b848a644a4af72150b6c11652cdbe862f2ee3ffce614) +[2 iterations] => #c0x84a0ebe63fadc8a5e8b848a644a4af72150b6c11652cdbe862f2ee3ffce614 ``` The above is a commitment to a function that squares its input then adds seven. @@ -81,7 +81,7 @@ user> (let ((secret-data 222) (data-interface (lambda (f) (f secret-data)))) (commit data-interface)) -[5 iterations] => (comm #0x4668b9badf58209537dbb62e132badc5bb7bbaf137a8daeeef550046634da8) +[5 iterations] => #c0x4668b9badf58209537dbb62e132badc5bb7bbaf137a8daeeef550046634da8 ``` Now we can open it, applying it to a function that adds `111` to the secret value that the committed function hides. diff --git a/src/07-reference.md b/src/07-reference.md index 7063da7..a853521 100644 --- a/src/07-reference.md +++ b/src/07-reference.md @@ -119,10 +119,10 @@ user> (char nil) ``` user> (commit 1) -[2 iterations] => (comm #0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb) -user> (open (comm #0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb)) +[2 iterations] => #c0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb +user> (open #c0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb) [3 iterations] => 1 -user> (secret (comm #0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb)) +user> (secret #c0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb) [3 iterations] => #0x0 ``` @@ -132,10 +132,10 @@ user> (secret (comm #0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a4 ``` user> (comm #0x0) -[2 iterations] => (comm #0x0) +[2 iterations] => #c0x0 user> (bignum (comm #0x0)) [3 iterations] => #0x0 -user> (open (comm #0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb)) +user> (open #c0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb) [3 iterations] => 1 ``` @@ -281,10 +281,10 @@ user> (type-eqq (+ 1 2) (cons 1 2)) ``` user> (hide #0x123 456) -[3 iterations] => (comm #0x6abde5983eb1b904d3b4fa40700307e835f99547043ccec37a7be641aad3ce) -user> (open (comm #0x6abde5983eb1b904d3b4fa40700307e835f99547043ccec37a7be641aad3ce)) +[3 iterations] => #c0x6abde5983eb1b904d3b4fa40700307e835f99547043ccec37a7be641aad3ce +user> (open #c0x6abde5983eb1b904d3b4fa40700307e835f99547043ccec37a7be641aad3ce) [3 iterations] => 456 -user> (secret (comm #0x6abde5983eb1b904d3b4fa40700307e835f99547043ccec37a7be641aad3ce)) +user> (secret #c0x6abde5983eb1b904d3b4fa40700307e835f99547043ccec37a7be641aad3ce) [3 iterations] => #0x123 ``` @@ -370,7 +370,7 @@ user> (open (hide #0x123 2)) [4 iterations] => 2 user> (open #0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb) [2 iterations] => 1 -user> (open (comm #0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb)) +user> (open #c0x35ff7b6fb1e777a95aadced4e080fa9c024a47d7b1f81d217fa04a2a494fbb) [3 iterations] => 1 ``` @@ -406,7 +406,7 @@ user> (secret (hide #0x123 2)) [4 iterations] => #0x123 user> (secret #0x93ac209775c37ba61db238500fb84e528807ae21d523a1e51a7b1be05d23dc) [2 iterations] => #0x123 -user> (secret (comm #0x93ac209775c37ba61db238500fb84e528807ae21d523a1e51a7b1be05d23dc)) +user> (secret #c0x93ac209775c37ba61db238500fb84e528807ae21d523a1e51a7b1be05d23dc) [3 iterations] => #0x123 ``` diff --git a/src/08-repl.md b/src/08-repl.md index 46658d3..3d19d36 100644 --- a/src/08-repl.md +++ b/src/08-repl.md @@ -56,7 +56,7 @@ For example, the following is accepted by Lurk. ``` user> (commit (lambda (x) (+ x 1))) -[2 iterations] => (comm #0x4384e08797d3cd0f911d844e137e54093460c295a4d71cf951259a9ff9712e) +[2 iterations] => #c0x4384e08797d3cd0f911d844e137e54093460c295a4d71cf951259a9ff9712e user> (#0x4384e08797d3cd0f911d844e137e54093460c295a4d71cf951259a9ff9712e 10) [6 iterations] => 11 ``` @@ -75,14 +75,14 @@ user> (let ((counter (+ counter x))) (cons counter (commit (add counter))))))) (add 0))) -[6 iterations] => (comm #0x8ef25bc2228ca9799db65fd2b137a7b0ebccbfc04cf8530133e60087d403db) +[6 iterations] => #c0x8ef25bc2228ca9799db65fd2b137a7b0ebccbfc04cf8530133e60087d403db ``` And let's see what happens when we provide the argument `5` to it. ``` user> (#0x8ef25bc2228ca9799db65fd2b137a7b0ebccbfc04cf8530133e60087d403db 5) -[13 iterations] => (5 . (comm #0x6b2984a56dc2bbb61495c6fdf8076f0debf10ab2ae43aa1de45de64b460141)) +[13 iterations] => (5 . #c0x6b2984a56dc2bbb61495c6fdf8076f0debf10ab2ae43aa1de45de64b460141) ``` We get the current counter result and the next callable (a functional commitment in this example). @@ -90,7 +90,7 @@ So let's provide the argument `3` to this next callable. ``` user> (#0x6b2984a56dc2bbb61495c6fdf8076f0debf10ab2ae43aa1de45de64b460141 3) -[13 iterations] => (8 . (comm #0x75711244ea5c5bb0f46692db8851748d860f1e8d7e24a8bbf12caf6ed27c91)) +[13 iterations] => (8 . #c0x75711244ea5c5bb0f46692db8851748d860f1e8d7e24a8bbf12caf6ed27c91) ``` The new result is `8` and we also get the next callable, as expected. @@ -206,7 +206,7 @@ user> !(prove (begin (open hash) t)) Proof key: "50426c0c272d181e8e2248f7de943b92093fd2386d5a1ecb68956a3250bb7d" user> !(inspect "50426c0c272d181e8e2248f7de943b92093fd2386d5a1ecb68956a3250bb7d") Expr: (begin (open hash) t) -Env: +Env: Result: t ```