From 0494295b95c5c44ef389f1259e408f9445cfe0a1 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 6 Apr 2022 05:24:14 -0400 Subject: Got documentation back in working condition. --- stdlib/source/documentation/lux.lux | 204 ++++++++++++++++++------------------ 1 file changed, 102 insertions(+), 102 deletions(-) (limited to 'stdlib/source/documentation/lux.lux') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 5dbef4fac..63fa76177 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -369,27 +369,27 @@ _ {#None})]) -(documentation: /.^or - (format "Or-patterns." - \n "It's a special macro meant to be used with 'case'.") - [(type: Weekday - (Variant - {#Monday} - {#Tuesday} - {#Wednesday} - {#Thursday} - {#Friday} - {#Saturday} - {#Sunday})) - - (def: (weekend? day) - (-> Weekday Bit) - (case day - (^or {#Saturday} {#Sunday}) - #1 - - _ - #0))]) +... (documentation: /.^or +... (format "Or-patterns." +... \n "It's a special macro meant to be used with 'case'.") +... [(type: Weekday +... (Variant +... {#Monday} +... {#Tuesday} +... {#Wednesday} +... {#Thursday} +... {#Friday} +... {#Saturday} +... {#Sunday})) + +... (def: (weekend? day) +... (-> Weekday Bit) +... (case day +... (^or {#Saturday} {#Sunday}) +... #1 + +... _ +... #0))]) (documentation: /.let (format "Creates local bindings." @@ -633,40 +633,40 @@ (let [updater (revised [#foo #bar #baz])] (updater func my_record))]) -(documentation: /.^template - "It's similar to template, but meant to be used during pattern-matching." - [(def: (reduced env type) - (-> (List Type) Type Type) - (case type - {.#Primitive name params} - {.#Primitive name (list#each (reduced env) params)} - - (^template [] - [{ left right} - { (reduced env left) (reduced env right)}]) - ([.#Sum] [.#Product]) - - (^template [] - [{ left right} - { (reduced env left) (reduced env right)}]) - ([.#Function] [.#Apply]) - - (^template [] - [{ old_env def} - (case old_env - {.#End} - { env def} - - _ - type)]) - ([.#UnivQ] [.#ExQ]) - - {.#Parameter idx} - (else type (list.item idx env)) - - _ - type - ))]) +... (documentation: /.^template +... "It's similar to template, but meant to be used during pattern-matching." +... [(def: (reduced env type) +... (-> (List Type) Type Type) +... (case type +... {.#Primitive name params} +... {.#Primitive name (list#each (reduced env) params)} + +... (^template [] +... [{ left right} +... { (reduced env left) (reduced env right)}]) +... ([.#Sum] [.#Product]) + +... (^template [] +... [{ left right} +... { (reduced env left) (reduced env right)}]) +... ([.#Function] [.#Apply]) + +... (^template [] +... [{ old_env def} +... (case old_env +... {.#End} +... { env def} + +... _ +... type)]) +... ([.#UnivQ] [.#ExQ]) + +... {.#Parameter idx} +... (else type (list.item idx env)) + +... _ +... type +... ))]) (.template [ ] [(documentation: @@ -738,25 +738,25 @@ _ false))]) -(documentation: /.^multi - (format "Multi-level pattern matching." - \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]) - (match_uri endpoint? parts' uri') - - _ - {#Left (format "Static part " (%t static) " does not match URI: " uri)})] - ["Short-cuts can be taken when using bit tests." - "The example above can be rewritten as..." - (case (split (size static) uri) - (^multi {#Some [chunk uri']} - (text#= static chunk)) - (match_uri endpoint? parts' uri') - - _ - {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) +... (documentation: /.^multi +... (format "Multi-level pattern matching." +... \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]) +... (match_uri endpoint? parts' uri') + +... _ +... {#Left (format "Static part " (%t static) " does not match URI: " uri)})] +... ["Short-cuts can be taken when using bit tests." +... "The example above can be rewritten as..." +... (case (split (size static) uri) +... (^multi {#Some [chunk uri']} +... (text#= static chunk)) +... (match_uri endpoint? parts' uri') + +... _ +... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) (documentation: /.symbol "Gives back a 2 tuple with the module and name parts, both as Text." @@ -785,20 +785,20 @@ (same? +5 (+ +2 +3))]) -(documentation: /.^let - "Allows you to simultaneously bind and de-structure a value." - [(def: (hash (^let set [member_hash _])) - (list#mix (function (_ elem acc) - (+ acc - (# member_hash hash elem))) - 0 - (set.list set)))]) - -(documentation: /.^|> - "Pipes the value being pattern-matched against prior to binding it to a variable." - [(case input - (^|> value [++ (% 10) (max 1)]) - (foo value))]) +... (documentation: /.^let +... "Allows you to simultaneously bind and de-structure a value." +... [(def: (hash (^let set [member_hash _])) +... (list#mix (function (_ elem acc) +... (+ acc +... (# member_hash hash elem))) +... 0 +... (set.list set)))]) + +... (documentation: /.^|> +... "Pipes the value being pattern-matched against prior to binding it to a variable." +... [(case input +... (^|> value [++ (% 10) (max 1)]) +... (foo value))]) (documentation: /.as_expected "Coerces the given expression to the type of whatever is expected." @@ -862,15 +862,15 @@ [(`` (some expression (~~ (some macro which may yield 0 or more results))))]) -(documentation: /.^code - "Generates pattern-matching code for Code values in a way that looks like code-templating." - [(is (Maybe Nat) - (case (` (#0 123 +456.789)) - (^code (#0 (~ [_ {.#Nat number}]) +456.789)) - {.#Some number} +... (documentation: /.^code +... "Generates pattern-matching code for Code values in a way that looks like code-templating." +... [(is (Maybe Nat) +... (case (` (#0 123 +456.789)) +... (^code (#0 (~ [_ {.#Nat number}]) +456.789)) +... {.#Some number} - _ - {.#None}))]) +... _ +... {.#None}))]) (documentation: /.false "The boolean FALSE value.") @@ -954,7 +954,7 @@ ..exec ..case ..pattern - ..^or + ... ..^or ..let ..function ..def: @@ -983,18 +983,18 @@ ..# ..has ..revised - ..^template + ... ..^template ..++ ..-- ..loop ..with_expansions ..static - ..^multi + ... ..^multi ..symbol ..parameter ..same? - ..^let - ..^|> + ... ..^let + ... ..^|> ..as_expected ..undefined ..type_of @@ -1003,7 +1003,7 @@ ..char ..for ..`` - ..^code + ... ..^code ..false ..true ..try -- cgit v1.2.3