This file is part of the <ext/Preprocessor> library API, and can be directly included by user programs.
ext/ | This file is part of the <ext/Preprocessor> library API, and can be directly included by user programs. |
License | Copyright © 2007-2011, FreeBASIC Extended Library Development Group Copyright © 2002, Paul Mensonides |
Macros | |
fbextPP_SeqFoldRight | Expands a macro returning a new state for each element in a sequence. |
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
# define fbextPP_SeqFoldRight( op, state, seq ) FBEXT_PP_REPEAT(FBEXT_PP_SEQ_SIZE(SEQ), fbextPP_SeqFoldRight__L, op) state FBEXT_PP_SEQ_FOREACHI(fbextPP_SeqFoldRight__R, seq, seq)
Expands a macro returning a new state for each element in a sequence.
op | A procedure macro of the form op(state, elem), where state is the current state, and elem is the current sequence element. This macro should return a new state. |
state | The initial state of the fold. |
seq | A sequence. |
The final state.
Given a sequence (a)(b)(c)(d), this macro will expand to op(op(op(op(state, d), c), b), a).
Expands a macro returning a new state for each element in a sequence.
# define fbextPP_SeqFoldRight( op, state, seq ) FBEXT_PP_REPEAT(FBEXT_PP_SEQ_SIZE(SEQ), fbextPP_SeqFoldRight__L, op) state FBEXT_PP_SEQ_FOREACHI(fbextPP_SeqFoldRight__R, seq, seq)