
Xs: a concatenative array language inspired by kdb+ and FORTH - kick
https://cryptm.org/xs/
======
BiteCode_dev
Sometimes I feel that, instead of APL/J/K being standalone languages, we
should standardize a mini-language like we did with printf, date formatting or
regexes, and embed it in all general purpose languages.

~~~
qznc
Why a mini language instead of a library?

Python has Numpy to satisfy most array programming needs, for example.

~~~
BiteCode_dev
Good point, and I'm not a big fan of DSL. I think most of the time, we should
make a better API.

But for regexes, it has been a success: they are rarely used, but when they
are, you are glad you have them.

In fact you probably need to do both: re in Python is a library. A library
that implements the regex DSL.

Maybe there is a way to create an API around numpy that translates a J/K/APL
like DSL into numpy operations.

Just like regexes, this is not something you want to use often.

But I assume that, just like I don't want to describe a whole parser when I
just need to match/split/extract text, people doing array processing probably
don't want to describe every single steps for very common operations in some
cases.

~~~
Y_Y
I did exactly that a couple of years ago, turned out it wasn't hard to
translate J expressions into the equivalent numpy code and then eval it in the
current context. I'm afraid I've lost the code, otherwise I'd post it.

------
JadeNB
The tutorial says that 2 + 5 yields 5. I originally thought it was some gotcha
about trying to use infix operators in a concatenative language, but the
documentation says that it's correctly re-written internally, so I think it's
just a typo.

(Incidentally, I tried to C&P the relevant section from the documentation, and
I can't highlight in the text at all. How does that work, and why?)

~~~
weareconvo
Come to Homer's BBBQ. The extra B is for BYOBB.

------
pwdisswordfish2
It appears the author was not inspired by the small binary size of k or FORTH
interpreters.

~~~
klibertp
Probably because this is a debug build, but yeah, 25Mb for the executable is
quite a lot, considering gforth is 225Kb and J ~2Mb.

Well, Xs looks very early in the development, so I think the large list of
dependencies is due to an initial effort for getting _something_ up and
running quickly. It'll probably get better over time. I think production build
of Haxe (also written in OCaml) was about 2Mb, so there's definitely room for
improvement :)

~~~
smabie
I'm the author, yeah I need to ditch Core. It's fucking massive. I would have
thought Jane Street gave a shit about binary size, but I guess not..

------
klibertp
Looks really interesting! I will definitely play with it tomorrow. I used
Forth for a bit in the past, and played with Factor a bit; my impression is
that Xs looks a bit like the latter, with some parts from J on top (I don't
know K, sadly, so I can't say what features Xs borrows from it).

~~~
quantified
Same impression.

------
cheez
what is this obsession with terse languages that look like a composition of
random characters, didn't we learn from Perl

~~~
rscho
Terse languages are a must for single or few-user experiments, e.g. research.
Not everyone is implementing a commercial website that needs to be understood
by 50 people.

~~~
j88439h84
I still use good variable names in projects where I'm the only person reading
the code. I wouldn't remember what things mean otherwise.

~~~
rscho
We have a different definition of terseness.

~~~
j88439h84
What do you mean?

~~~
rscho
I mean that programming in a terse language has nothing to do with obscure
variable names. The point of terse languages is that knowing the primitives
allows you to write concise programs comfortably. It doesn't mean you have to
use single letter variables which in opposition to primitives _do_ change
between programs.

~~~
j88439h84
Isn't the way those languages make concise programs by having short symbols
instead of descriptive names?

Comparing NumPy to APL it looks that way.

[https://analyzethedatanotthedrivel.org/2018/03/31/numpy-
anot...](https://analyzethedatanotthedrivel.org/2018/03/31/numpy-another-
iverson-ghost/)

~~~
rscho
Well yeah, referring to my above comment the primitives are symbols and it's
expected that the user knows them, just as you're supposed to know the
keywords in any language.

Good (professional) APL though, will intersperse those primitives with
meaningful variable names.

Whether one thinks it's worth the effort to know the symbols vs know the
keywords is matter of opinion. But if one dares calling oneself let's say a
python programmer, I'd argue that anybody would expect that you'd know the
keywords anyways.

