If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Thursday, April 12, 2012

Where XQuery meets XSLT2.0

Goal: Return input element whose @value should be set to current date formatted as [yyyy-MM-dd]

Problem: Xquery misses good support for formatting dates but offers current-date() function

Resolution: Use XSLT to postprocess custom XML tags (instructions) in own namespace

XQuery snippet:

XSLT to postprocess xquery result:

Wednesday, April 4, 2012

Using breadth-first-search to solve dynamic programming problem

The previous implementation was using depth-first-search and might be improved by switching to breadth-first-search.

Dynamic Programming to the rescue

In my previous blog post I crafted a solution together that created a graph of all possible paths starting from the initial node. Next I filtered out the ones not ending at the goal node. For the paths that were left over I finally calculated the total path cost. As the number of lanes increases you will see that the number of possible paths grows exponentially and my previous code will run into timeouts.

So now i present the same solution but drastically improved using dynamic programming.

Tuesday, April 3, 2012

Practising Python skills

I recently followed 2 courses from Udacity:
  • CS101: Building a search engine
  • CS373: Programming a robotic car

Both courses used Python as programming language and I have to admit that it has a low-barrier to get started. I'm currently thinking about a programming assignment which can be solved in a number of ways:

  • Dynamic programming
  • A*
  • ...

For the time being here is some experimental code that will be heavily due to changes ;-)