We just released version 0.6.0. This release drops the support for PHP 7.4. Phel supports now PHP 8.0 and PHP 8.1. Read the rest of the thread for other important changes
The for loop supports now a
:reduce option. This allows you to use the list comprehension loop for task that normally would required to use the reduce function.
# Instead of (reduce + 0 [1 2 3]) # Do (for [x :in [1 2 3] :reduce [acc 0]] (+ acc x))
This becomes very useful if you combine it with other options of the for loop. Instead of using map, filter and reduce individually you can now do everything in a for loop.
# Instead of (->> [1 2 3 4] (filter even?) (map inc) (reduce + 0)) # Do (for [x :in [1 2 3 4] :when (even? x) :reduce [acc 0]] (+ acc (inc x)))
Next, it is now possible to require a PHP file in the namespace statement. This is very handy to load the autoload.php file from composer.
(ns myapp (:require-file "vendor/autoload.php"))
Finally, a new function was added to the core library. The
coerce-in function will bound a value in a given range.
(coerce-in 0.5 0 1) # evaluates to 0.5 (coerce-in 1.5 0 1) # evaluates to 1 (coerce-in -0.5 0 1) # evaluates to 0
All other changes can be found the in the Changelog