I am new to design pattern and I am trying to learn the strategy pattern. After reading bunch examples here and on oodesign.com, I have a fair understanding of its intent. However, most example I found are in Java, C# or, C/C++; these languages are more structured and force you to have class and such. When it comes to dynamic language like scheme, I have trouble picturing how I could implement such pattern. Could someone show me a example?
Share
One could draw up a more complex example, although there are already great built-in methods native to the language that demonstrate the strategy pattern. This implements the strategy pattern with scheme’s first-class functions:
We process/manipulate the same data, although each time with a different strategy. This is a toy example, so the strategy selection here isn’t very advanced, although by the same token it could be a list, or a lookup table of sorts.