Hy: A LISP dialect embedded in Python (hylang.org)
from armchair_progamer@programming.dev to programming_languages@programming.dev on 22 Sep 2024 19:07
https://programming.dev/post/19726741

From homepage:

Hy (or “Hylang” for long) is a multi-paradigm general-purpose programming language in the Lisp family. It’s implemented as a kind of alternative syntax for Python. Compared to Python, Hy offers a variety of new features, generalizations, and syntactic simplifications, as would be expected of a Lisp. Compared to other Lisps, Hy provides direct access to Python’s built-ins and third-party Python libraries, while allowing you to freely mix imperative, functional, and object-oriented styles of programming. (More on “Why Hy?”)

Some examples on the homepage:

Hy:

(defmacro do-while [test #* body]
  `(do
    ~@body
    (while ~test
      ~@body)))

(setv x 0)
(do-while x
  (print "Printed once."))

Python:

x = 0
print("Printed once.")
while x:
    print("Printed once.")

Interestingly programming.dev’s Markdown renderer highlights ```hy code blocks. Maybe it knows the language (highlight.js has it). Maybe it’s using Hybris (another language that could get its own post, one of its extensions is *.hy).

GitHub

Online REPL

1.0 announcement

#programming_languages

threaded - newest