A peer-to-peer stack for code collaboration
Use backticks for arguments in documentation (#276)
Merle Breitkreuz27f5c4c042f1
diff --git a/docs/source/reference.rst b/docs/source/reference.rstindex c9f5679..bcfb23f 100644--- a/docs/source/reference.rst+++ b/docs/source/reference.rst@@ -387,7 +387,7 @@ Replaces the radicle state with the one provided.~~~~~~~~~~~~Given an atom ``x`` and a value ``v``, sets the value associated to-``x`` in the current environemtn to be ``v``. Doesn't evaluate ``v``.+``x`` in the current environment to be ``v``. Doesn't evaluate ``v``.``to-json``~~~~~~~~~~~@@ -531,7 +531,7 @@ value, etc.``(or x y)``~~~~~~~~~~~~-Returns 'arg1' if 'arg1' is not #f, otherwise returns 'arg2'+Returns ``x`` if ``x`` is not ``#f``, otherwise returns ``y````(some xs)``~~~~~~~~~~~~~@@ -541,12 +541,12 @@ Checks that there is a least one truthy value in a list.``(empty-seq? xs)``~~~~~~~~~~~~~~~~~~~-Returns true if the input is an empty sequence (either list or vector).+Returns true if ``xs`` is an empty sequence (either list or vector).``(length xs)``~~~~~~~~~~~~~~~-Returns the length of 'list'.+Returns the length of ``xs``.``(maybe->>= v f)``~~~~~~~~~~~~~~~~~~~@@ -556,8 +556,8 @@ Monadic bind for the maybe monad.``(maybe-foldlM f i xs)``~~~~~~~~~~~~~~~~~~~~~~~~~-Monadic fold over the elements of a seq, associating to the left (i.e.-from left to right) in the maybe monad.+Monadic fold over the elements of a sequence ``xs``, associating to the+left (i.e. from left to right) in the maybe monad.``(elem? x xs)``~~~~~~~~~~~~~~~~@@ -669,9 +669,9 @@ user input is a security hazard! Example: ``(shell! "ls -Glah" "")``.``(process! command args to-write)``~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-Executes ``command`` using 'execvp'. with 'to-write' as input. Stdout-and stderr are inherited. See 'man exec' for more information on-'execvp'. Example: ``(process! "ls" ["-Glah"] "")``.+Executes ``command`` using ``execvp`` with ``to-write`` as input. Stdout+and stderr are inherited. See ``man exec`` for more information on+``execvp``. Example: ``(process! "ls" ["-Glah"] "")``.``(read-line!)``~~~~~~~~~~~~~~~~@@ -733,30 +733,30 @@ Functions for manipulating lists.The empty list.-``(empty? ls)``-~~~~~~~~~~~~~~~+``(empty? seq)``+~~~~~~~~~~~~~~~~-True if 'seq' is empty, false otherwise.+True if ``seq`` is empty, false otherwise.``(reverse ls)``~~~~~~~~~~~~~~~~-Returns the reversed 'ls'.+Returns the reversed list ``ls``.``(range from to)``~~~~~~~~~~~~~~~~~~~-Returns a list with all integers from ``from`` to ``end``, inclusive.+Returns a list with all integers from ``from`` to ``to``, inclusive.``(concat list1 list2)``~~~~~~~~~~~~~~~~~~~~~~~~-Concatenates 'list1' and 'list2'.+Concatenates ``list1`` and ``list2``.``(filter pred ls)``~~~~~~~~~~~~~~~~~~~~-Returns 'list' with only the elements that satisfy 'filter-cond'.+Returns ``ls`` with only the elements that satisfy ``pred``.``prelude/dict``----------------@@ -771,29 +771,29 @@ Creates a dictionary from a list of key-value pairs.``(keys d)``~~~~~~~~~~~~-Given a ``dict``, returns a vector of its keys.+Given a dict ``d``, returns a vector of its keys.``(values d)``~~~~~~~~~~~~~~-Given a ``dict``, returns a vector of its values.+Given a dict ``d``, returns a vector of its values.-``(rekey old-key new-key mp)``-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+``(rekey old-key new-key d)``+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-Change the key from 'old-key' to 'new-key' in 'dict'. If 'new-key'-already exists, it is overwritten.+Change the key from ``old-key`` to ``new-key`` in a dict ``d``. If+``new-key`` already exists, it is overwritten.-``(modify-map key f mp)``-~~~~~~~~~~~~~~~~~~~~~~~~~+``(modify-map k f d)``+~~~~~~~~~~~~~~~~~~~~~~-Given a key, a function and a dict, applies the function to the value-associated to that key.+Given a key ``k``, a function ``f`` and a dict ``d``, applies the+function to the value associated to that key.``(delete-many ks d)``~~~~~~~~~~~~~~~~~~~~~~-Delete several keys from a dict.+Delete several keys ``ks`` from a dict ``d``.``prelude/set``---------------@@ -838,7 +838,7 @@ Functions for dealing with reference cells.``(modify-ref r f)``~~~~~~~~~~~~~~~~~~~~-Modify 'ref' by applying the provided function. Returns the new value.+Modify ``r`` by applying the function ``f``. Returns the new value.``prelude/lens``----------------@@ -893,17 +893,17 @@ Lenses into the nth element of a vector``(view-ref r lens)``~~~~~~~~~~~~~~~~~~~~~-Like 'view', but for refs.+Like ``view``, but for refs.``(set-ref r lens v)``~~~~~~~~~~~~~~~~~~~~~~-Like 'set', but for refs.+Like ``set``, but for refs.``(over-ref r lens f)``~~~~~~~~~~~~~~~~~~~~~~~-Like 'over', but for refs.+Like ``over``, but for refs.``prelude/chain``-----------------@@ -924,8 +924,8 @@ chain dictionary with the chain state.``(eval-in-chain expr chain)``~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-Evaluates 'expr' in the 'chain' and returns a dict with the ':result'-and the resulting ':chain'.+Evaluates ``expr`` in the ``chain`` and returns a dict with the+``:result`` and the resulting ``:chain``.``(update-chain-ref! chain-ref)``~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~diff --git a/rad/prelude/basic.rad b/rad/prelude/basic.radindex 4927919..c454755 100644--- a/rad/prelude/basic.rad+++ b/rad/prelude/basic.rad@@ -5,7 +5,7 @@;; or(def or- "Returns 'arg1' if 'arg1' is not #f, otherwise returns 'arg2'"+ "Returns `x` if `x` is not `#f`, otherwise returns `y`"(fn [x y](if x x y)))@@ -32,7 +32,7 @@)(def empty-seq?- "Returns true if the input is an empty sequence (either list or vector)."+ "Returns true if `xs` is an empty sequence (either list or vector)."(fn [xs](or (eq? xs (list))(eq? xs []))))@@ -40,7 +40,7 @@;; length(def length- "Returns the length of 'list'."+ "Returns the length of `xs`."(fn [xs](foldr (fn [x acc] (+ acc 1)) 0 xs)))@@ -61,7 +61,7 @@:nothing)))(def-rec maybe-foldlM- "Monadic fold over the elements of a seq, associating to the left (i.e. from+ "Monadic fold over the elements of a sequence `xs`, associating to the left (i.e. fromleft to right) in the maybe monad."(fn [f i xs](if (empty-seq? xs)diff --git a/rad/prelude/chain.rad b/rad/prelude/chain.radindex 129e6e6..4249892 100644--- a/rad/prelude/chain.rad+++ b/rad/prelude/chain.rad@@ -28,7 +28,7 @@;; eval-in-chain(def eval-in-chain- "Evaluates 'expr' in the 'chain' and returns a dict with the ':result' and the resulting ':chain'."+ "Evaluates `expr` in the `chain` and returns a dict with the `:result` and the resulting `:chain`."(fn [expr chain](def chain-eval (view (.. (@ :state) (@var 'eval)) chain))(def x (chain-eval expr (lookup :state chain)))@@ -129,7 +129,7 @@;; 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."+ "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-state (lookup :state chain))diff --git a/rad/prelude/dict.rad b/rad/prelude/dict.radindex acea4a6..c3c430b 100644--- a/rad/prelude/dict.rad+++ b/rad/prelude/dict.rad@@ -14,7 +14,7 @@;; keys(def keys- "Given a `dict`, returns a vector of its keys."+ "Given a dict `d`, returns a vector of its keys."(fn [d](map head (seq d))))@@ -23,7 +23,7 @@)(def values- "Given a `dict`, returns a vector of its values."+ "Given a dict `d`, returns a vector of its values."(fn [d](map (fn [x] (nth 1 x)) (seq d))))@@ -33,25 +33,25 @@;; rekey(def rekey- "Change the key from 'old-key' to 'new-key' in 'dict'. If 'new-key' already exists, it is overwritten."- (fn [old-key new-key mp]- (def old-val (lookup old-key mp))- (delete old-key (insert new-key old-val mp))))+ "Change the key from `old-key` to `new-key` in a dict `d`. If `new-key` already exists, it is overwritten."+ (fn [old-key new-key d]+ (def old-val (lookup old-key d))+ (delete old-key (insert new-key old-val d))))(:test "rekey"[ (rekey :a :b {:a 5}) ==> {:b 5} ]);; modify-map(def modify-map- "Given a key, a function and a dict, applies the function to the value associated to that key."- (fn [key f mp]- (insert key (f (lookup key mp)) mp)))+ "Given a key `k`, a function `f` and a dict `d`, applies the function to the value associated to that key."+ (fn [k f d]+ (insert k (f (lookup k d)) d)))(:test "modify-map"[ (modify-map :a (fn [x] (+ x 1)) {:a 5})==> {:a 6} ])(def delete-many- "Delete several keys from a dict."+ "Delete several keys `ks` from a dict `d`."(fn [ks d](foldr (fn [k d] (delete k d)) d ks)))diff --git a/rad/prelude/io.rad b/rad/prelude/io.radindex 949fbf2..3414da3 100644--- a/rad/prelude/io.rad+++ b/rad/prelude/io.rad@@ -88,8 +88,8 @@ Example: `(shell! \"ls -Glah\" \"\")`. "(def process!- "Executes `command` using 'execvp'. with 'to-write' as input. Stdout and stderr are inherited.-See 'man exec' for more information on 'execvp'.+ "Executes `command` using `execvp` with `to-write` as input. Stdout and stderr are inherited.+See `man exec` for more information on `execvp`.Example: `(process! \"ls\" [\"-Glah\"] \"\")`. "(fn [command args to-write](def cpdiff --git a/rad/prelude/lens.rad b/rad/prelude/lens.radindex 5ceec89..746d81e 100644--- a/rad/prelude/lens.rad+++ b/rad/prelude/lens.rad@@ -106,7 +106,7 @@;; view-ref(def view-ref- "Like 'view', but for refs."+ "Like `view`, but for refs."(fn [r lens](view lens (read-ref r))))@@ -116,7 +116,7 @@;; set-ref(def set-ref- "Like 'set', but for refs."+ "Like `set`, but for refs."(fn [r lens v](modify-ref r (fn [x] (set lens v x)))))@@ -130,7 +130,7 @@;; over-ref(def over-ref- "Like 'over', but for refs."+ "Like `over`, but for refs."(fn [r lens f](modify-ref r (fn [x] (over lens f x)))))diff --git a/rad/prelude/list.rad b/rad/prelude/list.radindex 3a99aaf..fd5db1a 100644--- a/rad/prelude/list.rad+++ b/rad/prelude/list.rad@@ -11,8 +11,8 @@;; empty?(def empty?- "True if 'seq' is empty, false otherwise."- (fn [ls] (or (eq? ls nil) (eq? ls []))))+ "True if `seq` is empty, false otherwise."+ (fn [seq] (or (eq? seq nil) (eq? seq []))))(:test "empty"[ (empty? (list 2)) ==> #f ]@@ -23,7 +23,7 @@;; reverse(def reverse- "Returns the reversed 'ls'."+ "Returns the reversed list `ls`."(fn [ls](def-rec go(fn [acc new]@@ -39,7 +39,7 @@;; range(def-rec range- "Returns a list with all integers from `from` to `end`, inclusive."+ "Returns a list with all integers from `from` to `to`, inclusive."(fn [from to](if (eq? from to)(list to)@@ -52,7 +52,7 @@;; concat(def concat- "Concatenates 'list1' and 'list2'."+ "Concatenates `list1` and `list2`."(fn [list1 list2](foldr (fn [a b] (cons a b)) list2 list1)))@@ -63,7 +63,7 @@;; filter(def-rec filter- "Returns 'list' with only the elements that satisfy 'filter-cond'."+ "Returns `ls` with only the elements that satisfy `pred`."(fn [pred ls](cond(empty? ls) lsdiff --git a/rad/prelude/patterns.rad b/rad/prelude/patterns.radindex a041233..4784130 100644--- a/rad/prelude/patterns.rad+++ b/rad/prelude/patterns.rad@@ -5,10 +5,10 @@(import prelude/basic :unqualified)(def exclusive-dict-merge- "Merges two dicts while checking for key conflicts. Returns `{:merge- m :conflicts c}` where `m` is the merged dict for all non-conflicting keys and- `c` is a dict with all the conflicting keys, mapping to pairs of values, one- from each input dict."+ "Merges two dicts while checking for key conflicts. Returns+ `{:merge m :conflicts c}` where `m` is the merged dict for all non-conflicting+ keys and `c` is a dict with all the conflicting keys, mapping to pairs of+ values, one from each input dict."(fn [m n](foldr (fn [kv acc](def k (nth 0 kv))diff --git a/rad/prelude/ref.rad b/rad/prelude/ref.radindex 89fab10..be3e968 100644--- a/rad/prelude/ref.rad+++ b/rad/prelude/ref.rad@@ -3,6 +3,6 @@:exports ['modify-ref]}(def modify-ref- "Modify 'ref' by applying the provided function. Returns the new value."+ "Modify `r` by applying the function `f`. Returns the new value."(fn [r f](write-ref r (f (read-ref r)))))diff --git a/src/Radicle/Internal/Effects.hs b/src/Radicle/Internal/Effects.hsindex 3540423..57a0695 100644--- a/src/Radicle/Internal/Effects.hs+++ b/src/Radicle/Internal/Effects.hs@@ -110,7 +110,7 @@ replPrimFns = fromList $ allDocs $, ( "set-env!", "Given an atom `x` and a value `v`, sets the value associated to `x` in\- \ the current environemtn to be `v`. Doesn't evaluate `v`."+ \ the current environment to be `v`. Doesn't evaluate `v`.", \case[Atom x, v] -> dodefineAtom x Nothing v