A+B: Difference between revisions
Content added Content deleted
m (→{{header|Lambdatalk}}: minor edit) |
(lambdatalk alternative) |
||
Line 2,971: | Line 2,971: | ||
=={{header|Lambdatalk}}== |
=={{header|Lambdatalk}}== |
||
<lang scheme> |
<lang scheme> |
||
Lambdatalk works in a wiki, lambdatank. |
|||
1) writing this lambdatalk code |
|||
{center |
|||
Enter any sequence of numbers in the field below |
|||
{div |
|||
⚫ | |||
⚫ | |||
⚫ | |||
and double-clic to display their sum. |
|||
} |
|||
1) Open the wiki frame-editor and define a contenteditable box |
|||
and this javascript code |
|||
{def box |
|||
{script |
|||
{pre |
|||
var addme = function(x) { |
|||
⚫ | |||
alert( LAMBDATALK.eval_forms( |
|||
⚫ | |||
"The sum of " + x + " is equal to {+ " + x + "}") ) |
|||
⚫ | |||
}; |
|||
} |
}}} |
||
-> blockedit |
|||
2) create this box |
|||
displays an editable field in the wiki page |
|||
_______________________________________________________________ |
|||
{box} |
|||
Enter any sequence of numbers in the editable field below |
|||
⚫ | |||
and double-clic on it to display its sum. |
|||
_______________________________________________________________ |
|||
and close the wiki frame-editor. The wiki-page displays a shadowed box, |
|||
The result is displayed in an alert box |
|||
(here simulated as a space between square brackets) |
|||
"The sum of 12 34 56 is equal to 102" |
|||
⚫ | |||
3) Enter any valid lambdatalk expression, for instance |
|||
1+2+3 is equal to {+ 1 2 3} |
|||
then double-click. The expression is evaluated and the box displays |
|||
[ 1+2+3 is equal to 6 ] |
|||
Several boxes can be created in the wiki page |
|||
with any valid lambdatalk expressions. |
|||
</lang> |
</lang> |
||