ext/preprocessor/seq/firstn.bi

This file is part of the <ext/Preprocessor> library API, and can be directly included by user programs.

Summary
ext/preprocessor/seq/firstn.biThis file is part of the <ext/Preprocessor> library API, and can be directly included by user programs.
LicenseCopyright © 2007-2011, FreeBASIC Extended Library Development Group Copyright © 2002, Paul Mensonides
Macros
fbextPP_SeqFirstNexpands to a sequence of the first n number of elements of the sequence seq.

License

Copyright © 2007-2011, FreeBASIC Extended Library Development Group Copyright © 2002, Paul Mensonides

Distributed under the Boost Software License, Version 1.0.  See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com/p/fb-extended-lib/wiki/License

Macros

fbextPP_SeqFirstN

# define fbextPP_SeqFirstN(
   n,
   seq
) FBEXT_PP_SEQ_FOLDLEFT( fbextPP_SeqFirstN__M, FBEXT_PP_EMPTY(), FBEXT_PP_CAT(fbextPP_TupleElem__2__0, FBEXT_PP_SEQ_SPLIT(n, seq(__))) )

expands to a sequence of the first n number of elements of the sequence seq.

Example

# include "ext/preprocessor/seq/firstn.bi"
# include "ext/preprocessor/stringize.bi"

# define SEQ (a)(b)(c)(d)

' Expands to "(a)(b)(c)"
# print FBEXT_PP_STRINGIZE(fbextPP_SeqFirstN(3, SEQ))
# define fbextPP_SeqFirstN(
   n,
   seq
) FBEXT_PP_SEQ_FOLDLEFT( fbextPP_SeqFirstN__M, FBEXT_PP_EMPTY(), FBEXT_PP_CAT(fbextPP_TupleElem__2__0, FBEXT_PP_SEQ_SPLIT(n, seq(__))) )
expands to a sequence of the first n number of elements of the sequence seq.