From 38328f38b6904a884411835afa0066d0f9c503e7 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 15 Jun 2022 20:12:02 -0400 Subject: De-sigil-ification: suffix : [Part 11] --- stdlib/source/library/lux.lux | 61 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 12 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index ee78bcc4b..483362c7d 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -5048,19 +5048,56 @@ =refers) =refers)})))) -(with_expansions [ "#Macro/Immediate_UnQuote"] - (these (type: .public Immediate_UnQuote - (Primitive )) +(def: (symbol#= [moduleL shortL] [moduleR shortR]) + (-> Symbol Symbol Bit) + (and (text#= moduleL moduleR) + (text#= shortL shortR))) + +(def: (type#= left right) + (-> Type Type Bit) + (case [left right] + [{#Primitive nameL parametersL} {#Primitive nameR parametersR}] + (and (text#= nameL nameR) + ("lux i64 =" (list#size parametersL) (list#size parametersR)) + (every? (function (_ [itL itR]) + (type#= itL itR)) + (zipped_2 parametersL parametersR))) - (def: .private (immediate_unquote_type? it) - (-> Type Bit) - (case it - (pattern {#Named [(static ..prelude) "Immediate_UnQuote"] - {#Primitive {#End}}}) - #1 + (with_template#pattern [] + [[{ leftL rightL} { leftR rightR}] + (and (type#= leftL leftR) + (type#= rightL rightR))]) + ([#Sum] + [#Product] + [#Function] + [#Apply]) - _ - #0)))) + (with_template#pattern [] + [[{ idL} { idR}] + ("lux i64 =" idL idR)]) + ([#Parameter] + [#Var] + [#Ex]) + + (with_template#pattern [] + [[{ envL bodyL} { envR bodyR}] + (and ("lux i64 =" (list#size envL) (list#size envR)) + (every? (function (_ [itL itR]) + (type#= itL itR)) + (zipped_2 envL envR)) + (type#= bodyL bodyR))]) + ([#UnivQ] + [#ExQ]) + + [{#Named nameL anonL} {#Named nameR anonR}] + (and (symbol#= nameL nameR) + (type#= anonL anonR)) + + _ + #0)) + +(type: .public Immediate_UnQuote + (Primitive "#Macro/Immediate_UnQuote")) (def: .public immediate_unquote (-> Macro Immediate_UnQuote) @@ -5120,7 +5157,7 @@ {#Right [type value]} - (if (immediate_unquote_type? type) + (if (type#= ..Immediate_UnQuote type) (do meta#monad [bound ((immediate_unquote_macro (as Immediate_UnQuote value)) parameters) g!expansion (..generated_symbol "g!expansion")] -- cgit v1.2.3