diff options
author | Eduardo Julian | 2017-11-29 04:51:04 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-29 04:51:04 -0400 |
commit | 8c5cca122817bc63f4f84cc8351ced3cb67e5eea (patch) | |
tree | 8803dd3ed59ddcc6b964354fd312ab9e62e12cd8 /stdlib/source/lux/control/comonad.lux | |
parent | 1ef969c8ce0f1a83ffa8d26d779806190ac3eced (diff) |
- Changed the identifier separator, from the semi-colon (;) to the period/dot (.).
Diffstat (limited to 'stdlib/source/lux/control/comonad.lux')
-rw-r--r-- | stdlib/source/lux/control/comonad.lux | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index dd395ff64..69e891219 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -1,14 +1,14 @@ -(;module: +(.module: lux ["F" //functor] (lux/data/coll [list "list/" Fold<List>])) ## [Signatures] (sig: #export (CoMonad w) - {#;doc "CoMonads are the opposite/complement to monads. + {#.doc "CoMonads are the opposite/complement to monads. CoMonadic structures are often infinite in size and built upon lazily-evaluated functions."} - (: (F;Functor w) + (: (F.Functor w) functor) (: (All [a] (-> (w a) a)) @@ -19,42 +19,42 @@ ## [Types] (type: #export (CoFree F a) - {#;doc "The CoFree CoMonad."} + {#.doc "The CoFree CoMonad."} [a (F (CoFree F a))]) ## [Syntax] (def: _cursor Cursor ["" +0 +0]) (macro: #export (be tokens state) - {#;doc (doc "A co-monadic parallel to the \"do\" macro." + {#.doc (doc "A co-monadic parallel to the \"do\" macro." (let [square (function [n] (i/* n n))] (be CoMonad<Stream> [inputs (iterate i/inc 2)] (square (head inputs)))))} (case tokens - (#;Cons comonad (#;Cons [_ (#;Tuple bindings)] (#;Cons body #;Nil))) - (if (|> bindings list;size (n/% +2) (n/= +0)) - (let [g!map (: Code [_cursor (#;Symbol ["" " map "])]) - g!split (: Code [_cursor (#;Symbol ["" " split "])]) + (#.Cons comonad (#.Cons [_ (#.Tuple bindings)] (#.Cons body #.Nil))) + (if (|> bindings list.size (n/% +2) (n/= +0)) + (let [g!map (: Code [_cursor (#.Symbol ["" " map "])]) + g!split (: Code [_cursor (#.Symbol ["" " split "])]) body' (list/fold (: (-> [Code Code] Code Code) (function [binding body'] (let [[var value] binding] (case var - [_ (#;Tag ["" "let"])] + [_ (#.Tag ["" "let"])] (` (let (~ value) (~ body'))) _ (` (|> (~ value) (~ g!split) ((~ g!map) (function [(~ var)] (~ body'))))) )))) body - (list;reverse (list;as-pairs bindings)))] - (#;Right [state (#;Cons (` ("lux case" (~ comonad) + (list.reverse (list.as-pairs bindings)))] + (#.Right [state (#.Cons (` ("lux case" (~ comonad) {(~' @) ("lux case" (~' @) - {{#functor {#F;map (~ g!map)} #unwrap (~' unwrap) #split (~ g!split)} + {{#functor {#F.map (~ g!map)} #unwrap (~' unwrap) #split (~ g!split)} (~ body')})})) - #;Nil)])) - (#;Left "'be' bindings must have an even number of parts.")) + #.Nil)])) + (#.Left "'be' bindings must have an even number of parts.")) _ - (#;Left "Wrong syntax for 'be'"))) + (#.Left "Wrong syntax for 'be'"))) |