Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    InteLib 0.6.30

    Download button

    No screenshots available
    Downloads: 683  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Andrey V. Stolyarov | More programs
    GPL / FREE
    May 10th, 2010, 15:27 GMT [view history]
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    InteLib description

    A library of C++ classes which lets you do Lisp programming within your C++ program

    InteLib is a library of C++ classes which lets you do Lisp programming within your C++ program even without any additional preprocessing, without all those calling conventions etc.

    You can write a C++ code (that is, a code which is accepted by your C++ compiler) thinking in a "Lisp mode" and the code you write will look much like Lisp code altough it will be pure C++.

    To give you the essential feeling, the following example is provided.

    (defun isomorphic (tree1 tree2)
    (cond ((atom tree1) (atom tree2))
    ((atom tree2) NIL)
    (t (and (isomorphic (car tree1)
    (car tree2))
    (isomorphic (cdr tree1)
    (cdr tree2))
    ))))


    Just a Lisp function, isn't it? Now look at the following code:

    (L|DEFUN, ISOMORPHIC, (L|TREE1, TREE2),
    (L|COND,
    (L|(L|ATOM, TREE1), (L|ATOM, TREE2)),
    (L|(L|ATOM, TREE2), NIL),
    (L|T, (L|AND,
    (L|ISOMORPHIC, (L|CAR, TREE1),
    (L|CAR, TREE2)),
    (L|ISOMORPHIC, (L|CDR, TREE1),
    (L|CDR, TREE2))
    ))))


    Obviously the code is just the same, the syntax changed a bit, but it's still the same. Well, do I surprise you if I say it is C++ code? If you don't believe, look at the following:

    // File isomorph.cpp
    #include "lisp/lisp.hpp"
    #include "lisp/lsymbol.hpp"
    #include "lfun_std.hpp"

    LSymbol ISOMORPHIC("ISOMORPHIC");

    static LFunctionalSymbol< LFunctionDefun > DEFUN("DEFUN");
    static LFunctionalSymbol< LFunctionCond > COND("COND");
    static LFunctionalSymbol< LFunctionAtom > ATOM("ATOM");
    static LFunctionalSymbol< LFunctionAnd > AND("AND");
    static LFunctionalSymbol< LFunctionCar > CAR("CAR");
    static LFunctionalSymbol< LFunctionCdr > CDR("CDR");

    LListConstructor L;

    void LispInit_isomorphic() {
    static LSymbol TREE1("TREE1");
    static LSymbol TREE2("TREE2");
    ////////////////////////////////////////////////
    //
    (L|DEFUN, ISOMORPHIC, (L|TREE1, TREE2),
    (L|COND,
    (L|(L|ATOM, TREE1), (L|ATOM, TREE2)),
    (L|(L|ATOM, TREE2), NIL),
    (L|T, (L|AND,
    (L|ISOMORPHIC, (L|CAR, TREE1),
    (L|CAR, TREE2)),
    (L|ISOMORPHIC, (L|CDR, TREE1),
    (L|CDR, TREE2))
    )))).Evaluate();
    //
    ////////////////////////////////////////////////
    }
    // end of file


    Well, this code is a complete C++ module and it does compile pretty well. No joke, it's real.

    By the way, don't try to find any use I made out of the macroprocessor. No macros have ever been used by InteLib (except those for conditional compile directives). Instead, just recall that comma is an operator in C++ and can be overloaded for user-invented data types.


    Product's homepage

    What's New in This Release: [ read full changelog ]

    · The version includes an implementation of the Refal computation model significantly reworked by Igor Bronshtein (thanks Igor!).
    · This implementation seems to be notably faster than the previously-existing one.

      


    TAGS:

    Lisp programming | C++ classes library | C++ library | InteLib | Lisp | programming

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM