Skip to content

Commit

Permalink
ocaml: Fix exception on literal empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
dubek committed Mar 28, 2016
1 parent 52cee85 commit 127b36c
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions ocaml/step3_env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let rec eval_ast ast env =
| _ -> ast
and eval ast env =
match ast with
| T.List { T.value = [] } -> ast
| T.List { T.value = [(T.Symbol { T.value = "def!" }); key; expr] } ->
let value = (eval expr env) in
Env.set env key value; value
Expand Down
1 change: 1 addition & 0 deletions ocaml/step4_if_fn_do.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let rec eval_ast ast env =
| _ -> ast
and eval ast env =
match ast with
| T.List { T.value = [] } -> ast
| T.List { T.value = [(T.Symbol { T.value = "def!" }); key; expr] } ->
let value = (eval expr env) in
Env.set env key value; value
Expand Down
1 change: 1 addition & 0 deletions ocaml/step6_file.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let rec eval_ast ast env =
| _ -> ast
and eval ast env =
match ast with
| T.List { T.value = [] } -> ast
| T.List { T.value = [(T.Symbol { T.value = "def!" }); key; expr] } ->
let value = (eval expr env) in
Env.set env key value; value
Expand Down
1 change: 1 addition & 0 deletions ocaml/step7_quote.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let rec eval_ast ast env =
| _ -> ast
and eval ast env =
match ast with
| T.List { T.value = [] } -> ast
| T.List { T.value = [(T.Symbol { T.value = "def!" }); key; expr] } ->
let value = (eval expr env) in
Env.set env key value; value
Expand Down
1 change: 1 addition & 0 deletions ocaml/step8_macros.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ let rec eval_ast ast env =
| _ -> ast
and eval ast env =
match macroexpand ast env with
| T.List { T.value = [] } -> ast
| T.List { T.value = [(T.Symbol { T.value = "def!" }); key; expr] } ->
let value = (eval expr env) in
Env.set env key value; value
Expand Down
1 change: 1 addition & 0 deletions ocaml/step9_try.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ let rec eval_ast ast env =
| _ -> ast
and eval ast env =
match macroexpand ast env with
| T.List { T.value = [] } -> ast
| T.List { T.value = [(T.Symbol { T.value = "def!" }); key; expr] } ->
let value = (eval expr env) in
Env.set env key value; value
Expand Down
1 change: 1 addition & 0 deletions ocaml/stepA_mal.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ let rec eval_ast ast env =
| _ -> ast
and eval ast env =
match macroexpand ast env with
| T.List { T.value = [] } -> ast
| T.List { T.value = [(T.Symbol { T.value = "def!" }); key; expr] } ->
let value = (eval expr env) in
Env.set env key value; value
Expand Down

0 comments on commit 127b36c

Please sign in to comment.