Author: admin
-
Tree
You can build tree data structures from cons cells, as lists of lists. To implement tree structures, you will have to design functionalities that would traverse through the cons cells, in specific order, for example, pre-order, in-order, and post-order for binary trees. Tree as List of Lists Let us consider a tree structure made up…
-
Node.js StringDecoder
The Node.js StringDecoder is used to decode buffer into string. It is similar to buffer.toString() but provides extra support to UTF. You need to use require(‘string_decoder’) to use StringDecoder module. Node.js StringDecoder Methods StringDecoder class has two methods only. Method Description decoder.write(buffer) It is used to return the decoded string. decoder.end() It is used to…
-
Set
Common Lisp does not provide a set data type. However, it provides number of functions that allows set operations to be performed on a list. You can add, remove, and search for items in a list, based on various criteria. You can also perform various set operations like: union, intersection, and set difference. Implementing Sets…
-
Vectors
Vectors are one-dimensional arrays, therefore a subtype of array. Vectors and lists are collectively called sequences. Therefore all sequence generic functions and array functions we have discussed so far, work on vectors. Creating Vectors The vector function allows you to make fixed-size vectors with specific values. It takes any number of arguments and returns a…
-
Node.js Path
The Node.js path module is used to handle and transform files paths. This module can be imported by using the following syntax: Syntax: Node.js Path Methods Let’s see the list of methods used in path module: Index Method Description 1. path.normalize(p) It is used to normalize a string path, taking care of ‘..’ and ‘.’…
-
Symbols
In LISP, a symbol is a name that represents data objects and interestingly it is also a data object. What makes symbols special is that they have a component called the property list, or plist. Property Lists LISP allows you to assign properties to symbols. For example, let us have a ‘person’ object. We would like this…
-
Lists
Lists had been the most important and the primary composite data structure in traditional LISP. Present day’s Common LISP provides other data structures like, vector, hash table, classes or structures. Lists are single linked lists. In LISP, lists are constructed as a chain of a simple record structure named cons linked together. The cons Record Structure A cons is…
-
Sequences
Sequence is an abstract data type in LISP. Vectors and lists are the two concrete subtypes of this data type. All the functionalities defined on sequence data type are actually applied on all vectors and list types. In this section, we will discuss most commonly used functions on sequences. Before starting on various ways of…
-
Node.js File System (FS)
In Node.js, file I/O is provided by simple wrappers around standard POSIX functions. Node File System (fs) module can be imported using following syntax: Syntax: Node.js FS Reading File Every method in fs module has synchronous and asynchronous forms. Asynchronous methods take a last parameter as completion function callback. Asynchronous method is preferred over synchronous…
-
Strings
Strings in Common Lisp are vectors, i.e., one-dimensional array of characters. String literals are enclosed in double quotes. Any character supported by the character set can be enclosed within double quotes to make a string, except the double quote character (“) and the escape character (\). However, you can include these by escaping them with…