Janet

Moving averages beatifully

janet code math

So this is another post on the janet journey. My goal here was to create a simple moving average function in janet (maybe just as a functional programming lover).

The code

I created a repo named numja that I intend to put all mathy stuff there. And moving average fits that category.

The second step was to create a small script that would run with the new “lib”.

The result

Simple as the proposition is, simple the code and simple the result. I used the “lib”, and plotted with gnuplot and voila!

Figure 1: Moving average

Figure 1: Moving average

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Moving averages beatifully

Janet? Janet!

janet game-of-life code

Do you like C but changed because you were tired of the low productivity, the annoying syntax and - oh my god! - Segmentation fault? Holy shit! Me too!

But then, a couple of years ago, a friend of mine showed me Janet. And I was from the get go hooked! It took me a while to create something in it, now I have something to show.

Why Janet?

Come on… google it

What have I done with it?

Well, I have this pet project that it is to create a Janet wrapper for ncurses. But that will deserve a post on its own. For now, I will show a game of life using the prototype version of the janet-ncurses.

  1. I created a repo for it: https://git.sr.ht/~lucasemmoreira/game-of-life
  2. It is very simple to use it. The big bang file is the initial state of it. Play with it!
  3. Now you can run with janet, if you have installed it, make

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Janet? Janet!