unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Update the value of specific column using the values of other columns on-the-fly.
@ 2020-12-26 12:47 Hongyi Zhao
  2020-12-26 12:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 5+ messages in thread
From: Hongyi Zhao @ 2020-12-26 12:47 UTC (permalink / raw)
  To: help-gnu-emacs

I want to edit a table with 5 columns, where the first column is
calculated from the other columns as below:

val_col1 = 20% * val_col2 + 30% * val_col3 + 40% * val_col4 + 10% * val_col5

I want to let emacs update the column 1, i.e., the weighted mean
result of other columns automatically and on the fly when I input the
values for other columns.

Is this possible with emacs? Any hints will be highly appreciated.

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Update the value of specific column using the values of other columns on-the-fly.
  2020-12-26 12:47 Update the value of specific column using the values of other columns on-the-fly Hongyi Zhao
@ 2020-12-26 12:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-26 12:57   ` Hongyi Zhao
  2020-12-27  0:54   ` Hongyi Zhao
  0 siblings, 2 replies; 5+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-26 12:52 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> I want to edit a table with 5 columns, where the first
> column is calculated from the other columns as below:
>
> val_col1 = 20% * val_col2 + 30% * val_col3 + 40% * val_col4 + 10% * val_col5
>
> I want to let emacs update the column 1, i.e., the weighted
> mean result of other columns automatically and on the fly
> when I input the values for other columns.
>
> Is this possible with emacs? Any hints will be
> highly appreciated.

There is the Emacs spreadsheet, of course.

Or do it in Lisp.

But then in Lispp (Lisp and only Lisp), i.e., 100% code,
because reading column values back and forth in a buffer -
that is soo fragile... use the spreadsheet for that, that's
why it's there!

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Update the value of specific column using the values of other columns on-the-fly.
  2020-12-26 12:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-26 12:57   ` Hongyi Zhao
  2020-12-27  0:54   ` Hongyi Zhao
  1 sibling, 0 replies; 5+ messages in thread
From: Hongyi Zhao @ 2020-12-26 12:57 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Sat, Dec 26, 2020 at 8:52 PM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > I want to edit a table with 5 columns, where the first
> > column is calculated from the other columns as below:
> >
> > val_col1 = 20% * val_col2 + 30% * val_col3 + 40% * val_col4 + 10% * val_col5
> >
> > I want to let emacs update the column 1, i.e., the weighted
> > mean result of other columns automatically and on the fly
> > when I input the values for other columns.
> >
> > Is this possible with emacs? Any hints will be
> > highly appreciated.
>
> There is the Emacs spreadsheet, of course.
>
> Or do it in Lisp.
>
> But then in Lispp (Lisp and only Lisp), i.e., 100% code,

What do you mean by saying *Lispp*?

> because reading column values back and forth in a buffer -
> that is soo fragile... use the spreadsheet for that, that's
> why it's there!
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>


-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Update the value of specific column using the values of other columns on-the-fly.
  2020-12-26 12:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-26 12:57   ` Hongyi Zhao
@ 2020-12-27  0:54   ` Hongyi Zhao
  2020-12-27  1:17     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 5+ messages in thread
From: Hongyi Zhao @ 2020-12-27  0:54 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Sat, Dec 26, 2020 at 8:52 PM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > I want to edit a table with 5 columns, where the first
> > column is calculated from the other columns as below:
> >
> > val_col1 = 20% * val_col2 + 30% * val_col3 + 40% * val_col4 + 10% * val_col5
> >
> > I want to let emacs update the column 1, i.e., the weighted
> > mean result of other columns automatically and on the fly
> > when I input the values for other columns.
> >
> > Is this possible with emacs? Any hints will be
> > highly appreciated.
>
> There is the Emacs spreadsheet, of course.
>
> Or do it in Lisp.
>
> But then in Lispp (Lisp and only Lisp), i.e., 100% code,
> because reading column values back and forth in a buffer -
> that is soo fragile...

The orgmode itself is also written in elisp, so why do you have the
above point of view?

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Update the value of specific column using the values of other columns on-the-fly.
  2020-12-27  0:54   ` Hongyi Zhao
@ 2020-12-27  1:17     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 5+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-27  1:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

>> But then in Lispp (Lisp and only Lisp), i.e., 100% code,
>> because reading column values back and forth in a buffer -
>> that is soo fragile...
>
> The orgmode itself is also written in elisp

Yes, as is the SES (Simple Emacs Spreadsheet).

> so why do you have the above point of view?

Take a look at this file, it is about about Olympic hockey. [1]
Sure, you can do the most basic of all arithmetic (which is
counting) but move a single entry in that file even one column
to the right or left and it breaks...

So to have something that even remotely works like
a spreadsheet, either do it in Lisp, suitable for a quick
one-shot

(let*((value-1 (do-computations))
      ...)
  (present-result) )

or, even better, and in particular if you intend to do this
again and/or extend/resuse/modify it, use
a spreadsheet solution.

The type of software you are asking for is a spreadsheet.

[1] https://dataswamp.org/~incal/hockey/og.el

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-27  1:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-26 12:47 Update the value of specific column using the values of other columns on-the-fly Hongyi Zhao
2020-12-26 12:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-26 12:57   ` Hongyi Zhao
2020-12-27  0:54   ` Hongyi Zhao
2020-12-27  1:17     ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).