Jump to content

LAMBDA seems to crap out when stepping through LISP Code


Bill Tillman

Recommended Posts

I'm using this neat little function that Lee-Mac posted in the AutoDesk forum a few weeks ago:

(defun numpos ( str )
   (if (wcmatch str "*#*")
       (- (strlen str) (length (vl-member-if '(lambda ( x ) (< 47 x 58)) (vl-string->list str))))
   )
)

 

It works great but I'm having some other troubles with another part of my code so I toggled a break point and started stepping through the code to debug it. The trouble now is when it hits this code it all comes to a screeching halt and brings up a new window in the LISP IDE called "Source #4" with this in it:

;;; Copied to window at 9:40 AM 5/20/14

(LAMBDA (X) (< 47 X 58))

;;; End of text

LAMBDA is still something I'm very weak with so I don't fully understand what's happening. Any further attempts to use the F8 key to continue causes a new "Source #5....#6....etc) window to open up with the same text in it and the code just halts. If I click on the green arrow to continue it will go on, but I no longer get to step through the code to see what's happening. Run the code without the breakpoint allows it to run without this Window #4... etc. I found a post from almost a year ago where this was addressed but I don't think it was ever resolved.

Link to comment
Share on other sites

It does appear that LAMBDA is the culprit in this. Can anyone recommend a substitute for Lee-Mac's code....I will be very glad to use LAMBDA but not until I can get the code debugged and with LAMBDA all attempts to step through it are failing. I did at least have one of the modules write some of the variables to a text file before the LAMBDA code runs and I can now at least confirm that the variables I'm having trouble with are correct. It's just the other section of the code is not behaving as anticipated and unless I can step through it, I really can't find out what's going wrong.

 

UPDATE: The text file process helped me find out what was going wrong. So my debug mission is accomplished. Now if anyone can shed some light on LAMBDA and debugging I'd be very glad to hear about it.

Link to comment
Share on other sites

I don't know what causes the problem, but lambda is just a way to create a function without defining one. Perhaps the problem has to to with the way it interacts with the vl... extended functions? If you need to get around it, perhaps you can just define a named function.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...