diff options
Diffstat (limited to 'stdlib/source/documentation')
37 files changed, 1303 insertions, 1268 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 1ffc31a13..28350a7c9 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -371,10 +371,10 @@ ... (-> Weekday Bit) ... (case day ... (^or {#Saturday} {#Sunday}) - ... #1 + ... true ... _ - ... #0))]) + ... false))]) ($.definition /.let (format "Creates local bindings." @@ -720,7 +720,7 @@ ... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") ... [(case (split (size static) uri) ... (^multi {#Some [chunk uri']} - ... [(text#= static chunk) #1]) + ... [(text#= static chunk) .true]) ... (match_uri endpoint? parts' uri') ... _ diff --git a/stdlib/source/documentation/lux/control.lux b/stdlib/source/documentation/lux/control.lux index 94b5981ee..0dd79c795 100644 --- a/stdlib/source/documentation/lux/control.lux +++ b/stdlib/source/documentation/lux/control.lux @@ -28,7 +28,7 @@ ["[1][0]" writer]]) (.def .public documentation - (.List $.Module) + (.List $.Documentation) (list.together (list /concatenative.documentation /concurrency.documentation diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index ec8a3ed74..1a1f06dfa 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop left right) + [lux (.except) ["$" documentation] [data [text @@ -17,180 +17,181 @@ [\\library ["[0]" /]]) -(`` (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.value) - - ($.definition /.=> - "Concatenative function types." - [(=> [Nat] [Nat])] - [(All (_ a) - (-> a (=> [] [a])))] - [(All (_ t) - (=> [t] []))] - [(All (_ a b c) - (=> [a b c] [b c a]))] - [(All (_ ,,,0 ,,,1) - (=> [then (=> ,,,0 ,,,1) - else (=> ,,,0 ,,,1)] - ,,,0 [Bit then else] ,,,1))]) - - ($.definition /.apply - "A generator for functions that turn arity N functions into arity N concatenative functions." - [(is (=> [Nat] [Nat]) - ((apply 1) ++))]) - - (,, (with_template [<arity>] - [(with_expansions [<name> (template.symbol [/._] ["apply_" <arity>]) - <doc> (template.text ["Lift a function of arity " <arity> - " into a concatenative function of arity " <arity> "."])] - ($.definition <name> - <doc>))] - - [1] [2] [3] [4] - [5] [6] [7] [8] - )) - - ($.definition /.push - "Push a value onto the stack.") - - ($.definition /.drop - "Drop/pop a value from the top of the stack.") - - ($.definition /.nip - "Drop the second-to-last value from the top of the stack.") - - ($.definition /.dup - "Duplicate the top of the stack.") - - ($.definition /.swap - "Swaps the 2 topmost stack values.") - - ($.definition /.left_rotation - "Rotes the 3 topmost stack values to the left.") - - ($.definition /.right_rotation - "Rotes the 3 topmost stack values to the right.") - - ($.definition /.&& - "Groups the 2 topmost stack values as a 2-tuple.") - - ($.definition /.left - "Left-injects the top into sum.") - - ($.definition /.right - "Right-injects the top into sum.") - - (,, (with_template [<input> <word> <func>] - [(`` ($.definition (,, (template.symbol [/._] [<word>])) - (,, (template.text [<func> " for " <input> " arithmetic."]))))] - - [Nat n/+ n.+] - [Nat n/- n.-] - [Nat n/* n.*] - [Nat n// n./] - [Nat n/% n.%] - [Nat n/= n.=] - [Nat n/< n.<] - [Nat n/<= n.<=] - [Nat n/> n.>] - [Nat n/>= n.>=] - - [Int i/+ i.+] - [Int i/- i.-] - [Int i/* i.*] - [Int i// i./] - [Int i/% i.%] - [Int i/= i.=] - [Int i/< i.<] - [Int i/<= i.<=] - [Int i/> i.>] - [Int i/>= i.>=] - - [Rev r/+ r.+] - [Rev r/- r.-] - [Rev r/* r.*] - [Rev r// r./] - [Rev r/% r.%] - [Rev r/= r.=] - [Rev r/< r.<] - [Rev r/<= r.<=] - [Rev r/> r.>] - [Rev r/>= r.>=] - - [Frac f/+ f.+] - [Frac f/- f.-] - [Frac f/* f.*] - [Frac f// f./] - [Frac f/% f.%] - [Frac f/= f.=] - [Frac f/< f.<] - [Frac f/<= f.<=] - [Frac f/> f.>] - [Frac f/>= f.>=] - )) - - ($.definition /.if - "If expression." - [(same? "then" - (/.value (|>> (push true) - (push "then") - (push "else") - if)))]) - - ($.definition /.call - "Executes an anonymous block on the stack.") - - ($.definition /.loop - "Executes a block as a loop until it yields #0 to stop.") - - ($.definition /.dip - "Executes a block on the stack, save for the topmost value.") - - ($.definition /.dip_2 - "Executes a block on the stack, save for the 2 topmost values.") - - ($.definition /.do - "Do-while loop expression." - [(n.= (++ sample) - (/.value (|>> (push sample) - (push (push false)) - (push (|>> (push 1) n/+)) - do while)))]) - - ($.definition /.while - "While loop expression." - [(n.= (n.+ distance start) - (/.value (|>> (push start) - (push (|>> dup - (push start) n/- - (push distance) n/<)) - (push (|>> (push 1) n/+)) - while)))]) - - ($.definition /.compose - "Function composition." - [(n.= (n.+ 2 sample) - (/.value (|>> (push sample) - (push (|>> (push 1) n/+)) - (push (|>> (push 1) n/+)) - compose - call)))]) - - ($.definition /.partial - "Partial application." - [(n.= (n.+ sample sample) - (/.value (|>> (push sample) - (push sample) - (push n/+) - partial - call)))]) - - ($.definition /.when - "Only execute the block when #1.") - - ($.definition /.? - "Choose the top value when #0 and the second-to-top when #1.")] - []))) +(`` (def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.value) + + ($.definition /.=> + "Concatenative function types." + [(=> [Nat] [Nat])] + [(All (_ a) + (-> a (=> [] [a])))] + [(All (_ t) + (=> [t] []))] + [(All (_ a b c) + (=> [a b c] [b c a]))] + [(All (_ ,,,0 ,,,1) + (=> [then (=> ,,,0 ,,,1) + else (=> ,,,0 ,,,1)] + ,,,0 [Bit then else] ,,,1))]) + + ($.definition /.apply + "A generator for functions that turn arity N functions into arity N concatenative functions." + [(is (=> [Nat] [Nat]) + ((apply 1) ++))]) + + (,, (with_template [<arity>] + [(with_expansions [<name> (template.symbol [/._] ["apply_" <arity>]) + <doc> (template.text ["Lift a function of arity " <arity> + " into a concatenative function of arity " <arity> "."])] + ($.definition <name> + <doc>))] + + [1] [2] [3] [4] + [5] [6] [7] [8] + )) + + ($.definition /.push + "Push a value onto the stack.") + + ($.definition /.drop + "Drop/pop a value from the top of the stack.") + + ($.definition /.nip + "Drop the second-to-last value from the top of the stack.") + + ($.definition /.dup + "Duplicate the top of the stack.") + + ($.definition /.swap + "Swaps the 2 topmost stack values.") + + ($.definition /.left_rotation + "Rotes the 3 topmost stack values to the left.") + + ($.definition /.right_rotation + "Rotes the 3 topmost stack values to the right.") + + ($.definition /.&& + "Groups the 2 topmost stack values as a 2-tuple.") + + ($.definition /.left + "Left-injects the top into sum.") + + ($.definition /.right + "Right-injects the top into sum.") + + (,, (with_template [<input> <word> <func>] + [(`` ($.definition (,, (template.symbol [/._] [<word>])) + (,, (template.text [<func> " for " <input> " arithmetic."]))))] + + [Nat n/+ n.+] + [Nat n/- n.-] + [Nat n/* n.*] + [Nat n// n./] + [Nat n/% n.%] + [Nat n/= n.=] + [Nat n/< n.<] + [Nat n/<= n.<=] + [Nat n/> n.>] + [Nat n/>= n.>=] + + [Int i/+ i.+] + [Int i/- i.-] + [Int i/* i.*] + [Int i// i./] + [Int i/% i.%] + [Int i/= i.=] + [Int i/< i.<] + [Int i/<= i.<=] + [Int i/> i.>] + [Int i/>= i.>=] + + [Rev r/+ r.+] + [Rev r/- r.-] + [Rev r/* r.*] + [Rev r// r./] + [Rev r/% r.%] + [Rev r/= r.=] + [Rev r/< r.<] + [Rev r/<= r.<=] + [Rev r/> r.>] + [Rev r/>= r.>=] + + [Frac f/+ f.+] + [Frac f/- f.-] + [Frac f/* f.*] + [Frac f// f./] + [Frac f/% f.%] + [Frac f/= f.=] + [Frac f/< f.<] + [Frac f/<= f.<=] + [Frac f/> f.>] + [Frac f/>= f.>=] + )) + + ($.definition /.if + "If expression." + [(same? "then" + (/.value (|>> (push true) + (push "then") + (push "else") + if)))]) + + ($.definition /.call + "Executes an anonymous block on the stack.") + + ($.definition /.loop + "Executes a block as a loop until it yields #0 to stop.") + + ($.definition /.dip + "Executes a block on the stack, save for the topmost value.") + + ($.definition /.dip_2 + "Executes a block on the stack, save for the 2 topmost values.") + + ($.definition /.do + "Do-while loop expression." + [(n.= (++ sample) + (/.value (|>> (push sample) + (push (push false)) + (push (|>> (push 1) n/+)) + do while)))]) + + ($.definition /.while + "While loop expression." + [(n.= (n.+ distance start) + (/.value (|>> (push start) + (push (|>> dup + (push start) n/- + (push distance) n/<)) + (push (|>> (push 1) n/+)) + while)))]) + + ($.definition /.compose + "Function composition." + [(n.= (n.+ 2 sample) + (/.value (|>> (push sample) + (push (|>> (push 1) n/+)) + (push (|>> (push 1) n/+)) + compose + call)))]) + + ($.definition /.partial + "Partial application." + [(n.= (n.+ sample sample) + (/.value (|>> (push sample) + (push sample) + (push n/+) + partial + call)))]) + + ($.definition /.when + "Only execute the block when #1.") + + ($.definition /.? + "Choose the top value when #0 and the second-to-top when #1.") + ))) diff --git a/stdlib/source/documentation/lux/control/concurrency.lux b/stdlib/source/documentation/lux/control/concurrency.lux index 3a464a384..7bfd1436b 100644 --- a/stdlib/source/documentation/lux/control/concurrency.lux +++ b/stdlib/source/documentation/lux/control/concurrency.lux @@ -17,7 +17,7 @@ ["[1][0]" thread]]) (.def .public documentation - (.List $.Module) + (.List $.Documentation) (list.together (list /actor.documentation /async.documentation diff --git a/stdlib/source/documentation/lux/control/concurrency/actor.lux b/stdlib/source/documentation/lux/control/concurrency/actor.lux index ab412a640..1d4fa276f 100644 --- a/stdlib/source/documentation/lux/control/concurrency/actor.lux +++ b/stdlib/source/documentation/lux/control/concurrency/actor.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,54 +8,55 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "The actor model of concurrency." - [($.definition /.poisoned) - ($.definition /.dead) - ($.definition /.alive?) - ($.definition /.obituary') +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "The actor model of concurrency.") - ($.definition (/.Actor state) - "An entity that can react to messages (mail) sent to it concurrently.") + ($.definition /.poisoned) + ($.definition /.dead) + ($.definition /.alive?) + ($.definition /.obituary') - ($.definition (/.Mail state) - "A one-way message sent to an actor, without expecting a reply.") + ($.definition (/.Actor state) + "An entity that can react to messages (mail) sent to it concurrently.") - ($.definition (/.Obituary state) - "Details on the death of an actor.") + ($.definition (/.Mail state) + "A one-way message sent to an actor, without expecting a reply.") - ($.definition (/.Behavior state) - "An actor's behavior when mail is received.") + ($.definition (/.Obituary state) + "Details on the death of an actor.") - ($.definition /.spawn! - "Given a behavior and initial state, spawns an actor and returns it.") + ($.definition (/.Behavior state) + "An actor's behavior when mail is received.") - ($.definition /.obituary - "Await for an actor to stop working.") + ($.definition /.spawn! + "Given a behavior and initial state, spawns an actor and returns it.") - ($.definition /.mail! - "Send mail to an actor.") + ($.definition /.obituary + "Await for an actor to stop working.") - ($.definition (/.Message state output) - "A two-way message sent to an actor, expecting a reply.") + ($.definition /.mail! + "Send mail to an actor.") - ($.definition /.tell! - "Communicate with an actor through message-passing.") + ($.definition (/.Message state output) + "A two-way message sent to an actor, expecting a reply.") - ($.definition /.default - "Default actor behavior.") + ($.definition /.tell! + "Communicate with an actor through message-passing.") - ($.definition /.poison! - (format "Kills the actor by sending mail that will kill it upon processing," - \n "but allows the actor to handle previous mail.")) + ($.definition /.default + "Default actor behavior.") - ($.definition /.Stop - "A signal to stop an actor from observing a channel.") + ($.definition /.poison! + (format "Kills the actor by sending mail that will kill it upon processing," + \n "but allows the actor to handle previous mail.")) - ($.definition /.observe! - (format "Use an actor to observe a channel by transforming each datum" - \n "flowing through the channel into mail the actor can process." - \n "Can stop observing the channel by executing the Stop value."))] - [])) + ($.definition /.Stop + "A signal to stop an actor from observing a channel.") + + ($.definition /.observe! + (format "Use an actor to observe a channel by transforming each datum" + \n "flowing through the channel into mail the actor can process." + \n "Can stop observing the channel by executing the Stop value.")) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/async.lux b/stdlib/source/documentation/lux/control/concurrency/async.lux index 02d407203..f05e501b0 100644 --- a/stdlib/source/documentation/lux/control/concurrency/async.lux +++ b/stdlib/source/documentation/lux/control/concurrency/async.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except or and) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,72 +8,73 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Async it) - "Represents values produced by asynchronous computations (unlike IO, which is synchronous).") - - ($.definition (/.Resolver it) - (format "The function used to give a value to an async." - \n "Will signal 'true' if the async has been resolved for the 1st time, 'false' otherwise.")) - - ($.definition /.resolved - "Produces an async that has already been resolved to the given value." - [(resolved value)]) - - ($.definition /.async - "Creates a fresh async that has not been resolved yet." - [(async _)]) - - ($.definition /.value - "Polls an async for its value.") - - ($.definition /.upon! - "Executes the given function as soon as the async has been resolved." - [(upon! function async)]) - - ($.definition /.resolved? - "Checks whether an async's value has already been resolved.") - - ($.definition /.and - "Combines the results of both asyncs, in-order." - [(and left right)]) - - ($.definition /.or - (format "Yields the results of whichever async gets resolved first." - \n "You can tell which one was resolved first through pattern-matching.") - [(or left right)]) - - ($.definition /.either - (format "Yields the results of whichever async gets resolved first." - \n "You cannot tell which one was resolved first.") - [(either left right)]) - - ($.definition /.schedule! - (format "Runs an I/O computation on its own thread (after a specified delay)." - \n "Returns an async that will eventually host its result.") - [(schedule! milli_seconds computation)]) - - ($.definition /.future - (format "Runs an I/O computation on its own thread." - \n "Returns an async that will eventually host its result.") - [(future computation)]) - - ($.definition /.after - "Delivers a value after a certain period has passed." - [(after milli_seconds value)]) - - ($.definition /.delay - "An async that will be resolved after the specified amount of milli-seconds." - [(delay milli_seconds)]) - - ($.definition /.within - "Wait for an async to be resolved within the specified amount of milli-seconds." - [(within milli_seconds async)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Async it) + "Represents values produced by asynchronous computations (unlike IO, which is synchronous).") + + ($.definition (/.Resolver it) + (format "The function used to give a value to an async." + \n "Will signal 'true' if the async has been resolved for the 1st time, 'false' otherwise.")) + + ($.definition /.resolved + "Produces an async that has already been resolved to the given value." + [(resolved value)]) + + ($.definition /.async + "Creates a fresh async that has not been resolved yet." + [(async _)]) + + ($.definition /.value + "Polls an async for its value.") + + ($.definition /.upon! + "Executes the given function as soon as the async has been resolved." + [(upon! function async)]) + + ($.definition /.resolved? + "Checks whether an async's value has already been resolved.") + + ($.definition /.and + "Combines the results of both asyncs, in-order." + [(and left right)]) + + ($.definition /.or + (format "Yields the results of whichever async gets resolved first." + \n "You can tell which one was resolved first through pattern-matching.") + [(or left right)]) + + ($.definition /.either + (format "Yields the results of whichever async gets resolved first." + \n "You cannot tell which one was resolved first.") + [(either left right)]) + + ($.definition /.schedule! + (format "Runs an I/O computation on its own thread (after a specified delay)." + \n "Returns an async that will eventually host its result.") + [(schedule! milli_seconds computation)]) + + ($.definition /.future + (format "Runs an I/O computation on its own thread." + \n "Returns an async that will eventually host its result.") + [(future computation)]) + + ($.definition /.after + "Delivers a value after a certain period has passed." + [(after milli_seconds value)]) + + ($.definition /.delay + "An async that will be resolved after the specified amount of milli-seconds." + [(delay milli_seconds)]) + + ($.definition /.within + "Wait for an async to be resolved within the specified amount of milli-seconds." + [(within milli_seconds async)]) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/atom.lux b/stdlib/source/documentation/lux/control/concurrency/atom.lux index 188d52f48..30f7cfa8d 100644 --- a/stdlib/source/documentation/lux/control/concurrency/atom.lux +++ b/stdlib/source/documentation/lux/control/concurrency/atom.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,26 +8,27 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.atom) - ($.definition /.read!) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Atom it) - "Atomic references that are safe to mutate concurrently.") + ($.definition /.atom) + ($.definition /.read!) - ($.definition /.compare_and_swap! - (format "Only mutates an atom if you can present its current value." - \n "That guarantees that atom was not updated since you last read from it.")) + ($.definition (/.Atom it) + "Atomic references that are safe to mutate concurrently.") - ($.definition /.update! - (format "Updates an atom by applying a function to its current value." - \n "If it fails to update it (because some other process wrote to it first), it will retry until it succeeds." - \n "The retries will be done with the new values of the atom, as they show up.")) + ($.definition /.compare_and_swap! + (format "Only mutates an atom if you can present its current value." + \n "That guarantees that atom was not updated since you last read from it.")) - ($.definition /.write! - (format "Writes the given value to an atom." - \n "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds."))] - [])) + ($.definition /.update! + (format "Updates an atom by applying a function to its current value." + \n "If it fails to update it (because some other process wrote to it first), it will retry until it succeeds." + \n "The retries will be done with the new values of the atom, as they show up.")) + + ($.definition /.write! + (format "Writes the given value to an atom." + \n "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds.")) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/frp.lux b/stdlib/source/documentation/lux/control/concurrency/frp.lux index c2e543372..f22587e37 100644 --- a/stdlib/source/documentation/lux/control/concurrency/frp.lux +++ b/stdlib/source/documentation/lux/control/concurrency/frp.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,49 +8,50 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.already_closed) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.subscribe!) - ($.definition /.mixes) - ($.definition /.poll) - ($.definition /.periodic) - ($.definition /.iterations) - ($.definition /.distinct) - ($.definition /.list) - - ($.definition (/.Channel it) - "An asynchronous channel to distribute values.") - - ($.definition (/.Sink it) - "The tail-end of a channel, which can be written-to to fee the channel.") - - ($.definition /.channel - "Creates a brand-new channel and hands it over, along with the sink to write to it." - [(channel _)]) - - ($.definition (/.Subscriber it) - "A function that can receive every value fed into a channel.") - - ($.definition /.only - (format "Produces a new channel based on the old one, only with values" - \n "that pass the test.") - [(only pass? channel)]) - - ($.definition /.of_async - "A one-element channel containing the output from an async." - [(of_async async)]) - - ($.definition /.mix - "Asynchronous mix over channels." - [(mix f init channel)]) - - ($.definition /.sequential - "Transforms the given list into a channel with the same elements." - [(sequential milli_seconds values)])] - [])) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.already_closed) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.subscribe!) + ($.definition /.mixes) + ($.definition /.poll) + ($.definition /.periodic) + ($.definition /.iterations) + ($.definition /.distinct) + ($.definition /.list) + + ($.definition (/.Channel it) + "An asynchronous channel to distribute values.") + + ($.definition (/.Sink it) + "The tail-end of a channel, which can be written-to to fee the channel.") + + ($.definition /.channel + "Creates a brand-new channel and hands it over, along with the sink to write to it." + [(channel _)]) + + ($.definition (/.Subscriber it) + "A function that can receive every value fed into a channel.") + + ($.definition /.only + (format "Produces a new channel based on the old one, only with values" + \n "that pass the test.") + [(only pass? channel)]) + + ($.definition /.of_async + "A one-element channel containing the output from an async." + [(of_async async)]) + + ($.definition /.mix + "Asynchronous mix over channels." + [(mix f init channel)]) + + ($.definition /.sequential + "Transforms the given list into a channel with the same elements." + [(sequential milli_seconds values)]) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/semaphore.lux b/stdlib/source/documentation/lux/control/concurrency/semaphore.lux index 556406f4d..757bb8692 100644 --- a/stdlib/source/documentation/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/documentation/lux/control/concurrency/semaphore.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,49 +8,50 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.semaphore_is_maxed_out) - ($.definition /.barrier) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.Semaphore - "A tool for controlling access to resources by multiple concurrent processes.") + ($.definition /.semaphore_is_maxed_out) + ($.definition /.barrier) - ($.definition /.semaphore - "" - [(semaphore initial_open_positions)]) + ($.definition /.Semaphore + "A tool for controlling access to resources by multiple concurrent processes.") - ($.definition /.wait! - (format "Wait on a semaphore until there are open positions." - \n "After finishing your work, you must 'signal' to the semaphore that you're done.") - [(wait! semaphore)]) + ($.definition /.semaphore + "" + [(semaphore initial_open_positions)]) - ($.definition /.signal! - "Signal to a semaphore that you're done with your work, and that there is a new open position." - [(signal! semaphore)]) + ($.definition /.wait! + (format "Wait on a semaphore until there are open positions." + \n "After finishing your work, you must 'signal' to the semaphore that you're done.") + [(wait! semaphore)]) - ($.definition /.Mutex - "A mutual-exclusion lock that can only be acquired by one process at a time.") + ($.definition /.signal! + "Signal to a semaphore that you're done with your work, and that there is a new open position." + [(signal! semaphore)]) - ($.definition /.mutex - "Creates a brand-new mutex." - [(mutex _)]) + ($.definition /.Mutex + "A mutual-exclusion lock that can only be acquired by one process at a time.") - ($.definition /.synchronize! - "Runs the procedure with exclusive control of the mutex." - [(synchronize! mutex procedure)]) + ($.definition /.mutex + "Creates a brand-new mutex." + [(mutex _)]) - ($.definition /.limit - "Produce a limit for a barrier.") + ($.definition /.synchronize! + "Runs the procedure with exclusive control of the mutex." + [(synchronize! mutex procedure)]) - ($.definition /.Limit - "A limit for barriers.") + ($.definition /.limit + "Produce a limit for a barrier.") - ($.definition /.Barrier - "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier.") + ($.definition /.Limit + "A limit for barriers.") - ($.definition /.block! - "Wait on a barrier until all processes have arrived and met the barrier's limit.")] - [])) + ($.definition /.Barrier + "A barrier that blocks all processes from proceeding until a given number of processes are parked at the barrier.") + + ($.definition /.block! + "Wait on a barrier until all processes have arrived and met the barrier's limit.") + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/stm.lux b/stdlib/source/documentation/lux/control/concurrency/stm.lux index fb4438584..afa5e4744 100644 --- a/stdlib/source/documentation/lux/control/concurrency/stm.lux +++ b/stdlib/source/documentation/lux/control/concurrency/stm.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,36 +9,37 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.read) - ($.definition /.write) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Var it) - "A mutable cell containing a value, and observers that will be alerted of any change to it.") - - ($.definition /.var - "Creates a new STM var, with a default value." - [(var value)]) - - ($.definition /.changes - "Creates a channel that will receive all changes to the value of the given var." - [(changes target)]) - - ($.definition (/.STM it) - "A computation which updates a transaction and produces a value.") - - ($.definition /.update - "Update a var's value, and return a tuple with the old and the new values." - [(update function var)]) - - ($.definition /.commit! - (format "Commits a transaction and returns its result (asynchronously)." - \n "Note that a transaction may be re-run an indeterminate number of times if other transactions involving the same variables successfully commit first." - \n "For this reason, it's important to note that transactions must be free from side-effects, such as I/O.") - [(commit! procedure)])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.read) + ($.definition /.write) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Var it) + "A mutable cell containing a value, and observers that will be alerted of any change to it.") + + ($.definition /.var + "Creates a new STM var, with a default value." + [(var value)]) + + ($.definition /.changes + "Creates a channel that will receive all changes to the value of the given var." + [(changes target)]) + + ($.definition (/.STM it) + "A computation which updates a transaction and produces a value.") + + ($.definition /.update + "Update a var's value, and return a tuple with the old and the new values." + [(update function var)]) + + ($.definition /.commit! + (format "Commits a transaction and returns its result (asynchronously)." + \n "Note that a transaction may be re-run an indeterminate number of times if other transactions involving the same variables successfully commit first." + \n "For this reason, it's important to note that transactions must be free from side-effects, such as I/O.") + [(commit! procedure)]) + )) diff --git a/stdlib/source/documentation/lux/control/concurrency/thread.lux b/stdlib/source/documentation/lux/control/concurrency/thread.lux index e4ed65586..ec9e89ee1 100644 --- a/stdlib/source/documentation/lux/control/concurrency/thread.lux +++ b/stdlib/source/documentation/lux/control/concurrency/thread.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,13 +9,14 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.parallelism - "How many processes can run in parallel.") + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.schedule! - "Executes an I/O procedure after some milli-seconds." - [(schedule! milli_seconds action)])] - [])) + ($.definition /.parallelism + "How many processes can run in parallel.") + + ($.definition /.schedule! + "Executes an I/O procedure after some milli-seconds." + [(schedule! milli_seconds action)]) + )) diff --git a/stdlib/source/documentation/lux/control/continuation.lux b/stdlib/source/documentation/lux/control/continuation.lux index 4279293de..c1baa45bd 100644 --- a/stdlib/source/documentation/lux/control/continuation.lux +++ b/stdlib/source/documentation/lux/control/continuation.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,38 +9,39 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.reset) - ($.definition /.shift) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.portal) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Cont input output) - "Continuations.") + ($.definition /.reset) + ($.definition /.shift) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.portal) - ($.definition /.continued - "Continues a continuation thunk." - [(continued next cont)]) + ($.definition (/.Cont input output) + "Continuations.") - ($.definition /.result - "Forces a continuation thunk to be evaluated." - [(result cont)]) + ($.definition /.continued + "Continues a continuation thunk." + [(continued next cont)]) - ($.definition /.with_current - "Call with current continuation." - [(with_current - (function (_ go) - (do /.monad - [.let [nexus (function (nexus val) - (go [nexus val]))] - _ (go [nexus init])] - (in (undefined)))))]) + ($.definition /.result + "Forces a continuation thunk to be evaluated." + [(result cont)]) - ($.definition /.pending - "Turns any expression into a function that is pending a continuation." - [(pending (some_function some_input))])] - [])) + ($.definition /.with_current + "Call with current continuation." + [(with_current + (function (_ go) + (do /.monad + [.let [nexus (function (nexus val) + (go [nexus val]))] + _ (go [nexus init])] + (in (undefined)))))]) + + ($.definition /.pending + "Turns any expression into a function that is pending a continuation." + [(pending (some_function some_input))]) + )) diff --git a/stdlib/source/documentation/lux/control/exception.lux b/stdlib/source/documentation/lux/control/exception.lux index 6db7ad8e9..6d0bbc2dd 100644 --- a/stdlib/source/documentation/lux/control/exception.lux +++ b/stdlib/source/documentation/lux/control/exception.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,59 +9,60 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "Pure-Lux exception-handling functionality." - [($.definition /.assertion) + (.List $.Documentation) + (list ($.module /._ + "Pure-Lux exception-handling functionality.") - ($.definition (/.Exception it) - "An exception provides a way to decorate error messages.") + ($.definition /.assertion) - ($.definition /.match? - "Is this exception the cause of the error message?" - [(match? exception error)]) + ($.definition (/.Exception it) + "An exception provides a way to decorate error messages.") - ($.definition /.when - (format "If a particular exception is detected on a possibly-erroneous value, handle it." - \n "If no exception was detected, or a different one from the one being checked, then pass along the original value.") - [(when exception then try)]) + ($.definition /.match? + "Is this exception the cause of the error message?" + [(match? exception error)]) - ($.definition /.otherwise - "If no handler could be found to catch the exception, then run a function as a last-resort measure." - [(otherwise else try)]) + ($.definition /.when + (format "If a particular exception is detected on a possibly-erroneous value, handle it." + \n "If no exception was detected, or a different one from the one being checked, then pass along the original value.") + [(when exception then try)]) - ($.definition /.error - "Constructs an error message from an exception." - [(error exception message)]) + ($.definition /.otherwise + "If no handler could be found to catch the exception, then run a function as a last-resort measure." + [(otherwise else try)]) - ($.definition /.except - "Decorate an error message with an Exception and lift it into the error-handling context." - [(except exception message)]) + ($.definition /.error + "Constructs an error message from an exception." + [(error exception message)]) - ($.definition /.exception - (format "Define a new exception type." - \n "It mostly just serves as a way to tag error messages for later catching.") - ["Simple case:" - (exception .public some_exception)] - ["Complex case:" - (exception .public [arbitrary type variables] (some_exception [optional Text - arguments Int]) - optional_body)]) + ($.definition /.except + "Decorate an error message with an Exception and lift it into the error-handling context." + [(except exception message)]) - ($.definition /.report - "An error report." - [(is Text - (report (list ["Row 0" value/0] - ["Row 1" value/1] - ,,, - ["Row N" value/N])))]) + ($.definition /.exception + (format "Define a new exception type." + \n "It mostly just serves as a way to tag error messages for later catching.") + ["Simple case:" + (exception .public some_exception)] + ["Complex case:" + (exception .public [arbitrary type variables] (some_exception [optional Text + arguments Int]) + optional_body)]) - ($.definition /.listing - (format "A numbered report of the entries on a list." - \n "NOTE: 0-based numbering.") - [(listing format entries)]) + ($.definition /.report + "An error report." + [(is Text + (report (list ["Row 0" value/0] + ["Row 1" value/1] + ,,, + ["Row N" value/N])))]) - ($.definition /.with - "If a computation fails, prepends the exception to the error." - [(with exception message computation)])] - [])) + ($.definition /.listing + (format "A numbered report of the entries on a list." + \n "NOTE: 0-based numbering.") + [(listing format entries)]) + + ($.definition /.with + "If a computation fails, prepends the exception to the error." + [(with exception message computation)]) + )) diff --git a/stdlib/source/documentation/lux/control/function.lux b/stdlib/source/documentation/lux/control/function.lux index ce4b51519..237844ab2 100644 --- a/stdlib/source/documentation/lux/control/function.lux +++ b/stdlib/source/documentation/lux/control/function.lux @@ -4,7 +4,9 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" monoid)]]]]] [\\library ["[0]" /]] ["[0]" / @@ -15,37 +17,41 @@ ["[1][0]" predicate]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.monoid) - - ($.definition /.identity - (format "Identity function." - \n "Does nothing to its argument and just returns it.") - [(same? (identity value) - value)]) - - ($.definition /.composite - "Function composition." - [(= ((composite f g) "foo") - (f (g "foo")))]) - - ($.definition /.constant - "Create constant functions." - [(= ((constant "foo") "bar") - "foo")]) - - ($.definition /.flipped - "Flips the order of the arguments of a function." - [(= ((flipped f) "foo" "bar") - (f "bar" "foo"))]) - - ($.definition /.on - "Simple 1-argument function application." - [(on input function)])] - [/contract.documentation - /memo.documentation - /mixin.documentation - /mutual.documentation - /predicate.documentation])) + (.List $.Documentation) + (list.partial ($.module /._ + "") + + ($.definition /.monoid) + + ($.definition /.identity + (format "Identity function." + \n "Does nothing to its argument and just returns it.") + [(same? (identity value) + value)]) + + ($.definition /.composite + "Function composition." + [(= ((composite f g) "foo") + (f (g "foo")))]) + + ($.definition /.constant + "Create constant functions." + [(= ((constant "foo") "bar") + "foo")]) + + ($.definition /.flipped + "Flips the order of the arguments of a function." + [(= ((flipped f) "foo" "bar") + (f "bar" "foo"))]) + + ($.definition /.on + "Simple 1-argument function application." + [(on input function)]) + + (all list#composite + /contract.documentation + /memo.documentation + /mixin.documentation + /mutual.documentation + /predicate.documentation) + )) diff --git a/stdlib/source/documentation/lux/control/function/contract.lux b/stdlib/source/documentation/lux/control/function/contract.lux index ea946a3fa..ad91f818d 100644 --- a/stdlib/source/documentation/lux/control/function/contract.lux +++ b/stdlib/source/documentation/lux/control/function/contract.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,24 +9,25 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.pre_condition_failed) - ($.definition /.post_condition_failed) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.pre - (format "Pre-conditions." - \n "Given a test and an expression to run, only runs the expression if the test passes." - \n "Otherwise, an error is raised.") - [(pre (i.= +4 (i.+ +2 +2)) - (foo +123 +456 +789))]) + ($.definition /.pre_condition_failed) + ($.definition /.post_condition_failed) - ($.definition /.post - (format "Post-conditions." - \n "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." - \n "If the predicate returns #1, returns the value of the expression." - \n "Otherwise, an error is raised.") - [(post i.even? - (i.+ +2 +2))])] - [])) + ($.definition /.pre + (format "Pre-conditions." + \n "Given a test and an expression to run, only runs the expression if the test passes." + \n "Otherwise, an error is raised.") + [(pre (i.= +4 (i.+ +2 +2)) + (foo +123 +456 +789))]) + + ($.definition /.post + (format "Post-conditions." + \n "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." + \n "If the predicate returns #1, returns the value of the expression." + \n "Otherwise, an error is raised.") + [(post i.even? + (i.+ +2 +2))]) + )) diff --git a/stdlib/source/documentation/lux/control/function/memo.lux b/stdlib/source/documentation/lux/control/function/memo.lux index 0633cff02..dcbda3a2d 100644 --- a/stdlib/source/documentation/lux/control/function/memo.lux +++ b/stdlib/source/documentation/lux/control/function/memo.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except open) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,23 +9,24 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.memoization) - ($.definition (/.Memo input output)) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.open - "Memoization where the memoized results can be re-used accross invocations." - [(open memo)]) + ($.definition /.memoization) + ($.definition (/.Memo input output)) - ($.definition /.closed - (format "Memoization confined to a single invocation to the function (not counting any subsequent recursive invocations)." - \n "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.") - [(closed hash memo)]) + ($.definition /.open + "Memoization where the memoized results can be re-used accross invocations." + [(open memo)]) - ($.definition /.none - (format "No memoization at all." - \n "This is useful as a test control when measuring the effect of using memoization.") - [(none hash memo)])] - [])) + ($.definition /.closed + (format "Memoization confined to a single invocation to the function (not counting any subsequent recursive invocations)." + \n "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.") + [(closed hash memo)]) + + ($.definition /.none + (format "No memoization at all." + \n "This is useful as a test control when measuring the effect of using memoization.") + [(none hash memo)]) + )) diff --git a/stdlib/source/documentation/lux/control/function/mixin.lux b/stdlib/source/documentation/lux/control/function/mixin.lux index 7444f1114..9ed15bf09 100644 --- a/stdlib/source/documentation/lux/control/function/mixin.lux +++ b/stdlib/source/documentation/lux/control/function/mixin.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,42 +8,43 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.monoid) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Mixin input output) - "A partially-defined function which can be mixed with others to inherit their behavior.") + ($.definition /.monoid) - ($.definition /.fixed - "Given a mixin, produces a normal function." - [(fixed f)]) + ($.definition (/.Mixin input output) + "A partially-defined function which can be mixed with others to inherit their behavior.") - ($.definition /.nothing - "A mixin that does nothing and just delegates work to the next mixin.") + ($.definition /.fixed + "Given a mixin, produces a normal function." + [(fixed f)]) - ($.definition /.mixed - "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent." - [(mixed parent child)]) + ($.definition /.nothing + "A mixin that does nothing and just delegates work to the next mixin.") - ($.definition /.advice - "Only apply then mixin when the input meets some criterion." - [(advice when then)]) + ($.definition /.mixed + "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent." + [(mixed parent child)]) - ($.definition /.before - "Executes an action before doing the main work." - [(before monad action)]) + ($.definition /.advice + "Only apply then mixin when the input meets some criterion." + [(advice when then)]) - ($.definition /.after - "Executes an action after doing the main work." - [(after monad action)]) + ($.definition /.before + "Executes an action before doing the main work." + [(before monad action)]) - ($.definition (/.Recursive input output) - "An indirectly recursive function.") + ($.definition /.after + "Executes an action after doing the main work." + [(after monad action)]) - ($.definition /.of_recursive - "Transform an indirectly recursive function into a mixin." - [(of_recursive recursive)])] - [])) + ($.definition (/.Recursive input output) + "An indirectly recursive function.") + + ($.definition /.of_recursive + "Transform an indirectly recursive function into a mixin." + [(of_recursive recursive)]) + )) diff --git a/stdlib/source/documentation/lux/control/function/mutual.lux b/stdlib/source/documentation/lux/control/function/mutual.lux index 05c89af6c..9a6930379 100644 --- a/stdlib/source/documentation/lux/control/function/mutual.lux +++ b/stdlib/source/documentation/lux/control/function/mutual.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except let def) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,38 +8,39 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.let - "Locally-defined mutually-recursive functions." - [(let [(even? number) - (-> Nat Bit) - (case number - 0 true - _ (odd? (-- number))) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - (odd? number) - (-> Nat Bit) - (case number - 0 false - _ (even? (-- number)))] - (and (even? 4) - (odd? 5)))]) + ($.definition /.let + "Locally-defined mutually-recursive functions." + [(let [(even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (-- number))) - ($.definition /.def - "Globally-defined mutually-recursive functions." - [(def - [.public (even? number) - (-> Nat Bit) - (case number - 0 true - _ (odd? (-- number)))] + (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (-- number)))] + (and (even? 4) + (odd? 5)))]) - [.public (odd? number) - (-> Nat Bit) - (case number - 0 false - _ (even? (-- number)))])])] - [])) + ($.definition /.def + "Globally-defined mutually-recursive functions." + [(def + [.public (even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (-- number)))] + + [.public (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (-- number)))])]) + )) diff --git a/stdlib/source/documentation/lux/control/function/predicate.lux b/stdlib/source/documentation/lux/control/function/predicate.lux index a8a4fffe7..53ab7de88 100644 --- a/stdlib/source/documentation/lux/control/function/predicate.lux +++ b/stdlib/source/documentation/lux/control/function/predicate.lux @@ -1,6 +1,6 @@ (.require [library - [lux + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -8,35 +8,36 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.union) - ($.definition /.intersection) - ($.definition /.functor) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Predicate it) - "A question that can be asked of a value, yield either false (#0) or true (#1).") + ($.definition /.union) + ($.definition /.intersection) + ($.definition /.functor) - ($.definition /.none - "A predicate that always fails.") + ($.definition (/.Predicate it) + "A question that can be asked of a value, yield either false (#0) or true (#1).") - ($.definition /.or - "A predicate that meets either predecessor.") + ($.definition /.none + "A predicate that always fails.") - ($.definition /.all - "A predicate that always succeeds.") + ($.definition /.or + "A predicate that meets either predecessor.") - ($.definition /.and - "A predicate that meets both predecessors.") + ($.definition /.all + "A predicate that always succeeds.") - ($.definition /.complement - "The opposite of a predicate.") + ($.definition /.and + "A predicate that meets both predecessors.") - ($.definition /.difference - "A predicate that meeds 'base', but not 'sub'.") + ($.definition /.complement + "The opposite of a predicate.") - ($.definition /.rec - "Ties the knot for a recursive predicate.")] - [])) + ($.definition /.difference + "A predicate that meeds 'base', but not 'sub'.") + + ($.definition /.rec + "Ties the knot for a recursive predicate.") + )) diff --git a/stdlib/source/documentation/lux/control/io.lux b/stdlib/source/documentation/lux/control/io.lux index 233b3da45..2e650626b 100644 --- a/stdlib/source/documentation/lux/control/io.lux +++ b/stdlib/source/documentation/lux/control/io.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,23 +9,24 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code." - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code.") - ($.definition (/.IO it) - "A type that represents synchronous, effectful computations that may interact with the outside world.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.io - (format "Delays the evaluation of an expression, by wrapping it in an IO 'thunk'." - \n "Great for wrapping effectful computations (which will not be performed until the IO is 'run!').") - [(io (exec - (log! msg) - "Some value..."))]) + ($.definition (/.IO it) + "A type that represents synchronous, effectful computations that may interact with the outside world.") - ($.definition /.run! - "A way to execute IO computations and perform their side-effects.")] - [])) + ($.definition /.io + (format "Delays the evaluation of an expression, by wrapping it in an IO 'thunk'." + \n "Great for wrapping effectful computations (which will not be performed until the IO is 'run!').") + [(io (exec + (log! msg) + "Some value..."))]) + + ($.definition /.run! + "A way to execute IO computations and perform their side-effects.") + )) diff --git a/stdlib/source/documentation/lux/control/lazy.lux b/stdlib/source/documentation/lux/control/lazy.lux index 75ab40ce1..5e8d22e27 100644 --- a/stdlib/source/documentation/lux/control/lazy.lux +++ b/stdlib/source/documentation/lux/control/lazy.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,20 +9,21 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.value) - ($.definition /.equivalence) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Lazy it) - (format "A value specified by an expression that is calculated only at the last moment possible." - \n "Afterwards, the value is cached for future reference.")) + ($.definition /.value) + ($.definition /.equivalence) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.lazy - "Specifies a lazy value by providing the expression that computes it." - [(lazy eager_computation)])] - [])) + ($.definition (/.Lazy it) + (format "A value specified by an expression that is calculated only at the last moment possible." + \n "Afterwards, the value is cached for future reference.")) + + ($.definition /.lazy + "Specifies a lazy value by providing the expression that computes it." + [(lazy eager_computation)]) + )) diff --git a/stdlib/source/documentation/lux/control/maybe.lux b/stdlib/source/documentation/lux/control/maybe.lux index b237e8ec8..0f22bcba5 100644 --- a/stdlib/source/documentation/lux/control/maybe.lux +++ b/stdlib/source/documentation/lux/control/maybe.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,43 +9,44 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.monoid) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.equivalence) - ($.definition /.hash) - ($.definition /.with) - ($.definition /.list) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.lifted - "Wraps a monadic value with Maybe machinery." - [(lifted monad)]) + ($.definition /.monoid) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.equivalence) + ($.definition /.hash) + ($.definition /.with) + ($.definition /.list) - ($.definition /.else - (format "Allows you to provide a default value that will be used" - \n "if a (Maybe x) value turns out to be .#None." - \n "Note: the expression for the default value will not be computed if the base computation succeeds.") - [(else +20 {.#Some +10}) - "=>" - +10] - [(else +20 {.#None}) - "=>" - +20]) + ($.definition /.lifted + "Wraps a monadic value with Maybe machinery." + [(lifted monad)]) - ($.definition /.trusted - (format "Assumes that a Maybe value is a .#Some and yields its value." - \n "Raises/throws a runtime error otherwise." - \n "WARNING: Use with caution.") - [(trusted trusted_computation)]) + ($.definition /.else + (format "Allows you to provide a default value that will be used" + \n "if a (Maybe x) value turns out to be .#None." + \n "Note: the expression for the default value will not be computed if the base computation succeeds.") + [(else +20 {.#Some +10}) + "=>" + +10] + [(else +20 {.#None}) + "=>" + +20]) - ($.definition /.when - "Can be used as a guard in (co)monadic be/do expressions." - [(do monad - [value (do_something 1 2 3) - .when (passes_test? value)] - (do_something_else 4 5 6))])] - [])) + ($.definition /.trusted + (format "Assumes that a Maybe value is a .#Some and yields its value." + \n "Raises/throws a runtime error otherwise." + \n "WARNING: Use with caution.") + [(trusted trusted_computation)]) + + ($.definition /.when + "Can be used as a guard in (co)monadic be/do expressions." + [(do monad + [value (do_something 1 2 3) + .when (passes_test? value)] + (do_something_else 4 5 6))]) + )) diff --git a/stdlib/source/documentation/lux/control/parser.lux b/stdlib/source/documentation/lux/control/parser.lux index 4435c348e..1ece53c07 100644 --- a/stdlib/source/documentation/lux/control/parser.lux +++ b/stdlib/source/documentation/lux/control/parser.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except or and not) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,119 +9,120 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Parser state it) - "A generic parser.") - - ($.definition /.assertion - "Fails with the given message if the test is #0." - [(assertion message test)]) - - ($.definition /.maybe - "Optionality combinator." - [(maybe parser)]) - - ($.definition /.result - (format "Executes the parser on the input." - \n "Does not verify that all of the input has been consumed by the parser." - \n "Returns both the parser's output, and a value that represents the remaining input.") - [(result parser input)]) - - ($.definition /.and - "Sequencing combinator." - [(and first second)]) - - ($.definition /.or - "Heterogeneous alternative combinator." - [(or left right)]) - - ($.definition /.either - "Homogeneous alternative combinator." - [(either this that)]) - - ($.definition /.some - "0-or-more combinator." - [(some parser)]) - - ($.definition /.many - "1-or-more combinator." - [(many parser)]) - - ($.definition /.exactly - "Parse exactly N times." - [(exactly amount parser)]) - - ($.definition /.at_least - "Parse at least N times." - [(at_least amount parser)]) - - ($.definition /.at_most - "Parse at most N times." - [(at_most amount parser)]) - - ($.definition /.between - "" - [(between minimum additional parser)]) - - ($.definition /.separated_by - "Parses instances of 'parser' that are separated by instances of 'separator'." - [(separated_by separator parser)]) - - ($.definition /.not - "Only succeeds when the underlying parser fails." - [(not parser)]) - - ($.definition /.failure - "Always fail with this 'message'." - [(failure message)]) - - ($.definition /.lifted - "Lift a potentially failed computation into a parser." - [(lifted operation)]) - - ($.definition /.else - "If the given parser fails, returns the default value." - [(else value parser)]) - - ($.definition /.remaining - "Yield the remaining input (without consuming it).") - - ($.definition /.rec - "Combinator for recursive parsers." - [(rec parser)]) - - ($.definition /.after - "Run the parser after another one (whose output is ignored)." - [(after param subject)]) - - ($.definition /.before - "Run the parser before another one (whose output is ignored)." - [(before param subject)]) - - ($.definition /.only - "Only succeed when the parser's output passes a test." - [(only test parser)]) - - ($.definition /.parses? - "Ignore a parser's output and just verify that it succeeds." - [(parses? parser)]) - - ($.definition /.parses - "Ignore a parser's output and just execute it." - [(parses parser)]) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.speculative - (format "Executes a parser, without actually consuming the input." - \n "That way, the same input can be consumed again by another parser.") - [(speculative parser)]) - - ($.definition /.codec - "Decode the output of a parser using a codec." - [(codec codec parser)])] - [])) + ($.definition (/.Parser state it) + "A generic parser.") + + ($.definition /.assertion + "Fails with the given message if the test is #0." + [(assertion message test)]) + + ($.definition /.maybe + "Optionality combinator." + [(maybe parser)]) + + ($.definition /.result + (format "Executes the parser on the input." + \n "Does not verify that all of the input has been consumed by the parser." + \n "Returns both the parser's output, and a value that represents the remaining input.") + [(result parser input)]) + + ($.definition /.and + "Sequencing combinator." + [(and first second)]) + + ($.definition /.or + "Heterogeneous alternative combinator." + [(or left right)]) + + ($.definition /.either + "Homogeneous alternative combinator." + [(either this that)]) + + ($.definition /.some + "0-or-more combinator." + [(some parser)]) + + ($.definition /.many + "1-or-more combinator." + [(many parser)]) + + ($.definition /.exactly + "Parse exactly N times." + [(exactly amount parser)]) + + ($.definition /.at_least + "Parse at least N times." + [(at_least amount parser)]) + + ($.definition /.at_most + "Parse at most N times." + [(at_most amount parser)]) + + ($.definition /.between + "" + [(between minimum additional parser)]) + + ($.definition /.separated_by + "Parses instances of 'parser' that are separated by instances of 'separator'." + [(separated_by separator parser)]) + + ($.definition /.not + "Only succeeds when the underlying parser fails." + [(not parser)]) + + ($.definition /.failure + "Always fail with this 'message'." + [(failure message)]) + + ($.definition /.lifted + "Lift a potentially failed computation into a parser." + [(lifted operation)]) + + ($.definition /.else + "If the given parser fails, returns the default value." + [(else value parser)]) + + ($.definition /.remaining + "Yield the remaining input (without consuming it).") + + ($.definition /.rec + "Combinator for recursive parsers." + [(rec parser)]) + + ($.definition /.after + "Run the parser after another one (whose output is ignored)." + [(after param subject)]) + + ($.definition /.before + "Run the parser before another one (whose output is ignored)." + [(before param subject)]) + + ($.definition /.only + "Only succeed when the parser's output passes a test." + [(only test parser)]) + + ($.definition /.parses? + "Ignore a parser's output and just verify that it succeeds." + [(parses? parser)]) + + ($.definition /.parses + "Ignore a parser's output and just execute it." + [(parses parser)]) + + ($.definition /.speculative + (format "Executes a parser, without actually consuming the input." + \n "That way, the same input can be consumed again by another parser.") + [(speculative parser)]) + + ($.definition /.codec + "Decode the output of a parser using a codec." + [(codec codec parser)]) + )) diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux index 71d9faea5..50d232154 100644 --- a/stdlib/source/documentation/lux/control/pipe.lux +++ b/stdlib/source/documentation/lux/control/pipe.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except let cond if exec case) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,97 +9,98 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities." - [($.definition /.new - "Ignores the piped argument, and begins a new pipe." - [(n.= 1 - (|> 20 - (n.* 3) - (n.+ 4) - (new 0 [++])))]) + (.List $.Documentation) + (list ($.module /._ + "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities.") - ($.definition /.let - "Gives a name to the piped-argument, within the given expression." - [(n.= 10 - (|> 5 - (let x (n.+ x x))))]) + ($.definition /.new + "Ignores the piped argument, and begins a new pipe." + [(n.= 1 + (|> 20 + (n.* 3) + (n.+ 4) + (new 0 [++])))]) - ($.definition /.cond - (format "Branching for pipes." - \n "Both the tests and the bodies are piped-code, and must be given inside a tuple.") - [(|> +5 - (cond [i.even?] [(i.* +2)] - [i.odd?] [(i.* +3)] - [(new -1 [])]))]) + ($.definition /.let + "Gives a name to the piped-argument, within the given expression." + [(n.= 10 + (|> 5 + (let x (n.+ x x))))]) - ($.definition /.if - "If-branching." - [(same? (if (n.even? sample) - "even" - "odd") - (|> sample - (if [n.even?] - [(new "even" [])] - [(new "odd" [])])))]) + ($.definition /.cond + (format "Branching for pipes." + \n "Both the tests and the bodies are piped-code, and must be given inside a tuple.") + [(|> +5 + (cond [i.even?] [(i.* +2)] + [i.odd?] [(i.* +3)] + [(new -1 [])]))]) - ($.definition /.when - "Only execute the body when the test passes." - [(same? (if (n.even? sample) - (n.* 2 sample) - sample) - (|> sample - (when [n.even?] - [(n.* 2)])))]) + ($.definition /.if + "If-branching." + [(same? (if (n.even? sample) + "even" + "odd") + (|> sample + (if [n.even?] + [(new "even" [])] + [(new "odd" [])])))]) - ($.definition /.while - (format "While loops for pipes." - \n "Both the testing and calculating steps are pipes and must be given inside tuples.") - [(|> +1 - (while [(i.< +10)] - [++]))]) + ($.definition /.when + "Only execute the body when the test passes." + [(same? (if (n.even? sample) + (n.* 2 sample) + sample) + (|> sample + (when [n.even?] + [(n.* 2)])))]) - ($.definition /.do - (format "Monadic pipes." - \n "Each steps in the monadic computation is a pipe and must be given inside a tuple.") - [(|> +5 - (do identity.monad - [(i.* +3)] - [(i.+ +4)] + ($.definition /.while + (format "While loops for pipes." + \n "Both the testing and calculating steps are pipes and must be given inside tuples.") + [(|> +1 + (while [(i.< +10)] [++]))]) - ($.definition /.exec - (format "Non-updating pipes." - \n "Will generate piped computations, but their results will not be used in the larger scope.") - [(|> +5 - (exec [.nat %n log!]) - (i.* +10))]) + ($.definition /.do + (format "Monadic pipes." + \n "Each steps in the monadic computation is a pipe and must be given inside a tuple.") + [(|> +5 + (do identity.monad + [(i.* +3)] + [(i.+ +4)] + [++]))]) - ($.definition /.tuple - (format "Parallel branching for pipes." - \n "Allows to run multiple pipelines for a value and gives you a tuple of the outputs.") - [(|> +5 - (tuple [(i.* +10)] - [-- (i./ +2)] - [i#encoded])) - "=>" - [+50 +2 "+5"]]) + ($.definition /.exec + (format "Non-updating pipes." + \n "Will generate piped computations, but their results will not be used in the larger scope.") + [(|> +5 + (exec [.nat %n log!]) + (i.* +10))]) - ($.definition /.case - (format "Pattern-matching for pipes." - \n "The bodies of each branch are NOT pipes; just regular values.") - [(|> +5 - (case - +0 "zero" - +1 "one" - +2 "two" - +3 "three" - +4 "four" - +5 "five" - +6 "six" - +7 "seven" - +8 "eight" - +9 "nine" - _ "???"))])] - [])) + ($.definition /.tuple + (format "Parallel branching for pipes." + \n "Allows to run multiple pipelines for a value and gives you a tuple of the outputs.") + [(|> +5 + (tuple [(i.* +10)] + [-- (i./ +2)] + [i#encoded])) + "=>" + [+50 +2 "+5"]]) + + ($.definition /.case + (format "Pattern-matching for pipes." + \n "The bodies of each branch are NOT pipes; just regular values.") + [(|> +5 + (case + +0 "zero" + +1 "one" + +2 "two" + +3 "three" + +4 "four" + +5 "five" + +6 "six" + +7 "seven" + +8 "eight" + +9 "nine" + _ "???"))]) + )) diff --git a/stdlib/source/documentation/lux/control/reader.lux b/stdlib/source/documentation/lux/control/reader.lux index 624627756..33f324843 100644 --- a/stdlib/source/documentation/lux/control/reader.lux +++ b/stdlib/source/documentation/lux/control/reader.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,31 +9,32 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Reader environment it) - "Computations that have access to some environmental value.") - - ($.definition /.read - "Get the environment.") - - ($.definition /.local - "Run computation with a locally-modified environment." - [(local change proc)]) - - ($.definition /.result - "Executes the reader against the given environment." - [(result env proc)]) - - ($.definition /.with - "Monad transformer for Reader." - [(with monad)]) - - ($.definition /.lifted - "Lift monadic values to the Reader wrapper.")] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Reader environment it) + "Computations that have access to some environmental value.") + + ($.definition /.read + "Get the environment.") + + ($.definition /.local + "Run computation with a locally-modified environment." + [(local change proc)]) + + ($.definition /.result + "Executes the reader against the given environment." + [(result env proc)]) + + ($.definition /.with + "Monad transformer for Reader." + [(with monad)]) + + ($.definition /.lifted + "Lift monadic values to the Reader wrapper.") + )) diff --git a/stdlib/source/documentation/lux/control/region.lux b/stdlib/source/documentation/lux/control/region.lux index b90efa389..bd80295d6 100644 --- a/stdlib/source/documentation/lux/control/region.lux +++ b/stdlib/source/documentation/lux/control/region.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except if loop) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,35 +9,36 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.clean_up_error) - ($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Region r ! it) - (format "A region where resources may be be claimed and where a side-effecting computation may be performed." - \n "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks.")) - - ($.definition /.run! - "Executes a region-based computation, with a side-effect determined by the monad." - [(run! monad computation)]) - - ($.definition /.acquire! - "Acquire a resource while pairing it a function that knows how to reclaim it." - [(acquire! monad cleaner value)]) - - ($.definition /.failure - "Immediately fail with this 'message'." - [(failure monad error)]) - - ($.definition /.except - "Fail by throwing/raising an exception." - [(except monad exception message)]) - - ($.definition /.lifted - "Lift an effectful computation into a region-based computation." - [(lifted monad operation)])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.clean_up_error) + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Region r ! it) + (format "A region where resources may be be claimed and where a side-effecting computation may be performed." + \n "Every resource is paired with a function that knows how to clean/reclaim it, to make sure there are no leaks.")) + + ($.definition /.run! + "Executes a region-based computation, with a side-effect determined by the monad." + [(run! monad computation)]) + + ($.definition /.acquire! + "Acquire a resource while pairing it a function that knows how to reclaim it." + [(acquire! monad cleaner value)]) + + ($.definition /.failure + "Immediately fail with this 'message'." + [(failure monad error)]) + + ($.definition /.except + "Fail by throwing/raising an exception." + [(except monad exception message)]) + + ($.definition /.lifted + "Lift an effectful computation into a region-based computation." + [(lifted monad operation)]) + )) diff --git a/stdlib/source/documentation/lux/control/remember.lux b/stdlib/source/documentation/lux/control/remember.lux index ffe3b0330..f25d2e038 100644 --- a/stdlib/source/documentation/lux/control/remember.lux +++ b/stdlib/source/documentation/lux/control/remember.lux @@ -9,35 +9,36 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.must_remember) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.remember - (format "A message with an expiration date." - \n "Can have an optional piece of code to focus on.") - [(remember "2022-04-01" - "Do this, that and the other.")] - [(remember "2022-04-01" - "Improve the performace." - (some (complicated (computation 123))))]) + ($.definition /.must_remember) - ($.definition /.to_do - (format "A TODO message with an expiration date." - \n "Can have an optional piece of code to focus on.") - [(to_do "2022-04-01" - "Do this, that and the other.")] - [(to_do "2022-04-01" - "Improve the performace." - (some (complicated (computation 123))))]) + ($.definition /.remember + (format "A message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(remember "2022-04-01" + "Do this, that and the other.")] + [(remember "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) - ($.definition /.fix_me - (format "A FIXME message with an expiration date." - \n "Can have an optional piece of code to focus on.") - [(fix_me "2022-04-01" - "Do this, that and the other.")] - [(fix_me "2022-04-01" - "Improve the performace." - (some (complicated (computation 123))))])] - [])) + ($.definition /.to_do + (format "A TODO message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(to_do "2022-04-01" + "Do this, that and the other.")] + [(to_do "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) + + ($.definition /.fix_me + (format "A FIXME message with an expiration date." + \n "Can have an optional piece of code to focus on.") + [(fix_me "2022-04-01" + "Do this, that and the other.")] + [(fix_me "2022-04-01" + "Improve the performace." + (some (complicated (computation 123))))]) + )) diff --git a/stdlib/source/documentation/lux/control/security.lux b/stdlib/source/documentation/lux/control/security.lux index 2c18b0150..4a39f5fd2 100644 --- a/stdlib/source/documentation/lux/control/security.lux +++ b/stdlib/source/documentation/lux/control/security.lux @@ -12,7 +12,7 @@ ["[1][0]" policy]]) (.def .public documentation - (.List $.Module) + (.List $.Documentation) (list.together (list /policy.documentation /capability.documentation))) diff --git a/stdlib/source/documentation/lux/control/security/capability.lux b/stdlib/source/documentation/lux/control/security/capability.lux index d328cabd3..cbd415861 100644 --- a/stdlib/source/documentation/lux/control/security/capability.lux +++ b/stdlib/source/documentation/lux/control/security/capability.lux @@ -8,30 +8,31 @@ [\\library ["[0]" /]]) -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition (/.Capability brand input output) - (format "Represents the capability to perform an operation." - \n "This operation is assumed to have security implications.")) +(def .public documentation + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition /.use - "Applies a capability against its required input." - [(use capability input)]) + ($.definition (/.Capability brand input output) + (format "Represents the capability to perform an operation." + \n "This operation is assumed to have security implications.")) - ($.definition /.capability - "Defines a capability as a unique type, and a constructor for instances." - [(capability (Can_Duplicate a) - (can_duplicate a [a a])) - - (let [capability (can_duplicate - (function (_ value) - [value value])) - [left right] (..use capability 123)] - (same? left right))]) + ($.definition /.use + "Applies a capability against its required input." + [(use capability input)]) - ($.definition /.async - "Converts a synchronous I/O-based capability into an asynchronous capability." - [(async capability)])] - [])) + ($.definition /.capability + "Defines a capability as a unique type, and a constructor for instances." + [(capability (Can_Duplicate a) + (can_duplicate a [a a])) + + (let [capability (can_duplicate + (function (_ value) + [value value])) + [left right] (..use capability 123)] + (same? left right))]) + + ($.definition /.async + "Converts a synchronous I/O-based capability into an asynchronous capability." + [(async capability)]) + )) diff --git a/stdlib/source/documentation/lux/control/security/policy.lux b/stdlib/source/documentation/lux/control/security/policy.lux index 8666e7e6a..a05987aee 100644 --- a/stdlib/source/documentation/lux/control/security/policy.lux +++ b/stdlib/source/documentation/lux/control/security/policy.lux @@ -9,70 +9,71 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.Private) - ($.definition /.Can_Conceal) - ($.definition /.Can_Reveal) - ($.definition /.Safe) - ($.definition /.Can_Trust) - ($.definition /.Can_Distrust) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Policy brand value %) - "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.Private) + ($.definition /.Can_Conceal) + ($.definition /.Can_Reveal) + ($.definition /.Safe) + ($.definition /.Can_Trust) + ($.definition /.Can_Distrust) - ($.definition (/.Can_Upgrade brand % value) - "Represents the capacity to 'upgrade' a value.") + ($.definition (/.Policy brand value %) + "A security policy encoded as the means to 'upgrade' or 'downgrade' in a secure context.") - ($.definition (/.Can_Downgrade brand % value) - "Represents the capacity to 'downgrade' a value.") + ($.definition (/.Can_Upgrade brand % value) + "Represents the capacity to 'upgrade' a value.") - ($.definition (/.Privilege brand %) - "Represents the privilege to both 'upgrade' and 'downgrade' a value.") + ($.definition (/.Can_Downgrade brand % value) + "Represents the capacity to 'downgrade' a value.") - ($.definition (/.Delegation brand %from %to) - "Represents the act of delegating policy capacities.") + ($.definition (/.Privilege brand %) + "Represents the privilege to both 'upgrade' and 'downgrade' a value.") - ($.definition /.delegation - "Delegating policy capacities." - [(delegation downgrade upgrade)]) + ($.definition (/.Delegation brand %from %to) + "Represents the act of delegating policy capacities.") - ($.definition (/.Context brand scope %) - "A computational context with an associated policy privilege.") + ($.definition /.delegation + "Delegating policy capacities." + [(delegation downgrade upgrade)]) - ($.definition /.with_policy - "Activates a security context with the priviledge to enforce it's policy." - [(type Password - (Private Text)) + ($.definition (/.Context brand scope %) + "A computational context with an associated policy privilege.") - (type (Policy %) - (Interface - (is (-> Text (Password %)) - password) - (is (-> (Password %) Text) - unsafe))) + ($.definition /.with_policy + "Activates a security context with the priviledge to enforce it's policy." + [(type Password + (Private Text)) - (def (policy _) - (Ex (_ %) (-> Any (Policy %))) - (with_policy - (is (Context Privacy Policy) - (function (_ (open "%::.")) - (implementation - (def (password value) - (%::can_upgrade value)) - (def (unsafe password) - (%::can_downgrade password)))))))] - [(with_policy context)]) + (type (Policy %) + (Interface + (is (-> Text (Password %)) + password) + (is (-> (Password %) Text) + unsafe))) - ($.definition /.Privacy - (format "A security context for privacy." - \n "Private data is data which cannot be allowed to leak outside of the programmed.")) + (def (policy _) + (Ex (_ %) (-> Any (Policy %))) + (with_policy + (is (Context Privacy Policy) + (function (_ (open "%::.")) + (implementation + (def (password value) + (%::can_upgrade value)) + (def (unsafe password) + (%::can_downgrade password)))))))] + [(with_policy context)]) - ($.definition /.Safety - (format "A security context for safety." - \n "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections."))] - [])) + ($.definition /.Privacy + (format "A security context for privacy." + \n "Private data is data which cannot be allowed to leak outside of the programmed.")) + + ($.definition /.Safety + (format "A security context for safety." + \n "Safe data is data coming from outside the program which can be trusted to be properly formatted and lacking injections.")) + )) diff --git a/stdlib/source/documentation/lux/control/state.lux b/stdlib/source/documentation/lux/control/state.lux index ae14eafb1..5784561df 100644 --- a/stdlib/source/documentation/lux/control/state.lux +++ b/stdlib/source/documentation/lux/control/state.lux @@ -9,59 +9,60 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.State state it) - "Stateful computations.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.get - "Read the current state.") + ($.definition (/.State state it) + "Stateful computations.") - ($.definition /.put - "Set the new state." - [(put new_state)]) + ($.definition /.get + "Read the current state.") - ($.definition /.update - "Compute the new state." - [(update change)]) + ($.definition /.put + "Set the new state." + [(put new_state)]) - ($.definition /.use - "Run a function on the current state." - [(use user)]) + ($.definition /.update + "Compute the new state." + [(update change)]) - ($.definition /.local - "Run the computation with a locally-modified state." - [(local change action)]) + ($.definition /.use + "Run a function on the current state." + [(use user)]) - ($.definition /.result - "Run a stateful computation." - [(result state action)]) + ($.definition /.local + "Run the computation with a locally-modified state." + [(local change action)]) - ($.definition /.while - "A stateful while loop." - [(while condition body)]) + ($.definition /.result + "Run a stateful computation." + [(result state action)]) - ($.definition /.do_while - "A stateful do-while loop." - [(do_while condition body)]) + ($.definition /.while + "A stateful while loop." + [(while condition body)]) - ($.definition /.+State - "Stateful computations decorated by a monad.") + ($.definition /.do_while + "A stateful do-while loop." + [(do_while condition body)]) - ($.definition /.result' - "Execute a stateful computation decorated by a monad." - [(result' state action)]) + ($.definition /.+State + "Stateful computations decorated by a monad.") - ($.definition /.with - "A monad transformer to create composite stateful computations." - [(with monad)]) + ($.definition /.result' + "Execute a stateful computation decorated by a monad." + [(result' state action)]) - ($.definition /.lifted - "Lift monadic values to the +State wrapper." - [(lifted monad ma)])] - [])) + ($.definition /.with + "A monad transformer to create composite stateful computations." + [(with monad)]) + + ($.definition /.lifted + "Lift monadic values to the +State wrapper." + [(lifted monad ma)]) + )) diff --git a/stdlib/source/documentation/lux/control/thread.lux b/stdlib/source/documentation/lux/control/thread.lux index f567f5267..46f716a46 100644 --- a/stdlib/source/documentation/lux/control/thread.lux +++ b/stdlib/source/documentation/lux/control/thread.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,39 +9,40 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - - ($.definition (/.Thread ! it) - "An imperative process with access to mutable values.") - - ($.definition (/.Box ! it) - "A mutable box holding a value.") - - ($.definition /.box - "A brand-new box initialized to the given value." - [(box init)]) - - ($.definition /.read! - "Reads the current value in the box." - [(read! box)]) - - ($.definition /.write! - "Mutates the value in the box." - [(write! value box)]) - - ($.definition /.result - "Executes the imperative thread in a self-contained way." - [(result thread)]) - - ($.definition /.io - "Transforms the imperative thread into an I/O computation.") - - ($.definition /.update! - "Update a box's value by applying a function to it." - [(update! f box)])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + + ($.definition (/.Thread ! it) + "An imperative process with access to mutable values.") + + ($.definition (/.Box ! it) + "A mutable box holding a value.") + + ($.definition /.box + "A brand-new box initialized to the given value." + [(box init)]) + + ($.definition /.read! + "Reads the current value in the box." + [(read! box)]) + + ($.definition /.write! + "Mutates the value in the box." + [(write! value box)]) + + ($.definition /.result + "Executes the imperative thread in a self-contained way." + [(result thread)]) + + ($.definition /.io + "Transforms the imperative thread into an I/O computation.") + + ($.definition /.update! + "Update a box's value by applying a function to it." + [(update! f box)]) + )) diff --git a/stdlib/source/documentation/lux/control/try.lux b/stdlib/source/documentation/lux/control/try.lux index 09025de4f..0019ec86c 100644 --- a/stdlib/source/documentation/lux/control/try.lux +++ b/stdlib/source/documentation/lux/control/try.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,45 +9,46 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) - ($.definition /.equivalence) - - ($.definition (/.Try it) - "A computation that can fail with an error message.") - - ($.definition /.with - "Enhances a monad with error-handling functionality." - [(with monad)]) - - ($.definition /.lifted - "Wraps a monadic value with error-handling machinery." - [(lifted monad)]) - - ($.definition /.trusted - (format "Assumes a Try value succeeded, and yields its value." - \n "If it didn't, raises the error as a runtime error." - \n "WARNING: Use with caution.") - [(trusted try)]) - - ($.definition /.maybe - "" - [(maybe try)]) - - ($.definition /.of_maybe - "" - [(of_maybe maybe)]) - - ($.definition /.else - (format "Allows you to provide a default value that will be used" - \n "if a (Try x) value turns out to be #Failure." - \n "Note: the expression for the default value will not be computed if the base computation succeeds.") - [(= "bar" - (else "foo" {/.#Success "bar"}))] - [(= "foo" - (else "foo" {/.#Failure "KABOOM!"}))])] - [])) + (.List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) + ($.definition /.equivalence) + + ($.definition (/.Try it) + "A computation that can fail with an error message.") + + ($.definition /.with + "Enhances a monad with error-handling functionality." + [(with monad)]) + + ($.definition /.lifted + "Wraps a monadic value with error-handling machinery." + [(lifted monad)]) + + ($.definition /.trusted + (format "Assumes a Try value succeeded, and yields its value." + \n "If it didn't, raises the error as a runtime error." + \n "WARNING: Use with caution.") + [(trusted try)]) + + ($.definition /.maybe + "" + [(maybe try)]) + + ($.definition /.of_maybe + "" + [(of_maybe maybe)]) + + ($.definition /.else + (format "Allows you to provide a default value that will be used" + \n "if a (Try x) value turns out to be #Failure." + \n "Note: the expression for the default value will not be computed if the base computation succeeds.") + [(= "bar" + (else "foo" {/.#Success "bar"}))] + [(= "foo" + (else "foo" {/.#Failure "KABOOM!"}))]) + )) diff --git a/stdlib/source/documentation/lux/control/writer.lux b/stdlib/source/documentation/lux/control/writer.lux index 50129e1fb..36417304f 100644 --- a/stdlib/source/documentation/lux/control/writer.lux +++ b/stdlib/source/documentation/lux/control/writer.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except local) + [lux (.except) ["$" documentation] [data [text (.only \n) @@ -9,25 +9,26 @@ ["[0]" /]]) (.def .public documentation - (.List $.Module) - ($.module /._ - "" - [($.definition /.functor) - ($.definition /.apply) - ($.definition /.monad) + (.List $.Documentation) + (list ($.module /._ + "") - ($.definition (/.Writer log value) - "Represents a value with an associated 'log' to record arbitrary information.") + ($.definition /.functor) + ($.definition /.apply) + ($.definition /.monad) - ($.definition /.write - "Write a value to the log." - [(write message)]) + ($.definition (/.Writer log value) + "Represents a value with an associated 'log' to record arbitrary information.") - ($.definition /.with - "Enhances a monad with Writer functionality." - [(with monoid monad)]) + ($.definition /.write + "Write a value to the log." + [(write message)]) - ($.definition /.lifted - "Wraps a monadic value with Writer machinery." - [(lifted monoid monad)])] - [])) + ($.definition /.with + "Enhances a monad with Writer functionality." + [(with monoid monad)]) + + ($.definition /.lifted + "Wraps a monadic value with Writer machinery." + [(lifted monoid monad)]) + )) diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux index a0e8edaef..3048cea36 100644 --- a/stdlib/source/documentation/lux/ffi.js.lux +++ b/stdlib/source/documentation/lux/ffi.js.lux @@ -46,7 +46,7 @@ ($.definition /.type_of "The type of an object, as text." [(= "boolean" - (type_of #1))] + (type_of true))] [(= "number" (type_of +123.456))] [(= "string" diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index 404fa4b63..376d9958d 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -102,7 +102,7 @@ ... Methods ("public" [] (new [value A]) [] (exec - (:= ::foo #1) + (:= ::foo true) (:= ::bar value) (:= ::baz "") [])) @@ -119,7 +119,7 @@ "Fields and methods defined in the class can be used with special syntax." "For example:" "::resolved, for accessing the 'resolved' field." - "(:= ::resolved #1) for modifying it." + "(:= ::resolved true) for modifying it." "(::new! []) for calling the class's constructor." "(::resolve! container [value]) for calling the 'resolve' method."]) diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 490e8416f..a862963d8 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -61,7 +61,7 @@ ... Methods ("public" [] (new [value A]) [] (exec - (:= ::foo #1) + (:= ::foo true) (:= ::bar value) (:= ::baz "") [])) @@ -76,7 +76,7 @@ "Fields and methods defined in the class can be used with special syntax." "For example:" "::resolved, for accessing the 'resolved' field." - "(:= ::resolved #1) for modifying it." + "(:= ::resolved true) for modifying it." "(::new! []) for calling the class's constructor." "(::resolve! container [value]) for calling the 'resolve' method."]) |