Category talk:Wren-fmt: Difference between revisions
Content added Content deleted
(→Source code: Now uses Wren S/H lexer.) |
(→Source code: Added 'jslwrite' and family methods.) |
||
Line 1,013: | Line 1,013: | ||
static print(object) { System.print(object) } |
static print(object) { System.print(object) } |
||
static printAll(sequence) { System.printAll(sequence) } |
static printAll(sequence) { System.printAll(sequence) } |
||
// Gets or sets the separator for the 'jslwrite' method. The default is a single space. |
|||
static separator { (__separator != null) ? __separator : " " } |
|||
static separator=(s) { __separator = (s is String) ? s : s.toString } |
|||
// Returns a string formed from joining together the string representation of |
|||
// the elements of the list or sequence 'a' using the current separator. |
|||
static jslwrite(a) { a.join(separator) } |
|||
// Convenience versions of the 'jslwrite' method which allow from 2 to 6 arguments |
|||
// to be passed individually rather than in a list or sequence |
|||
static jswrite(a1, a2, a3, a4, a5, a6) { jsl.write([a1, a2, a3, a4, a5, a6]) } |
|||
static jswrite(a1, a2, a3, a4, a5) { jsl.write([a1, a2, a3, a4, a5]) } |
|||
static jswrite(a1, a2, a3, a4) { jsl.write([a1, a2, a3, a4]) } |
|||
static jswrite(a1, a2, a3) { jsl.write([a1, a2, a3]) } |
|||
static jswrite(a1, a2) { jsl.write([a1, a2]) } |
|||
// Applies jslwrite to the arguments and then 'writes' it (no following \n) to stdout. |
|||
static jwrite(a1, a2, a3, a4, a5, a6) { System.write(jslwrite([a1, a2, a3, a4, a5, a6])) } |
|||
static jwrite(a1, a2, a3, a4, a5) { System.write(jslwrite([a1, a2, a3, a4, a5])) } |
|||
static jwrite(a1, a2, a3, a4) { System.write(jslwrite([a1, a2, a3, a4])) } |
|||
static jwrite(a1, a2, a3) { System.write(jslwrite([a1, a2, a3])) } |
|||
static jwrite(a1, a2) { System.write(jslwrite([a1, a2])) } |
|||
static jlwrite(a) { System.write(jslwrite(a)) } |
|||
// Applies jslwrite to the arguments and then 'prints' it (with a following \n) to stdout. |
|||
static jprint(a1, a2, a3, a4, a5, a6) { System.print(jslwrite([a1, a2, a3, a4, a5, a6])) } |
|||
static jprint(a1, a2, a3, a4, a5) { System.print(jslwrite([a1, a2, a3, a4, a5])) } |
|||
static jprint(a1, a2, a3, a4) { System.print(jslwrite([a1, a2, a3, a4])) } |
|||
static jprint(a1, a2, a3) { System.print(jslwrite([a1, a2, a3])) } |
|||
static jprint(a1, a2) { System.print(jslwrite([a1, a2])) } |
|||
static jlprint(a) { System.print(jslwrite(a)) } |
|||
// Prints (with a following \n) a sequence 'a' to stdout in tabular form |
// Prints (with a following \n) a sequence 'a' to stdout in tabular form |