[fpc-pascal] How can I implement "thrice" in Free Pascal?

Andrew Pennebaker andrew.pennebaker at gmail.com
Tue Oct 18 05:09:37 CEST 2011


Can this be done with arrays? I didn't mean to be too specific; I'd be happy
with any generic collection that could do this.

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Mon, Oct 17, 2011 at 6:08 PM, Marco van de Voort <marcov at stack.nl> wrote:

> In our previous episode, Andrew Pennebaker said:
> > 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.
>
> There is no built in list type, generic or not, and no way to define new
> operators.  All list and collection types are library.  I see no way this
> could work.
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111017/87ce6dbb/attachment.html>


More information about the fpc-pascal mailing list