Wonderful! But i fear, most of the audience here hasn't the slightest idea,
what it's all about. Let me explain!

Maybe, you have already clicked into some graphics in your browser or just
used the "onmouseover" functionality. In HTML, everything is repesented in
a DOM, that's a tree structure, like JSON. But what do you mean, when you
move your mouse over a structure, say a table? Do you mean the cell element
or do you rather mean the whole table which then gets highlighted by
clicking on it?

Lenses here give you kind of functional tool to select or glue elements or
parts of the DOM together to make it a functional unit. Internally, it's
done with a set of chained getters and setters to compose DOM elements to
bigger units that then can be moved together, clicked on, activated or
deactivated, turned, (CSS3) animated, ... whatever.

A map function here is the simplest kind of "lens". With "onmouseover" you
mean whole DOM. Whereever you need kind of selector, you can do it with
lenses.

A more complicated example is a 5 - axis robot. Each arm can be moved
independently, so i have a chain of affine transformations, that finally
move the tool at the end to its position. But here 5 arms sometimes give us
more freedom, than we really need and maybe that there are many ways of
combining movements of arms to reach the same position.

Note: Moving forward then turning is not the same as first turning and then
moving forwards!

And now imagine, that one arm of the 5-axis robot breaks and i have to
compensate that. Mathematically, i now have to introduce co- and
contravariant matrixes to compensate the broken arm.

Contravariance you may also need e.g. to compensate a robot arm on a
rolling ship, e.g. to keep things horizontally.

Lenses here give you the universal tool for new aggregation of functions
that then treat data in a different way, with a different focus on the
underlying structures, be it tree, graph, linear list, whatever.... the
chain of getter/setter functions get rearranged automatically.

In Lisp or Picolisp it is done by reworking the code. Learn: "Data is code,
code is data", which makes Lisp unique in the whole world of programming.

Summary: Lenses are a general tool for functional composition or
rearrangement of getter/setter functions.

In non-functional programming languages lenses make no sense. They simply
don't exist there.

Have fun!


Abel Normand <abel.ze.norm...@gmail.com> schrieb am So., 19. Mai 2019,
23:08:

> Hello everyone.
>
> I'm happy to present you my last project:
> https://gitlab.com/Abel-ze-Normand/lens.l. It is a very nice abstraction
> from Haskell functional programming community and I wanted to share with
> you this PicoLisp implementation of Lens pattern and utilities to work with
> them. I plan to use them not only as a proof of concept but also as
> powerful tool to work with different formats of data in declarative way. I
> hope you will find it useful or at least interesting.
> --
> Best regards, Nail
>

Reply via email to