- What is newLISP and what can I do with it?
- Why newLISP, why not one of the other standard LISPs?
- How do I study newLISP?
- How does newLISP compare in speed?
- Does newLISP have matrices?
- Does newLISP have hash tables?
- Does newLISP have automatic memory management?
- Can newLISP pass data objects by reference?
- How does variable scoping work in newLISP?
- Does newLISP do multiprocessing?
- Can I use newLISP for distributed computing tasks?
- How about object-oriented programming?
- How about packages and modules?
- What are some differences between newLISP and other LISPs?
- Does newLISP run on XYZ operating system?
- Can newLISP handle the special characters of my country and language?
- Is implicit indexing not breaking LISP syntax rules?
- Can newLISP be embedded in other programs?
- Can I keep my newLISP scripts closed although newLISP is licensed GPL?
- Where do I file bug reports?
1. What is newLISP and what can I do with it?newLISP is a LISP-like scripting language for doing things you typically do with scripting languages: programming for the internet, system administration, text processing, gluing other programs together, etc. newLISP is a scripting LISP for people who are fascinated by LISP's beauty and power of expression, but who need it stripped down to easy-to-learn essentials.
2. What makes newLISP so special, why 'new'?LISP is an old language born, grown, and standardized in times very different from today, times when programming was for highly educated people who engineered programs. newLISP is LISP reborn as a scripting language: pragmatic and casual, simple to learn without requiring you to know advanced computer science concepts. Like any good scripting language, newLISP is quick to get into and gets the job done without fuss.
Related: In Praise of Scripting: Real Programming Pragmatics
newLISP has a very fast startup time, is small on resources like disk space and memory and has a deep, practical API with functions for networking, statistics, machine learning, regular expressions, multiprocessing and distributed computing built right into it, not added as a second thought in external modules.
3. How do I study newLISP?At least in the beginning, you mainly study newLISP using it. If you understand this:
(+ 1 2 3) ; computes the sum of 1,2,3 => 6
(define (double x) (+ x x)) ; defines a function
(double 123) ; computes the double of 123 => 246
then you have learned enough to start programming in newLISP. There are a few more concepts like anonymous functions, applying functions, namespaces (contexts), and implicit indexing. You will pick up those while using newLISP.
Books about Common LISP or Scheme, two different, older standards of LISP, teach you concepts, you don't need to know for learning newLISP. Many times newLISP expresses things differently from traditional LISPs, and in ways more applicable to today's programming tasks and on a higher level closer to the problem at hand.
Learn to solve problems the newLISP way! For a deeper understanding of newLISP, read the Users Manual section of the newLISP manual, with less theory and more examples. Make a pass through the reference part of the manual to get an impression of the depth and breadth of the built-in API.
For serious working with newLISP read Code Patterns with more tips and code pieces. A good beginners Introduction to newLISP and video tutorials can be found on the documentation page.
Many functions in newLISP have an easy to understand surface but are much more powerful when using the special options of that function. The depth of the newLISP programming API is not based on the quantity of functions, but rather based on multiple syntax forms and options of a specific function.
Start to write your first program now. Look at the small program snippets throughout the manual and on this web site. If you have questions, go to a discussion group hosted here and ask.
4. How does newLISP compare in speed?It compares well to popular scripting tools like Perl or Python, not only in general computing speed but even better when it comes to startup time and memory/disk footprint. Have a look at some benchmarks.
Many functions for which other languages require the inclusion of external modules are already built into newLISP. Networking functions and mathematical methods like FFT (Fast Fourier Analysis) or Bayesian machine learning functions are lightning fast in newLISP. They are built-in functions and do not require any external modules. Despite of this, newLISP is smaller than other scripting languages.
5. Does newLISP have arrays?Yes, it does. For applications with random access in large lists, access can be made faster using newLISP arrays.
6. Does newLISP have hash tables?newLISP uses red-black binary trees for associative memory access when maintaining namespaces, dictionaries and for hash like key-value access.
7. Does newLISP have automatic memory management?Yes, it does. But it is not the typical garbage collecting process you find in other interactive languages. Just like traditional garbage collecting languages, newLISP recycles unused memory. However, newLISP does it in a new, much more efficient way. newLISP's memory management is synchronous with no sudden pauses in processing observed in languages with old-style garbage collection. newLISP's unique automatic memory management is one of the reasons for newLISP's speed, small size, and efficient memory usage.
8. Can newLISP pass data objects by reference?All built-in functions pass lists and strings by reference in and out. To pass by reference into user-defined functions, lists and strings can be wrapped into namespaces. Read more about this topic here Passing data by reference. Since 10.2, FOOP passes the target object by reference too.
9. How does variable scoping work in newLISP?newLISP is dynamically scoped inside lexically separated contexts or namespaces. Namespaces have very little overhead and millions of them can exist. Contexts in newLISP allow lexical enclosure of more than one lambda function and data object. Contexts can be used to write lexically scoped functions with memory, software modules and objects. This avoids the pitfalls of dynamic scoping and helps structuring bigger programs.
10. Does newLISP do multiprocessing?Linux/UNIX versions of newLISP programs can fork and spawn existing process. Windows versions can start independent child processes. Semaphores are used to synchronize processes, and shared memory can be used for communications between processes.
On macOS and Linux and other Unix the Cilk API is built in for easy launching and synchronizing multiple processes, transparently without worrying about semaphores, locks etc.. An asynchronous actor messaging API is available to communicate between processes.
11. Can I use newLISP for distributed computing tasks?Some of today's larger applications run distributed across multiple computers, dividing their complex tasks between multiple nodes on a network. newLISP can be run as a server for evaluating commands sent by other newLISP clients connected to it. A net-eval directive encapsulates all network handling required to communicate with other computers on the network, distribute code and computing tasks, and collect results in a blocking or event-driven fashion. newLISP can also act as a web server handling HTTP requests including CGI.
12. How about object-oriented programming?newLISP offers a new way of Functional Object Oriented Programming called FOOP. It uses namespaces to collect all methods for an object class and uses normal s-expressions to represent objects. For more details on this new way of object oriented programming in newLISP see the the training video series "Towards FOOP" in the documentation section and the chapter Functional object-oriented programming in the Users Manual. Since v. 10.2 FOOP objects are mutable.
13. Is it usable for big projects, teams?newLISP uses namespaces for building packages and modules. Modules exist for database access to MySQL, PostgreSQL and SQLite databases, as well as ODBC. Additional modules support FTP, POP3, SMTP and REST internet protocols. Because newLISP namespaces are lexically closed, newLISP lets programmers treat modules like black boxes. This is suitable for teams of programmers working on large applications.
newLISP can also call functions in shared C libraries on Linux/UNIX and Windows operating systems to expand its functionality.
Modules can be documented using the newLISPdoc automatic documentation system.
14. What are some differences between newLISP and other LISPs?newLISP's differences from other LISPs include: the working of lambda expressions; the existence of namespaces (or contexts); parameter passing; and of course, the newLISP API (function repertoire). Overall, newLISP's new ways of LISP programming make it faster, smaller, and easier to understand and learn. For a more detailed discussion, see Differences to Other LISPs.
15. Does newLISP run on XYZ operating system?It probably does. newLISP has a minimum of dependencies; it only uses standard C libraries to compile. If your system has GNU tools such as the GCC compiler and the make utility, then newLISP should compile and link right away using one of the makefiles in its source distribution.
newLISP is built using one of several makefiles, each written for a specific platform. There are no complex make scripts. The makefiles are short and easy to change and adapt if your platform or configuration is not included already.
16. Can newLISP handle the special characters of my country and language?In most parts of the Western world, you will only need to set your locale using the newLISP function set-locale.
More than half of the countries in the world use a decimal comma instead of a decimal point. newLISP will correctly read and write decimal commas when switched to the correct locale.
Most alphabets in the Western hemisphere fit into 256-place character code tables, and each character needs only one 8-bit byte to be encoded. If the written language of your country requires multibyte characters to encode it, then you need the newLISP version with UTF-8 support enabled. Makefiles for Windows and Linux are included to compile UTF-8 versions of newLISP. In the UTF-8 version, many character-handling functions are able to handle multibyte characters. See the localization and UTF-8 chapter in the manual for details.
17. Is implicit indexing not breaking LISP syntax rules?On the contrary, implicit indexing is a logical extension of the LISP syntax. When evaluating s-expressions, the first element is applied as a function to the rest elements in the expression serving as function arguments. Implicit indexing is merely looking at members of number, string and list data types as special indexing operators when in the first position of an s-expression.
18. Can newLISP be embedded in other programs?newLISP can be compiled as a UNIX shared library or Windows DLL (dynamic link library). As a result, the shared library versions of newLISP can be used inside other programs that are able to import shared library functions. Other ways to integrate your application with newLISP include I/O pipes and network ports.
On Win32 systems, newLISP has been used inside MS Excel, MS Visual Basic, and the NeoBook GUI application builder. On UNIX, newLISP has been used inside the GNumeric spreadsheet. On macOS, newLISP has been used as an extension language for the BBEdit editor by having newLISP communicate with BBEdit via standard I/O pipes. The Java based Guiserver and the older Tcl/Tk frontend for newLISP are examples of newLISP integration via network ports.
19. Can I keep my newLISP scripts closed although newLISP is licensed GPL?Yes, you can. The gnu.org FAQ for the GPL explains this. As long as your scripts do not use other 3rd party GPL'ed software in the form of imported libraries or loaded modules, your newLISP scripts don't need to be GPL licensed. Most modules on the newLISP website are unlicensed and don't import other libraries. If they do, consult the licenses of those 3rd party libraries.
newLISP allows you to distribute a binary of the interpreter together with closed source. When using newLISP in your software always mention the www.newlisp.org website in your documentation as a place where source code for newLISP is available.