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

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

Mark Watson
Buy on Leanpub

Table of Contents

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

  • Cover Material, Copyright, and License
  • Preface
    • Requests from the Author
    • 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
  • 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 Brave Search APIs
    • Setting an Environment Variable for the Access Key for Brave 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
    • OpenAI Text Completion API
  • Using Google Gemini API
    • REST Interface
    • Using Google’s Python Package to Access Gemini
    • Wrap Up for Using the Gemini APIs
  • Running Local LLMs Using Ollama
    • Completions
    • Tool Use
    • Wrap Up for Running Local LLMs Using Ollama
  • Agents Using the Agno Agent Framework Running On a Local Ollama Model
    • An Agent For Answering Questions About A Specific Web Site
    • Wrap Up for Agno Agent Example
  • Using Perplexity Sonar Model for Combined Web Search and LLM Based Reasoning
    • A Hy Language Client Library for Perplexity
    • Example Output
    • Wrap Up for Using Perplexity
  • 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
A Lisp Programmer Living in Python-Land: The Hy Programming Language/