After so many years of Java development, functional programming (is not just code), but a different approach to designing and implementing code.
I’m working on a side project, and need to check if some specific keywords are in some subjects. Here is the (the first draft) of the code which identifies keywords in topics:
subject_topics = [“oval beetle which is need of total restoration”, “oh no not another advert title”, “this is not imagination”]
keywords = [‘oval’, ‘keyword’, ‘another’]
contains_subject = map(lambda each_keyword:
map(lambda each_topic: each_topic.count(each_keyword), subject_topics),
contains_subject = [[1, 0, 0], [0, 0, 0], [0, 1, 0]]
The “1” show that oval and another have been found in the subject_topics.