Boost logo

Boost Users :

Subject: [Boost-users] lisp like operetor collection on well kown C++ data structure
From: Niitsuma Hirotaka (hirotaka.niitsuma_at_[hidden])
Date: 2012-10-02 15:25:57


I wrote
scm2cpp.hpp
https://github.com/niitsuma/scm2cpp.hpp/blob/master/scm2cpp.hpp

scm2cpp.hpp is
lisp like operetor collection on well kown C++ data structure

lisp function

car cdr cons list-ref set-car! .. etc

can use for

std::vector
std::list
boost::ptr_list
boost::fusion::list

and std::pair is regard as cons

example usage
https://github.com/niitsuma/scm2cpp.hpp/blob/master/usage.cpp
https://github.com/niitsuma/scm2cpp.hpp/blob/master/list-test.cpp

Also
eq? eqv? equal? quote symbol
functions are implemented.

plz see usege
https://github.com/niitsuma/scm2cpp.hpp/blob/master/equal-test.cpp

eq? function implimeted as direct addrest comparison

template<typename T>
bool is_eq(T & x, T & y)
{return (&x)==(&y);}

thus

cons(T, std::list<T>)

becomes

boost::ptr_list<T>

All lisp like operator keep same address for same object.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net