Anonymous user
Apply a callback to an array: Difference between revisions
m
no edit summary
(Undo revision 8029 by Special:Contributions/TucRup (User talk:TucRup)) |
mNo edit summary |
||
Line 4:
'''Tested With:'''
* [[Gnat GPL 2005]]
** Amd-64bit-3500
with Ada.Text_Io;
Line 93:
{
int i;
for(i = 0; i < len; i
{
callback(i, array[i]);
Line 116:
'''Platform:''' [[.NET]]
'''Language Version:''' 2.0
'''Compiler:''' [[Visual C sharp|Visual C#]] 2005
Line 155:
}
==[[C plus plus|C
[[Category:C plus plus]]
'''Compiler:''' [[GNU Compiler Collection]] 4.1.1
Line 171:
int ary[]={1,2,3,4,5};
//stl for_each
std::for_each(ary,ary
return 0;
}
Line 230:
vector<int> ary(10);
int i = 0;
for_each(ary.begin(), ary.end(), _1 =
transform(ary.begin(), ary.end(), ostream_iterator<int>(cout, " "), _1 * _1); // square and output
Line 267:
(defvar *a* (vector 1 2 3))
(map-into *a* #'1
==[[E]]==
Line 301:
: map ( addr n fn -- )
-rot cells bounds do i @ over execute i ! cell
Example usage:
create data 1 , 2 , 3 , 4 , 5 ,
data 5 ' 1
==[[Fortran]]==
Line 332:
{square * . [id, id]}
|