basix_doc 0.1
chain_test.cpp
/******************************************************************************
* MODULE     : chain_test.cc
* DESCRIPTION: Test chains
* COPYRIGHT  : (C) 2006  Joris van der Hoeven
*******************************************************************************
* This software falls under the GNU general public license and comes WITHOUT
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
* If you don't have this file, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/

#include <basix/chain.hpp>

using namespace mmx;

int
main () {
  chain<int> x (1, 2, 3);
  chain<int> y (seq (1, 5));
  chain<int> z= x*y;
  mmout << "x\t= " << x << "\n";
  mmout << "y\t= " << y << "\n";
  mmout << "car(x)\t= " << car (x) << "\n";
  mmout << "cAr(x)\t= " << cAr (x) << "\n";
  mmout << "cdr(x)\t= " << cdr (x) << "\n";
  mmout << "cDr(x)\t= " << cDr (x) << "\n";
  mmout << "z=x*y\t= " << x*y << "\n";
  mmout << "x*y*x*y\t= " << x*y*x*y << "\n";
  mmout << "z^2\t= " << z*z << "\n";
  mmout << "z^3\t= " << z*z*z << "\n";
  mmout << "z^4\t= " << z*z*z*z << "\n";
  mmout << "z^5\t= " << z*z*z*z*z << "\n";
  mmout << "z^6\t= " << z*z*z*z*z*z << "\n";
  mmout << "z*\t= " << reverse (z) << "\n";
  mmout << "z(2,4)\t= " << range (z, 2, 4) << "\n";
  mmout << "x==x\t= " << (x == x) << "\n";    
  mmout << "x==y\t= " << (x == y) << "\n";
  mmout << "x!=y\t= " << (x != y) << "\n";
  mmout << "x*y==y*x\t= " << (x*y == y*x) << "\n";
  mmout << "x...\t= " << iterate (x) << "\n";
  return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines