Clojure function to match nested lists
2 Pages1228 Words149 Views
Added on 2019-09-25
About This Document
In this lab, you will learn how to write a Clojure function called match to match nested lists using keywords and hash maps. The function takes a pattern and a subject as its arguments and returns a hash map if the pattern matches the subject, otherwise it returns nil. The function calls a helper function called matching, which takes three arguments: a hash map called table, along with pattern and subject from match. The function matching does all the work for match and has at least three cases. The first case occurs when pattern is a keyword, the second case is the recursive case, and the last case occurs when neither of the other cases occur. You may use additional helper functions as needed.
Clojure function to match nested lists
Added on 2019-09-25
ShareRelated Documents
End of preview
Want to access all the pages? Upload your documents or become a member.