On 1/6/2025 2:33 PM, Jeong Dal via ntg-context wrote:
Dear Hans,
Thank you for your suggestions.
I changed the code without the intermediate variables.
I works well.
good, so now we're ready for a next improvement:
local tf = { true, false }
function document.truthTable(a)
document.MakeHead(a)
for i,s in ipairs(tf) do
for j,t in ipairs(tf) do
for k,u in ipairs(tf) do
context.NC()
context(s and "1" or "0")
context.NC()
context(t and "1" or "0")
context.NC()
if #a == 3 then
break
end
context(u and "1" or "0")
context.NC()
context(document.logicFa(s,t,u))
context.NC()
context.AR()
end
if #a == 3 then
context(document.logicF2(s,t))
context.NC()
context.AR()
end
end
end
document.MakeFooter()
end
and after that
local tf = { "1", "0" }
function document.truthTable(a)
document.MakeHead(a)
for i,s in ipairs(tf) do
for j,t in ipairs(tf) do
for k,u in ipairs(tf) do
context.NC()
context(s)
context.NC()
context(t)
context.NC()
if #a == 3 then
break
end
context(u)
context.NC()
context(document.logicFa(s,t,u))
context.NC()
context.AR()
end
if #a == 3 then
context(document.logicF2(s,t))
context.NC()
context.AR()
end
end
end
document.MakeFooter()
end
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________