Not even sure what terms would describe what I'm looking for, but the general idea:
Given a list of strings of a finite length, determine whether or not a test string belongs to the list. Then, produce a new list of strings containing the difference of the original list and the test string.
In pseudocode, this would probably look something like:
def list = envelope(["string1", "string2", "string3"])
def validate( collection, test ) {
if ( contains( collection, test ) ) {
return remove( collection, test )
} else {
throw Exception
}
}
// In Use
validate( list, "string2")
-> envelope( ["string1", "string3"] )
validate( list, "string4")
-> Exception
One person told me this sounded like the way a blockchain works, but given everything I've read and my rudimentary understanding of blockchain, I'm skeptical. Is there another process or protocol available that I can use to make the above function?