[Haskell-cafe] When the unknown is unknown
ajs at 2piix.com
Wed Jun 23 18:04:18 EDT 2010
On Jun 23, 2010, at 1:50 PM, Martin Drautzburg wrote:
> I said that a rhythm is a series of Moments (or Beats), each
> expressed as
> fractions of a bar. But each Moment also has volume. So I could
> model rhythm
> as Pairs of (Moment, Volume). However I certanly do not want to
> specify both
> the Moments and the Volume, but rather compute one from the other.
How about something like:
type RhythmScheme = [(Maybe Moment, Maybe Volume)]
type Rhythm = [(Moment, Volume)]
-- The resolution function will then be a function with type:
rhythm_from_scheme :: RhythmScheme -> Rhythm
-- Though you might want something like
-- rhythm_from_scheme :: RhythmScheme -> IO Rhythm
-- rhythm_from_scheme :: Seed -> RhythmScheme -> Rhythm
-- so that you can get and use random numbers, for example.
I guess the point of my suggestion is to let pattern matching in
function definitions deal with unification of constraints. Beta
reduction and unification are two sides of a coin.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe