This section introduces variables from the view-point that they are user-defined text transformations.
A variable is a user-defined macro that takes in an arbitrary input, but does not use it.
[[set my_macro]]: Hello world!
[[my_macro]]
[[my_macro]]: Arbitrary input.
Hello world! Hello world!
Constant-output macros have their uses, but more generally we would like to build macros whose output are dependent on the input.
Remark passes the parameter of a macro in the parameter
variable. Using this knowledge we can build a generalized version of our macro:
[[set my_macro]]: Hello [[parameter]]!
[[my_macro]]: world
[[my_macro]]: jello
Hello world! Hello jello!
parameter
is local to each macro invocationThe parameter
is a variable local to each macro invocation.
[[set my_macro]]:
[[set my_replicate]]:
[[parameter]][[parameter]]
[[+my_replicate]]: Hello [[parameter]]!
[[my_macro]]: world
[[my_macro]]: jello
Hello world!Hello world!
Hello jello!Hello jello!