How do I find and insert the average of multiple lines in Emacs / Elisp? -


I have a file that looks like:

  AT 4 AT 5.6A .a. 7.2 IG 6EG 6S2 OP3 OP 1.2 OP 40   

And I want to calculate on average for some such as each title and output (I have made this average):

  AT 5.42EG 6S2OP32.1   

The file is in order, so all the titles will be right under each other, but like a different volume headings. AT has three, but S is the only one.

How do I add each of these lines, will be divided by the number of rows, and then the Emacs / elisp?

Replace all lines I still try to solve this question while learning Decided yourself Elisp Perhaps there are more efficient ways to resolve this.

After defining the function, you want to set the area around the score. (If the whole file, then M-& lt ;, C-SPC, M-> I thought it would be fine because your score could be in the middle of other text, my function would calculate the average and then the end of the field Answer in

  (Fius (make-hash-table: test 'equal')) (Answer "") (curl hook)) (key blue) (value zero); The process of each line in the field (Save-Go (Goto-Four begging) (while the end (& lt; (point)); Partition line (two ((division line (split line (buffer-substring-no-properties) Start-position) (line-end-position))) (setkey key (car split-line) val (string-to-number) (cadre split-line) Crवाल advance to the next line (forward-line) ( Accumulation (+ (car carving) 1) (+ (CDR curve)) avgs; Next line advance; String (Maphash (Lambda (KV) (Satyak North (Answer to Cocktail "\ n" K "(Number-to-String (/ (CDV V) (Car V)))))) AGGS (end-of- Line) (insert response)))   

As a warning, I am checking zero errors to check lines that do not meet your formatting strictly .

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -