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

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

Re: Understanding the "let" construct and the setting of variables


From: steve-humphreys
Subject: Re: Understanding the "let" construct and the setting of variables
Date: Thu, 17 Dec 2020 01:25:11 +0100

Let's introspect two questions.

1. In what simple circumstances would one use a "setq" in the body of a let?
2. What simple option does one have that is more advantageous than using a 
"setq"?



> Sent: Thursday, December 17, 2020 at 1:10 AM
> From: steve-humphreys@gmx.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Understanding the "let" construct and the setting of variables
>
> I have been writing some elisp to set the time grid in the agenda.
> The discussion progressed towards the use of the "let" construct.
>
> But, the discussion got too advanced for me to follow the different
> points of view and make a decision.
>
> This message is for showing some examples, of how to set and use variables
> in a "let", because people criticise using "setq".  But discussion needs
> simple examples  that would not overwhelm a relative beginner.
>
> (defun timfutur ()
>    (interactive)
>    (setq tim 845)
>    (setq tsk 80)
>
>    (setq thr (/ tim 100))
>    (setq tmn (- tim (* thr 100)))
>
>    (setq tinc_mn (+ tmn tsk))
>    (setq tinc_hr (/ (+ tmn tsk) 60))
>    (setq tinc_mn (- tinc_mn (* tinc_hr 60)) )
>
>    (setq thr_futur (* (+ thr tinc_hr) 100)  )
>    (setq tmn_futur tinc_mn)
>    (setq tim_out (+ thr_futur tmn_futur))
>
>
>
>
>
>



reply via email to

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