help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ELisp - Making a list from a function returning a number


From: steve-humphreys
Subject: Re: ELisp - Making a list from a function returning a number
Date: Fri, 18 Dec 2020 04:01:26 +0100

This is my new function

(defun timgrid ()

   (let* ( (tstr 800)
           (tend 1300)
           (tpd 34)
           (i 0)
           (tim tstr)
           tim tfr )
      ;; ----- body of let -----
      (dotimes (i 4)
         (message "tim tpd: %d %d" tim tpd)
         (setq tfr (timfutur tim tpd))
         (message "tim: %d" tim)
         ;;(setq tlist (append 'tlist (list tim)))
         (setq tim tfr)) ))


> Sent: Friday, December 18, 2020 at 3:26 AM
> From: steve-humphreys@gmx.com
> To: steve-humphreys@gmx.com
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: ELisp - Making a list from a function returning a number
>
> I have now started constructing my function but get many problems.
>
> (defun timgrid ()
>
>    (setq tstr 800)
>    (setq tend 1300)
>    (setq tpd 34)
>
>    (setq i 0)
>    (setq tim tstr)
>    (setq tlist '(tim))
>    (dotimes (i 4)
>       (setq tfr (timfutur (tim tpd)))
>       (setq tim tfr)
>       (setq tlist (append (tlist) (tim))) ))
>
>
> > Sent: Thursday, December 17, 2020 at 12:42 PM
> > From: steve-humphreys@gmx.com
> > To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: ELisp - Making a list from a function returning a number
> >
> >
> > I have written a function to return time as a number so I can set the 
> > temporal grid
> > in org-agenda.
> >
> > I was previously using number-sequence until someone fount a problem.  Now 
> > I have timfutur to
> > give me the next time (time interval "tsk" after time "tim")
> >
> > (tim (number-sequence tstr tend tskp))
> >
> > So what I have remaining to do is to make a list of numbers representing 
> > the times when the
> > agenda grids are displayed.
> >
> >
> > (defun timfutur (tim tsk)
> >
> >    (let* ( (thr (/ tim 100))
> >            (tmn (- tim (* thr 100)))
> >
> >            (tinc_mn (+ tmn tsk))
> >            (tinc_hr (/ (+ tmn tsk) 60))
> >            (tinc_mn (- tinc_mn (* tinc_hr 60)))
> >
> >            (thr_futur (* (+ thr tinc_hr) 100))
> >            (tmn_futur tinc_mn)
> >            (tim_out (+ thr_futur tmn_futur)) )
> >       ;; --- body of let ----
> >       tim_out ))                  ;  function returns last form
> >
> >
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]