2012/06/11 17:22:47 | (82.249.85.212) {h1 functions} _p Defining functions and variables and using them (@ 11/06/2012). {div {@ white-space:pre-wrap; border:1px solid grey; padding:5px; background:#222; color:white;} _h6 listing functions hard-coded in the [[parser|meca/parser.js]] : ? °°{list_core_func }°° > {list_core_func } _h6 defining functions in the wiki page : ? °°{define diag3 (x y z) {sqrt {add {mult x x} {mult y y} {mult z z}}} }°° > {define diag3 (x y z) °°{sqrt {add {mult x x} {mult y y} {mult z z}}}°° } ? °°{define diag2 (x y) {sqrt {add {mult x x} {mult y y}}} }°° > {define diag2 (x y) °°{sqrt {add {mult x x} {mult y y}}}°° } _h6 using functions defined in the page : ? °°{apply diag3 1 1 1}°° > {apply diag3 1 1 1} ? °°{apply diag2 1 1}°° > {apply diag2 1 1} _h6 defining variables in the wiki page and using them : ? °°{set N 3}°° > {set N 3} ? °°{set M 4}°° > {set M 4} _h6 listing defined functions and variables : ? °°{list_dyna_func }°° > {list_dyna_func } ? °°{list_dyna_var }°° > {list_dyna_var } _h6 using variables and functions : ? °°{apply diag2 {get N} {get M}}°° > {apply diag2 {get N} {get M}} ? °°{equal 2 3}°° > {equal 2 3} ? °°{set P 3}°° > {set P 3} ? °°{set Q 4}°° > {set Q 4} ? °°{if {equal {get P} {get Q}} egaux inegaux }°° > {if {equal {get P} {get Q}} egaux inegaux } ? }