Two weeks later, on deadline day…
I think I defeated the XQuery assignment. It took the best part of a week, guessing at around 18 hours, but my 485 lines of code handle everything I can think of that was within the spec of the assignment. It was loads of fun handling transformations from various combinations of sequences, choices, star-expressions, minOccurs and maxOccurs in an element to a XML description of regular expressions, as well as implementing a combinations generator and a function to filter out unique elements in a sequence of elements.
I’m sure all that stuff with a functional lean is pretty old hat to someone who’s a Python, Erlang, F# or Haskell guru, but for little ol’ me with my OO background, it was pretty painful to swap my thinking over to immutable variables (which I’m sure is a contradiction in terms!), a complete inability to track state and just plain indulgence in recursion.
In short, it was brilliant. Exactly what I’m here for, to get out of my ‘comfort zone’ and learn new ways of thinking. Continue reading “Semi-Structured Data and the Web – Day 5.5″