Last week I fully automated the release process for YAMLScript ys, libys.so, it's 15 language bindings and the http://yamlscript.org website.
This makes it trivial for me to make new releases and I've made several.
About an hour ago I released 0.2.20
There's a few things worth pointing out:
• https://pypi.org/project/yamlscript/#files now has "wheels" (no need to install libys.so for yamlscript.py)
• Homebrew installs now work: https://yamlscript.org/doc/install/#install-with-homebrew
• There's a new binary operator for quot which is //
• Today I added support for conditional binding which I'll describe here:
I always hated this in ys and clj:
$ ys -ce '
defn foo():
x =:
if y > z: bar(x) x'
(defn foo [] (let [x (if (> y z) (bar x) x)]))
I find it really annoying to need to repeat x for the else clause, and there's no good way around that in clojure as far as I know.
Now YS has:
$ ys -ce '
defn foo():
x :if (y > z) =: bar(x)'
(defn foo [] (let [x (if (> y z) (bar x) x)]))
It generates the same clj code, but without having to repeat yourself in the sourcealso works with ys destructured binding and functional binding forms:
$ cat a.ys
!ys-0
defn foo():
a b c :if cond =: xs
a b c :if cond =: d e f
a :if cond +=: 42
a :if cond ||=: 42
$ ys -c a.ys | zprint
(defn foo
[]
(let [[a b c] (if cond xs [a b c])
[a b c] (if cond [d e f] [a b c])
a (if cond (add+ a 42) a)
a (if cond (or a 42) a)]))
$applying this in actual code:
49 else:
50 - result =:
51 - if e:odd?:
52 - then: rem((result * a) m)
53 - else: result
50 + result :if odd?(e) =: rem((result * a) m)
51 sq =: a:sqr
if d > limit:
then: total
else:
- total =:
- if (n % d):zero?:
- then:
- q =: n // d
- if q == d:
- then: total + d
- else: total + d + q
- else: total
+ q =: n // d
+ total :if zero?(n % d) +=: d
+ total :if (zero?(n % d) && (q != d)) +=: q
recur: d.++, total