From 53f7f432ca593ea007d576d682a27f23310d07a4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 6 Jan 2017 21:22:51 -0400 Subject: - Fixed a lot of errors in the documentation. --- stdlib/source/lux.lux | 5 +-- stdlib/source/lux/concurrency/atom.lux | 2 +- stdlib/source/lux/concurrency/frp.lux | 2 +- stdlib/source/lux/control/effect.lux | 33 ++++++++++---------- stdlib/source/lux/data/bit.lux | 14 ++++----- stdlib/source/lux/data/log.lux | 3 +- stdlib/source/lux/data/number.lux | 6 ++-- stdlib/source/lux/host.lux | 17 +++++------ stdlib/source/lux/math/simple.lux | 56 +++++++++++++++++----------------- stdlib/source/lux/pipe.lux | 7 +++-- 10 files changed, 74 insertions(+), 71 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 13dc4072e..8af215b43 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -17,7 +17,7 @@ (+0 "#Nat" (+0))) (+1 [["lux" "type?"] (+0 true)] (+1 [["lux" "export?"] (+0 true)] - (+1 [["lux" "doc"] (+6 "Unsigned integers, or natural numbers. + (+1 [["lux" "doc"] (+6 "Natural numbers (unsigned integers). They start at zero (+0) and extend in the positive direction.")] (+0))))) @@ -640,7 +640,8 @@ (#AppT (#AppT Either Text) (#ProdT Compiler (#BoundT +1)))))) (#Cons [["lux" "doc"] (#TextM "Computations that can have access to the state of the compiler. - Those computations may also fail, or modify the state of the compiler.")] + + These computations may fail, or modify the state of the compiler.")] (#Cons [["lux" "type-args"] (#ListM (#Cons (#TextM "a") #;Nil))] default-def-meta-exported))) diff --git a/stdlib/source/lux/concurrency/atom.lux b/stdlib/source/lux/concurrency/atom.lux index 3b4687931..ae8c7fa21 100644 --- a/stdlib/source/lux/concurrency/atom.lux +++ b/stdlib/source/lux/concurrency/atom.lux @@ -28,7 +28,7 @@ (def: #export (compare-and-swap current new atom) {#;doc "Only mutates an atom if you can present it's current value. - That guarantees that actor wasn't updated since you last read from it."} + That guarantees that atom wasn't updated since you last read from it."} (All [a] (-> a a (Atom a) (IO Bool))) (io (AtomicReference.compareAndSet [current new] atom))) diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index 1620618d5..45b9e1839 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -140,7 +140,7 @@ (wrap (#;Some [x (no-dups' eq x xs')]))))))) (def: #export (no-dups eq xs) - {#;doc "Multiple consecutive equal values in the input channel will just be single values in the output channel."} + {#;doc "Multiple consecutive equal values in the input channel will just be single value in the output channel."} (All [a] (-> (Eq a) (Chan a) (Chan a))) (let [(^open) eq] (do &;Monad diff --git a/stdlib/source/lux/control/effect.lux b/stdlib/source/lux/control/effect.lux index ede2f9d8f..bf98b9391 100644 --- a/stdlib/source/lux/control/effect.lux +++ b/stdlib/source/lux/control/effect.lux @@ -228,11 +228,12 @@ [defs (s;many (common;def *compiler*))]) {#;doc (doc "Define effect handlers by implementing the operations and values of an effect." (handler: _ - (=> EffA [io;IO io;Monad]) - (def: (opA size sample) - (:: io;Monad wrap (n.< size (text;size sample)))) + (=> EffA [IO Monad]) + (def: (opA length sample) + (:: Monad wrap (n.< length + (size sample)))) - (def: fieldA (:: io;Monad wrap +10))) + (def: fieldA (:: Monad wrap +10))) "Since a name for the handler was not specified, 'handler:' will generate the name as Handler.")} (do @ @@ -309,12 +310,12 @@ (syntax: #export (doE functor [bindings (s;tuple (s;some s;any))] body) {#;doc (doc "An alternative to the 'do' macro for monads." - (io;run (with-handler Handler - (doE Functor - [a (lift fieldA) - b (lift fieldB) - c (lift fieldC)] - (wrap ($_ n.+ a b c))))))} + (with-handler Handler + (doE Functor + [a (lift fieldA) + b (lift fieldB) + c (lift fieldC)] + (wrap ($_ n.+ a b c)))))} (do @ [g!output (compiler;gensym "")] (wrap (list (` (let [(~ g!functor) (~ functor)] @@ -370,12 +371,12 @@ (syntax: #export (lift [value (s;alt s;symbol s;any)]) {#;doc (doc "A way to (automatically) lift effectful fields and operations from simple effects into the larger space of composite effects." - (io;run (with-handler Handler - (doE Functor - [a (lift fieldA) - b (lift fieldB) - c (lift fieldC)] - (wrap ($_ n.+ a b c))))))} + (with-handler Handler + (doE Functor + [a (lift fieldA) + b (lift fieldB) + c (lift fieldC)] + (wrap ($_ n.+ a b c)))))} (case value (#;Left var) (do @ diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index 2562adc2d..99ade5269 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -12,12 +12,12 @@ (-> Nat ) (_lux_proc ["bit" ] [subject param]))] - [& "and" "Bit and." Nat] - [| "or" "Bit or." Nat] - [^ "xor" "Bit xor." Nat] - [<< "shift-left" "Bit shift-left." Nat] - [>> "shift-right" "Bit shift-right." Int] - [>>> "unsigned-shift-right" "Bit unsigned-shift-right." Nat] + [& "and" "Bitwise and." Nat] + [| "or" "Bitwise or." Nat] + [^ "xor" "Bitwise xor." Nat] + [<< "shift-left" "Bitwise shift-left." Nat] + [>> "shift-right" "Bitwise shift-right." Int] + [>>> "unsigned-shift-right" "Bitwise unsigned-shift-right." Nat] ) (def: #export (count subject) @@ -28,7 +28,7 @@ (def: mask Nat (int-to-nat -1)) (def: #export ~ - {#;doc "Bit negation."} + {#;doc "Bitwise negation."} (-> Nat Nat) (^ mask)) diff --git a/stdlib/source/lux/data/log.lux b/stdlib/source/lux/data/log.lux index e8e15d0ad..b3dd7749f 100644 --- a/stdlib/source/lux/data/log.lux +++ b/stdlib/source/lux/data/log.lux @@ -12,7 +12,8 @@ (type: #export (Log l a) {#;doc "Represents a value with an associated 'log' value to record arbitrary information."} - [l a]) + {#log l + #value a}) (struct: #export Functor (All [l] (Functor (Log l))) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index b2ad1df52..c5b3277f8 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -235,9 +235,9 @@ Real (_lux_proc ["jvm" ] []))] - [nan "getstatic:java.lang.Double:NaN" "not-a-number"] - [+inf "getstatic:java.lang.Double:POSITIVE_INFINITY" "positive infinity"] - [-inf "getstatic:java.lang.Double:NEGATIVE_INFINITY" "negative infinity"] + [nan "getstatic:java.lang.Double:NaN" "Not-a-number."] + [+inf "getstatic:java.lang.Double:POSITIVE_INFINITY" "Positive infinity."] + [-inf "getstatic:java.lang.Double:NEGATIVE_INFINITY" "Negative infinity."] ) (def: #export (nan? number) diff --git a/stdlib/source/lux/host.lux b/stdlib/source/lux/host.lux index 75ad3a1c5..7c0180ec1 100644 --- a/stdlib/source/lux/host.lux +++ b/stdlib/source/lux/host.lux @@ -1451,12 +1451,12 @@ (wrap (list (` (;_lux_proc ["jvm" (~ (ast;text def-code))] [])))))) (syntax: #export (null) - {#;doc (doc "Null object pointer." + {#;doc (doc "Null object reference." (null))} (wrap (list (` (;_lux_proc ["jvm" "null"] []))))) (def: #export (null? obj) - {#;doc (doc "Test for null object pointer." + {#;doc (doc "Test for null object reference." (null? (null)) "=>" true @@ -1467,8 +1467,8 @@ (;_lux_proc ["jvm" "null?"] [obj])) (syntax: #export (??? expr) - {#;doc (doc "Takes a (potentially null) object pointer and creates a (Maybe ObjectType) for it." - (??? (: java.lang.Thread (null))) + {#;doc (doc "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." + (??? (: java.lang.String (null))) "=>" #;None (??? "YOLO") @@ -1481,9 +1481,8 @@ (#;Some (~ g!temp))))))))) (syntax: #export (!!! expr) - {#;doc (doc "Takes a (Maybe ObjectType) and return a ObjectType." - "A #;None would gets translated in to a (null)." - "Takes a (potentially null) object pointer and creates a (Maybe ObjectType) for it." + {#;doc (doc "Takes a (Maybe ObjectType) and returns a ObjectType." + "A #;None would get translated into a (null)." (!!! (??? (: java.lang.Thread (null)))) "=>" (null) @@ -1653,7 +1652,7 @@ (` (let [(~ g!temp) (~ return-term)] (if (null? (:! (host (~' java.lang.Object)) (~ g!temp))) - (error! "Can't produce null pointers from method calls.") + (error! "Can't produce null references from method calls.") (~ g!temp)))))]) _ @@ -2139,7 +2138,7 @@ (syntax: #export (class-for [#let [imports (class-imports *compiler*)]] [type (generic-type^ imports (list))]) - {#;doc (doc "Loads the class a a Class object." + {#;doc (doc "Loads the class as a java.lang.Class object." (class-for java.lang.String))} (wrap (list (` (;_lux_proc ["jvm" "load-class"] [(~ (ast;text (simple-class$ (list) type)))]))))) diff --git a/stdlib/source/lux/math/simple.lux b/stdlib/source/lux/math/simple.lux index 4fa69a8a1..9de6a54b0 100644 --- a/stdlib/source/lux/math/simple.lux +++ b/stdlib/source/lux/math/simple.lux @@ -53,14 +53,14 @@ s;symbol s;any s;end)]) - {#;doc (doc (= ( +1 +2) - ( +1 +2)) - (= ( 1 2) - ( 1 2)) - (= ( 1.0 2.0) - ( 1.0 2.0)) - (= ( .1 .2) - ( .1 .2)))} + ## {#;doc (doc (= ( +1 +2) + ## ( +1 +2)) + ## (= ( 1 2) + ## ( 1 2)) + ## (= ( 1.0 2.0) + ## ( 1.0 2.0)) + ## (= ( .1 .2) + ## ( .1 .2)))} (case args (+0 [x y]) (do @ @@ -150,14 +150,14 @@ s;symbol s;any s;end)]) - {#;doc (doc (= ( +1 +2) - ( +1 +2)) - (= ( 1 2) - ( 1 2)) - (= ( 1.0 2.0) - ( 1.0 2.0)) - (= ( .1 .2) - ( .1 .2)))} + ## {#;doc (doc (= ( +1 +2) + ## ( +1 +2)) + ## (= ( 1 2) + ## ( 1 2)) + ## (= ( 1.0 2.0) + ## ( 1.0 2.0)) + ## (= ( .1 .2) + ## ( .1 .2)))} (case args (+0 [x y]) (do @ @@ -247,10 +247,10 @@ s;symbol s;any s;end)]) - {#;doc (doc (= ( +1 +2) - ( +1 +2)) - (= ( 1 2) - ( 1 2)))} + ## {#;doc (doc (= ( +1 +2) + ## ( +1 +2)) + ## (= ( 1 2) + ## ( 1 2)))} (case args (+0 [x y]) (do @ @@ -315,10 +315,10 @@ s;symbol s;any s;end)]) - {#;doc (doc (= ( +1 +2) - ( +1 +2)) - (= ( 1 2) - ( 1 2)))} + ## {#;doc (doc (= ( +1 +2) + ## ( +1 +2)) + ## (= ( 1 2) + ## ( 1 2)))} (case args (+0 x) (do @ @@ -360,10 +360,10 @@ s;symbol s;any s;end)]) - {#;doc (doc (= ( +1 +2) - ( +1 +2)) - (= ( 1 2) - ( 1 2)))} + ## {#;doc (doc (= ( +1 +2) + ## ( +1 +2)) + ## (= ( 1 2) + ## ( 1 2)))} (case args (+0 x) (do @ diff --git a/stdlib/source/lux/pipe.lux b/stdlib/source/lux/pipe.lux index c0b99bd5b..12337e3ef 100644 --- a/stdlib/source/lux/pipe.lux +++ b/stdlib/source/lux/pipe.lux @@ -34,12 +34,13 @@ (syntax: #export (@> [name (s;default "@" s;local-symbol)] [body body^] prev) - {#;doc (doc "Gives the name '@' to the piped-argument, within the given expression." + {#;doc (doc "Gives a name to the piped-argument, within the given expression." + "If given no name, defaults to '@'." (|> 5 - (@> [(i.+ @ @)])) + (@> X [(i.+ X X)])) (|> 5 - (@> X [(i.+ X X)])))} + (@> [(i.+ @ @)])))} (wrap (list (fold (lambda [next prev] (` (let% [(~ (ast;symbol ["" name])) (~ prev)] (~ next)))) -- cgit v1.2.3