I think there is a story for YAMLScript in Python-dominated data-science. I used ys --compile to feed the Ferret-Clj->C++ compiler and do C++ interop with CERN's data analysis framework. The comparison Python/Clojure/YAMLScript is on https://github.com/kloimhardt/LisRoot#yamlscript .
This is neat. Sorry I didn't see it until now. Been in transit. I'll see if I can get it running per the README. I might have a couple YS suggestions to make.
I was a bit confused by the identity call in
newTF1: identity('pyf2') l -1. 1. 2
but I get why now. You wanted:
newTF1: 'pyf2' l -1. 1. 2
but that's invalid YAML.
This is common in YS; a plain (unquoted) scalar begins with a yaml syntax char. These are common '"*[{.
YS let's you escape that with a leading . , so:
newTF1: .'pyf2' l -1. 1. 2
is idiomatic there 🙂YS ends up having many ways to write expressions.
newTF1 'pyf2': l -1. 1. 2
# or:
=>: newTF1('pyf2' l -1. 1. 2)
Would have worked also.You could have even gone full-lisp with something like:
doto:
(newTF1 "pyf2" l -1. 1. 2)
(SetParameters 5. 2.)
(Draw)
I wouldn't, but just showing you you can.I got it working!
Working on a PR for you 🙂
I am so glad that this really works! You made my day. I think no-one ever tried this shade-blossom. Based on your suggestions I tinkered a bit with the syntax. Decided to use S-Exp for the ROO/T macro, Yes-Exp for the higher order function Linear and YAML-Exp for the normal functions.
If you
defn Linear():
fn([x] [d k]):
(+ d (* k x))
you can get rid of:
sed 's/+_/+/g' |
sed 's/*_/*/g' |Here my three (S, Yes, YAML) versions of higher order function calls, The YAML-Exp needs to involve apply, right?
(f(1 2) 3)
f(1 2): 3
apply:
f: 1 2
list: 3
The +++ thing I was already planning to remove. I can get that released soon
and the blank:: thing is a bug on my part
I do not want to move to prefix-math. That is because in our research paper, saying that for science Lisp is better than Python, one weakness is exactly the prefix-math. And YAMLScript removes this weakness, that is a major improvement. I need to stick to infix math.
makes sense. YS uses polymorphic +_ and *_.
I'd like it if you didn't have to postprocess the compiled YS.
Can you define your own clojure.core/+_ and *_?
$ ys -Cpe '[+_ *_ + *]'
[#object[ys.std$_PLUS__ 0x3dd86908 "ys.std$_PLUS__@3dd86908"]
#object[ys.std$_STAR__ 0x6bf4819b "ys.std$_STAR__@6bf4819b"]
#object[clojure.core$_PLUS_ 0xfebe864 "clojure.core$_PLUS_@febe864"]
#object[clojure.core$_STAR_ 0x472cbef2 "clojure.core$_STAR_@472cbef2"]]I am currently looking into Ferret how to define + and *
I'm looking at the blank:: problem
fixed the blank:: problem 🙂
Pushed: you can test with:
git clone git@github.com:yaml/yamlscript
make -C yamlscript/ys install
will install ~/.local/bin/ysI fixed +++
I fixed blank +++ +_ *_ on my side. Still using ys0.1.56 so the world can continue to conveniently digest the first example of the future standard scientific notation :-)
I can put out 0.1.57 in a few minutes
how long are you around?
I am around for the next hours including some breaks
cool
have you pushed your changes?
pushed yes. I just added the namespace yslib.cxx
cxx would work with 0.1.57, but that's fine
glad to find/fix the bug
are you on linux or mac?
I am mac
intel or arm?
Intel i5
ok thanks
pushed the +++ fix if you want to rebuild and test while I release this
Its time for supper around here, I‘ll pass on the rebuild…
ok
https://github.com/yaml/yamlscript/releases/tag/0.1.57 Released
dang it. I made this work:
require foo: => bar
but not this:
require:
foo: => bar
😕will fix later. you don't need it anyway 🙂
I was just writing about this...
thank you for the hint
got the require foo: => bar to work. I'm happy!
Thanks a lot for the special cut release! I'll call it a day...
You bet...
I'm working on a PR still
you'll see it tomorrow
I need to switch gears for a while
I made the fix this morning but haven't had time to release it yet. FYI
as week draws to an end ... tried git clone - make build ... my i5 Mac breathed heavily ... my nerves steeled enough in weekend prospect ... it worked! (I should have bet, I know, but I wouldn't have before seeing the success) ... !!! the Graal build magically worked without having Graal on the machine in the first place!!!... now if you have a git branch with the newest updates, pls. post its name.
Your machine also didn't need Clojure or a JDK.
The YS Makefile build system downloads 2 things (into /tmp):
• The OS/Arch appropriate GraalVM tarball
• The 458 line Bash script called lein
And sets 2 env vars: JAVA_HOME and PATH
The tarball contains a complete JDK, so now you have everything you need to run Clojure, Java and GraalVM's native-image compiler on any machine that native-image supports :)
I'm not sure how widely this has been known/discovered in the Clojure world. I haven't seen it elsewhere.
The prereqs are only Gnu make, bash and curl... I think that's pretty powerful way to sell Clojure based tools, to the Java adverse... 🙂
I haven't looked into pulling this off without lein yet (ie tools-deps)
this way is so awesome that noone will consciously recognize this way just by your homepage sentence „No Java or JVM installation is used to run (or build) YAMLScript programs“. It needs further expansion, at least the sentence: „your machine does not need Clojure or the JDK to even build the YAMLScript binary itself“, possibly with a link to some details to bolster confidence.
maybe mention that „on Mac you need XCode package for the make util“, as for me it was not obvious how to get „make“ and a subsequent struggle to get XCode running on my i5
brew install make ?
or maybe add a build.yaml in addition to „make“, dunno that makes sense … musing
Musings welcome :)
I want to have wiki pages for all kinds of stuff. Definitely for every error message (like shellcheck does)
So I could link there from the ReadMe likely
https://gist.github.com/ingydotnet/5fc7f0e4be87d13fb1a6094008964888#file-tmp-blxry8mlm1-L111-L114
is an example of running shellcheck on the lein command...
I've long thought everyone should do this...
I even bought the domain name to start that movement 😄
Maybe my clone can handle that, sigh
well as a ClojureScript user I never heard of shellcheck let alone what it does. As well as this awsome build way, that shellcheck would need a blog post to explain the idea.
Thanks for the feedback. And the encouragement. I'll give it a stab soon.
Just pushed that fix I was talking about wrt require
Will do the 0.1.58 release now...
regarding lein vs tools-deps there is a debate. I know that the inspirer of my LisRoot, Jeaye Wilkerson of https://www.clojuriststogether.org/news/q2-2024-funding-announcement/#jank-jeaye-wilkerson is vocally pro lein.
yes, I'm well aware. I know the core and most of community is moving to tools-deps,
but the cool thing about lein is that it only really needs bash and curl .
It needs a JDK too but now we see that doesn't need to be a permanent install.
Clojurists assume a JDK and Clojure install.
But that can be scary to non-java people, thus hard to sell Clojure based stuff to the world. (my opinion)
I certainly do share your opinion and more specifically add "Graal compilation indeed is scary". But today I saw through YAMLScript that Graal need not be scary, and that might have been a small step for you, but ...
... a big step for me
> Just pushed that fix I was talking about wrt require buildt and successfully tested the fix.