From 464b6e8f5e6c62f58fa8c7ff61ab2ad215e98bd1 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 9 Aug 2021 23:02:01 -0400 Subject: Improved single-line comment syntax (from "##" to "..."). --- stdlib/source/library/lux.lux | 720 +++++++++++++++++++++--------------------- 1 file changed, 360 insertions(+), 360 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index ec1eac721..5e27a94c4 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -23,8 +23,8 @@ [dummy_location (9 #1 (0 #0))] #1) -## (type: .public Any -## (Ex [a] a)) +... (type: .public Any +... (Ex [a] a)) ("lux def" Any ("lux type check type" (9 #1 ["library/lux" "Any"] @@ -37,8 +37,8 @@ (0 #0)))] #1) -## (type: .public Nothing -## (All [a] a)) +... (type: .public Nothing +... (All [a] a)) ("lux def" Nothing ("lux type check type" (9 #1 ["library/lux" "Nothing"] @@ -51,15 +51,15 @@ (0 #0)))] #1) -## (type: .public (List a) -## #End -## (#Item a (List a))) +... (type: .public (List a) +... #End +... (#Item a (List a))) ("lux def type tagged" List (9 #1 ["library/lux" "List"] (7 #0 (0 #0) - (1 #0 ## "lux.End" + (1 #0 ... "lux.End" Any - ## "lux.Item" + ... "lux.Item" (2 #0 (4 #0 1) (9 #0 (4 #0 1) (4 #0 0)))))) [dummy_location @@ -156,15 +156,15 @@ #End))] #1) -## (type: .public (Maybe a) -## #None -## (#Some a)) +... (type: .public (Maybe a) +... #None +... (#Some a)) ("lux def type tagged" Maybe (9 #1 ["library/lux" "Maybe"] (7 #0 #End - (1 #0 ## "lux.None" + (1 #0 ... "lux.None" Any - ## "lux.Some" + ... "lux.Some" (4 #0 1)))) [dummy_location (9 #1 (#Item [[dummy_location (7 #0 ["library/lux" "type_args"])] @@ -175,19 +175,19 @@ ["None" "Some"] #1) -## (type: .public #rec Type -## (#Primitive Text (List Type)) -## (#Sum Type Type) -## (#Product Type Type) -## (#Function Type Type) -## (#Parameter Nat) -## (#Var Nat) -## (#Ex Nat) -## (#UnivQ (List Type) Type) -## (#ExQ (List Type) Type) -## (#Apply Type Type) -## (#Named Name Type) -## ) +... (type: .public #rec Type +... (#Primitive Text (List Type)) +... (#Sum Type Type) +... (#Product Type Type) +... (#Function Type Type) +... (#Parameter Nat) +... (#Var Nat) +... (#Ex Nat) +... (#UnivQ (List Type) Type) +... (#ExQ (List Type) Type) +... (#Apply Type Type) +... (#Named Name Type) +... ) ("lux def type tagged" Type (9 #1 ["library/lux" "Type"] ({Type @@ -195,27 +195,27 @@ ({Type_Pair (9 #0 Nothing (7 #0 #End - (1 #0 ## "lux.Primitive" + (1 #0 ... "lux.Primitive" (2 #0 Text Type_List) - (1 #0 ## "lux.Sum" + (1 #0 ... "lux.Sum" Type_Pair - (1 #0 ## "lux.Product" + (1 #0 ... "lux.Product" Type_Pair - (1 #0 ## "lux.Function" + (1 #0 ... "lux.Function" Type_Pair - (1 #0 ## "lux.Parameter" + (1 #0 ... "lux.Parameter" Nat - (1 #0 ## "lux.Var" + (1 #0 ... "lux.Var" Nat - (1 #0 ## "lux.Ex" + (1 #0 ... "lux.Ex" Nat - (1 #0 ## "lux.UnivQ" + (1 #0 ... "lux.UnivQ" (2 #0 Type_List Type) - (1 #0 ## "lux.ExQ" + (1 #0 ... "lux.ExQ" (2 #0 Type_List Type) - (1 #0 ## "lux.Apply" + (1 #0 ... "lux.Apply" Type_Pair - ## "lux.Named" + ... "lux.Named" (2 #0 Name Type)))))))))))))} ("lux type check type" (2 #0 Type Type)))} ("lux type check type" (9 #0 Type List)))} @@ -229,10 +229,10 @@ ["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"] #1) -## (type: .public Location -## {#module Text -## #line Nat -## #column Nat}) +... (type: .public Location +... {#module Text +... #line Nat +... #column Nat}) ("lux def type tagged" Location (#Named ["library/lux" "Location"] (#Product Text (#Product Nat Nat))) @@ -243,9 +243,9 @@ ["module" "line" "column"] #1) -## (type: .public (Ann m v) -## {#meta m -## #datum v}) +... (type: .public (Ann m v) +... {#meta m +... #datum v}) ("lux def type tagged" Ann (#Named ["library/lux" "Ann"] (#UnivQ #End @@ -261,44 +261,44 @@ ["meta" "datum"] #1) -## (type: .public (Code' w) -## (#Bit Bit) -## (#Nat Nat) -## (#Int Int) -## (#Rev Rev) -## (#Frac Frac) -## (#Text Text) -## (#Identifier Name) -## (#Tag Name) -## (#Form (List (w (Code' w)))) -## (#Tuple (List (w (Code' w)))) -## (#Record (List [(w (Code' w)) (w (Code' w))]))) +... (type: .public (Code' w) +... (#Bit Bit) +... (#Nat Nat) +... (#Int Int) +... (#Rev Rev) +... (#Frac Frac) +... (#Text Text) +... (#Identifier Name) +... (#Tag Name) +... (#Form (List (w (Code' w)))) +... (#Tuple (List (w (Code' w)))) +... (#Record (List [(w (Code' w)) (w (Code' w))]))) ("lux def type tagged" Code' (#Named ["library/lux" "Code'"] ({Code ({Code_List (#UnivQ #End - (#Sum ## "lux.Bit" + (#Sum ... "lux.Bit" Bit - (#Sum ## "lux.Nat" + (#Sum ... "lux.Nat" Nat - (#Sum ## "lux.Int" + (#Sum ... "lux.Int" Int - (#Sum ## "lux.Rev" + (#Sum ... "lux.Rev" Rev - (#Sum ## "lux.Frac" + (#Sum ... "lux.Frac" Frac - (#Sum ## "lux.Text" + (#Sum ... "lux.Text" Text - (#Sum ## "lux.Identifier" + (#Sum ... "lux.Identifier" Name - (#Sum ## "lux.Tag" + (#Sum ... "lux.Tag" Name - (#Sum ## "lux.Form" + (#Sum ... "lux.Form" Code_List - (#Sum ## "lux.Tuple" + (#Sum ... "lux.Tuple" Code_List - ## "lux.Record" + ... "lux.Record" (#Apply (#Product Code Code) List) )))))))))) )} @@ -313,8 +313,8 @@ ["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"] #1) -## (type: .public Code -## (Ann Location (Code' (Ann Location)))) +... (type: .public Code +... (Ann Location (Code' (Ann Location)))) ("lux def" Code (#Named ["library/lux" "Code"] ({w @@ -446,8 +446,8 @@ [dummy_location (#Record #End)] #0) -## (type: .public Definition -## [Bit Type Code Any]) +... (type: .public Definition +... [Bit Type Code Any]) ("lux def" Definition ("lux type check type" (#Named ["library/lux" "Definition"] @@ -457,8 +457,8 @@ #End)) #1) -## (type: .public Alias -## Name) +... (type: .public Alias +... Name) ("lux def" Alias ("lux type check type" (#Named ["library/lux" "Alias"] @@ -466,9 +466,9 @@ (record$ #End) #1) -## (type: .public Global -## (#Alias Alias) -## (#Definition Definition)) +... (type: .public Global +... (#Alias Alias) +... (#Definition Definition)) ("lux def type tagged" Global (#Named ["library/lux" "Global"] (#Sum Alias @@ -479,16 +479,16 @@ ["Alias" "Definition"] #1) -## (type: .public (Bindings k v) -## {#counter Nat -## #mappings (List [k v])}) +... (type: .public (Bindings k v) +... {#counter Nat +... #mappings (List [k v])}) ("lux def type tagged" Bindings (#Named ["library/lux" "Bindings"] (#UnivQ #End (#UnivQ #End - (#Product ## "lux.counter" + (#Product ... "lux.counter" Nat - ## "lux.mappings" + ... "lux.mappings" (#Apply (#Product (#Parameter 3) (#Parameter 1)) List))))) @@ -498,33 +498,33 @@ ["counter" "mappings"] #1) -## (type: .public Ref -## (#Local Nat) -## (#Captured Nat)) +... (type: .public Ref +... (#Local Nat) +... (#Captured Nat)) ("lux def type tagged" Ref (#Named ["library/lux" "Ref"] - (#Sum ## Local + (#Sum ... Local Nat - ## Captured + ... Captured Nat)) (record$ #End) ["Local" "Captured"] #1) -## (type: .public Scope -## {#name (List Text) -## #inner Nat -## #locals (Bindings Text [Type Nat]) -## #captured (Bindings Text [Type Ref])}) +... (type: .public Scope +... {#name (List Text) +... #inner Nat +... #locals (Bindings Text [Type Nat]) +... #captured (Bindings Text [Type Ref])}) ("lux def type tagged" Scope (#Named ["library/lux" "Scope"] - (#Product ## name + (#Product ... name (#Apply Text List) - (#Product ## inner + (#Product ... inner Nat - (#Product ## locals + (#Product ... locals (#Apply (#Product Type Nat) (#Apply Text Bindings)) - ## captured + ... captured (#Apply (#Product Type Ref) (#Apply Text Bindings)))))) (record$ #End) ["name" "inner" "locals" "captured"] @@ -536,16 +536,16 @@ (record$ #End) #0) -## (type: .public (Either l r) -## (#Left l) -## (#Right r)) +... (type: .public (Either l r) +... (#Left l) +... (#Right r)) ("lux def type tagged" Either (#Named ["library/lux" "Either"] (#UnivQ #End (#UnivQ #End - (#Sum ## "lux.Left" + (#Sum ... "lux.Left" (#Parameter 3) - ## "lux.Right" + ... "lux.Right" (#Parameter 1))))) (record$ (#Item [(tag$ ["library/lux" "type_args"]) (tuple$ (#Item (text$ "l") (#Item (text$ "r") #End)))] @@ -555,8 +555,8 @@ ["Left" "Right"] #1) -## (type: .public Source -## [Location Nat Text]) +... (type: .public Source +... [Location Nat Text]) ("lux def" Source ("lux type check type" (#Named ["library/lux" "Source"] @@ -564,57 +564,57 @@ (record$ #End) #1) -## (type: .public Module_State -## #Active -## #Compiled -## #Cached) +... (type: .public Module_State +... #Active +... #Compiled +... #Cached) ("lux def type tagged" Module_State (#Named ["library/lux" "Module_State"] (#Sum - ## #Active + ... #Active Any (#Sum - ## #Compiled + ... #Compiled Any - ## #Cached + ... #Cached Any))) (record$ #End) ["Active" "Compiled" "Cached"] #1) -## (type: .public Module -## {#module_hash Nat -## #module_aliases (List [Text Text]) -## #definitions (List [Text Global]) -## #imports (List Text) -## #tags (List [Text [Nat (List Name) Bit Type]]) -## #types (List [Text [(List Name) Bit Type]]) -## #module_annotations (Maybe Code) -## #module_state Module_State}) +... (type: .public Module +... {#module_hash Nat +... #module_aliases (List [Text Text]) +... #definitions (List [Text Global]) +... #imports (List Text) +... #tags (List [Text [Nat (List Name) Bit Type]]) +... #types (List [Text [(List Name) Bit Type]]) +... #module_annotations (Maybe Code) +... #module_state Module_State}) ("lux def type tagged" Module (#Named ["library/lux" "Module"] - (#Product ## "lux.module_hash" + (#Product ... "lux.module_hash" Nat - (#Product ## "lux.module_aliases" + (#Product ... "lux.module_aliases" (#Apply (#Product Text Text) List) - (#Product ## "lux.definitions" + (#Product ... "lux.definitions" (#Apply (#Product Text Global) List) - (#Product ## "lux.imports" + (#Product ... "lux.imports" (#Apply Text List) - (#Product ## "lux.tags" + (#Product ... "lux.tags" (#Apply (#Product Text (#Product Nat (#Product (#Apply Name List) (#Product Bit Type)))) List) - (#Product ## "lux.types" + (#Product ... "lux.types" (#Apply (#Product Text (#Product (#Apply Name List) (#Product Bit Type))) List) - (#Product ## "lux.module_annotations" + (#Product ... "lux.module_annotations" (#Apply Code Maybe) Module_State)) )))))) @@ -624,34 +624,34 @@ ["module_hash" "module_aliases" "definitions" "imports" "tags" "types" "module_annotations" "module_state"] #1) -## (type: .public Type_Context -## {#ex_counter Nat -## #var_counter Nat -## #var_bindings (List [Nat (Maybe Type)])}) +... (type: .public Type_Context +... {#ex_counter Nat +... #var_counter Nat +... #var_bindings (List [Nat (Maybe Type)])}) ("lux def type tagged" Type_Context (#Named ["library/lux" "Type_Context"] - (#Product ## ex_counter + (#Product ... ex_counter Nat - (#Product ## var_counter + (#Product ... var_counter Nat - ## var_bindings + ... var_bindings (#Apply (#Product Nat (#Apply Type Maybe)) List)))) (record$ #End) ["ex_counter" "var_counter" "var_bindings"] #1) -## (type: .public Mode -## #Build -## #Eval -## #Interpreter) +... (type: .public Mode +... #Build +... #Eval +... #Interpreter) ("lux def type tagged" Mode (#Named ["library/lux" "Mode"] - (#Sum ## Build + (#Sum ... Build Any - (#Sum ## Eval + (#Sum ... Eval Any - ## Interpreter + ... Interpreter Any))) (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "A sign that shows the conditions under which the compiler is running.")] @@ -659,19 +659,19 @@ ["Build" "Eval" "Interpreter"] #1) -## (type: .public Info -## {#target Text -## #version Text -## #mode Mode}) +... (type: .public Info +... {#target Text +... #version Text +... #mode Mode}) ("lux def type tagged" Info (#Named ["library/lux" "Info"] (#Product - ## target + ... target Text (#Product - ## version + ... version Text - ## mode + ... mode Mode))) (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ "Information about the current version and type of compiler that is running.")] @@ -679,44 +679,44 @@ ["target" "version" "mode"] #1) -## (type: .public Lux -## {#info Info -## #source Source -## #location Location -## #current_module (Maybe Text) -## #modules (List [Text Module]) -## #scopes (List Scope) -## #type_context Type_Context -## #expected (Maybe Type) -## #seed Nat -## #scope_type_vars (List Nat) -## #extensions Any -## #host Any}) +... (type: .public Lux +... {#info Info +... #source Source +... #location Location +... #current_module (Maybe Text) +... #modules (List [Text Module]) +... #scopes (List Scope) +... #type_context Type_Context +... #expected (Maybe Type) +... #seed Nat +... #scope_type_vars (List Nat) +... #extensions Any +... #host Any}) ("lux def type tagged" Lux (#Named ["library/lux" "Lux"] - (#Product ## "lux.info" + (#Product ... "lux.info" Info - (#Product ## "lux.source" + (#Product ... "lux.source" Source - (#Product ## "lux.location" + (#Product ... "lux.location" Location - (#Product ## "lux.current_module" + (#Product ... "lux.current_module" (#Apply Text Maybe) - (#Product ## "lux.modules" + (#Product ... "lux.modules" (#Apply (#Product Text Module) List) - (#Product ## "lux.scopes" + (#Product ... "lux.scopes" (#Apply Scope List) - (#Product ## "lux.type_context" + (#Product ... "lux.type_context" Type_Context - (#Product ## "lux.expected" + (#Product ... "lux.expected" (#Apply Type Maybe) - (#Product ## "lux.seed" + (#Product ... "lux.seed" Nat - (#Product ## scope_type_vars + (#Product ... scope_type_vars (#Apply Nat List) - (#Product ## extensions + (#Product ... extensions Any - ## "lux.host" + ... "lux.host" Any)))))))))))) (record$ (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" @@ -728,8 +728,8 @@ ["info" "source" "location" "current_module" "modules" "scopes" "type_context" "expected" "seed" "scope_type_vars" "extensions" "host"] #1) -## (type: .public (Meta a) -## (-> Lux (Either Text [Lux a]))) +... (type: .public (Meta a) +... (-> Lux (Either Text [Lux a]))) ("lux def" Meta ("lux type check type" (#Named ["library/lux" "Meta"] @@ -746,8 +746,8 @@ #End))) #1) -## (type: .public Macro' -## (-> (List Code) (Meta (List Code)))) +... (type: .public Macro' +... (-> (List Code) (Meta (List Code)))) ("lux def" Macro' ("lux type check type" (#Named ["library/lux" "Macro'"] @@ -755,8 +755,8 @@ (record$ #End) #1) -## (type: .public Macro -## (primitive "#Macro")) +... (type: .public Macro +... (primitive "#Macro")) ("lux def" Macro ("lux type check type" (#Named ["library/lux" "Macro"] @@ -766,7 +766,7 @@ #End)) #1) -## Base functions & macros +... Base functions & macros ("lux def" in_meta ("lux type check" (#UnivQ #End @@ -958,9 +958,9 @@ (macro:' .public (comment tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Throws away any code given to it." __paragraph) + ("lux text concat" "... Throws away any code given to it." __paragraph) ("lux text concat" - ("lux text concat" "## Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor." __paragraph) + ("lux text concat" "... Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor." __paragraph) "(comment +1 +2 +3 +4)")))] #End) (in_meta #End)) @@ -1091,7 +1091,7 @@ (def:'' .private (quantified_args_parser args next) #End - ## (-> (List Code) (-> (List Text) (Meta (List Code))) (Meta (List Code))) + ... (-> (List Code) (-> (List Text) (Meta (List Code))) (Meta (List Code))) (#Function ($' List Code) (#Function (#Function ($' List Text) (#Apply ($' List Code) Meta)) (#Apply ($' List Code) Meta) @@ -1113,7 +1113,7 @@ (def:'' .private (list\fold f init xs) #End - ## (All [a b] (-> (-> b a a) a (List b) a)) + ... (All [a b] (-> (-> b a a) a (List b) a)) (#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1) (#Function (#Parameter 3) (#Parameter 3))) @@ -1136,11 +1136,11 @@ (macro:' .public (All tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Universal quantification." __paragraph) + ("lux text concat" "... Universal quantification." __paragraph) ("lux text concat" ("lux text concat" "(All [a] (-> a a))" __paragraph) ("lux text concat" - ("lux text concat" "## A name can be provided, to specify a recursive type." __paragraph) + ("lux text concat" "... A name can be provided, to specify a recursive type." __paragraph) "(All List [a] (Variant Any [a (List a)]))"))))] #End) (let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens) @@ -1181,11 +1181,11 @@ (macro:' .public (Ex tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Existential quantification." __paragraph) + ("lux text concat" "... Existential quantification." __paragraph) ("lux text concat" ("lux text concat" "(Ex [a] [(Codec Text a) a])" __paragraph) ("lux text concat" - ("lux text concat" "## A name can be provided, to specify a recursive type." __paragraph) + ("lux text concat" "... A name can be provided, to specify a recursive type." __paragraph) "(Ex Self [a] [(Codec Text a) a (List (Self a))])"))))] #End) (let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens) @@ -1234,10 +1234,10 @@ (macro:' .public (-> tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Function types:" __paragraph) + ("lux text concat" "... Function types:" __paragraph) ("lux text concat" ("lux text concat" "(-> Int Int Int)" __paragraph) - "## This is the type of a function that takes 2 Ints and returns an Int.")))] + "... This is the type of a function that takes 2 Ints and returns an Int.")))] #End) ({(#Item output inputs) (in_meta (#Item (list\fold ("lux type check" (#Function Code (#Function Code Code)) @@ -1253,7 +1253,7 @@ (macro:' .public (list xs) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## List-construction macro." __paragraph) + ("lux text concat" "... List-construction macro." __paragraph) "(list +1 +2 +3)"))] #End) (in_meta (#Item (list\fold (function'' [head tail] @@ -1267,9 +1267,9 @@ (macro:' .public (list& xs) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## List-construction macro, with the last element being a tail-list." __paragraph) + ("lux text concat" "... List-construction macro, with the last element being a tail-list." __paragraph) ("lux text concat" - ("lux text concat" "## In other words, this macro prepends elements to another list." __paragraph) + ("lux text concat" "... In other words, this macro prepends elements to another list." __paragraph) "(list& +1 +2 +3 (list +4 +5 +6))")))] #End) ({(#Item last init) @@ -1286,11 +1286,11 @@ (macro:' .public (Tuple tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Tuple types:" __paragraph) + ("lux text concat" "... Tuple types:" __paragraph) ("lux text concat" ("lux text concat" "(Tuple Text Int Bit)" __paragraph) ("lux text concat" - ("lux text concat" "## Any." __paragraph) + ("lux text concat" "... Any." __paragraph) "(&)"))))] #End) ({#End @@ -1305,11 +1305,11 @@ (macro:' .public (Variant tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Variant types:" __paragraph) + ("lux text concat" "... Variant types:" __paragraph) ("lux text concat" ("lux text concat" "(Variant Text Int Bit)" __paragraph) ("lux text concat" - ("lux text concat" "## Nothing." __paragraph) + ("lux text concat" "... Nothing." __paragraph) "(Variant)"))))] #End) ({#End @@ -1473,11 +1473,11 @@ (macro:' .public (_$ tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Left-association for the application of binary functions over variadic arguments." ..\n) + ("lux text concat" "... Left-association for the application of binary functions over variadic arguments." ..\n) ("lux text concat" ("lux text concat" "(_$ text\compose ''Hello, '' name ''. How are you?'')" ..\n) ("lux text concat" - ("lux text concat" "## =>" ..\n) + ("lux text concat" "... =>" ..\n) "(text\compose (text\compose ''Hello, '' name) ''. How are you?'')"))))] #End) ({(#Item op tokens') @@ -1495,11 +1495,11 @@ (macro:' .public ($_ tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" - ("lux text concat" "## Right-association for the application of binary functions over variadic arguments." ..\n) + ("lux text concat" "... Right-association for the application of binary functions over variadic arguments." ..\n) ("lux text concat" ("lux text concat" "($_ text\compose ''Hello, '' name ''. How are you?'')" ..\n) ("lux text concat" - ("lux text concat" "## =>" ..\n) + ("lux text concat" "... =>" ..\n) "(text\compose ''Hello, '' (text\compose name ''. How are you?''))"))))] #End) ({(#Item op tokens') @@ -1514,11 +1514,11 @@ (failure "Wrong syntax for $_")} tokens)) -## (interface: (Monad m) -## (: (All [a] (-> a (m a))) -## in) -## (: (All [a b] (-> (-> a (m b)) (m a) (m b))) -## bind)) +... (interface: (Monad m) +... (: (All [a] (-> a (m a))) +... in) +... (: (All [a b] (-> (-> a (m b)) (m a) (m b))) +... bind)) ("lux def type tagged" Monad (#Named ["library/lux" "Monad"] (All [m] @@ -1595,8 +1595,8 @@ (def:''' .private (monad\map m f xs) #End - ## (All [m a b] - ## (-> (Monad m) (-> a (m b)) (List a) (m (List b)))) + ... (All [m a b] + ... (-> (Monad m) (-> a (m b)) (List a) (m (List b)))) (All [m a b] (-> ($' Monad m) (-> a ($' m b)) @@ -1615,8 +1615,8 @@ (def:''' .private (monad\fold m f y xs) #End - ## (All [m a b] - ## (-> (Monad m) (-> a b (m b)) b (List a) (m b))) + ... (All [m a b] + ... (-> (Monad m) (-> a b (m b)) b (List a) (m b))) (All [m a b] (-> ($' Monad m) (-> a b ($' m b)) @@ -1695,16 +1695,16 @@ (def:''' .private (get_meta tag def_meta) #End (-> Name Code ($' Maybe Code)) - (let' [[prefix name] tag] + (let' [[module name] tag] ({[_ (#Record def_meta)] ({(#Item [key value] def_meta') - ({[_ (#Tag [prefix' name'])] + ({[_ (#Tag [module' name'])] ({[#1 #1] (#Some value) _ (get_meta tag (record$ def_meta'))} - [(text\= prefix prefix') + [(text\= module module') (text\= name name')]) _ @@ -1891,7 +1891,7 @@ (macro:' .public (primitive tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Macro to treat define new primitive types." __paragraph + "... Macro to treat define new primitive types." __paragraph "(primitive ''java.lang.Object'')" __paragraph "(primitive ''java.util.List'' [(primitive ''java.lang.Long'')])"))]) ({(#Item [_ (#Text class_name)] #End) @@ -1922,8 +1922,8 @@ (macro:' .public (` tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Hygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph - "## All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used." __paragraph + "... Hygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph + "... All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used." __paragraph "(` (def: (~ name) (function ((~' _) (~+ args)) (~ body))))"))]) ({(#Item template #End) (do meta_monad @@ -1940,7 +1940,7 @@ (macro:' .public (`' tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Unhygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph + "... Unhygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~+) must also be used as forms." __paragraph "(`' (def: (~ name) (function (_ (~+ args)) (~ body))))"))]) ({(#Item template #End) (do meta_monad @@ -1954,7 +1954,7 @@ (macro:' .public (' tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Quotation as a macro." __paragraph + "... Quotation as a macro." __paragraph "(' YOLO)"))]) ({(#Item template #End) (do meta_monad @@ -1968,9 +1968,9 @@ (macro:' .public (|> tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Piping macro." __paragraph + "... Piping macro." __paragraph "(|> elems (list\map int\encode) (interpose '' '') (fold text\compose ''''))" __paragraph - "## =>" __paragraph + "... =>" __paragraph "(fold text\compose '''' (interpose '' '' (list\map int\encode elems)))"))]) ({(#Item [init apps]) (in_meta (list (list\fold ("lux type check" (-> Code Code Code) @@ -1994,9 +1994,9 @@ (macro:' .public (<| tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Reverse piping macro." __paragraph + "... Reverse piping macro." __paragraph "(<| (fold text\compose '''') (interpose '' '') (list\map int\encode) elems)" __paragraph - "## =>" __paragraph + "... =>" __paragraph "(fold text\compose '''' (interpose '' '' (list\map int\encode elems)))"))]) ({(#Item [init apps]) (in_meta (list (list\fold ("lux type check" (-> Code Code Code) @@ -2142,7 +2142,7 @@ (macro:' .public (template tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." __paragraph + "... By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." __paragraph "(template [ ]" ..\n " " "[(def: .public (-> Int Int) (+ ))]" __paragraph " " "[inc +1]" ..\n @@ -2273,7 +2273,7 @@ (def:''' .public (not x) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Bit negation." __paragraph + "... Bit negation." __paragraph "(not #1) => #0" __paragraph "(not #0) => #1"))]) (-> Bit Bit) @@ -2481,7 +2481,7 @@ (macro:' .public (type tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Takes a type expression and returns its representation as data-structure." __paragraph + "... Takes a type expression and returns its representation as data-structure." __paragraph "(type (All [a] (Maybe (List a))))"))]) ({(#Item type #End) (do meta_monad @@ -2500,7 +2500,7 @@ (macro:' .public (: tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## The type-annotation macro." __paragraph + "... The type-annotation macro." __paragraph "(: (List Int) (list +1 +2 +3))"))]) ({(#Item type (#Item value #End)) (in_meta (list (` ("lux type check" (type (~ type)) (~ value))))) @@ -2512,7 +2512,7 @@ (macro:' .public (:as tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## The type-coercion macro." __paragraph + "... The type-coercion macro." __paragraph "(:as Dinosaur (list +1 +2 +3))"))]) ({(#Item type (#Item value #End)) (in_meta (list (` ("lux type as" (type (~ type)) (~ value))))) @@ -2610,8 +2610,8 @@ (macro:' .public (Rec tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Parameter-less recursive types." __paragraph - "## A name has to be given to the whole type, to use it within its body." __paragraph + "... Parameter-less recursive types." __paragraph + "... A name has to be given to the whole type, to use it within its body." __paragraph "(Rec Self [Int (List Self)])"))]) ({(#Item [_ (#Identifier "" name)] (#Item body #End)) (let' [body' (|> body @@ -2626,7 +2626,7 @@ (macro:' .public (exec tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Sequential execution of expressions (great for side-effects)." __paragraph + "... Sequential execution of expressions (great for side-effects)." __paragraph "(exec" ..\n " " "(log! ''#1'')" ..\n " " "(log! ''#2'')" ..\n @@ -2708,15 +2708,15 @@ [_ (#Text value)] (text\encode value) - [_ (#Identifier [prefix name])] - (if (text\= "" prefix) + [_ (#Identifier [module name])] + (if (text\= "" module) name - ($_ text\compose prefix "." name)) + ($_ text\compose module "." name)) - [_ (#Tag [prefix name])] - (if (text\= "" prefix) + [_ (#Tag [module name])] + (if (text\= "" module) ($_ text\compose "#" name) - ($_ text\compose "#" prefix "." name)) + ($_ text\compose "#" module "." name)) [_ (#Form xs)] ($_ text\compose "(" (|> xs @@ -2777,8 +2777,8 @@ (macro:' .public (case tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## The pattern-matching macro." ..\n - "## Allows the usage of macros within the patterns to provide custom syntax." ..\n + "... The pattern-matching macro." ..\n + "... Allows the usage of macros within the patterns to provide custom syntax." ..\n "(case (: (List Int) (list +1 +2 +3))" ..\n " " "(#Item x (#Item y (#Item z #End)))" ..\n " " "(#Some ($_ * x y z))" __paragraph @@ -2796,8 +2796,8 @@ (macro:' .public (^ tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Macro-expanding patterns." ..\n - "## It's a special macro meant to be used with 'case'." ..\n + "... Macro-expanding patterns." ..\n + "... It's a special macro meant to be used with 'case'." ..\n "(case (: (List Int) (list +1 +2 +3))" ..\n " (^ (list x y z))" ..\n " (#Some ($_ * x y z))" @@ -2821,8 +2821,8 @@ (macro:' .public (^or tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Or-patterns." ..\n - "## It's a special macro meant to be used with 'case'." ..\n + "... Or-patterns." ..\n + "... It's a special macro meant to be used with 'case'." ..\n "(type: Weekday #Monday #Tuesday #Wednesday #Thursday #Friday #Saturday #Sunday)" __paragraph "(def: (weekend? day)" ..\n @@ -2859,8 +2859,8 @@ (macro:' .public (let tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Creates local bindings." ..\n - "## Can (optionally) use pattern-matching macros when binding." ..\n + "... Creates local bindings." ..\n + "... Can (optionally) use pattern-matching macros when binding." ..\n "(let [x (foo bar)" ..\n " y (baz quux)]" ..\n " (op x y))"))]) @@ -2885,8 +2885,8 @@ (macro:' .public (function tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Syntax for creating functions." ..\n - "## Allows for giving the function itself a name, for the sake of recursion." ..\n + "... Syntax for creating functions." ..\n + "... Allows for giving the function itself a name, for the sake of recursion." ..\n "(: (All [a b] (-> a b a))" ..\n " (function (_ x y) x))" __paragraph @@ -2935,8 +2935,8 @@ [_ (#Text value)] (meta_code ["library/lux" "Text"] (text$ value)) - [_ (#Tag [prefix name])] - (meta_code ["library/lux" "Tag"] (` [(~ (text$ prefix)) (~ (text$ name))])) + [_ (#Tag [module name])] + (meta_code ["library/lux" "Tag"] (` [(~ (text$ module)) (~ (text$ name))])) (^or [_ (#Form _)] [_ (#Identifier _)]) code @@ -3075,11 +3075,11 @@ (def:' .private (bodyP tokens) (-> (List Code) (Maybe [(List Code) [(Maybe Code) Code]])) (case tokens - ## TB + ... TB (^ (list& type body tokens')) (#Some [tokens' [(#Some type) body]]) - ## B + ... B (^ (list& body tokens')) (#Some [tokens' [#None body]]) @@ -3114,8 +3114,8 @@ .let' [[tokens [?type body]] %] _ (endP tokens)] (in [export_policy name parameters annotations ?type body])) - ## (^ (list _export_policy _declaration _annotations _type _body)) - ## (^ (list _export_policy _declaration _annotations _body)) + ... (^ (list _export_policy _declaration _annotations _type _body)) + ... (^ (list _export_policy _declaration _annotations _body)) (maybe\else' (do maybe_monad [% (enhanced_local_declarationP tokens) .let' [[tokens [name parameters]] %] @@ -3123,8 +3123,8 @@ .let' [[tokens [?type body]] %] _ (endP tokens)] (in [(` ..private) name parameters #End ?type body]))) - ## (^ (list _declaration _type _body)) - ## (^ (list _declaration _body)) + ... (^ (list _declaration _type _body)) + ... (^ (list _declaration _body)) (maybe\else' (do maybe_monad [% (enhanced_local_declarationP tokens) .let' [[tokens [name parameters]] %] @@ -3134,8 +3134,8 @@ .let' [[tokens [?type body]] %] _ (endP tokens)] (in [(` ..private) name parameters annotations ?type body]))) - ## (^ (list _declaration _annotations _type _body)) - ## (^ (list _declaration _annotations _body)) + ... (^ (list _declaration _annotations _type _body)) + ... (^ (list _declaration _annotations _body)) (maybe\else' (do maybe_monad [% (enhanced_declarationP tokens) .let' [[tokens [export_policy name parameters]] %] @@ -3143,14 +3143,14 @@ .let' [[tokens [?type body]] %] _ (endP tokens)] (in [export_policy name parameters #End ?type body]))) - ## (^ (list _export_policy _declaration _type _body)) - ## (^ (list _export_policy _declaration _body)) + ... (^ (list _export_policy _declaration _type _body)) + ... (^ (list _export_policy _declaration _body)) )) (macro:' .public (def: tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Defines global constants/functions." ..\n + "... Defines global constants/functions." ..\n "(def: (pair_list pair)" ..\n " (-> [Code Code] (List Code))" ..\n " (let [[left right] pair]" ..\n @@ -3216,7 +3216,7 @@ .let' [[tokens body] %] _ (endP tokens)] (in [export_policy name parameters annotations body])) - ## (^ (list _export_policy _declaration _annotations _body)) + ... (^ (list _export_policy _declaration _annotations _body)) (maybe\else' (do maybe_monad [% (local_declarationP tokens) .let' [[tokens [name parameters]] %] @@ -3224,7 +3224,7 @@ .let' [[tokens body] %] _ (endP tokens)] (in [(` ..private) name parameters #End body]))) - ## (^ (list _declaration _body)) + ... (^ (list _declaration _body)) (maybe\else' (do maybe_monad [% (local_declarationP tokens) .let' [[tokens [name parameters]] %] @@ -3234,7 +3234,7 @@ .let' [[tokens body] %] _ (endP tokens)] (in [(` ..private) name parameters annotations body]))) - ## (^ (list _declaration _annotations _body)) + ... (^ (list _declaration _annotations _body)) (maybe\else' (do maybe_monad [% (declarationP tokens) .let' [[tokens [export_policy name parameters]] %] @@ -3242,18 +3242,18 @@ .let' [[tokens body] %] _ (endP tokens)] (in [export_policy name parameters #End body]))) - ## (^ (list _export_policy _declaration _body)) + ... (^ (list _export_policy _declaration _body)) )) (macro:' .public (macro: tokens) (list [(tag$ ["library/lux" "doc"]) (text$ ($_ "lux text concat" - "## Macro-definition macro." ..\n + "... Macro-definition macro." ..\n "(macro: .public (name_of tokens)" ..\n " (case tokens" ..\n " (^template []" ..\n - " [(^ (list [_ ( [prefix name])]))" ..\n - " (in (list (` [(~ (text$ prefix)) (~ (text$ name))])))])" ..\n + " [(^ (list [_ ( [module name])]))" ..\n + " (in (list (` [(~ (text$ module)) (~ (text$ name))])))])" ..\n " ([#Identifier] [#Tag])" __paragraph " _" ..\n @@ -3306,8 +3306,8 @@ _ (failure )))] - [and (if (~ pre) (~ post) #0) "'and' requires >=1 clauses." "Short-circuiting 'and': (and #1 #0 #1) ## => #0"] - [or (if (~ pre) #1 (~ post)) "'or' requires >=1 clauses." "Short-circuiting 'or': (or #1 #0 #1) ## => #1"]) + [and (if (~ pre) (~ post) #0) "'and' requires >=1 clauses." "Short-circuiting 'and': (and #1 #0 #1) ... => #0"] + [or (if (~ pre) #1 (~ post)) "'or' requires >=1 clauses." "Short-circuiting 'or': (or #1 #0 #1) ... => #1"]) (def: (index part text) (-> Text Text (Maybe Nat)) @@ -3315,19 +3315,19 @@ (def: .public (error! message) {#.doc (text$ ($_ "lux text concat" - "## Causes an error, with the given error message." ..\n + "... Causes an error, with the given error message." ..\n "(error! ''OH NO!'')"))} (-> Text Nothing) ("lux io error" message)) (macro: (else tokens state) {#.doc (text$ ($_ "lux text concat" - "## Allows you to provide a default value that will be used" ..\n - "## if a (Maybe x) value turns out to be #.None." + "... Allows you to provide a default value that will be used" ..\n + "... if a (Maybe x) value turns out to be #.None." __paragraph - "(else +20 (#.Some +10)) ## => +10" + "(else +20 (#.Some +10)) ... => +10" __paragraph - "(else +20 #.None) ## => +20"))} + "(else +20 #.None) ... => +20"))} (case tokens (^ (list else maybe)) (let [g!temp (: Code [dummy_location (#Identifier ["" ""])]) @@ -3369,7 +3369,7 @@ (#Some x) (item ("lux i64 -" 1 idx) xs')))) -## https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction +... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction (def: (reduced env type) (-> (List Type) Type Type) (case type @@ -3629,8 +3629,8 @@ .let' [[tokens type] %] tokens (remainderP tokens)] (in [export_policy name parameters annotations type tokens])) - ## (^ (list _export_policy _declaration _annotations _type _body)) - ## (^ (list _declaration _annotations _type _body)) + ... (^ (list _export_policy _declaration _annotations _type _body)) + ... (^ (list _declaration _annotations _type _body)) (maybe\else' (do maybe_monad [% (enhanced_local_declarationP tokens) .let' [[tokens [name parameters]] %] @@ -3638,7 +3638,7 @@ .let' [[tokens type] %] tokens (remainderP tokens)] (in [(` ..private) name parameters #End type tokens]))) - ## (^ (list _declaration _type _body)) + ... (^ (list _declaration _type _body)) (maybe\else' (do maybe_monad [% (anyP tokens) .let' [[tokens export_policy] %] @@ -3648,12 +3648,12 @@ .let' [[tokens type] %] tokens (remainderP tokens)] (in [export_policy name parameters #End type tokens]))) - ## (^ (list _export_policy _declaration _type _body)) + ... (^ (list _export_policy _declaration _type _body)) )) (macro: .public (implementation: tokens) {#.doc (text$ ($_ "lux text concat" - "## Definition of structures ala ML." ..\n + "... Definition of structures ala ML." ..\n "(implementation: .public order" ..\n " (Order Int)" ..\n " (def: &equivalence equivalence)" ..\n @@ -3709,8 +3709,8 @@ .let' [[tokens annotations] %] tokens (remainderP tokens)] (in [export_policy rec? name parameters annotations tokens])) - ## (^ (list _export_policy _rec _declaration _annotations _body)) - ## (^ (list _export_policy _declaration _annotations _body)) + ... (^ (list _export_policy _rec _declaration _annotations _body)) + ... (^ (list _export_policy _declaration _annotations _body)) (maybe\else' (do maybe_monad [.let' [[tokens rec?] (recP tokens)] % (local_declarationP tokens) @@ -3719,16 +3719,16 @@ .let' [[tokens annotations] %] tokens (remainderP tokens)] (in [(` ..private) rec? name parameters annotations tokens]))) - ## (^ (list _rec _declaration _annotations _body)) - ## (^ (list _declaration _annotations _body)) + ... (^ (list _rec _declaration _annotations _body)) + ... (^ (list _declaration _annotations _body)) (maybe\else' (do maybe_monad [.let' [[tokens rec?] (recP tokens)] % (local_declarationP tokens) .let' [[tokens [name parameters]] %] tokens (remainderP tokens)] (in [(` ..private) rec? name parameters #End tokens]))) - ## (^ (list _rec _declaration _body)) - ## (^ (list _declaration _body)) + ... (^ (list _rec _declaration _body)) + ... (^ (list _declaration _body)) (maybe\else' (do maybe_monad [% (anyP tokens) .let' [[tokens export_policy] %] @@ -3737,13 +3737,13 @@ .let' [[tokens [name parameters]] %] tokens (remainderP tokens)] (in [export_policy rec? name parameters #End tokens]))) - ## (^ (list _export_policy _rec _declaration _body)) - ## (^ (list _export_policy _declaration _body)) + ... (^ (list _export_policy _rec _declaration _body)) + ... (^ (list _export_policy _declaration _body)) )) (macro: .public (type: tokens) {#.doc (text$ ($_ "lux text concat" - "## The type-definition macro." ..\n + "... The type-definition macro." ..\n "(type: (List a)" ..\n " {#.doc (doc (: (List Nat) (list 0 1 2 3)))}" ..\n " #End" ..\n @@ -3811,23 +3811,23 @@ % (annotationsP tokens) .let' [[tokens annotations] %]] (in [export_policy name parameters annotations tokens])) - ## (^ (list _export_policy _declaration _annotations _body)) - ## (^ (list _declaration _annotations _body)) + ... (^ (list _export_policy _declaration _annotations _body)) + ... (^ (list _declaration _annotations _body)) (maybe\else' (do maybe_monad [% (local_declarationP tokens) .let' [[tokens [name parameters]] %]] (in [(` ..private) name parameters #End tokens]))) - ## (^ (list _declaration _body)) + ... (^ (list _declaration _body)) (maybe\else' (do maybe_monad [% (declarationP tokens) .let' [[tokens [export_policy name parameters]] %]] (in [export_policy name parameters #End tokens]))) - ## (^ (list _export_policy _declaration _body)) + ... (^ (list _export_policy _declaration _body)) )) (macro: .public (interface: tokens) {#.doc (text$ ($_ "lux text concat" - "## Definition of interfaces/signatures ala ML." ..\n + "... Definition of interfaces/signatures ala ML." ..\n "(interface: .public (Order a)" ..\n " (: (Equivalence a)" ..\n " &equivalence)" ..\n @@ -3973,7 +3973,7 @@ [_ post] (text\split! ("lux text size" token) post')]] (in [pre post]))) -(def: (replace_all pattern replacement template) +(def: (replaced pattern replacement template) (-> Text Text Text Text) ((: (-> Text Text Text) (function (recur left right) @@ -3991,8 +3991,8 @@ (def: (module_alias context self aliased) (-> Text Text Text Text) (|> aliased - (replace_all ..self_reference self) - (replace_all ..contextual_reference context))) + (replaced ..self_reference self) + (replaced ..contextual_reference context))) (def: .public module_separator "/") @@ -4086,7 +4086,7 @@ (: (-> Code (Meta (List Importation))) (function (_ token) (case token - ## Simple + ... Simple [_ (#Identifier ["" module_name])] (do meta_monad [absolute_module_name (..absolute_module_name nested? relative_root module_name)] @@ -4095,7 +4095,7 @@ #import_refer {#refer_defs #All #refer_open (list)}}))) - ## Nested + ... Nested (^ [_ (#Tuple (list& [_ (#Identifier ["" module_name])] extra))]) (do meta_monad [absolute_module_name (case (normal_parallel_path relative_root module_name) @@ -4145,7 +4145,7 @@ #refer_open openings}} sub_imports)))) - ## Unrecognized syntax. + ... Unrecognized syntax. _ (do meta_monad [current_module current_module_name] @@ -4248,12 +4248,12 @@ (def: (definition_type name state) (-> Name Lux (Maybe Type)) - (let [[v_prefix v_name] name + (let [[v_module v_name] name {#info info #source source #current_module _ #modules modules #scopes scopes #type_context types #host host #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars} state] - (case (get v_prefix modules) + (case (get v_module modules) #None #None @@ -4272,12 +4272,12 @@ (def: (definition_value name state) (-> Name (Meta [Type Any])) - (let [[v_prefix v_name] name + (let [[v_module v_name] name {#info info #source source #current_module _ #modules modules #scopes scopes #type_context types #host host #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars} state] - (case (get v_prefix modules) + (case (get v_module modules) #None (#Left (text\compose "Unknown definition: " (name\encode name))) @@ -4409,8 +4409,8 @@ (macro: .public (^open tokens) {#.doc (text$ ($_ "lux text concat" - "## Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings." ..\n - "## Takes an 'alias' text for the generated local bindings." ..\n + "... Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings." ..\n + "... Takes an 'alias' text for the generated local bindings." ..\n "(def: .public (range (^open ''.'') minimum additional)" ..\n " (All [a] (-> (Enum a) a a (List a)))" ..\n " (range' <= succ minimum additional))"))} @@ -4460,11 +4460,11 @@ (macro: .public (cond tokens) {#.doc (text$ ($_ "lux text concat" - "## Branching structures with multiple test conditions." ..\n + "... Branching structures with multiple test conditions." ..\n "(cond (even? num) ''even''" ..\n " (odd? num) ''odd''" __paragraph - " ## else_branch" ..\n + " ... else_branch" ..\n " ''???'')"))} (if ("lux i64 =" 0 (n/% 2 (list\size tokens))) (failure "cond requires an uneven number of arguments.") @@ -4495,13 +4495,13 @@ (macro: .public (get@ tokens) {#.doc (text$ ($_ "lux text concat" - "## Accesses the value of a record at a given tag." ..\n + "... Accesses the value of a record at a given tag." ..\n "(get@ #field my_record)" __paragraph - "## Can also work with multiple levels of nesting:" ..\n + "... Can also work with multiple levels of nesting:" ..\n "(get@ [#foo #bar #baz] my_record)" __paragraph - "## And, if only the slot/path is given, generates an accessor function:" ..\n + "... And, if only the slot/path is given, generates an accessor function:" ..\n "(let [getter (get@ [#foo #bar #baz])]" ..\n " (getter my_record))"))} (case tokens @@ -4515,8 +4515,8 @@ (case (interface_methods type) (#Some members) (let [pattern (record$ (list\map (: (-> [Name [Nat Type]] [Code Code]) - (function (_ [[r_prefix r_name] [r_idx r_type]]) - [(tag$ [r_prefix r_name]) + (function (_ [[r_module r_name] [r_idx r_type]]) + [(tag$ [r_module r_name]) (if ("lux i64 =" idx r_idx) g!output g!_)])) @@ -4574,12 +4574,12 @@ (macro: .public (open: tokens) {#.doc (text$ ($_ "lux text concat" - "## Opens a implementation and generates a definition for each of its members (including nested members)." + "... Opens a implementation and generates a definition for each of its members (including nested members)." __paragraph - "## For example:" ..\n + "... For example:" ..\n "(open: ''i:.'' number)" __paragraph - "## Will generate:" ..\n + "... Will generate:" ..\n "(def: i:+ (\ number +))" ..\n "(def: i:- (\ number -))" ..\n "(def: i:* (\ number *))" ..\n @@ -4617,9 +4617,9 @@ (macro: .public (|>> tokens) {#.doc (text$ ($_ "lux text concat" - "## Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n + "... Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n "(|>> (list\map int\encode) (interpose '' '') (fold text\compose ''''))" ..\n - "## =>" ..\n + "... =>" ..\n "(function (_ ) (fold text\compose '''' (interpose '' '' (list\map int\encode ))))"))} (do meta_monad [g!_ (gensym "_") @@ -4628,9 +4628,9 @@ (macro: .public (<<| tokens) {#.doc (text$ ($_ "lux text concat" - "## Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n + "... Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..\n "(<<| (fold text\compose '''') (interpose '' '') (list\map int\encode))" ..\n - "## =>" ..\n + "... =>" ..\n "(function (_ ) (fold text\compose '''' (interpose '' '' (list\map int\encode ))))"))} (do meta_monad [g!_ (gensym "_") @@ -4741,7 +4741,7 @@ #Nothing (list))) openings (list\map (function (_ [alias structs]) - (form$ (list& (text$ (..replace_all ..contextual_reference module_alias alias)) + (form$ (list& (text$ (..replaced ..contextual_reference module_alias alias)) (list\map local_identifier$ structs)))) r_opens)] (` (..refer (~ (text$ module_name)) @@ -4750,11 +4750,11 @@ (macro: .public (module: tokens) {#.doc (text$ ($_ "lux text concat" - "## Module_definition macro." + "... Module_definition macro." __paragraph - "## Can take optional annotations and allows the specification of modules to import." + "... Can take optional annotations and allows the specification of modules to import." __paragraph - "## Example" ..\n + "... Example" ..\n "(.module: {#.doc ''Some documentation...''}" ..\n " [lux #*" ..\n " [control" ..\n @@ -4792,10 +4792,10 @@ (macro: .public (\ tokens) {#.doc (text$ ($_ "lux text concat" - "## Allows accessing the value of a implementation's member." ..\n + "... Allows accessing the value of a implementation's member." ..\n "(\ codec encode)" __paragraph - "## Also allows using that value as a function." ..\n + "... Also allows using that value as a function." ..\n "(\ codec encode +123)"))} (case tokens (^ (list struct [_ (#Identifier member)])) @@ -4809,13 +4809,13 @@ (macro: .public (set@ tokens) {#.doc (text$ ($_ "lux text concat" - "## Sets the value of a record at a given tag." ..\n + "... Sets the value of a record at a given tag." ..\n "(set@ #name ''Lux'' lang)" __paragraph - "## Can also work with multiple levels of nesting:" ..\n + "... Can also work with multiple levels of nesting:" ..\n "(set@ [#foo #bar #baz] value my_record)" __paragraph - "## And, if only the slot/path and (optionally) the value are given, generates a mutator function:" ..\n + "... And, if only the slot/path and (optionally) the value are given, generates a mutator function:" ..\n "(let [setter (set@ [#foo #bar #baz] value)] (setter my_record))" ..\n "(let [setter (set@ [#foo #bar #baz])] (setter value my_record))"))} (case tokens @@ -4898,13 +4898,13 @@ (macro: .public (update@ tokens) {#.doc (text$ ($_ "lux text concat" - "## Modifies the value of a record at a given tag, based on some function." ..\n + "... Modifies the value of a record at a given tag, based on some function." ..\n "(update@ #age inc person)" __paragraph - "## Can also work with multiple levels of nesting:" ..\n + "... Can also work with multiple levels of nesting:" ..\n "(update@ [#foo #bar #baz] func my_record)" __paragraph - "## And, if only the slot/path and (optionally) the value are given, generates a mutator function:" ..\n + "... And, if only the slot/path and (optionally) the value are given, generates a mutator function:" ..\n "(let [updater (update@ [#foo #bar #baz] func)] (updater my_record))" ..\n "(let [updater (update@ [#foo #bar #baz])] (updater func my_record))"))} (case tokens @@ -4973,7 +4973,7 @@ (macro: .public (^template tokens) {#.doc (text$ ($_ "lux text concat" - "## It's similar to template, but meant to be used during pattern-matching." ..\n + "... It's similar to template, but meant to be used during pattern-matching." ..\n "(def: (reduced env type)" ..\n " (-> (List Type) Type Type)" ..\n " (case type" ..\n @@ -5088,18 +5088,18 @@ (-> Name Text) (|>> name\encode (text\compose "#"))) -(def: (repeat n x) +(def: (repeated n x) (All [a] (-> Int a (List a))) (if ("lux i64 <" n +0) - (#Item x (repeat ("lux i64 +" -1 n) x)) + (#Item x (repeated ("lux i64 +" -1 n) x)) #End)) (def: (location_padding baseline [_ old_line old_column] [_ new_line new_column]) (-> Nat Location Location Text) (if ("lux i64 =" old_line new_line) - (text\join_with "" (repeat (.int ("lux i64 -" old_column new_column)) " ")) - (let [extra_lines (text\join_with "" (repeat (.int ("lux i64 -" old_line new_line)) ..\n)) - space_padding (text\join_with "" (repeat (.int ("lux i64 -" baseline new_column)) " "))] + (text\join_with "" (repeated (.int ("lux i64 -" old_column new_column)) " ")) + (let [extra_lines (text\join_with "" (repeated (.int ("lux i64 -" old_line new_line)) ..\n)) + space_padding (text\join_with "" (repeated (.int ("lux i64 -" baseline new_column)) " "))] (text\compose extra_lines space_padding)))) (def: (text\size x) @@ -5170,7 +5170,7 @@ (#Documentation_Comment comment) (|> comment (text\split_all_with ..\n) - (list\map (function (_ line) ($_ text\compose "## " line ..\n))) + (list\map (function (_ line) ($_ text\compose "... " line ..\n))) (text\join_with "")) (#Documentation_Example example) @@ -5181,9 +5181,9 @@ (macro: .public (doc tokens) {#.doc (text$ ($_ "lux text concat" - "## Creates code documentation, embedding text as comments and properly formatting the forms it's being given." + "... Creates code documentation, embedding text as comments and properly formatting the forms it's being given." __paragraph - "## For Example:" ..\n + "... For Example:" ..\n "(doc ''Allows arbitrary looping, using the 'recur' form to re-start the loop.''" ..\n " ''Can be used in monadic code to create monadic loops.''" ..\n " (loop [count +0" ..\n @@ -5236,10 +5236,10 @@ ([#.UnivQ] [#.ExQ]) (#Named [module name] anonymous) - ## TODO: Generate the explicit type definition instead of using - ## the "identifier$" shortcut below. - ## (` (#.Named [(~ (text$ module)) (~ (text$ name))] - ## (~ (type_code anonymous)))) + ... TODO: Generate the explicit type definition instead of using + ... the "identifier$" shortcut below. + ... (` (#.Named [(~ (text$ module)) (~ (text$ name))] + ... (~ (type_code anonymous)))) (identifier$ [module name]))) (macro: .public (loop tokens) @@ -5346,8 +5346,8 @@ (^or [_ (#Bit _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Rev _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) (#Some (list target)) - [_ (#Identifier [prefix name])] - (if (and (text\= "" prefix) + [_ (#Identifier [module name])] + (if (and (text\= "" module) (text\= label name)) (#Some tokens) (#Some (list target))) @@ -5463,12 +5463,12 @@ (def: (static_literal token) (-> Code (Meta Code)) (case token - [_ (#Identifier [def_prefix def_name])] - (if (text\= "" def_prefix) + [_ (#Identifier [def_module def_name])] + (if (text\= "" def_module) (do meta_monad [current_module current_module_name] (static_simple_literal [current_module def_name])) - (static_simple_literal [def_prefix def_name])) + (static_simple_literal [def_module def_name])) (^template [] [[meta ( parts)] @@ -5491,8 +5491,8 @@ _ (\ meta_monad in_meta token) - ## TODO: Figure out why this doesn't work: - ## (\ meta_monad in token) + ... TODO: Figure out why this doesn't work: + ... (\ meta_monad in token) )) (macro: .public (static tokens) @@ -5601,23 +5601,23 @@ _ (failure "Wrong syntax for ^multi"))) -## TODO: Allow asking the compiler for the name of the definition -## currently being defined. That name can then be fed into -## 'wrong_syntax_error' for easier maintenance of the error_messages. +... TODO: Allow asking the compiler for the name of the definition +... currently being defined. That name can then be fed into +... 'wrong_syntax_error' for easier maintenance of the error_messages. (def: wrong_syntax_error (-> Name Text) (|>> name\encode (text\compose "Wrong syntax for "))) (macro: .public (name_of tokens) - {#.doc (doc "Given an identifier or a tag, gives back a 2 tuple with the prefix and name parts, both as Text." + {#.doc (doc "Given an identifier or a tag, gives back a 2 tuple with the module and name parts, both as Text." (name_of #.doc) "=>" ["library/lux" "doc"])} (case tokens (^template [] - [(^ (list [_ ( [prefix name])])) - (in_meta (list (` [(~ (text$ prefix)) (~ (text$ name))])))]) + [(^ (list [_ ( [module name])])) + (in_meta (list (` [(~ (text$ module)) (~ (text$ name))])))]) ([#Identifier] [#Tag]) _ @@ -5783,8 +5783,8 @@ .let' [[tokens templates] %] _ (endP tokens)] (in [export_policy name parameters annotations templates])) - ## (^ (list _export_policy _declaration _annotations _body)) - ## (^ (list _declaration _annotations _body)) + ... (^ (list _export_policy _declaration _annotations _body)) + ... (^ (list _declaration _annotations _body)) (maybe\else' (do maybe_monad [% (declarationP tokens) .let' [[tokens [export_policy name parameters]] %] @@ -5792,7 +5792,7 @@ .let' [[tokens templates] %] _ (endP tokens)] (in [export_policy name parameters #End templates]))) - ## (^ (list _export_policy _declaration _body)) + ... (^ (list _export_policy _declaration _body)) (maybe\else' (do maybe_monad [% (local_declarationP tokens) .let' [[tokens [name parameters]] %] @@ -5800,7 +5800,7 @@ .let' [[tokens templates] %] _ (endP tokens)] (in [(` ..private) name parameters #End templates]))) - ## (^ (list _declaration _body)) + ... (^ (list _declaration _body)) )) (macro: .public (template: tokens) -- cgit v1.2.3