tag:blogger.com,1999:blog-1317519969686201237.post8881927850305308057..comments2023-03-01T16:35:02.152-07:00Comments on Americium Dream Documents: set generator syntaxPhilip Torrance (ADDN)http://www.blogger.com/profile/13133625113916983486noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-1317519969686201237.post-4218898007802699572012-08-01T20:45:59.160-07:002012-08-01T20:45:59.160-07:008.1: adda/syntax/generators
. here is the current,...8.1: adda/syntax/generators<br />. here is the current, fully typed generator:<br />f = {^(x.{1..3}).(int,int): (x, x+1) }<br />-- generates f = { (1, 2), (2,3), (3,4) };<br />but now I'm thinking we need only define<br />the control var's type, not the return type,<br />because then that already tells you<br />what operations are used,<br />which then tells you what the result's type is:<br />eg, f= {^(x.{1..3}) (x, x+1) }<br />= { 1:2, 2:3, 3:4 } .<br />. math's way to define the return type is this:<br />f = {(x in dom, y in codomain) | y = f(x) };<br />but we need to keep our set generator syntax<br />consistent with our syntax for the <br />function call generator: f^(3)(x) = f f f x;<br />hence, {^(x.t) f(x) }<br />instead of {^(x.t).t: f(x) }.<br />. the mandatory colon has be replaced<br />by the mandatory parenthesis .Philip Torrance (ADDN)https://www.blogger.com/profile/13133625113916983486noreply@blogger.com