What is `wholemeal` in functional programming?
Asked Answered
H

2

18

Can anybody give a clear explanation? What is a wholemeal programming in functional programming area. All I've found is that wholemeal is a

focusing on entire data structures rather than their elements

but how can it be archived? (Code examples in such languages as Scala or Ocaml are very desirable.)

Hainaut answered 5/8, 2011 at 13:42 Comment(0)
H
13

"Functional languages excel at wholemeal programming, a term coined by Geraint Jones. Wholemeal programming means to think big: work with an entire list, rather than a sequence of elements; develop a solution space, rather than an individual solution; imagine a graph, rather than a single path. The wholemeal approach often offers new insights or provides new perspectives on a given problem. It is nicely complemented by the idea of projective programming: first solve a more general problem, then extract the interesting bits and pieces by transforming the general program into more specialised ones."

I also found this

it helps prevent a disease called "indexitis" and encourages lawful program construction (from "Pearls of Functional Algorithm Design", Richard Bird, 2010)

See also (http://www.comlab.ox.ac.uk/ralf.hinze/publications/ICFP09.pdf)

Holmann answered 5/8, 2011 at 13:44 Comment(3)
Am I correctly understand that this is closely similar to dynamic programming concept?Hainaut
@om: I don't think so. dynamic refers to your overall programming style whereas wholemeal refers to data structures.Holmann
@0A0D "dynamic programming" usually refers to a variant of divide-and-conquer where subproblems overlap, e.g. Levenshtein edit distance.Mattson
T
5

I always found the Hutton/Bird Sudoku solver a good example of wholemeal programming: http://www.cs.nott.ac.uk/~gmh/sudoku.lhs

A fair number of functional pearls (both that in Bird's excellent book that Code Monkey cites and those available here: http://www.haskell.org/haskellwiki/Research_papers/Functional_pearls) will probably also be instructive.

Trichina answered 5/8, 2011 at 18:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.