ch2_3_manage
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ch2_3_manage [2023/02/19 03:11] – admin | ch2_3_manage [2024/05/04 11:15] (current) – admin | ||
---|---|---|---|
Line 114: | Line 114: | ||
</ | </ | ||
- | See also the section about macros in chapter 1. | + | See also [[ch1_6_macros|Macros]]. |
- | '' | + | '' |
- | Primitive SET as function, | + | Primitive |
+ | |||
+ | <code lisp> | ||
+ | >(set 'a 12) ; is same as (SETQ a 12) | ||
+ | 12 | ||
+ | >(set (cadr '(a b)) 45) ; first argument evals to symbol B | ||
+ | 45 | ||
+ | >b ; so B was set to 45 | ||
+ | 45 | ||
+ | </ | ||
'' | '' | ||
- | Function | + | Some functions return multiple values, e.g. '' |
+ | |||
+ | <code lisp> | ||
+ | >(values 1 2) | ||
+ | 1 ; returned as separate values | ||
+ | 2 | ||
+ | > | ||
+ | ; no return value | ||
+ | >(values 3) | ||
+ | 3 ; trivial single value | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | Cosmetic function for labeling processes as shown on the LabLISP window, accepts one or two arguments. First must be string - the desired name. Second argument is optional integer specifying the process number, if not supplied, the active process is renamed. This function can be only meaningfully used on the active running process, to give information about reason for waiting. Returns the string name. | ||
+ | |||
+ | <code lisp> | ||
+ | .. | ||
+ | (move-motor 100) ; non-blocking call to start moving | ||
+ | (name-process "motor moving" | ||
+ | (wait (motor-moves? | ||
+ | .. | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | Function kills given process, needs one argument, the process number. Cannot be used on the active running process. Meaningful use is killing process stuck in an infinite loop. Returns '' | ||
+ | |||
+ | <code lisp> | ||
+ | >(wait t) ; infinite loop in process #0 | ||
+ | >(kill 0) ; user entry, process #1 | ||
+ | p# | ||
+ | </ | ||
+ | |||
+ | '' | ||
- | '' | + | This function kills the active running process, no arguments, returns |
- | these are unique LabLISP multi-process | + | The last three functions |
See also the section 1.2 about multi-process behavior in LabLISP. | See also the section 1.2 about multi-process behavior in LabLISP. | ||
ch2_3_manage.1676801460.txt.gz · Last modified: 2023/02/19 03:11 by admin