5

The Phel Language

 3 years ago
source link: https://phel-lang.org/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The Phel Language

Phel is a function programming language that compiles to PHP. It is a dialect of Lisp inspired by Clojure and Janet.

Community

Feel free to ask questions and join discussions on the Phel Gitter channel.

Features

  • Built on PHP's ecosystem
  • Good error reporting
  • Different Datastructures (Arrays, Tables and Tuples)
  • Macros
  • Recursive functions
  • Powerful but simple Syntax

Why Phel?

Phel is a result of my failed attempts to do functional programming in PHP. Basically I wanted:

  • A LISP-inspired
  • functional programming language
  • that runs on cheap hosting providers
  • and is easy to write and debug

Example

The following example gives a short impression on how Phel looks like:

# Define a namespace
(ns my\example)

# Define a variable with name "my-name" and value "world"
(def my-name "world")

# Define a function with name "print-name" and one argument "your-name"
(defn print-name [your-name]
  (print "hello" your-name))

# Call the function
(print-name my-name)

Getting started

Phel requires PHP 7.4 or higher and Composer. Read the Getting Started Guide to create your first Phel program.

Status of Development

Phel has not been released yet, but it is fairly complete. In the next weeks or months I will probably find some more edge cases that I will fix before the first official release. Maybe some of you are willing to test it out and give feedback.

© 2020 Jens Haase Legal Disclosure | Data protection


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK