LISP

Allegro Common Lisp ver 11.0 introduced support for OpenAI LLMs. In this article, let us look at some of the functions for interacting with OpenAI. First we need to specify basic parameters such as the API key, LLM to use, Temperature, etc. I have defined a convenient function configure-openai to do this (full source is included […]

In the last article I discussed an interesting word puzzle and showed how to solve it using Prolog. Here is the problem statement: “You are given two words of the same length. You have to transform the first word into the second word, by changing only one letter at a time. The additional constraint is that […]

Recently I came across a nice article by Jose Crespo, where the author stresses that the future of programming revolves around the application of math concepts such as Functor, Monads, Folds, etc. In addition, he argues that familiarity with C/C++ is essential in this modern AI age. The author goes through a toy example that uses […]

In an earlier article I had explained how to execute Python code from within Common Lisp using “CLPython” package. In contrast to that approach, “Hy” is a Lisp-style language (not compatible with Common Lisp) that is embedded in Python and hence provides seamless interoperability with Python code. Installation is straightforward (it is usually a good idea to […]

In my last article, I showed how we can use Prolog to generate univariate Polynomials. After I finished that article, I wanted to try Lisp for the same task. Prolog is “declarative”, whereas Lisp is primarily “functional” (it supports OOP as well), so the implementation will exhibit that difference. Here is the primary function generate-polynomial […]

The zip() function in Python is a convenient mechanism for iterating over multiple “iterables” in parallel. Looping over lists is a common scenario. Here is the output generated by the above code: Common Lisp does not have such a feature built into the language or as part of the standard library. Of course, we have […]

Julia supports calling external functions, especially those written in “C” language. As Julia documentation says, such calls do not involve any “boilerplate” code and hence are efficient. In today’s article, I am going to show how to call functions defined in a DLL (Windows 64 bit). Instead of using direct “C” functions, I will discuss […]
In the last article, I had shared my views on why programmers should learn Prolog, preferably as the first language. What language should one learn next? I strongly pitch for Lisp, to be precise, “Common Lisp”. Lisp happens to be the second oldest (1958) programming language, only after Fortran (1957)! Initially there were several dialects […]

In a series of articles written earlier, I had shown how it is possible to model Definite Clause Grammars (DCG) in LispWorks Lisp (Enterprise Edition). We use defgrammar in Common Prolog (available as part of KnowledgeWorks package) to define our grammar rules. Here is a toy English grammar represented using defgrammar: This corresponds to the following Prolog […]

Lisp is known to be a highly dynamic language, where functions are first-class objects. It is possible to define and undefine functions on the fly as well as attach hooks to existing functions. These are in addition to the ability to pass functions as parameters to other functions and returning a function as the result of […]
Recent Comments