Another Word For It Patrick Durusau on Topic Maps and Semantic Diversity

April 20, 2012

Functional thinking: Functional design patterns, Part 1 (and Part 2)

Filed under: Church,Functional Programming — Patrick Durusau @ 6:26 pm

Functional thinking: Functional design patterns, Part 1: How patterns manifest in the functional world

Neal Ford writes:

Some contingents in the functional world claim that the concept of the design pattern is flawed and isn’t needed in functional programming. A case can be made for that view under a narrow definition of pattern — but that’s an argument more about semantics than use. The concept of a design pattern — a named, cataloged solution to a common problem — is alive and well. However, patterns sometimes take different guises under different paradigms. Because the building blocks and approaches to problems are different in the functional world, some of the traditional Gang of Four patterns (see Resources) disappear, while others preserve the problem but solve it radically differently. This installment and the next investigate some traditional design patterns and rethink them in a functional way.

In the functional-programming world, traditional design patterns generally manifest in one of three ways:

  • The pattern is absorbed by the language.
  • The pattern solution still exists in the functional paradigm, but the implementation details differ.
  • The solution is implemented using capabilities other languages or paradigms lack. (For example, many solutions that use metaprogramming are clean and elegant — and they’re not possible in Java.)

I’ll investigate these three cases in turn, starting in this installment with some familiar patterns, most of which are wholly or partially subsumed by modern languages.

Neal continues this series in: Functional thinking: Functional design patterns, Part 2

In the lead-in Neal says:

… patterns sometimes take different guises under different paradigms.

What? Expression of patterns vary from programming language to programming language?

Does that mean if I could trace patterns from one language to another that I might have greater insight into the use of patterns across languages?

Not having to relearn a pattern or its characteristics?

Does that sound like a net win?

If it does, consider topic maps as one path to that net win.

April 13, 2012

Probabilistic Programming

Filed under: Church,Probabilistic Programming — Patrick Durusau @ 4:40 pm

Probabilistic Programming by Deniz Yuret.

From the post:

The probabilistic programming language Church brings together two of my favorite subjects: Scheme and Probability. I highly recommend this tutorial to graduate students interested in machine learning and statistical inference. The tutorial explains probabilistic inference through programming starting from simple generative models with biased coins and dice leading up to hierarchical, non-parametric, recursive and nested models. Even at the undergraduate level, I have long thought probability and statistics should be taught in an integrated manner instead of their current almost independent treatment. One roadblock is that even the simplest statistical inference (e.g. three tosses of a coin with an unknown (uniformly distributed) weight results in H, H, T; what is the fourth toss?) requires some calculus at the undergraduate level. Using a programming language like Church may allow an instructor to introduce basic concepts without students getting confused about the details of integration.

Good pointers on probabilistic programming resources. Enjoy!

Powered by WordPress