[Haskell-beginners] print all days of calendar
kane96 at gmx.de
kane96 at gmx.de
Mon Dec 21 11:39:49 EST 2009
-------- Original-Nachricht --------
> Datum: Mon, 21 Dec 2009 17:22:18 +0100
> Von: Daniel Fischer <daniel.is.fischer at web.de>
> An: beginners at haskell.org
> CC: kane96 at gmx.de
> Betreff: Re: [Haskell-beginners] print all days of calendar
> Am Montag 21 Dezember 2009 17:04:56 schrieb kane96 at gmx.de:
> > -------- Original-Nachricht --------
> >
> > > Datum: Mon, 21 Dec 2009 11:53:02 +0100
> > > Von: Daniel Fischer <daniel.is.fischer at web.de>
> > > An: beginners at haskell.org
> > > CC: kane96 at gmx.de
> > > Betreff: Re: [Haskell-beginners] print all days of calendar
> > >
> > > Am Montag 21 Dezember 2009 11:38:14 schrieb kane96 at gmx.de:
> > > > Which function can I use to trim the calendar of a month from the
> > >
> > > calendar
> > >
> > > > of the whole year, because I have to implement a function: getMonth
> ::
> > > > Month -> Calendar -> Calendar
> > >
> > > look at filter or span and break, takeWhile/dropWhile
> >
> > Dont't find any good examples of this functions that can help me. I
> think
> > it have to be somethink like that, but don't find a way that works:
> > getMonth :: Month -> Calendar -> Calendar
> > getMonth month year = filter ([1..31],month,year) (calendar year)
>
> Prelude> :t filter
> filter :: (a -> Bool) -> [a] -> [a]
>
> So we need a predicate on the type of list elements.
>
> getMonth month cal = filter predicate cal
> where
> predicate (d,m,y) = ??
it has to match the given month and year. But don't know how to define it.
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the Beginners
mailing list