
Sentient: a high-level, declarative programming language - panic
https://sentient-lang.org
======
bane
Something feels kind of "right" about this in the same sense that machine
learning techniques seem to be able to produce correct results. In my "things
that exist in Star Trek:TNG that we should be making more progress on" list, I
think that how we program is wrong for a great many of use-cases.

In the Star Trek fictional universe, you often see characters programming
impossibly complex things very quickly. There's several episodes where a
character will create a holodeck simulation simply by describing what they
want and providing detail for the parts the computer got wrong until the
simulation is more or less what they want.

I feel like in some cases we're starting to figure this out like with GauGAN:
[https://www.youtube.com/watch?v=p5U4NgVGAwg](https://www.youtube.com/watch?v=p5U4NgVGAwg)

But what about other cases? Can we just sort of describe the output we want,
feed in data and have the computer more or less figure out the set of
functions that produces what we're looking for? Such a paradigm would
basically allow anybody to make a huge array of one-off, ultra-custom, long-
tail, "programs" that solve extremely niche needs without needing to learn all
the rigor of actually programming.

~~~
oscargrouch
I think one programming paradigm that is very underserved is something in the
sorts of filters.

GPU shaders, Signal Processing or a Nginx filter are all on this line of
thinking.

We should be more inclined into program things as filters where we manipulate
and maybe mutate/transform the data that is passing through that filter, so
this could be easily paralelized, cut a lot of expensive CPU branches and
where humans and machines could work together making those filters. (It would
be much easiar for an AI to infer/learn about how to program like this)

In this perspective how we layout and shape the data is much more important..
so if we could create new standards where we can represent anything as a
matrix for instance, we could have state-of-the-art engines who would care
about scheduling, compilation and paralelization so we could only focus on
manipulate and transform data according to the goals of what we are trying to
achieve.

~~~
hderms
I'm inclined to agree but if an nginx filter is like (HttpRequest,
HttpResponse) => (HttpRequest, HttpResponse) then aren't we basically saying
we like purely problems that can be expressed as compositions of pure
functions? Signal programming I have less feelings on

~~~
oscargrouch
Just to add to this, more to the spot of your question, i think a no side-
effect is often desirable, but i dont think it should be an impediment.

As you might need to call another function inside of our procedure that
mutates some data.

But i think there are some sort of problems we are imposing to ourselves just
because we need to deal with the millions possible ways a data could be laid
out or modeled based in our type-system centric world.

In my perfect world, we should model functions in a DNA fashion, so function
is also data, and if is mutable, could even be changed by the data depending
of the what is in it.

First, we would never have to re-create a function again, and if we do, the
data signature would be exactly the same as the other one created before, so
we can match in a index for instance.

Im more inspired by the way things are done in the natural world, than the way
we ended up shaping math (where the concepts of FP are more based on).

------
cpatuzzo
Hey everyone, I'm really flattered by everyone's interest in the language. I
had no expectation of that when I worked on it. I'm happy to try and answer
questions, though my memory's a bit fuzzy now. I think the reason for this
sudden interest was this self-referential Tweet by Robin Houston which used
Sentient to construct a pangram:

[https://twitter.com/robinhouston/status/1177575725240639489?...](https://twitter.com/robinhouston/status/1177575725240639489?s=20)

The best resource to understand the language is probably this podcast:
[https://whyarecomputers.com/4](https://whyarecomputers.com/4)

I'm immensely grateful to Tom for coaxing me into recording it with him.

------
dang
This is pretty neat about this:
[https://news.ycombinator.com/item?id=12429393](https://news.ycombinator.com/item?id=12429393).

------
xvilka
Prolog, and Lambda Prolog are much more universal. See the Awesome Prolog[1]
list for more resources and examples.

[1] [https://github.com/klaussinani/awesome-
prolog](https://github.com/klaussinani/awesome-prolog)

------
i_don_t_know
At first glance, this appears to be similar to languages like MiniZinc
([https://www.minizinc.org/](https://www.minizinc.org/)) and maybe AMPL
([https://ampl.com/](https://ampl.com/)). That is, you describe a problem in
some form of constraint-based programming language, and you send it to a
solver to find the solution.

Am I understanding this correctly? Or am I missing something? What are the
differences between Sentient and MiniZinc etc?

------
tiberius_p
this is something that hardware verification languages like specman-e and
systemverilog have been doing for decades

------
angel_j
Neat, but not the most illuminating introductory demo. Took me a few minutes
to figure out the UI is filling in the blanks at runtime, and I still don't
see how/where it assigns an index to "members", or how it reasons about
"members" at all.

Also confusing is declaring sum=0 instead of sum=?, since the program doesn't
know what "sum" is until runtime. If I change the declaration to sum=10, does
that change the runtime count?

~~~
cpatuzzo
>Neat, but not the most illuminating introductory demo.

Agreed. It was the first one I made so it just happened to become the
homepage. It'd probably be better served by one of the others.

>I still don't see how/where it assigns an index to "members", or how it
reasons about "members" at all

Members is an array of booleans. Its intended meaning is: "is the number with
this index in the subset?". When it iterates over the numbers, it only adds
them to the sum if members[index] is true. The standard library is light so
doesn't have a #zip function which would probably help clarity.

>Also confusing is declaring sum=0 instead of sum=?

I think this demonstrates an unusual thing about Sentient in that you can
write your constraint-based programs in a procedural style, but their
evaluation is far from procedural such that you can set sum to anything you
like at runtime.

I sometimes think of Sentient programs as running over the space of all
possible values for variables. Sometimes they're completely deterministic (as
in a conventional language) but other times they're determined at runtime as a
consequence of the invariants of your program.

It reminds me a bit of quantum physics where the 'act of measuring' seems to
determine the actual value of something.

------
carapace
See also Tau Prolog implemented in Javascript [http://tau-
prolog.org/](http://tau-prolog.org/)

------
Gormisdomai
Why does the subset sum example here seem to fail on '0'? Or is it just
returning the empty set?

~~~
cpatuzzo
It's returning the empty set. You can click on the grid to cycle through some
of the solutions.

Also, there's an easter egg hidden in this example.

