yamlscript 2024-06-12

YAMLScript 0.1.61 released https://github.com/yaml/yamlscript/releases/tag/0.1.61 Main change is that data mode :foo evals to a keyword rather than a string. Allowed my to make this fun script: https://gist.github.com/ingydotnet/201c6da3b33a5af2dcc069a7af5e81e8 Been playing with LLMs the past week and this is a cool way to play using YS.

$ ./ollamys What's up? >>> Is Clojure a fun programming language? llama3: Clojure is a variant of the ClojureScript compiler, which allows you to create web applications in a way that's easy and enjoyable for developers. Whether or not it's "fun" ultimately depends on your personal preferences and what you enjoy about programming. That being said, here are some features that might make Clojure (or ClojureScript) a fun language to use: 1. *Concise syntax*: Clojure has a very concise syntax, which can make it feel more enjoyable to write code. You can express complex ideas in just a few lines of code. 2. *Immutability by default*: Clojure's immutable data structures can help you avoid bugs and make your code easier to reason about. This can be a fun challenge as you learn how to work with immutability. 3. *Dynamic typing*: ClojureScript is dynamically typed, which means you don't need to declare variable types beforehand. This can be liberating and allow you to focus on the logic of your code rather than worrying about type annotations. 4. *Macros*: Clojure has a powerful macro system that allows you to extend the language itself. Macros can be used to create domain-specific languages (DSLs) or implement complex algorithms in a declarative way. This can be a fun and creative way to express yourself as a programmer. 5. *Ecosystem*: The Clojure ecosystem is known for its strong community and numerous libraries and frameworks that make it easy to build web applications, data analysis tools, and more. 6. *Functional programming*: Clojure is a functional programming language at heart, which means you can focus on composing pure functions rather than managing mutable state. This can be a fun and refreshing way to approach programming. Of course, "fun" is subjective, and whether or not Clojure is enjoyable for you will depend on your individual preferences and experiences. If you're interested in learning more about Clojure or ClojureScript, I encourage you to try out some tutorials or small projects to see if it's a good fit for you!

Try it out and let me know what you think...

Very interesting! Still a bit disorienting to open the ys file, zoom to the end where main "should" be, and find subroutines (e.g format)! Do you see a REPL for ys in the crystal ball or would it technologically not work?

> Clojure is a variant of the ClojureScript compiler someone ought to train these LLMs on more Clojure sources 😛

The creative results were well done and the factual stuff terrible. But reading through the ollama api docs there's a lot of parameters to play with.

As a software project I'm so far impressed with ollama. It feels well done. It feels lie a developer ecosystem for playing with LLMs. Including training and publishing your own. @hifumi123 maybe that "someone" is you 😎

@phill I wouldn't say "a REPL" I would say several REPL options 🙂 @markus.agwin and I have been working through some stuff to provide a simple repl-like experience. but full-nrepl in the future, certainly. It has some bigger roasmap dependencies though. @pez and @rayatrahman9 were talking about this (from a Calva perspective) back in March. @danielmgerson was also asking me about YS and the REPL when we met up IRL last week...

@phill YS has "auto declare". It's a good example of putting code-gen to good use. One of the last steps of compilation is to walk the AST and see what needs to be declared. I always want my main function at the top. I think that's a common style in various language ecosystems... YS lets you (in almost all regards) be you. Clojure doesn't force a bottom up order per se (it has declare) but it makes top down unattractive.

I encourage everyone to run ys -c file.ys on any code I post to see the clojure result...

At some level I think a repl could be created by using the babashka repl. While working with a YS script in development mode it would be a running babashka app you are “actually” working with. Inspecting and evaluating YS code would be about compiling it to Clojure and sending it to the babashka repl. I might not have the right model of YS in my head though, so I could be talking BS here. 😃

Well the ys interpreter is effectively the younger sister of the bb interpreter. What I mean is that they are both built over the same thing, SCI. YS just has an different syntax at first. You can:

ys -c file.ys | bb -
> Where - means -e '(load-string (slurp *in*))' 🙂 as long as you don't use anything from the ys.std library (stick to clj/bb calls). ys (the runtime) is growing up to be closer to bb. Ironically, I didn't see that until a couple months ago. bb provides a roadmap of possible directions for ys. So back to your point, I don't see how using a babashka repl helps, but maybe I'm missing something.

Using babashka repl helps if Calva can just start a babashka nrepl server, which exists. 😃

@markus.agwin and I are in the middle of playing with something like ys --watch file.ys where the file is loaded and then watched, and reloaded when it changes and compiles cleanly. We are thinking of ways to mark things syntactically in file.ys that make them remember state and report state. Thus you watch in one window while editing in another

As a poor man’s repl?

✅ 1

I’m guessing some other use case. 😃

With one goal to make this type of dev something that data scientists on windows using notepad++ can use. Less intimidating than even python...

@markus.agwin can speak to this more directly as he is the one who made the case for it in the first place...

But the full calva/nrepl scenario we were talking about is still definitely planned.

I just need to get to the point where more people want to help me drive things forward 😄

Since its a lot of work, and I'm an average (at best) clojure hacker so far...

@pez yes, the --watch is a poor man's repl. The idea is taken directly from https://rigsomelight.com/2014/05/01/interactive-programming-flappy-bird-clojurescript.html. This --watch is the easiest way to introduce non-lisp people to the concept of functions and most importantly memoize . Of course, --watch does not exclude an nrepl connection to VS-code -- in the same way as figwheel/Shadow-cljs does not exclude the ClojureScript repl. But I think YS is not mainly targeted at Clojure users who already have the nrepl setup but for people who do not like S-Expressions and thus never heard of nrepl. Having a way to show memoize immediately in a hands on example, an example which speeds up calculations and thus the print-line debugging cycle already opens the door to functional programming.

🙌 1

@ingy re: that someone: indeed… I’ve been interested for months now to train LLMs with high-quality Clojure examples produced by myself, but I’m honestly clueless when it comes to this stuff 😄

I joined #clojurellm with the intent of providing tokens for anyone building a Clojure-specialized language model, but haven’t figured out how to help there

I'm learning baby steps with that

I need to train LLMs to return responses in valid YAML

👍 1

I'll let you know how it goes

@hifumi123 I read something this morning. I'll try to find it