I wanted to create a list of numbers with missing numbers in a given list as provided in the example below
Existing list { 1,3, 5, 9 , 13, 15}
Resultant list { 2,4,6,7,8,10,11,12,14}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Extended TCL has the function
intersect3which as one of its return values gives a list ofA-B. You could intersect your list with a list of all possible numbers that span your list.If you don’t use Extended TCL, you’ll have to implement something yourself.
I hardly ever use TCL, so maybe there’s a better way, but the basic approach is to just sort the list, then run through it and find the missing values:
Output: