diff options
Diffstat (limited to 'stdlib/source/library/lux.lux')
-rw-r--r-- | stdlib/source/library/lux.lux | 61 |
1 files changed, 49 insertions, 12 deletions
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 [<Immediate_UnQuote> "#Macro/Immediate_UnQuote"] - (these (type: .public Immediate_UnQuote - (Primitive <Immediate_UnQuote>)) +(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 <Immediate_UnQuote> {#End}}}) - #1 + (with_template#pattern [<tag>] + [[{<tag> leftL rightL} {<tag> leftR rightR}] + (and (type#= leftL leftR) + (type#= rightL rightR))]) + ([#Sum] + [#Product] + [#Function] + [#Apply]) - _ - #0)))) + (with_template#pattern [<tag>] + [[{<tag> idL} {<tag> idR}] + ("lux i64 =" idL idR)]) + ([#Parameter] + [#Var] + [#Ex]) + + (with_template#pattern [<tag>] + [[{<tag> envL bodyL} {<tag> 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 @@ <failure> {#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")] |