Message 1 of 42
APPLY function problem/strangeness...
Not applicable
01-05-2000
03:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Amigos,
I've come across the following AutoLISP strangeness/inconsistency in
R14.01 and ADT2, and I was wondering if any of you could
confirm/duplicate this behavior. Or perhaps clue me in as to if/where
this has been discussed before.
I noticed it whilst trying to program a check on a list of strings to
verify that no member is equivalent to "0" - but it seems that the
problem lies on a deeper level than that.
Here is a snip of my original function, which is supposed to take a
string like "FR10.0/15.0", split it up, then check to make sure it is
formatted correctly. [The function STD-STRTOK splits up a string (in
this case *FSM_STR*) based on a supplied delimeter (in this case the
"/"), and returns a list containing the substrings... IOW, (STD-STRTOK
"10.0/15.0" "/") -> ("10.0" "15.0")] :
(apply 'not (mapcar 'zerop (mapcar 'atof (STD-STRTOK (substr *FSM_STR*
3) "/"))))))
Perhaps there is a much better way to do this, but my point is that
entire construct is throwing out some strange error messages...
IOW, given any list:, I can't get:
(apply 'not)
to work in either R14.01 or ADT2
However, if I use 'null, instead, as in:
(apply 'null)
this DOES work in R14.01 - but NOT in ADT2. (?!)
I thought that just in case the STDLIB functions might *possibly* have
something to do with this, I decided to try it without them loaded up.
As you can see below, this made no difference.
Here are two snips from my command line
(Tried immediately after starting fresh sessions of AutoCAD):
----------------------------------------------------------------
R14.01 Command Line output:
...
Command: ARX
?/Load/Unload/Commands/Options: ?
Loaded Runtime Extension Programs:
acadapp.arx
acmted.arx
autocell.arx
doslib14.arx
livetext.arx
oleaprot.arx
qpik14.arx
toolr14.arx
End of List.
Command: (apply 'NOT '(1 2 3 4 5))
error: too many arguments
(NOT (<> 1) (<> 2) (<> 3)
(<>
#28f3e40> 4) (<> 5))
(APPLY (QUOTE NOT) (QUOTE (1 2 3 4 5)))
*Cancel*
Command: (apply 'NOT (list 1 2 3 4 5))
error: too many arguments
(NOT (<> 1) (<> 2) (<> 3)
(<>
#28f3e40> 4) (<> 5))
(APPLY (QUOTE NOT) (LIST 1 2 3 4 5))
*Cancel*
Command: (apply 'NULL '(1 2 3 4 5))
nil
Command: (apply 'NULL '(nil nil nil nil nil))
T
Command: (apply 'AND '(1 2 3 4 5))
T
Command: (apply 'AND '(1 NIL 3 4 5))
nil
Command: (apply 'OR '(1 NIL 3 4 5))
T
Command: (apply 'OR '(NIL NIL NIL NIL NLI))
nil
----------------------------------------------------------------
ADT2 Command Line output:
...
Command: arx
Enter an option [?/Load/Unload/Commands/Options]: ?
Loaded Runtime Extension Programs:
acadapp.arx - MDI Aware.
acdim.arx - MDI Aware.
aceplotx.arx - MDI Aware.
acetutil.arx - MDI Aware.
achapi15.dbx - MDI Aware.
achlnkui.arx - MDI Aware.
aecstartup.arx - MDI Aware.
appload.arx - MDI Aware.
doslib2k.arx - MDI Aware.
modemacro.arx - MDI Aware.
oleaprot.arx - MDI Aware.
qpik15.arx - MDI Aware.
stdlib15.arx - MDI Aware.
vl.arx - MDI Aware.
End of List.
Command: arx
Enter an option [?/Load/Unload/Commands/Options]: u
Enter ARX/DBX file name to unload: stdlib15.arx
stdlib15.arx successfully unloaded.
Command: (apply 'NOT '(1 2 3 4 5))
; error: too many arguments
Command: (apply 'NOT (list 1 2 3 4 5))
; error: too many arguments
Command: (apply 'NULL '(1 2 3 4 5))
; error: too many arguments
Command: (apply 'NULL '(nil nil nil nil nil))
; error: too many arguments
Command: (apply 'AND '(1 2 3 4 5))
T
Command: (apply 'AND '(1 nil 3 4 5))
nil
Command: (apply 'OR '(1 nil 3 4 5))
T
Command: (apply 'OR '(nil nil nil nil nil))
nil
----------------------------------------------------------------
This is really weird; (apply 'and... , as well as (apply 'or... ,
both work as I would expect, but not (apply 'not... [as well as (apply
'null... in ADT2)]
BTW, my 'puter OS is WinNT4.0 SP4, FWIW, and I'm using a plenty good
machine w/ plenty o' memory for this paltry exercise.
So, first of all, can anyone duplicate/very this behavior?
Is it possible that the problem could be related to one of the other
third party programs I'm using?
(I truly hope that this isn't the case.) Perhaps NOT (and NULL) have
been setq redefined somehow/somewhere? [I'm 99.999% certain my own
programs have not done this.]
If this is indeed an AutoCAD/AutoLISP bug, does anyone have a good
simple workaround for this?
Sorry for the long post, but I hope I have explained this sufficiently
well.
Appreciative of any assistance/feedback tracking down this problemo,
David Kozina>>>>>>>>>>
I've come across the following AutoLISP strangeness/inconsistency in
R14.01 and ADT2, and I was wondering if any of you could
confirm/duplicate this behavior. Or perhaps clue me in as to if/where
this has been discussed before.
I noticed it whilst trying to program a check on a list of strings to
verify that no member is equivalent to "0" - but it seems that the
problem lies on a deeper level than that.
Here is a snip of my original function, which is supposed to take a
string like "FR10.0/15.0", split it up, then check to make sure it is
formatted correctly. [The function STD-STRTOK splits up a string (in
this case *FSM_STR*) based on a supplied delimeter (in this case the
"/"), and returns a list containing the substrings... IOW, (STD-STRTOK
"10.0/15.0" "/") -> ("10.0" "15.0")] :
(apply 'not (mapcar 'zerop (mapcar 'atof (STD-STRTOK (substr *FSM_STR*
3) "/"))))))
Perhaps there is a much better way to do this, but my point is that
entire construct is throwing out some strange error messages...
IOW, given any list:
(apply 'not
to work in either R14.01 or ADT2
However, if I use 'null, instead, as in:
(apply 'null
this DOES work in R14.01 - but NOT in ADT2. (?!)
I thought that just in case the STDLIB functions might *possibly* have
something to do with this, I decided to try it without them loaded up.
As you can see below, this made no difference.
Here are two snips from my command line
(Tried immediately after starting fresh sessions of AutoCAD):
----------------------------------------------------------------
R14.01 Command Line output:
...
Command: ARX
?/Load/Unload/Commands/Options: ?
Loaded Runtime Extension Programs:
acadapp.arx
acmted.arx
autocell.arx
doslib14.arx
livetext.arx
oleaprot.arx
qpik14.arx
toolr14.arx
End of List.
Command: (apply 'NOT '(1 2 3 4 5))
error: too many arguments
(NOT (<> 1) (<> 2) (<> 3)
(<>
#28f3e40> 4) (<> 5))
(APPLY (QUOTE NOT) (QUOTE (1 2 3 4 5)))
*Cancel*
Command: (apply 'NOT (list 1 2 3 4 5))
error: too many arguments
(NOT (<> 1) (<> 2) (<> 3)
(<>
#28f3e40> 4) (<> 5))
(APPLY (QUOTE NOT) (LIST 1 2 3 4 5))
*Cancel*
Command: (apply 'NULL '(1 2 3 4 5))
nil
Command: (apply 'NULL '(nil nil nil nil nil))
T
Command: (apply 'AND '(1 2 3 4 5))
T
Command: (apply 'AND '(1 NIL 3 4 5))
nil
Command: (apply 'OR '(1 NIL 3 4 5))
T
Command: (apply 'OR '(NIL NIL NIL NIL NLI))
nil
----------------------------------------------------------------
ADT2 Command Line output:
...
Command: arx
Enter an option [?/Load/Unload/Commands/Options]: ?
Loaded Runtime Extension Programs:
acadapp.arx - MDI Aware.
acdim.arx - MDI Aware.
aceplotx.arx - MDI Aware.
acetutil.arx - MDI Aware.
achapi15.dbx - MDI Aware.
achlnkui.arx - MDI Aware.
aecstartup.arx - MDI Aware.
appload.arx - MDI Aware.
doslib2k.arx - MDI Aware.
modemacro.arx - MDI Aware.
oleaprot.arx - MDI Aware.
qpik15.arx - MDI Aware.
stdlib15.arx - MDI Aware.
vl.arx - MDI Aware.
End of List.
Command: arx
Enter an option [?/Load/Unload/Commands/Options]: u
Enter ARX/DBX file name to unload: stdlib15.arx
stdlib15.arx successfully unloaded.
Command: (apply 'NOT '(1 2 3 4 5))
; error: too many arguments
Command: (apply 'NOT (list 1 2 3 4 5))
; error: too many arguments
Command: (apply 'NULL '(1 2 3 4 5))
; error: too many arguments
Command: (apply 'NULL '(nil nil nil nil nil))
; error: too many arguments
Command: (apply 'AND '(1 2 3 4 5))
T
Command: (apply 'AND '(1 nil 3 4 5))
nil
Command: (apply 'OR '(1 nil 3 4 5))
T
Command: (apply 'OR '(nil nil nil nil nil))
nil
----------------------------------------------------------------
This is really weird; (apply 'and... , as well as (apply 'or... ,
both work as I would expect, but not (apply 'not... [as well as (apply
'null... in ADT2)]
BTW, my 'puter OS is WinNT4.0 SP4, FWIW, and I'm using a plenty good
machine w/ plenty o' memory for this paltry exercise.
So, first of all, can anyone duplicate/very this behavior?
Is it possible that the problem could be related to one of the other
third party programs I'm using?
(I truly hope that this isn't the case.) Perhaps NOT (and NULL) have
been setq redefined somehow/somewhere? [I'm 99.999% certain my own
programs have not done this.]
If this is indeed an AutoCAD/AutoLISP bug, does anyone have a good
simple workaround for this?
Sorry for the long post, but I hope I have explained this sufficiently
well.
Appreciative of any assistance/feedback tracking down this problemo,
David Kozina>>>>>>>>>>