Skip to content

Commit

Permalink
latex3: remove obsolete {macro,quasiquote}expand special forms
Browse files Browse the repository at this point in the history
  • Loading branch information
asarhaddon committed Oct 14, 2024
1 parent 4739261 commit 80bc451
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 116 deletions.
9 changes: 1 addition & 8 deletions impls/latex3/step7_quote.tex
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@

\tl_const:Nx \c_quote_symbol { y \tl_to_str:n { quote } }
\tl_const:Nx \c_quasiquote_symbol { y \tl_to_str:n { quasiquote } }
\tl_const:Nx \c_quasiquoteexpand_symbol { y \tl_to_str:n { quasiquoteexpand } }
\tl_const:Nx \c_splice_unquote_symbol { y \tl_to_str:n { splice-unquote } }
\tl_const:Nx \c_unquote_symbol { y \tl_to_str:n { unquote } }

Expand Down Expand Up @@ -188,9 +187,7 @@
\tl_if_head_eq_charcode:nNTF { #1 } b
{ \use_none:nn #1 { #2 } }
{
\bool_lazy_or:nnTF
{ \tl_if_head_eq_charcode_p:nN { #1 } u }
{ \tl_if_head_eq_charcode_p:nN { #1 } c }
\tl_if_head_eq_charcode:nNTF { #1 } u
{
\exp_args:Nx \mal_env_new:N { \tl_item:nn { #1 } { 4 } }
\mal_env_set_keys_values:on { \use_none:nnnn #1 } { #2 }
Expand Down Expand Up @@ -251,10 +248,6 @@

{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquote_symbol }
{ \mal_eval:xN { \mal_eval_quasiquote:nn #1 } #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquoteexpand_symbol }
{ \tl_set:Nx \l_tmpa_tl { \mal_eval_quasiquote:nn #1 } }

}
{
% \iow_term:n {eval_mal_list~apply_phase~tl=#1~env=#2}
Expand Down
36 changes: 0 additions & 36 deletions impls/latex3/step8_macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@

\tl_const:Nx \c_quote_symbol { y \tl_to_str:n { quote } }
\tl_const:Nx \c_quasiquote_symbol { y \tl_to_str:n { quasiquote } }
\tl_const:Nx \c_quasiquoteexpand_symbol { y \tl_to_str:n { quasiquoteexpand } }
\tl_const:Nx \c_splice_unquote_symbol { y \tl_to_str:n { splice-unquote } }
\tl_const:Nx \c_unquote_symbol { y \tl_to_str:n { unquote } }

Expand Down Expand Up @@ -183,7 +182,6 @@
% Step 8

\tl_const:Nx \c_defmacro_symbol { y \tl_to_str:n { defmacro! } }
\tl_const:Nx \c_macroexpand_symbol { y \tl_to_str:n { macroexpand } }

\cs_new:Nn \mal_eval_defmacro:nnnN
{
Expand All @@ -197,34 +195,6 @@
% \iow_term:V \l_tmpa_tl
}

\cs_new:Nn \mal_macroexpand:nN
{
% \iow_term:n {macroexpand~ast=#1~env=#2}
\tl_if_head_eq_charcode:nNTF { #1 } l
{
\tl_set:No \l_tmpb_tl { \use_none:nn #1 }
\tl_if_empty:NTF \l_tmpb_tl
{ \tl_set:Nn \l_tmpa_tl { #1 } }
{
\mal_env_get:NxTF #2 { \tl_head:N \l_tmpb_tl }
{
\tl_if_head_eq_charcode:VNTF \l_tmpa_tl c
{
\mal_fn_apply:Vo \l_tmpa_tl { \use_none:nnn #1 }
\tl_if_head_eq_charcode:VNF \l_tmpa_tl e
{ \mal_macroexpand:VN \l_tmpa_tl #2 }
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
\cs_generate_variant:Nn \mal_macroexpand:nN { VN }

\cs_new:Nn \mal_eval_macroexpand:nnN { \mal_macroexpand:nN { #2 } #3 }

% EVAL

\cs_new:Nn \mal_fn_apply:nn
Expand Down Expand Up @@ -297,14 +267,8 @@
{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquote_symbol }
{ \mal_eval:xN { \mal_eval_quasiquote:nn #1 } #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquoteexpand_symbol }
{ \tl_set:Nx \l_tmpa_tl { \mal_eval_quasiquote:nn #1 } }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_defmacro_symbol }
{ \mal_eval_defmacro:nnnN #1 #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_macroexpand_symbol }
{ \mal_eval_macroexpand:nnN #1 #2 }
}
{
% \iow_term:n {eval_mal_list~apply_phase~tl=#1~env=#2}
Expand Down
36 changes: 0 additions & 36 deletions impls/latex3/step9_try.tex
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@

\tl_const:Nx \c_quote_symbol { y \tl_to_str:n { quote } }
\tl_const:Nx \c_quasiquote_symbol { y \tl_to_str:n { quasiquote } }
\tl_const:Nx \c_quasiquoteexpand_symbol { y \tl_to_str:n { quasiquoteexpand } }
\tl_const:Nx \c_splice_unquote_symbol { y \tl_to_str:n { splice-unquote } }
\tl_const:Nx \c_unquote_symbol { y \tl_to_str:n { unquote } }

Expand Down Expand Up @@ -183,7 +182,6 @@
% Step 8

\tl_const:Nx \c_defmacro_symbol { y \tl_to_str:n { defmacro! } }
\tl_const:Nx \c_macroexpand_symbol { y \tl_to_str:n { macroexpand } }

\cs_new:Nn \mal_eval_defmacro:nnnN
{
Expand All @@ -197,34 +195,6 @@
% \iow_term:V \l_tmpa_tl
}

\cs_new:Nn \mal_macroexpand:nN
{
% \iow_term:n {macroexpand~ast=#1~env=#2}
\tl_if_head_eq_charcode:nNTF { #1 } l
{
\tl_set:No \l_tmpb_tl { \use_none:nn #1 }
\tl_if_empty:NTF \l_tmpb_tl
{ \tl_set:Nn \l_tmpa_tl { #1 } }
{
\mal_env_get:NxTF #2 { \tl_head:N \l_tmpb_tl }
{
\tl_if_head_eq_charcode:VNTF \l_tmpa_tl c
{
\mal_fn_apply:Vo \l_tmpa_tl { \use_none:nnn #1 }
\tl_if_head_eq_charcode:VNF \l_tmpa_tl e
{ \mal_macroexpand:VN \l_tmpa_tl #2 }
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
\cs_generate_variant:Nn \mal_macroexpand:nN { VN }

\cs_new:Nn \mal_eval_macroexpand:nnN { \mal_macroexpand:nN { #2 } #3 }

% Step 9

\tl_const:Nx \c_try_symbol { y \tl_to_str:n { try* } }
Expand Down Expand Up @@ -318,15 +288,9 @@
{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquote_symbol }
{ \mal_eval:xN { \mal_eval_quasiquote:nn #1 } #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquoteexpand_symbol }
{ \tl_set:Nx \l_tmpa_tl { \mal_eval_quasiquote:nn #1 } }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_defmacro_symbol }
{ \mal_eval_defmacro:nnnN #1 #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_macroexpand_symbol }
{ \mal_eval_macroexpand:nnN #1 #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_try_symbol }
{
\tl_if_empty:oTF { \use_none:nn #1 }
Expand Down
36 changes: 0 additions & 36 deletions impls/latex3/stepA_mal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@

\tl_const:Nx \c_quote_symbol { y \tl_to_str:n { quote } }
\tl_const:Nx \c_quasiquote_symbol { y \tl_to_str:n { quasiquote } }
\tl_const:Nx \c_quasiquoteexpand_symbol { y \tl_to_str:n { quasiquoteexpand } }
\tl_const:Nx \c_splice_unquote_symbol { y \tl_to_str:n { splice-unquote } }
\tl_const:Nx \c_unquote_symbol { y \tl_to_str:n { unquote } }

Expand Down Expand Up @@ -183,7 +182,6 @@
% Step 8

\tl_const:Nx \c_defmacro_symbol { y \tl_to_str:n { defmacro! } }
\tl_const:Nx \c_macroexpand_symbol { y \tl_to_str:n { macroexpand } }

\cs_new:Nn \mal_eval_defmacro:nnnN
{
Expand All @@ -197,34 +195,6 @@
% \iow_term:V \l_tmpa_tl
}

\cs_new:Nn \mal_macroexpand:nN
{
% \iow_term:n {macroexpand~ast=#1~env=#2}
\tl_if_head_eq_charcode:nNTF { #1 } l
{
\tl_set:No \l_tmpb_tl { \use_none:nn #1 }
\tl_if_empty:NTF \l_tmpb_tl
{ \tl_set:Nn \l_tmpa_tl { #1 } }
{
\mal_env_get:NxTF #2 { \tl_head:N \l_tmpb_tl }
{
\tl_if_head_eq_charcode:VNTF \l_tmpa_tl c
{
\mal_fn_apply:Vo \l_tmpa_tl { \use_none:nnn #1 }
\tl_if_head_eq_charcode:VNF \l_tmpa_tl e
{ \mal_macroexpand:VN \l_tmpa_tl #2 }
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
}
{ \tl_set:Nn \l_tmpa_tl { #1 } }
}
\cs_generate_variant:Nn \mal_macroexpand:nN { VN }

\cs_new:Nn \mal_eval_macroexpand:nnN { \mal_macroexpand:nN { #2 } #3 }

% Step 9

\tl_const:Nx \c_try_symbol { y \tl_to_str:n { try* } }
Expand Down Expand Up @@ -318,15 +288,9 @@
{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquote_symbol }
{ \mal_eval:xN { \mal_eval_quasiquote:nn #1 } #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_quasiquoteexpand_symbol }
{ \tl_set:Nx \l_tmpa_tl { \mal_eval_quasiquote:nn #1 } }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_defmacro_symbol }
{ \mal_eval_defmacro:nnnN #1 #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_macroexpand_symbol }
{ \mal_eval_macroexpand:nnN #1 #2 }

{ \tl_if_eq_p:NN \l_tmpa_tl \c_try_symbol }
{
\tl_if_empty:oTF { \use_none:nn #1 }
Expand Down

0 comments on commit 80bc451

Please sign in to comment.