How can, lisp A provide user input to lisp B that it is calling? Thank You.
Are you really asking about *user* input, or do you simply want to pass arguments? If B is defined to accept arguments, then you just pass their values in the call from A: (defun B (arg1 arg2) ... ) (defun A ( ) ... (B val1 val2) ... ) ___ You.
Or, make use of 'global' nature of Lisp. File a: (setq Z "123") File b: (if (= Z "123") (do it) (don't do it) ); end if (setq Z nil) Bob
lispB should: (defun function ( input1 input2 input3) (perform_useful_operation) ) and (defun c:function () (function(get_input_from_user)(get_input_from_user)(get_input_from_user))) other functions can call 'function users can call 'c:function at the command line if you dont want to, or cant modify lispB, you could always interupt the getXXXX functions. simply, (defun newfunc() (setq old_getstring getstring) (defun getstring() "INPUT" ) (c:function) (setq getstring old_getstring) ) but its not that simple you have to know the number of times the interupted function is being called and with what number of arguments. you have to handle errors to be sure the original function is restored i have a function (interupt function args interuption continue followup) that easily redefines functions and restores the original after its been called a certain number of times. it performs the interuption and then possibly performs the original function and then possibly performs a follow up sequence before returning the required value. it comes in handy every once in a while mostly for debugging and hacking. it would be easier to just modify your lispB as shown above You.
I guess this is more difficult than I should make it but there are two lisp. xxx.lsp and mycustom.lsp I have a lengthy lisp (xxx.lsp) that is isolated in it's own file. It has a lot of arguments more than 10. Instead of asking 5 user inputs. I was wondering about the easiest way to create a lisp that will walk through a few typical inputs. I am typically able to write simple lisp that can traverse through other commands but when calling (c:xxx) it does not work. So basically I'm wondering how I can write a simple lisp to traverse through a more complicated lisp located in a different file.
AFAIK, there's no way to make one lisp respond to another interactively. You may be able to do something close to what you want with a script, however. Another thought: if most of the inputs are sufficiently constant to be "fed" from another piece of code, why not just hard-code those values into your "lengthy" application in the first place? ___ through a more complicated lisp located in a different file.
You could replace all your (getxxx ) prompts in your complicated lisp with variables that could be supplied from a calling lisp. Say your complicated lisp did something like (defun c:xxx ( / a b c ) (setq a (getpoint) b (getstring) c (getreal) ) (process a b c) ) rewrite it something like: (defun xxx ( a b c) (process a b c) ) and write your calling lisp to supply the arguments (defun c:mycustom ( / a b c ) (setq a (getpoint) b (getstring) c (getreal ) ) (xxx a b c ) ) and If you have have multiple "standard" settings you supply to xxx: (defun c:mycustom1 ( / a b c ) (setq a '(1 2 3) b "George" c (getreal) ) (xxx a b c ) ) (defun c:mycustom2 ( / a b c ) (setq a '(2 4 6) b "Bill" c (getreal) ) (xxx a b c ) ) commands but when calling (c:xxx) it does not work. through a more complicated lisp located in a different file.