[fpc-pascal] How can I implement "thrice" in Free Pascal?
Andrew Pennebaker
andrew.pennebaker at gmail.com
Mon Oct 17 22:51:30 CEST 2011
Haskell lets you define functions like thrice, which accepts an element of
type a and returns a list of the element repeated three times, for any data
type a.
thrice :: a -> [a]
thrice x = [x, x, x]
I know the answer involves generics, but the docs don't offer examples using
Free Pascal's built-in generic types.
Cheers,
Andrew Pennebaker
www.yellosoft.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111017/7b41bc14/attachment.html>
More information about the fpc-pascal
mailing list