Brief introduction
This chapter will showcase lush and its capabilities and features.
1.1 Lush Show
Lush is an object-oriented programming language designed for researchers, experimenters and engineers interested in large-scale numerical computing and graphical applications. Lush is used in scenarios where you want to combine the flexibility of a high-level, weakly-typed interpretive language, the efficiency of a strongly typed, natively compiled language, and the ease with which code written in languages such as C and C + + can be combined.
The benefits of lush are particularly significant in engineering related to interpreted languages such as Python, Perl, Matlab, s+, and even basic, and the use of compiled languages such as C. By using lush, we will get the best parts in the world of interpretive and compiled programming, and eventually merge:
- an interpretive language with a loosely typed, garbage-collected, dynamic scope with a simple Lisp-like syntax;
- a compiled language with a class of Lisp syntax, with strongly typed, lexical scopes;
- C language can be freely mixed into the lush code, the lush code can be a separate program or a separate function.
It sounds a little complicated, but it's not. In fact, Lush's design principles are easy to learn and use.
The main characteristics of lush are as follows:
- a neat, simple and easy-to-learn lisp-like grammar;
- a very efficient local compiler (implemented by the C language);
- an easy way to interface with C functions and libraries, Unicom's powerful dynamic loading capabilities for object files written in other languages;
- The ability to freely mix Lisp code with C code into a function;
- a powerful set of vectors, matrices, and tensor operations;
- a large library of numerical methods, including GSL, Lapack and Blas;
- an extension set of graphical methods (including an object-oriented GUI toolkit and interfaces for OpenGL and SDL ) );
- Sound and video capture (via Alsa and video4linux);
- a library of image and signal processing methods;
- Some libraries for machine learning, neural networks, and statistical estimates.
This combination of flexibility, efficiency and extensibility makes the lush an ideal platform for artificial intelligence, bioinformatics, computer vision, data mining, image processing, machine learning, signal processing, and statistical research and development. Its running speed and extensible library make it a trial in many areas, such as real-time audio, video and visual processing. Some users use it as a universal scripting language, and one that introduces it as the main development language to work. Some users are known for developing 2D or 3D games with lush. Some users have even developed commercial software for embedded processors with lush.
Compared with MATLAB, Lush is a true object-oriented language with data structures, type matrices, simple syntax, and a local compiler. Compared to Python, Lush has an efficient local compiler (compiled numeric code is as fast as C) and provides a functional programming paradigm. In lush, the ability to easily call C libraries and freely mix C and Lisp code is unique.
If you have the following requirements, then Lush is prepared for you:
- want a simple, interpretive language that can quickly practice your ideas, or achieve high-performance numerical operations, or write a prototype program based on GUI applications;
- wrote a software in C and wanted to invoke it from a simple explanatory scripting language;
- wrote a scripting language interpreter and wanted it to be a fully extensible programming language;
- use an interpreted class scripting language, such as Perl, Matlab, Mathematics, TCL, Python, or basic, to make the compiler produce efficient code and to easily invoke the C method;
- write programs in a scripting language, like the ones mentioned earlier, and then want to generate lightweight, offline applications.
- or you might want to use a combination of two languages for your project: an efficient, compiled, basic-only language for the underlying implementation, such as c\c++, and the language of the upper-level implementation and user interface, which are interpreted as weakly-typed languages with intelligent memory management, such as Lisp.
Many software engineering, especially research projects, require two languages: extensible functions for implementing the underlying or computational functions, such as c\c++, and a flexible language for top-level control, scripted, experimental, and patched, most of which are interpreted languages. The popular research-oriented interpretive language, such as MATLAB, has a little inefficiency, little or no complex data structure to support, does not provide complete object-oriented programming capabilities, lacks simple interface functions with C and other compiled languages.
Lush grammar is a simple Lisp form, if the word "Lisp" gives you a creepy feeling, then please note that its dialect lush implementation is extremely simple and easy to learn, lush may be the simplest of available grammars. Most scientists, engineers and software developers who have studied lush can use it skillfully in a few days, even though they have not previously been exposed to Lisp. Really, lush is very simple. In fact, Lush has been used to teach children programming!
The lush compiler has some interesting features (there are some limitations). Its main advantage is that it can produce very efficient C code, which is compiled using the best C compilers available in all considered machines.
Lush is currently running on a variety of Unix platforms, including Linux/x86,solaris and Sgi/irix, and it can also run on Mac OS X and Windows (with Cygwin installed).
1.2 Features
Lush is a Lisp interpreter written by C, around a compact, lightweight, and intentional simple. It has all the common functions and structures that are available in the formal object language, such as traditional sentence patterns, loops, local variables, functions, macros, objects, classes, methods, and inheritance. In addition, Lush provides a number of functions for working with lists, strings (including regular expression matching and substitution), vectors, matrices, and tensor.
Lush is quite similar to some Lisp in the middle of the 1980, such as Le_lisp and Uci_lisp. Lush is obviously more simple than Common Lisp, which differs greatly from scheme.
Lush has some unusual features, which are compilers for conversion to C, dynamic loaders, and convenient interfaces to existing C functions and already implemented C libraries, one of the most unusual features of which is its ability to cross-mix C and Lisp sources within a single function.
Lush's vector and matrix operation engine is also very powerful and efficient, which makes it ideal for applications with very high computational strength in numerical and signal and image processing. These functions include operations on vectors, matrices, and tensor up to 8 dimensions, which can be created, resized, and transformed. Some basic matrix operations, such as scalar operations (for all elements on a matrix), inner product, outer product, transpose, highly optimized 1-D and 2-D convolution, are included. The iteration operator provided by Lush can get any element of the matrix without requiring a large overhead boundary check.
As an object-oriented language, Lush provides the ability to define and compile classes, where the classes are composed of slots and methods, and for derived classes also contain slots and methods inherited from their parent classes (similar to C + + syntax).
Lush contains all the functions that Lisp fanatics are familiar with. They are: List functions, list iterations, physical list operators (vectors, matrices, tensor, etc.), macros, cut macros and symbol operators, and so on. Most temporary users prefer to stay away from more complex operators than these.
Lush provides easy-to-use graphical functions for drawing lines, polygons, rectangles, images, and colored text, with auto-refresh and double-buffering (for simple animations). The graph can be drawn to the X Window System, or it can be drawn to a PostScript file. The underlying drawing functions provided by lush can be used to build advanced functions, such as function plots .
Lush also has a very concise and easy-to-use GUI builder called Oger, which uses the underlying drawing functions mentioned above and is written entirely in Lisp. Contains predefined classes for buttons, sliders, radio buttons, menus, string editors, and so on. Oger contains an automated mechanism for placing objects in a form, which greatly simplifies the design and implementation of GUI programs, and simple GUI programs can be written in very short time and are very concise.
The Lush provides two modules for both input and output. A module is a set of functions that face Lisp, allowing easy input and output of ASCII data, Lisp expressions, Lisp objects, and matrices, as well as something particularly appealing, such as plumbing and sockets, and another that fundamentally provides access to standard C-language I/O libraries. Functions that include fopen, Popen, fprintf, fscanf, fgetc, FPUTC, fgets, and some read-write matrices, by using these functions, large-scale matrices can be mapped into virtual address spaces without having to be explicitly loaded into memory. This allows for efficient access to very large databases.
1.3 Library
in Lush, there are a large collection of libraries and utility functions available to users, some of which are written in Lisp, some written by C and then interfaces to lush, and some are pre-stored libraries that have been implanted into lush.
for friends in favor of numerical applications, Lush has a complete interface for the current algebraic libraries of the GNU Scientfic Library (GSL), Lapack, and Blas. This gives lush the ability to access an extensible set of numeric and statistical functions (in fact there are thousands of).
Having a complete interface to the industry-standard OpenGL library enables lush to create 3D graphics and animations, which itself includes interfaces to glut, Openglu, and OPENRM (scene mapping rendering engine). This feature makes lush an excellent platform for writing interactive virtual reality applications and computer games.
Another library lush provides interfaces is the simple DirectMedia Layer (SDL) video game API, which is enhanced by an advanced library that allows easy stage control and removable screen objects, which are collision detection with pixel accuracy levels. The simple syntax combination of this library and Lush is an ideal way to develop simple video games and educational programs for children.
There is also an image processing library that is user-controlled, and functions of this library can be used to load, save, resize and sample, convolution, filter, and analyze images. Mathematical morphology operations, such as Unicom volume analysis, distance transformation, corrosion and expansion, are available for both black and white images. In order to use the Video4linux API to easily crawl video, it also contains related classes and functions.
There is also a library contained in the lush, which provides the function of graphs, allows syntax tree and finite element state machine structure, graph transduction and combination, Viterbi search algorithm.
Lush also includes an extensible library for gradient-based machine learning, where gradient-based machine learning includes neural networks, radial basis functions, support vector Machines (SVM), and some other algorithms. The library is based on an innovative, object-oriented design that facilitates the construction of training from multi-learning machines and cooperative learning machines to large learning machine. The Commercial optical identification system using the library has been established.
In addition, Lush offers a variety of multimedia library interfaces, including Video4linux (video capture) and Alsa (audio recording and playback).
1.4 Fields of Application
For many applications, lush is a good tool. Initially, Lush was developed as an environment for experimentation and development of machine learning, neural networks and pattern recognition applications, but after several years of development, it has grown into a mature language and rapid development environment.
Here are some examples of the use of lush:
- a simulated environment for neural networks and machine learning experiments
- a class of Matlab prototyping tools for numerical computation, signal processing, image processing, statistical estimation, etc.
- a control/scripting language for software engineering
- A debugger and analysis tool for large applications
- A quick prototyping tool for GUI applications
- a scripting language for fast hack
Below is a small subset of the research projects completed using lush:
- a large number of handwriting recognition projects
- many projects for neural networks, machine learning and statistical estimation
- data Mining, error detection, and database marketing projects
- Research on image processing
Some of the mature business applications are also built with lush, including:
- a full cheque-amount reader, now it is assembled on the check-reader of NCR's ATMs and large clearing rooms (lush generated code runs on the DSP board). This is extremely complex code snippet (60000 lines Lush Lisp code automatically converted to C code )
- an earlier version of the foreground/background segment module for the DjVu image compression system
- a neural network simulator and Neural Network training tool
- a stroke data input system with handwriting recognition
1.5 implementation
The lush programming language has been implemented as a variant of Lisp.
At some point in the development of the software industry, Lisp is sometimes understood as a monster of academic interest, and its theoretical computer science heritage can cause common misconceptions about Lisp, such as the fact that it is inefficient and difficult to learn. Then why do we choose Lisp? The reason is that , contrary to common prejudices,Lisp is very easy to learn and flexible, efficient and convenient. Lisp has a very simple, neat, and flexible syntax, which is probably the simplest syntax we've ever learned (instead, per is the other extreme). Our experience with C developers using lush is that they are proficient in using lush within a few days. Scripting language designers often make some mistakes, not only in the design of language functions, but also in the design of their language grammar, related examples include Matlab, Mathematica, s+, and some other languages, why there is lisp such a good grammar exists we still have to spoil a new one? Lish is such a language, it is Lisp's object-oriented version of the dialect, it will focus on ease of use and efficiency, the application scenario is a numerical operation (this is different from many of the traditional implementation of Lisp), as close to the effect as possible, That is, you can interface with the existing C code without any effort.
Another Jin only Lisp has the advantage that Lisp is a programmable programming language. In Lisp, a program is just a data structure that programmers can create or manipulate, just like manipulating data. In other words, Lisp programs can create other Lisp programs that allow the user (not just the language designer) to extend the language itself indefinitely. This feature also makes it possible to write syntax conversions, self-optimizing programs, compilers, auto-differentiator, and so on. Most users will be away from the work of writing these programs, but they will still benefit from the work of others (such as the Clush compiler) in these areas.
1.6 History
Lush is a direct descendant of the SN system, originally developed by Leon Bottou and Yann LeCun, a terminal of a neural network simulator. Since 1987, a variety of SN systems have been developed, and in France, some have been sold commercially by Neuristique S.A., in fact, it has developed into a mature prototype environment and development environment.
AT/T Bell Labs, and then at the at-and-T Labs and NEC Research and development, have been used to build a number of successful pieces and products, the most famous are:
- a handwriting recognition system used by many banks around the world to automatically read indicators. In fact, some ATMs that are manufactured by NCR (which can read cheques) Run this compiled SN code on the embedded DSP motherboard
- prototype of DjVu image compression system
- starting from 1988, many countless machine learning algorithms, including the Lenet family and Support vector Machine (SVM) algorithms for evolutionary neural networks, have been implemented by the rice- at-T.
SN is used primarily within the Bell Lab for many research projects, including machine learning, pattern recognition, and image processing. But its predecessors were used at the T-Lab, Lucent Technologies (Lucent), the Salk Institute, the University of Toronto, the University of Montreal, the University of California, Berkeley, and many other research institutions. The commercial version of SN is used in a number of large companies as a prototype tool: The Thomson Semiconductor company, the French National Aeronautics and Astronautics Research Center 、.....
Contributors are: Leon Bottou, Yann Lecun,jie Huang Fu, Patrice Simard, Yoshua Bengio, Jean bourrelly, Patrick Haffner, Pascal Vincent, Sergey Loffe and so on.
In 2001, T and Neuristique released their respective versions under the GPL license, allowing the development and distribution of the lush. Yann LeCun, Leon Bzottou and Jie Huang-fu completed the work of turning SN into lush at the NEC Institute.
Below are the family Atlas of the various precursors of SN and lush:
What does 1.7 lush represent?
Lush should represent "Lisp Universal SHell" (Lisp Universal Interpreter) or something like that. But the English dictionary tells us another story. According to the 1914 edition of the Century Grand dictionary, Lush has 4 main meanings in English:
For some of us, lush certainly looks fresh, gorgeous, fun, energetic, flexible, mature, and exciting.
For others, it may seem inactive, energetic and questionable.
How to see by you.
Lush Handbook--Introduction to the first chapter