Chris Okasaki, author of Purely Functional Data Structures, writes about functional programming, teaching, puzzle games and data structure design.
Commenters recommend it to programmers generally, call it eclectic and very good, and link it alongside his book.
I think if you find those algorithms obvious and you're able to write memoized solutions, then you already know most of what you need to know about dynamic programming. For example, Dijkstra's algorithm for shortest paths can be seen as DP.
The main thing is to write down a formulation for the answer for n in terms of answers for smaller n, or the answer for (n, k) in terms of answers for smaller (n, k). (And don't worry about how you'd compute them, just focus on getting a correct expression in terms of smaller ones. http://okasaki.blogspot.com/2008/10/score-one-for-induction.html)
It can be tricky to formulate exactly what you're counting / measuring (e.g. what's "k" and what's the quantity you're optimizing for (n, k)), but once you have that, and once you have the recurrence, you can consider it a separate (and independent) step to figure out in which order to compute the values, so that you have each value by the time you need it (i.e. the bottom-up formulation that you said is the tricky part for you).
Beyond that I guess lots of practice with problems… e.g. about a decade ago there used to be weekly(?) TopCoder contests with editorials written later explaining the solutions (and the problems were graded by difficulty and even how many people solved it), and the DPs could get quite tricky. I believe those are still happening, and now there are other resources like LeetCode or whatnot.
Do you have an example of a problem that you struggled with, to see what's…
The syntax is more cumbersome than actually needed. It probably should use mandatory indentation as well. We lovers of curly brackets may not like that, but it makes things easier for beginners.[1] In this case, the first listing would have looked like that:
hello = ^name -> "Hello " + name
repeat {times: 3}
print hello {name: "John"}
Or, without the keyword arguments:
hello = ^name -> "Hello " + name
repeat 3
print hello "John"
(the last line is meant to be a function. Indentation is used instead of ^{}) Note that for a syntax that use juxtaposition for function application, I was very surprised to see that
print hello "John"
== print (hello "John")
!= (print hello) "John"
It looks like a misfeature (doesn't work well with currying), but maybe there's some justification?
(Edit: the language does look very simple, and I like that. Very good for "I'll show you programming in 10 minutes". For that purpose, fixing the syntax would make it even better.)
[1]: http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-indentation-for.html
Many years ago, on Boardgamegeek, there was a game trading system called "Math Trades", where participants would list a number of trades they were willing to make, and they ran some complicated calculations to figure out how to let as many as possible trade.
CS professor Chris Okasaki, known for his book on purely functional data structures, also played board games and he came across this phenomenon. He realized that it could be modelled as a bipartite matching problem, and wrote a MUCH faster program to manage math trades.
https://okasaki.blogspot.com/2008/03/what-heck-is-math-trade.html
I guess it can be made even faster now in theory.
You're very welcome :-)
BTW, if you like the article, even briefly... consider subscribing to his feed. Very interesting, very eclectic. He is the author of "Purely functional data structures" which goes into some depth on high-performance data structures. He also write fun things about games and thinking and...
Oh for Pete's sake stop reading my rambingss and read his well-chosen words instead ;-)
http://okasaki.blogspot.com/
From Okasaki's blog:
Sales were steady but trending downward, until 2004, when a book review by Andrew Cooke appeared on Slashdot. After that, sales doubled and have stayed at that level for several years. Of course, I can't be sure this increase was because of Slashdot, but it seems likely. Thanks, Andrew!
http://okasaki.blogspot.com/2008/02/ten-years-of-purely-functional-data.html
Chris Okasaki has some high praise for languages implementing indentation as part of the syntax http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-indentation-for.html
Personally I think Coffeescript is a big step forward. A pity it will likely never gain enough momentum to see native implementations on the major browsers.