#Python code
#wow this makes me want the qw() function in PERL :P
unknownWords = [
"mutable",
"immutable",
"mutex",
"semaphore",
"intractable",
"instantiate",
"P=NP?",
"object oriented",
"functional",
"parallel",
"unit test",
"procedural",
"imperative",
"concurrent",
"thread pool",
"polymorphism",
"object code",
"fibonacci",
"data structure",
"pragmatics",
"associative array",
"matrix",
"obfuscation",
"abstraction",
"inheritence",
"anti-patterns",
"agile",
"recursion",
"deterministic",
"nondeterministic",
"lambda",
"semantics",
"boilerplate",
"list comprehension",
"sigil",
"closures",
"iterators",
]
#Building such a list is tedious work indeed! Imagine, if you could have simply highlighted the words on your browser and have them added to the list automatically!!! This can be done, and will be possible in WikiWYSIWYG hence, our first requirement!
requirements = ['The user shall be able to harvest unknown words on the web and obtain a well formatted list of these words in the language of his choice (C, python, PERL, Java, etc.)']
#This is a requirement because WikiWYSIWYG allows the user to tell us how he/she wants to learn and he/she cannot do so until he/she has defined what he/she doesn't know.
#I must say these pads are the bomb! Too bad "they didn't exist"/"I didn't know about them" until now!
#Here is a list of words for which I know the definition
wordsKnownToJordan = [
"mutable",
"immutable",
"intractable",
"instantiate",
"P=NP?",
"object oriented",
"functional",
"parallel",
"unit test",
"procedural",
"imperative",
"concurrent",
"thread pool",
"polymorphism",
"object code",
"fibonacci",
"data structure",
"matrix",
"obfuscation",
"abstraction",
"inheritence",
"agile",
"recursion",
"deterministic",
"nondeterministic",
"lambda",
"semantics",
"list comprehension",
"iterators",
]
#I simply copy-pasted your list and removed the words which I was unable to mentally describe.
#Suppose I wanted to start my own list of unknow words. Can you write a python function that would take 2 lists as arguments and return a list containing the difference between them?
#You don't need to write this function, just answer yes or no :)
#Well there are 2 ways to go about that function, first you could directly paste the lists into the code such as we've done here or you could set it to accept text files from a folder or such. Off the top of my head without going to google and digging into some examples I couldn't sit here and spill out the code to compare two lists. I'm wondering if this would require use of the zip() function.
#Here is my first attempt (maybe the syntax is not exact, I'll check it out.
from sets import Set
def listDiff(list1, list2):
half_result1 = Set([word for word in list1 if word not in list2])
half_result2 = Set([word for word in list2 if word not in list1])
diffList = half_result1 | half_result2
return diffList
#need to return the union of these half results, zip() function won't help us here
#Calling this function with the lists above will show you which words I removed
listDiff(unknownWords, wordsKnownToJordan)
#this leaves us with the following list:
wordsNeitherKnow[
'boilerplate',
'anti-patterns',
'associative array',
'sigil',
'closures',
'mutex',
'semaphore',
'pragmatics'
]