0 Members and 1 Guest are viewing this topic.
Quote from: DuanJinHui on July 19, 2015, 11:01:51 AMQuote from: Lee Mac on July 18, 2015, 06:35:28 AM...or pass the function two quoted symbols to which the values will be assigned:Code - Auto/Visual Lisp: [Select](defun get_time ( outsym1 outsym2 ) (if (set outsym1 (LM:internettime "YYYYMODD")) (set outsym2 (dtoj (atoi (eval outsym1)))) (progn (set outsym1 (itoa (fix (getvar 'cdate)))) (set outsym2 (fix (getvar 'date))) ) ) nil)Lee, Why use "set" rather than "setq" ?Because I require both arguments supplied to the set function to be evaluated: the first argument yields the symbol to which the value should be assigned (that is, the quoted symbol supplied as an argument to the 'get_time' function); the second argument yields the value (as per setq). If setq were used, the first argument would not be evaluated and the corresponding value would be assigned to the 'outsym1' or 'outsym2' symbols.Observe:Code - Auto/Visual Lisp: [Select]_$ (setq a 'b)B_$ (set a 1)1_$ aB_$ b1
Quote from: Lee Mac on July 18, 2015, 06:35:28 AM...or pass the function two quoted symbols to which the values will be assigned:Code - Auto/Visual Lisp: [Select](defun get_time ( outsym1 outsym2 ) (if (set outsym1 (LM:internettime "YYYYMODD")) (set outsym2 (dtoj (atoi (eval outsym1)))) (progn (set outsym1 (itoa (fix (getvar 'cdate)))) (set outsym2 (fix (getvar 'date))) ) ) nil)Lee, Why use "set" rather than "setq" ?
...or pass the function two quoted symbols to which the values will be assigned:Code - Auto/Visual Lisp: [Select](defun get_time ( outsym1 outsym2 ) (if (set outsym1 (LM:internettime "YYYYMODD")) (set outsym2 (dtoj (atoi (eval outsym1)))) (progn (set outsym1 (itoa (fix (getvar 'cdate)))) (set outsym2 (fix (getvar 'date))) ) ) nil)