Skip to content

A peer-to-peer stack for code collaboration

Add missing exclamation marks. (#269)

Merle Breitkreuz6e6019277ad7
diff --git a/docs/source/guide/GettingStarted.rst b/docs/source/guide/GettingStarted.rst
index 0dfffe7..61c0da0 100644
--- a/docs/source/guide/GettingStarted.rst
+++ b/docs/source/guide/GettingStarted.rst
@@ -21,7 +21,7 @@ In order to build from source, you'll need stack_:
curl -sSL https://get.haskellstack.org/ | sh
The centralized server also requires PostgreSQL libs. On Ubuntu, you can
-`apt-get install libpq-dev`. On MacOS, you can `brew install postgresql'.
+`apt-get install libpq-dev`. On MacOS, you can `brew install postgresql`.
You can then download and build the latest source code for `radicle` from
http://git.oscoin.io/radicle:
diff --git a/docs/source/reference.rst b/docs/source/reference.rst
index ee391bc..0915618 100644
--- a/docs/source/reference.rst
+++ b/docs/source/reference.rst
@@ -1014,14 +1014,14 @@ A lens for variables in states of chains.
Evaluates 'expr' in the 'chain' and returns a dict with the ':result'
and the resulting ':chain'.
-``(enter-remote-chain url env)``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+``(enter-remote-chain! url env)``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Make the eval behave as that of a remote chain. The second param is the
env to return to after :quit.
-``(update-chain chain)``
-~~~~~~~~~~~~~~~~~~~~~~~~
+``(update-chain! chain)``
+~~~~~~~~~~~~~~~~~~~~~~~~~
Takes a chain, and returns a new chain updated with the new expressions
from the remote chain
@@ -1032,14 +1032,14 @@ from the remote chain
Adds a ``:quit`` command to ``before-quit-eval``, which switches to
``after-quit-state`` (and to the eval in that state)
-``(add-send oeval)``
-~~~~~~~~~~~~~~~~~~~~
+``(add-send! oeval)``
+~~~~~~~~~~~~~~~~~~~~~
Add a ``:send`` special form that sends the contents of ``_input`` to
the chain ``_cur-chain``
-``(load-chain url)``
-~~~~~~~~~~~~~~~~~~~~
+``(load-chain! url)``
+~~~~~~~~~~~~~~~~~~~~~
Takes a ``url``, and fetches the inputs of a remote chain and return a
chain dictionary with the chain state.
@@ -1049,8 +1049,8 @@ chain dictionary with the chain state.
List of files which together define the pure prelude.
-``pure-prelude-code``
-~~~~~~~~~~~~~~~~~~~~~
+``pure-prelude-code!``
+~~~~~~~~~~~~~~~~~~~~~~
The pure prelude.
@@ -1099,8 +1099,8 @@ Vote to disagree on a new transition function.
Given a function ``f``, makes a transition function who's output is also
the next state.
-``(update-chain-ref chain-ref)``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+``(update-chain-ref! chain-ref)``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update ``chain-ref`` containing a chain with the new expressions from
the remote chain
\ No newline at end of file
diff --git a/examples/radicle-counter b/examples/radicle-counter
index 58d3a0c..554ac90 100755
--- a/examples/radicle-counter
+++ b/examples/radicle-counter
@@ -77,14 +77,14 @@ SCRIPT
get-value )
radicle - <<-SCRIPT
(load! "rad/prelude.rad")
- (def chain (load-chain "${chain}"))
+ (def chain (load-chain! "${chain}"))
(lookup :result (eval-in-chain '(get-value) chain))
SCRIPT
;;
increment )
radicle - <<-SCRIPT
(load! "rad/prelude.rad")
- (def chain (load-chain "${chain}"))
+ (def chain (load-chain! "${chain}"))
(def expr '(increment))
(def result (lookup :result (eval-in-chain expr chain)))
(send! "${chain}" [expr])
diff --git a/exe/ReferenceDoc.hs b/exe/ReferenceDoc.hs
index fd1a9f6..42bf019 100644
--- a/exe/ReferenceDoc.hs
+++ b/exe/ReferenceDoc.hs
@@ -110,10 +110,10 @@ main = do
, "validator/and", "validator/or", "validator/key", "validator/keys", "validator/uuid", "validator/signed"]
crypto = ["verify-signature", "default-ecc-curve", "gen-key-pair!", "gen-signature!"]
chainTools =
- [ "new-chain", "@var", "eval-in-chain", "enter-remote-chain", "update-chain", "add-quit", "add-send"
- , "load-chain", "pure-prelude-files", "pure-prelude-code", "store-exprs", "eval-fn-app"
+ [ "new-chain", "@var", "eval-in-chain", "enter-remote-chain!", "update-chain!", "add-quit", "add-send!"
+ , "load-chain!", "pure-prelude-files", "pure-prelude-code!", "store-exprs", "eval-fn-app"
, "state-machine-eval", "state-machine-input", "state-machine-new-trans"
- , "state-machine-agree", "state-machine-disagree", "simple-trans", "update-chain-ref"]
+ , "state-machine-agree", "state-machine-disagree", "simple-trans", "update-chain-ref!"]
-- issueChain = ["create-issues-chain!", "list-issues", "new-issue!"]
diff --git a/rad/chain.rad b/rad/chain.rad
index 8464bc3..b9d2010 100644
--- a/rad/chain.rad
+++ b/rad/chain.rad
@@ -50,9 +50,9 @@
[ (view (.. (@ :chain) (@ :index)) res) ==> 2 ]
)
-;; update-chain
+;; update-chain!
-(def update-chain
+(def update-chain!
"Takes a chain, and returns a new chain updated with the new expressions from the remote chain"
(fn [chain]
(def new-inputs
@@ -63,39 +63,39 @@
(view (@ :chain) x)))
(foldl upd-ch chain new-inputs)))
-(:test "update-chain"
+(:test "update-chain!"
[:setup
(do
(def chain-name (uuid!))
(def chain (new-chain chain-name))
(send! chain-name ['(+ 3 2)])
(send! chain-name ['(+ 3 3)])
- (def chain (update-chain chain)))
+ (def chain (update-chain! chain)))
]
[ (lookup :inputs chain) ==> [(+ 3 2) (+ 3 3)]]
)
-(def load-chain
+(def load-chain!
"Takes a `url`, and fetches the inputs of a remote chain and return a chain dictionary with the chain state."
(fn [url]
- (update-chain (new-chain url))))
+ (update-chain! (new-chain url))))
-;; update-chain-ref
+;; update-chain-ref!
-(def update-chain-ref
+(def update-chain-ref!
"Update `chain-ref` containing a chain with the new expressions from the remote chain"
(fn [chain-ref]
- (modify-ref chain-ref update-chain)
+ (modify-ref chain-ref update-chain!)
:ok))
-(:test "update-chain-ref"
+(:test "update-chain-ref!"
[:setup
(do
(def chain-name (uuid!))
(def chain (ref (new-chain chain-name)))
(send! chain-name ['(+ 3 2)])
(send! chain-name ['(+ 3 3)])
- (update-chain-ref chain))
+ (update-chain-ref! chain))
]
[ (lookup :inputs (read-ref chain)) ==> [(+ 3 2) (+ 3 3)]]
)
@@ -119,8 +119,8 @@
(def env_ (over (@var '_inputs) (fn [x] (add-right expr x)) env))
(evalfn expr env_ ))))
-;; add-send
-(def add-send
+;; add-send!
+(def add-send!
"Add a `:send` special form that sends the contents of `_input` to the chain `_cur-chain`"
(fn [oeval]
(fn [expr env]
@@ -132,11 +132,11 @@
(list :ok env_))
((store-exprs oeval) expr env)))))
-;; enter-remote-chain
-(def enter-remote-chain
+;; enter-remote-chain!
+(def enter-remote-chain!
"Make the eval behave as that of a remote chain. The second param is the env to return to after :quit."
(fn [url env]
- (def chain (load-chain url))
+ (def chain (load-chain! url))
(def chain-state (lookup :state chain))
(def mod-state1
(over (@ :env) (fn [x] (insert '_inputs {:val []} x)) chain-state))
@@ -146,7 +146,7 @@
mod-state1))
(def mod-state3
(over (@var 'eval)
- (fn [x] (add-send (add-quit env x)))
+ (fn [x] (add-send! (add-quit env x)))
mod-state2))
(list :ok mod-state3)))
@@ -160,7 +160,7 @@
(if (list? expr)
(cond
(eq? (head expr) :enter-chain)
- (enter-remote-chain (head (eval__ (nth 1 expr) env)) env)
+ (enter-remote-chain! (head (eval__ (nth 1 expr) env)) env)
:else (eval__ expr env))
(eval__ expr env))))
diff --git a/rad/monadic/issues.rad b/rad/monadic/issues.rad
index 0733f0f..9c291db 100644
--- a/rad/monadic/issues.rad
+++ b/rad/monadic/issues.rad
@@ -10,13 +10,13 @@
"The name of this chain."
"monadic/radicle/issues")
-(def issues-chain
- (ref (load-chain "http://radicle.xyz/chains/radicle-issues")))
+(def issues-chain!
+ (ref (load-chain! "http://radicle.xyz/chains/radicle-issues")))
(def create-issues-chain!
"Create a remote issue chain with the given url."
(fn []
- (def url (lookup :url (read-ref issues-chain)))
+ (def url (lookup :url (read-ref issues-chain!)))
(send-prelude! url)
(send-code! url "rad/monadic/issue-remote.rad")))
@@ -56,13 +56,13 @@
(def create-issue!
"Create a new remote issue with the keys in `my-keys.rad`."
(fn [i]
- (send! (lookup :url (read-ref issues-chain))
+ (send! (lookup :url (read-ref issues-chain!))
[(list 'create-issue (sign-entity! i))])))
(def add-comment!
"Create a remote comment with the keys in `my-keys.rad`."
(fn [c]
- (send! (lookup :url (read-ref issues-chain))
+ (send! (lookup :url (read-ref issues-chain!))
[(list 'add-comment (sign-entity! c))])))
(def simple-create-issue!
@@ -75,15 +75,15 @@
(fn [in b]
(add-comment! (simple-comment in b))))
-(def list-issues
+(def list-issues!
"Return the full map of issues."
(fn []
- (lookup :result (eval-in-chain '(list-issues) (read-ref issues-chain)))))
+ (lookup :result (eval-in-chain '(list-issues) (read-ref issues-chain!)))))
-(def fetch
+(def fetch!
"Update the locally cached state of the chain."
(fn []
- (update-chain-ref issues-chain)))
+ (update-chain-ref! issues-chain!)))
(def import-github
"Imports the github issues stored in file `githubissues.rad`. To create this
@@ -117,15 +117,15 @@
": "
(lookup :title i))))
-(def list-last
+(def list-last!
"Get the last `n` issues."
(fn [n]
- (def is (sort-by (fn [i] (- 0 (lookup :number i))) (values (list-issues))))
+ (def is (sort-by (fn [i] (- 0 (lookup :number i))) (values (list-issues!))))
(take n is)))
-(def get-by-id
+(def get-by-id!
(fn [id]
- (lookup id (list-issues))))
+ (lookup id (list-issues!))))
(:test
"The monadic issues chain works."
@@ -135,12 +135,12 @@
(simple-create-issue! "title1" "body1")
(simple-add-comment! 0 "comment0")
(simple-add-comment! 1 "comment1")
- (fetch)
- (def is (list-issues)))]
+ (fetch!)
+ (def is (list-issues!)))]
[ (length (seq is)) ==> 2 ]
[ (view (.. (@ 0) (@ :title)) is) ==> "title0" ]
[ (view (.. (@ 1) (@ :title)) is) ==> "title1" ]
[ (view (... [(@ 1) (@ :comments) (@nth 0) (@ :body)]) is) ==> "comment1" ]
[ (short (head (values is))) ==> "0: title0" ]
- [ (short (head (list-last 1))) ==> "1: title1" ]
+ [ (short (head (list-last! 1))) ==> "1: title1" ]
)
diff --git a/rad/prelude.rad b/rad/prelude.rad
index ec92f6c..637af4d 100644
--- a/rad/prelude.rad
+++ b/rad/prelude.rad
@@ -32,7 +32,7 @@
"rad/prelude/util.rad"
))
-(def pure-prelude-code
+(def pure-prelude-code!
"The pure prelude."
(read-many
(apply string-append
@@ -41,7 +41,7 @@
(def send-prelude!
"Send the pure prelude to a chain."
(fn [chain-id]
- (send! chain-id pure-prelude-code)))
+ (send! chain-id pure-prelude-code!)))
(def _initial-prompt-text
"Text used for greeting in the repl."
diff --git a/test/spec/Radicle/Tests.hs b/test/spec/Radicle/Tests.hs
index 51642ef..28f9be7 100644
--- a/test/spec/Radicle/Tests.hs
+++ b/test/spec/Radicle/Tests.hs
@@ -864,4 +864,4 @@ assertReplInteraction input expected = do
Right _ -> pure ()
-- In addition to the output of the lines tested, tests get
-- printed, so we take only the last few output lines.
- reverse (take (length expected) output) @=? expected
+ reverse (take (length expected) output) @?= expected