MP, I'm sorry, that's way beyond me.
Sorry, trying to help, not confuse.
Do all possible numbers need entering into the list-I can't believe that would be the case?
No, I showed you how to use the function (which is supposed to make your life easier). Despite the fact that said function is overkill given the typical data being numbers as strings "starting from 1 up to about 600" as you put it, I'll try to explain for completeness' sake.
Let's say the string you wish to test is "123". If it can be converted to a number you want to use it in a calculation, say multiply it by 2, returning the result to the caller, otherwise you want to tell the user the string could not be coerced to a number and return nil to the caller.
(progn
(setq str "123")
(if (setq num (_DistOf str))
(* 2 num)
(progn (princ (strcat "String \"" str "\" cannot be coerced to a number.")) nil)
)
)
==> 246
Now try it again but pass string "ABC".
(progn
(setq str "ABC")
(if (setq num (_DistOf str))
(* 2 num)
(progn (princ (strcat "String \"" str "\" cannot be coerced to a number.")) nil)
)
)
==> String "ABC" cannot be coerced to a number.nil
Put one more way ... using your own example from later in the thread:
Instead of this:
(IF (numberp (READ txt))
(SETQ txt2 (ATOI txt))
)
All you would have to do is this:
(if (setq num (_DistOf txt))
(Do_Something_With_Num num)
)
PS: Using a variable named txt2 to represent a numerical value isn't advisable from a documentation perspective.
If so that would rule out its use here (it would leaving me needing to create a random? list up to 1000).
Sorry but you completely lost me.
I can find evidence that VL-SOME is an autolisp function, but nothing to suggest what it might do.
It's in the AutoLISP Reference:
Checks whether the predicate (the test) is not nil for (at least) one element combination.In layman's terms it means the function will return true (and immediately stop processing) if one of the list items produces a non nil result when used in the test function, otherwise it will return nil.
What do FIXED and RESULT need to be set to?
"You" don't need to set them to anything, they are variables local to the _DistOf function, and are set / used by same.
How do distof, x, and base get generated? I assume one of them is the test string?
Same as preceding comment.
HTH.