From bfacc0c96e56eedf788aba44bd8ad2848a35c390 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 16 Jul 2021 02:23:00 -0400 Subject: Fixed some inconsistent naming. --- stdlib/source/library/lux.lux | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 9b01303ea..6d1f82632 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -2052,7 +2052,7 @@ #None} x)) -(def:''' (tuple->list tuple) +(def:''' (tuple_to_list tuple) #Nil (-> Code ($' Maybe ($' List Code))) ({[_ (#Tuple members)] @@ -2161,7 +2161,7 @@ _ (fail "Wrong syntax for template")} [(monad\map maybe_monad get_short bindings) - (monad\map maybe_monad tuple->list data)]) + (monad\map maybe_monad tuple_to_list data)]) _ (fail "Wrong syntax for template")} @@ -3294,8 +3294,7 @@ (#Cons x xs') (if ("lux i64 =" 0 idx) (#Some x) - (nth ("lux i64 -" 1 idx) xs') - ))) + (nth ("lux i64 -" 1 idx) xs')))) (def: (beta_reduce env type) (-> (List Type) Type Type) @@ -4839,7 +4838,7 @@ (case (: (Maybe (List Code)) (do maybe_monad [bindings' (monad\map maybe_monad get_short bindings) - data' (monad\map maybe_monad tuple->list data)] + data' (monad\map maybe_monad tuple_to_list data)] (let [num_bindings (list\size bindings')] (if (every? (|>> ("lux i64 =" num_bindings)) (list\map list\size data')) @@ -4943,7 +4942,7 @@ (-> (List [Code Code]) (List Code)) (|>> (list\map rejoin_pair) list\join)) -(def: (doc_example->Text prev_location baseline example) +(def: (doc_example_to_text prev_location baseline example) (-> Location Nat Code [Location Text]) (case example (^template [ ] @@ -4963,7 +4962,7 @@ (^template [ ] [[group_location ( parts)] (let [[group_location' parts_text] (list\fold (function (_ part [last_location text_accum]) - (let [[part_location part_text] (doc_example->Text last_location baseline part)] + (let [[part_location part_text] (doc_example_to_text last_location baseline part)] [part_location (text\compose text_accum part_text)])) [(delim_update_location group_location) ""] ( parts))] @@ -4977,14 +4976,14 @@ [#Record "{" "}" rejoin_all_pairs]) [new_location (#Rev value)] - ("lux io error" "@doc_example->Text Undefined behavior.") + ("lux io error" "@doc_example_to_text Undefined behavior.") )) (def: (with_baseline baseline [file line column]) (-> Nat Location Location) [file line baseline]) -(def: (doc_fragment->Text fragment) +(def: (doc_fragment_to_text fragment) (-> Doc_Fragment Text) (case fragment (#Doc_Comment comment) @@ -4996,7 +4995,7 @@ (#Doc_Example example) (let [baseline (find_baseline_column example) [location _] example - [_ text] (doc_example->Text (with_baseline baseline location) baseline example)] + [_ text] (doc_example_to_text (with_baseline baseline location) baseline example)] (text\compose text __paragraph)))) (macro: #export (doc tokens) @@ -5013,7 +5012,7 @@ " x)))"))} (return (list (` [(~ location_code) (#.Text (~ (|> tokens - (list\map (|>> identify_doc_fragment doc_fragment->Text)) + (list\map (|>> identify_doc_fragment doc_fragment_to_text)) (text\join_with "") text$)))])))) @@ -5451,17 +5450,6 @@ (#Right state scope_type_vars) )) -(def: (list_at idx xs) - (All [a] (-> Nat (List a) (Maybe a))) - (case xs - #Nil - #None - - (#Cons x xs') - (if ("lux i64 =" 0 idx) - (#Some x) - (list_at (dec idx) xs')))) - (macro: #export ($ tokens) {#.doc (doc "Allows you to refer to the type-variables in a polymorphic function's type, by their index." "In the example below, 0 corresponds to the 'a' variable." @@ -5475,7 +5463,7 @@ (^ (list [_ (#Nat idx)])) (do meta_monad [stvs get_scope_type_vars] - (case (list_at idx (list\reverse stvs)) + (case (..nth idx (list\reverse stvs)) (#Some var_id) (wrap (list (` (#Ex (~ (nat$ var_id)))))) -- cgit v1.2.3