EVAL MODE
Pour évaluer une expression :
THe KM2 EVAL MODE allows entries with the KM2 notations, in text mode, and without icons. MODE ENTREE
. DESCRIPTION transforms first the tree into a KM2 tree, with icons and macros, then process the tree to build a python expression, and finally executes or evaluates the statement.
RULES
1. EVAL MODE
Definition :- EVAL is a mode which allows to type in Python expressions
- EVAL will display an history of inputs and results
1.1. Modus operandi
Operations | result |
---|---|
type in main line the python expression followed by Return_Key | => will evaluate the line |
Control-e_Key in minipad | execute the line(s) (useful when many lines) |
- sélectionner une zone
- faire Ctrl-e dans la fenetre de saisie
1.2. Examples
Screen shot1.3. COMMANDES DU MODE EVAL
1.3.1. SHORTCUTS
shortcuts/abreviations-
!ab x y : defines shortcut x for the text y.
Exemple : !ab xxx yyyy
- attention : 1 seul blanc séparateur, pas de blanc dans x ni dans y
- !abx : destroys all macros
- !abs : (show) show all macros
1.3.2. TRACE
1.3.3. ENTRIES IN KM2 MODE
THe KM2 EVAL MODE allows entries with the KM2 notations, in text mode, and without icons. MODE ENTREE
- !eval mode python : standard python instructions
- !eval mode km2 : pKM2 pre-processing of python elements
enter KM2 EVAL MODE
!eval mode km2 : instructions with km2 proeprocessing |
Back to STANDARD PYTHON MODE
!eval mode python : direct python normal processing |
. DESCRIPTION transforms first the tree into a KM2 tree, with icons and macros, then process the tree to build a python expression, and finally executes or evaluates the statement.
RULES
- # --> comment 1
- ## --> comment all
- i --> ignore
- ii --> ignore all
-
!*xxx -->
*xxx
1.3.3. 1. EXEMPLES
Definition of factorial n : n !STEPS | result and display | |
---|---|---|
1 |
|
|
2 |
|
|
3 |
|
|
1.4. Examples
simple example
Session |
KM2 input mode
session |
...