Gprint in ATS kind of means 'generic print'. However it does not have to do with print. Basically, it supports a generic way to process primitive data and also defined data structures.
For instance, the following code generates the table at <a href="http://myflask-tutoriats.rhcloud.com/multable">table</a>: (* ****** ****** *) // implement gprint_newline<>() = gprint_string<>("<br>") // (* ****** ****** *) // extern fun multable_create(): string = "mac#" // implement multable_create() = let // val out = PYlist_nil{string}() // implement gprint_string<>(x) = PYlist_append(out, x) // fun genall ( i: int ) : void = ( if (i > 1) then (genall(i-1); gprint_newline(); genone(i, 1)) else genone(1, 1) ) (* end of [if] *) // and genone ( i: int, j: int ) : void = if i >= j then ( if j > 1 then gprint(" | "); gprint!(j, " x ", i, " = "); if(j*i < 10) then gprint("0"); gprint(j*i); genone(i, j+1) ) (* end of [then] *) // val () = gprint!("<!DOCTYPE html>\n") val () = gprint!("<html>\n") // val () = gprint!("<head>\n") val () = gprint!("<meta charset=\"utf-8\">\n") val () = gprint!("<title>MultiplicationTable</title>\n") val () = gprint!("</head>\n") // val () = gprint!("<body>\n") val () = gprint!("<h1>Multiplication Table</h1>") val () = gprint!("<pre>\n") val () = genall(9) val () = gprint!("</pre>\n") val () = gprint!("</body>\n") // val () = gprint!("</html>\n") // in PYlist_string_join(out) end // end of [multable_create] // (* ****** ****** *) -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/ats-lang-users. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/8ef23d8e-03e9-4110-aa3f-80512f787ad5%40googlegroups.com.
