packages feed

hsc3-lang-0.7: Help/Pattern/pfin.help.lhs

pfin :: P Int -> P a -> P a
pfin_ :: Int -> P a -> P a
ptake :: P Int -> P a -> P a
ptake_ :: P Int -> P a -> P a

  n - number of elements to take
  x - value pattern

Take only the first n elements of the pattern 
into the stream.

> import Sound.SC3.Lang.Pattern

> let p = pseq [1, 2, 3] pinf
> in evalP 0 (pfin 5 p)

There is a variant where the count not a pattern.

> let p = pseq [1, 2, 3] 1
> in evalP 0 (pfin_ 5 p)

Note that pfin does not extend the input pattern,
unlike pser.

> let p = pseq [1, 2, 3] 1
> in evalP 0 (pser [p] 5)