- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I work in manufacturing, and I'm trying to automate Bill of Materials. I have a list with sublist that represents parts.
(setq PartList (("HM213ST" 22.0 1) ("GF200" 22.0 1) ("E150" 26.0 1) ("E260" 26.0 1)))
Each sublist is formated like so: ([Part number] [length] [Quatity]), so for example of the first part in my list would be:
Part# = HM213ST
Length = 22.0"
Qty = 1
The issue is if my lisp routine wants to add a new part to this list I want to avoid duplicate parts that have the same part number and length.
So how would I accomplish if I want to add a new part ("HM213ST" 22.0 5) to my existing list by:
First look through the sublist of parts and check if "HM213ST" with a length of 22.0,
if it does exist only add my quantity 5 to the caddr qty 1.
so end resault list would look like (("HM213ST" 22.0 6) ("GF200" 22.0 1) ("E150" 26.0 1) ("E260" 26.0 1))
lastly, if it didn't exist append the new part to the end of the PartList list.
Thanks in advance for any help!
Solved! Go to Solution.