+
1
|
list
|
skin
|
login
|
editor
α-wwwiki
::
calc
user:none
(966 bytes)
_h1 calc _p Lambdatalk_lite allows to play with math expressions. _h2 basic operators : + - * / _p Four operators pocket calculator. {pre °°{+ 1 2 3 4 5 6}°° -> {+ 1 2 3 4 5 6} °°{* 1 2 3 4 5 6}°° -> {* 1 2 3 4 5 6} °°{- 1 2 3 4 5 6}°° -> {- 1 2 3 4 5 6} °°{- 1}°° -> {- 1} °°{/ 1 2}°° -> {/ 1 2} °°{/ 1 2 oops}°° -> {/ 1 2 oops} °°{/ 1 0}°° -> {/ 1 0} °°{/ 1}°° -> {/ 1} °°{+ {* 3 3} {* 4 4}}°° -> {+ {* 3 3} {* 4 4}} } _h2 math functions _p Grace to the "define" function it's possible to access all the JS math functions : {pre abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan mod inv PI E} _p Example : {pre 1) defining sqrt function : °°{define sqrt (x) return Math.sqrt( x ); }°° -> {define sqrt (x) return Math.sqrt( x ); } 2) using it to compute c{sup 2} = a{sup 2} + b{sup 2} : °°{sqrt {+ {* 3 3} {* 4 4}}}°° -> {sqrt {+ {* 3 3} {* 4 4}}} }