FazBear Posted May 20, 2009 Share Posted May 20, 2009 Hi All Is it possible to end a lisp at any point of the result of an if is false? i.e. (if (= 1 1) (do this) (else end defun)) Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted May 20, 2009 Share Posted May 20, 2009 You could use the (exit) function. Quote Link to comment Share on other sites More sharing options...
FazBear Posted May 20, 2009 Author Share Posted May 20, 2009 Ah so thats what exit does :S Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 20, 2009 Share Posted May 20, 2009 IMO, I only use (exit) if I really have to - I try to write the program so that if something is false, then the rest of the program does not execute and just completes without forcing an error. I am not sure what the consensus is on this, but thats my $0.02 Quote Link to comment Share on other sites More sharing options...
Freerefill Posted May 20, 2009 Share Posted May 20, 2009 That's the classy way to do it, Lee. But, like so many things, there are a dozen (or two dozen) different ways of accomplishing the same task. I'd personally agree with you, I like having absolute control over where the data is flowing. That way, if something goes wrong, it's that much easier to track and fix. Then again, maybe I'd like to be absolutely certain that if something occurs, the function stops. I think it harkens back to the BASIC code, where programmers would use "GOTO" in place of a While loop, and an If statement to "GOTO" somewhere outside the loop to end it. I can't imagine ever needed to force an escape, but then again, I'd never imagine using a (grread) loop to dynamically capture and analyze user input data using a single prompt that gets altered based on user input. *whistles innocently* Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 20, 2009 Share Posted May 20, 2009 I can't imagine ever needed to force an escape, but then again, I'd never imagine using a (grread) loop to dynamically capture and analyze user input data using a single prompt that gets altered based on user input. *whistles innocently* I'd echo your opinions ** you and your grread fetish ** Quote Link to comment Share on other sites More sharing options...
Freerefill Posted May 20, 2009 Share Posted May 20, 2009 I'd echo your opinions ** you and your grread fetish ** Hey, you just wait. I've got something cooking and it's shaping up to be pretty sweet. Might take some time but it's looking real good. Quote Link to comment Share on other sites More sharing options...
Commandobill Posted May 20, 2009 Share Posted May 20, 2009 Hey, you just wait. I've got something cooking and it's shaping up to be pretty sweet. Might take some time but it's looking real good. cookies? Quote Link to comment Share on other sites More sharing options...
Freerefill Posted May 20, 2009 Share Posted May 20, 2009 cookies? None for you. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 20, 2009 Share Posted May 20, 2009 Hey, you just wait. I've got something cooking and it's shaping up to be pretty sweet. Might take some time but it's looking real good. I look forward to it Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted May 20, 2009 Share Posted May 20, 2009 IMO, I only use (exit) if I really have to I agree, but I was specifically answering this question: Is it possible to end a lisp at any point... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 20, 2009 Share Posted May 20, 2009 I agree, but I was specifically answering this question: I would have also answered in the same way - I just wanted a consensus on its usage Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.