A Lisp Programmer Living in Python-Land: The Hy Programming Language
Minimum price
Suggested price

A Lisp Programmer Living in Python-Land: The Hy Programming Language

All examples are provided in both Hy and Python

About the Book

Github repository update May 25, 2023:

  • Updated all code examples to use latest Hy language version 0.26.0
  • Added a chapter with examples using Open AI GPT-3.5 APIs
  • Added a chapter using the LangChain library

While this is a book on the Hy Lisp language.

In addition to being a tutorial and cookbook on using the Hy language, longer examples explore a variety of different applications and tools. The current structure of the book is:

  • Introduction to the Hy Language
  • Why use Lisp? Advantages of bottom up development using macros and closures
  • Relational databases
  • Web app development
  • Web scraping
  • Using the Bing search APIs
  • Accessing semantic web and linked data sources like Wikipedia, DBpedia, and Wikidata
  • Automatically constructing Knowledge Graphs from text documents, semantic web and linked data
  • Deep Learning (predictive model from spreadsheet data and a LSTM-based English text language model)
  • Natural Language Processing (NLP) using Deep Learning
  • Creating Knowledge Graphs from text data
  • Hy language implementation of the author's Knowledge Graph Navigator project
  • OpenAI GPT-3.5 APIs
  • LangChain

About the Author

Mark Watson
Mark Watson

Mark Watson is a consultant specializing in deep learning, machine learning, knowledge graphs, and general artificial intelligence software development. He uses Common Lisp, Clojure, Python, Java, Haskell, and Ruby for development.

He is the author of 20+ published books on Artificial Intelligence, Deep Learning, Java, Ruby, Machine Learning, Common LISP, Clojure, JavaScript, Semantic Web, NLP, C++, Linux, and Scheme. He has 55 US Patents.

Mark's consulting customer list includes: Google, Capital One, Olive AI, CompassLabs, Disney, Sitescout.com, Embed.ly, and Webmind Corporation.

All of my Leanpub books are available to read for free on my web site:  https://markwatson.com/

Mark Watson

Episode 253

Table of Contents

  • Cover Material, Copyright, and License
  • Preface
    • Setting Up Your Development Environment
    • What is Lisp Programming Style?
    • Hy is Python, But With a Lisp Syntax
    • How This Book Reflects My Views on Artificial Intelligence and the Future of Society and Technology
    • About the Book Cover
    • A Request from the Author
    • Acknowledgements
  • Introduction to the Hy Language
    • Using Python Libraries
    • Global vs. Local Variables
    • Using Python Code in Hy Programs
    • Using Hy Libraries in Python Programs
    • Replacing the Python slice (cut) Notation with the Hy Functional Form
    • Iterating Through a List With Index of Each Element
    • Formatted Output
    • Importing Libraries from Different Directories on Your Laptop
    • Hy Looks Like Clojure: How Similar Are They?
    • Plotting Data Using the Numpy and the Matplotlib Libraries
    • Bonus Points: Configuration for macOS and ITerm2 for Generating Plots Inline in a Hy REPL and Shell
  • Why Lisp?
    • I Hated the Waterfall Method in the 1970s but Learned to Love a Bottom-Up Programming Style
    • First Introduction to Lisp
    • Commercial Product Development and Deployment Using Lisp
    • Performing Bottom Up Development Inside a REPL is a Lifestyle Choice
  • Writing Web Applications
    • Getting Started With Flask: Using Python Decorators in Hy
    • Using Jinja2 Templates To Generate HTML
    • Handling HTTP Sessions and Cookies
    • Deploying Hy Language Flask Apps to Google Cloud Platform AppEngine
    • Wrap-up
  • Responsible Web Scraping
    • Using the Python BeautifulSoup Library in the Hy Language
    • Getting HTML Links from the DemocracyNow.org News Web Site
    • Getting Summaries of Front Page from the NPR.org News Web Site
  • Using the Microsoft Bing Search APIs
    • Getting an Access Key for Microsoft Bing Search APIs
    • Example Search Script
    • Wrap-up
  • Deep Learning
    • Simple Multi-layer Perceptron Neural Networks
    • Deep Learning
    • Using Keras and TensorFlow to Model The Wisconsin Cancer Data Set
    • Using a LSTM Recurrent Neural Network to Generate English Text Similar to the Philosopher Nietzsche’s Writing
  • Natural Language Processing
    • Exploring the spaCy Library
    • Implementing a HyNLP Wrapper for the Python spaCy Library
    • Wrap-up
  • Datastores
    • Sqlite
    • PostgreSQL
    • RDF Data Using the “rdflib” Library
    • Wrap-up
  • Linked Data, the Semantic Web, and Knowledge Graphs
    • Understanding the Resource Description Framework (RDF)
    • Resource Namespaces Provided in rdflib
    • Understanding the SPARQL Query Language
    • Wrapping the Python rdflib Library
  • Knowledge Graph Creator
    • Recommended Industrial Use of Knowledge Graphs
    • Design of KGCreator Application
    • Problems with using Literal Values in RDF
    • Revisiting This Example Using URIs Instead of Literal Values
    • Wrap-up
  • Knowledge Graph Navigator
    • Review of NLP Utilities Used in Application
    • Utilities to Colorize SPARQL and Generated Output
    • Text Utilities for Queries and Results
    • Finishing the Main Function for KGN
    • Wrap-up
  • Using OpenAI GPT and Hugging Face APIs
    • OpenAI Text Completion API
    • Coreference: Resolve Pronouns to Proper Nouns in Text Using Hugging Face APIs
  • Using LangChain to Chain Together Large Language Models
    • Installing Necessary Packages
    • Basic Usage and Examples
    • Creating Embeddings
    • Using LangChain Vector Stores to Query Documents
    • LangChain Wrap Up
  • Large Language Models Experiments Using Google Colab
  • Book Wrap-up

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub