From 06c5f9af1d7aa291ae8e7bdd75af57bbe0684193 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 6 Sep 2021 00:37:49 -0400 Subject: Documentation improvements. --- stdlib/source/documentation/lux.lux | 16 ++++++++----- .../source/documentation/lux/data/format/json.lux | 19 ++++++++++------ .../lux/macro/syntax/type/variable.lux | 2 +- stdlib/source/documentation/lux/math/infix.lux | 26 +++++++++++++++++----- 4 files changed, 44 insertions(+), 19 deletions(-) (limited to 'stdlib/source/documentation') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 184049d89..94ccb3b38 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -290,8 +290,10 @@ [(def: .public (-> Int Int) (+ ))] + [++ +1] - [-- -1])]) + [-- -1] + )]) (documentation: /.not "Bit negation." @@ -599,7 +601,7 @@ ["M" monad "*"]] [data maybe - ["." name ("#/." codec)]] + ["." name ("#\." codec)]] [macro code]] [// @@ -767,9 +769,9 @@ (documentation: /.name_of "Given an identifier or a tag, gives back a 2 tuple with the module and name parts, both as Text." - [(name_of #.doc) + [(name_of #..doc) "=>" - ["library/lux" "doc"]]) + ["documentation/lux" "doc"]]) (documentation: /.:parameter (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux." @@ -856,9 +858,11 @@ (documentation: /.for (format "Selects the appropriate code for a given target-platform when compiling Lux to it." \n "Look-up the available targets in library/lux/target.") - [(def: js "JavaScript") + [(def: js + "JavaScript") + (for {"JVM" (do jvm stuff) - ..js (do js stuff)} + js (do js stuff)} (do default stuff))]) (documentation: /.`` diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index cf3182daa..6bb637058 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -12,13 +12,18 @@ (documentation: /.json "A simple way to produce JSON literals." - [(json #null)] - [(json #1)] - [(json +123.456)] - [(json "this is a string")] - [(json ["this" "is" "an" "array"])] - [(json {"this" "is" - "an" "object"})]) + ["null" + (json #null)] + ["true" + (json #1)] + ["123.456" + (json +123.456)] + ["'this is a string'" + (json "this is a string")] + ["['this' 'is' 'an' 'array']" + (json ["this" "is" "an" "array"])] + ["{'this' 'is', 'an' 'object'}" + (json {"this" "is" "an" "object"})]) (documentation: /.fields "Get all the fields in a JSON object." diff --git a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux index 692c8523d..1512f5985 100644 --- a/stdlib/source/documentation/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/documentation/lux/macro/syntax/type/variable.lux @@ -11,7 +11,7 @@ ["." /]]) (documentation: /.Variable - "A variable'S name.") + "A variable's name.") (documentation: /.parser "Parser for the common type variable/parameter used by many macros.") diff --git a/stdlib/source/documentation/lux/math/infix.lux b/stdlib/source/documentation/lux/math/infix.lux index 19d21669b..c542dcf99 100644 --- a/stdlib/source/documentation/lux/math/infix.lux +++ b/stdlib/source/documentation/lux/math/infix.lux @@ -16,11 +16,27 @@ \n "If you want your binary function to work well with it." \n "Then take the argument to the right (y) as your first argument," \n "and take the argument to the left (x) as your second argument.") - [(infix [x * +10])] - [(infix [[x + y] * [x - y]])] - [(infix [sin [x + y]])] - [(infix [[x < y] and [y < z]])] - [(infix [(* 3 9) gcd 450])]) + ["Binary functions" + (infix [x * +10]) + "=>" + (* +10 x)] + ["Nested infix" + (infix [[x + y] * [x - y]]) + "=>" + (* (- y x) (+ y x))] + ["Unary functions" + (infix [sin [x + y]]) + "=>" + (sin (+ y x))] + ["Also works with logic" + (infix [[x < y] and [y < z]]) + "=>" + (and (< z y) + (< y x))] + ["Forms are left as-is" + (infix [(* 3 9) gcd 450]) + "=>" + (gcd 450 (* 3 9))]) (.def: .public documentation (.List $.Module) -- cgit v1.2.3