LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
text/plain; charset=ISO-8859-1; format=flowed
Wed, 26 Oct 2011 12:06:00 +0200
Mailing list for the LaTeX3 project <[log in to unmask]>
Mailing list for the LaTeX3 project <[log in to unmask]>
Lars Hellström <[log in to unmask]>
text/plain (52 lines)
Continuing my reading up on Lambda calculus and related matters, I've now 
gotten to the Combinatory logic 
(, which also turns out to be 
much easier to understand when one transcribes the whole thing into LaTeX 
macros. :-) In particular, there are

\cs_new:Npn \combinator_I:n #1 { #1 }      % AKA \use_i:n
\cs_new:Npn \combinator_K:nn #1 #2 { #1 }  % AKA \use_i:nn
\cs_new:Npn \combinator_S:nnn #1 #2 #3 { #1{#3}{ #2{#3} } }
\cs_new:Npn \combinator_B:nnn #1 #2 #3 { #1{ #2{#3} } }
\cs_new:Npn \combinator_C:nnn #1 #2 #3 { #1{#3}{#2} }

My thought with this mail is mainly to ask whether there are any more of 
these (or other standard combinators) that are defined in LaTeX3 already. I 
seem to recall some discussion to the effect that the C combinator might be 
named \use_i_biii_bii:nnn, but I haven't seen any occurrence in the source 
of such _bii_ names (then again, maybe I'm not looking close enough). 
Continuing such a naming scheme, one would arrive at maybe

   \use_i_biibiii:nnn        for the B combinator
   \use_i_biii_biibiii:nnn   for the S combinator

which does not seem entirely practical...

David Carlisle mentioned in the Church booleans thread that provides what 
amounts to the B and C combinators under the (so far most comprehensible) 
names \Compose and \Twiddle respectively. It doesn't provide the S 
combinator up front, but rather

\cs_new:Npn \Lift #1 #2 #3 #4 { #1{#4} {#2} {#3} {#4} }

the primary intent for which is that #1{#4} should behave as a Church 
boolean, and thus select whether to apply #2 or #3 to the second #4. I 
suspect \Lift, \Twiddle, \Compose, and maybe some additional macro could be 
combined into an S combinator, but it is not immediately clear to me how.

(Reading that lambda.tex, I'm surprised that not more of it made it into 
fontinst -- both projects having the same original author -- but three years 
was a lot of time in TeX history, back then.)

Somewhat relatedly, it occurs to me that the process of converting 
lambda-terms to combinator formulae /might/ be the beginning of an approach 
to having "named command parameters" in (high-level) LaTeX without radical 
modifications of the TeX engine -- the idea being that the named parameters 
are (upon macro definition) removed from the replacement text as a matter of 
lambda elimination (conversion of a lambda term to an equivalent 
combinatorial term). Whether that would be practical is of course an 
entirely different matter. ;-)

Lars Hellström