diff options
-rwxr-xr-x | evaluator.ml | 11 | ||||
-rwxr-xr-x | expression.ml | 4 | ||||
-rwxr-xr-x | sheet.ml | 7 |
3 files changed, 8 insertions, 14 deletions
diff --git a/evaluator.ml b/evaluator.ml index c17a397..f2a49d9 100755 --- a/evaluator.ml +++ b/evaluator.ml @@ -280,8 +280,8 @@ let repr mapper value = begin | ScTypes.Refs.Array1 l ->
(* Guess the list type from it's first defined element *)
let Result r = extract_value (Tools.List.find_map (fun x -> x) l) in
- let format_of = Data.format_of_value r in
- let type_of = Data.type_of_value r in
+ let format_of = Data.format_of_value r
+ and type_of = Data.type_of_value r in
(* Build the list with all the elements *)
let elems, format = List.fold_left (add_elem type_of) ([], format_of) l in
Result (Data.List (format, elems))
@@ -289,13 +289,13 @@ let repr mapper value = begin (* Guess the list type from it's first defined element *)
let Result r = extract_value (Tools.List.find_map2 (fun x -> x) l) in
- let format_of = Data.format_of_value r in
- let type_of = Data.type_of_value r in
+ let format_of = Data.format_of_value r
+ and type_of = Data.type_of_value r in
(* Build the list with all the elements *)
let elems, format = List.fold_left (fun (result, format_of) elems ->
let elems, format = List.fold_left (add_elem type_of) ([], format_of) elems in
elems::result, (Data.most_generic_format format_of format)
- ) ([], format_of) l in
+ ) ([], format_of) l in
Result (Data.Matrix (format, elems))
end
@@ -308,7 +308,6 @@ let repr mapper value = begin end
in
let Result r = (extract value) in
-
begin match r with
| Data.Bool b -> ScTypes.Result (ScTypes.Bool b)
| Data.Num (format, n) -> ScTypes.Result (ScTypes.Num (format, n))
diff --git a/expression.ml b/expression.ml index c61131e..31b6369 100755 --- a/expression.ml +++ b/expression.ml @@ -35,8 +35,8 @@ let load content = begin with Not_found -> content in
try
let ScTypes.Result r =
- Lexing.from_string content'
- |> ExpressionParser.content ExpressionLexer.read in
+ ExpressionParser.content ExpressionLexer.read
+ @@ Lexing.from_string content' in
Basic r
with _ -> Basic (ScTypes.Str (UTF8.from_utf8string content'))
)
@@ -50,13 +50,8 @@ module Raw = struct *)
let get_ref from t ref : ScTypes.result option ScTypes.Refs.range = begin
- let extract_values = begin function
- | ScTypes.Error e -> raise e
- | v -> v
- end in
-
ScTypes.Refs.collect ref
- |> ScTypes.Refs.map (fun coord -> Option.map extract_values (get_value coord t))
+ |> ScTypes.Refs.map (fun coord -> get_value coord t)
end
|