all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* problems of everyday life
@ 2022-11-15 15:19 Emanuel Berg
  2022-11-15 16:45 ` Heime
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-15 15:19 UTC (permalink / raw)
  To: help-gnu-emacs

If you are to boil one egg for 5 minutes, the other for
7 minutes, and the third one for 10 minutes, how long time
does it take to boil all three eggs?

In Lisp, there are several ways to solve this, it can be
put as

  (+ 5 7 10)

or maybe

  (apply #'+ '(5 7 10))

or ... well, what do you prefer?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-15 15:19 problems of everyday life Emanuel Berg
@ 2022-11-15 16:45 ` Heime
  2022-11-15 16:46 ` Dmitry Gutov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: Heime @ 2022-11-15 16:45 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

If you were a chef, 10 minutes!


------- Original Message -------
On Tuesday, November 15th, 2022 at 3:19 PM, Emanuel Berg <incal@dataswamp.org> wrote:


> If you are to boil one egg for 5 minutes, the other for
> 7 minutes, and the third one for 10 minutes, how long time
> does it take to boil all three eggs?
> 
> In Lisp, there are several ways to solve this, it can be
> put as
> 
> (+ 5 7 10)
> 
> or maybe
> 
> (apply #'+ '(5 7 10))
> 
> or ... well, what do you prefer?
> 
> --
> underground experts united
> https://dataswamp.org/~incal



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

* Re: problems of everyday life
  2022-11-15 15:19 problems of everyday life Emanuel Berg
  2022-11-15 16:45 ` Heime
@ 2022-11-15 16:46 ` Dmitry Gutov
  2022-11-15 17:17   ` Heime
  2022-11-15 18:38 ` tomas
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: Dmitry Gutov @ 2022-11-15 16:46 UTC (permalink / raw)
  To: help-gnu-emacs

On 15.11.2022 17:19, Emanuel Berg wrote:
> If you are to boil one egg for 5 minutes, the other for
> 7 minutes, and the third one for 10 minutes, how long time
> does it take to boil all three eggs?

10 minutes.



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

* Re: problems of everyday life
  2022-11-15 16:46 ` Dmitry Gutov
@ 2022-11-15 17:17   ` Heime
  2022-11-16 12:02     ` Akib Azmain Turja
  0 siblings, 1 reply; 23+ messages in thread
From: Heime @ 2022-11-15 17:17 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: help-gnu-emacs

------- Original Message -------
On Tuesday, November 15th, 2022 at 4:46 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:


> On 15.11.2022 17:19, Emanuel Berg wrote:
> 
> > If you are to boil one egg for 5 minutes, the other for
> > 7 minutes, and the third one for 10 minutes, how long time
> > does it take to boil all three eggs?
> 
> 
> 10 minutes.

I wonder what he is smoking or drinking!



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

* Re: problems of everyday life
  2022-11-15 15:19 problems of everyday life Emanuel Berg
  2022-11-15 16:45 ` Heime
  2022-11-15 16:46 ` Dmitry Gutov
@ 2022-11-15 18:38 ` tomas
  2022-11-16  7:51 ` Juri Linkov
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: tomas @ 2022-11-15 18:38 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

On Tue, Nov 15, 2022 at 04:19:21PM +0100, Emanuel Berg wrote:
> If you are to boil one egg for 5 minutes, the other for
> 7 minutes, and the third one for 10 minutes, how long time
> does it take to boil all three eggs?

As others have already said... c'mon. Save energy!

  (max 5 7 10)

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: problems of everyday life
  2022-11-15 15:19 problems of everyday life Emanuel Berg
                   ` (2 preceding siblings ...)
  2022-11-15 18:38 ` tomas
@ 2022-11-16  7:51 ` Juri Linkov
  2022-11-16 12:10   ` Akib Azmain Turja
                     ` (3 more replies)
  2022-11-16 20:54 ` North Year
  2022-11-17  6:33 ` Jean Louis
  5 siblings, 4 replies; 23+ messages in thread
From: Juri Linkov @ 2022-11-16  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

> or maybe
>
>   (apply #'+ '(5 7 10))
>
> or ... well, what do you prefer?

This reminds the implementation of sleep sort:

  (dolist (i '(3 1 4 1 5 92 65 3 5 89 79 3))
    (run-with-timer (* i 0.001) nil 'message "%d" i))

The sorted output printed in the *Messages* buffer:

  1 [2 times]
  3 [3 times]
  4
  5 [2 times]
  65
  79
  89
  92



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

* Re: problems of everyday life
  2022-11-15 17:17   ` Heime
@ 2022-11-16 12:02     ` Akib Azmain Turja
  0 siblings, 0 replies; 23+ messages in thread
From: Akib Azmain Turja @ 2022-11-16 12:02 UTC (permalink / raw)
  To: Heime; +Cc: Dmitry Gutov, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

Heime <heimeborgia@protonmail.com> writes:

> ------- Original Message -------
> On Tuesday, November 15th, 2022 at 4:46 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
>
>
>> On 15.11.2022 17:19, Emanuel Berg wrote:
>> 
>> > If you are to boil one egg for 5 minutes, the other for
>> > 7 minutes, and the third one for 10 minutes, how long time
>> > does it take to boil all three eggs?
>> 
>> 
>> 10 minutes.

It is less than 10 minutes.  Start boiling and just do whatever you
like.  Your clock would say 10 minutes have passed, but you'd object.

>
> I wonder what he is smoking or drinking!
>

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: problems of everyday life
  2022-11-16  7:51 ` Juri Linkov
@ 2022-11-16 12:10   ` Akib Azmain Turja
  2022-11-16 20:39     ` Emanuel Berg
  2022-11-17  3:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-11-16 14:31   ` Emanuel Berg
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 23+ messages in thread
From: Akib Azmain Turja @ 2022-11-16 12:10 UTC (permalink / raw)
  To: Juri Linkov; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

Juri Linkov <juri@linkov.net> writes:

>> or maybe
>>
>>   (apply #'+ '(5 7 10))
>>
>> or ... well, what do you prefer?
>
> This reminds the implementation of sleep sort:
>
>   (dolist (i '(3 1 4 1 5 92 65 3 5 89 79 3))
>     (run-with-timer (* i 0.001) nil 'message "%d" i))
>
> The sorted output printed in the *Messages* buffer:
>
>   1 [2 times]
>   3 [3 times]
>   4
>   5 [2 times]
>   65
>   79
>   89
>   92
>

Someone implemented addition using sleep.  Now I have implemented
subtraction:

--8<---------------cut here---------------start------------->8---
(defun subtract (x y)
  (when (< y x)
    (let ((tmp x))
      (setq x y)
      (setq y tmp)))
  (let ((time-a (current-time)))
    (sleep-for x)
    (let ((time-b (current-time)))
      (while (< (float-time (time-subtract nil time-a)) y)
        (sleep-for 0.9))
      (floor (float-time (time-subtract nil time-b))))))

(subtract 0 1)     ; => 1
(subtract 3 5)     ; => 2
--8<---------------cut here---------------end--------------->8---

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: problems of everyday life
  2022-11-16  7:51 ` Juri Linkov
  2022-11-16 12:10   ` Akib Azmain Turja
@ 2022-11-16 14:31   ` Emanuel Berg
  2022-11-16 14:54   ` Emanuel Berg
  2022-11-16 16:14   ` Rudolf Adamkovič
  3 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-16 14:31 UTC (permalink / raw)
  To: help-gnu-emacs

Juri Linkov wrote:

>> or maybe
>>
>>   (apply #'+ '(5 7 10))
>>
>> or ... well, what do you prefer?
>
> This reminds the implementation of sleep sort:
>
>   (dolist (i '(3 1 4 1 5 92 65 3 5 89 79 3))
>     (run-with-timer (* i 0.001) nil 'message "%d" i))
>
> The sorted output printed in the *Messages* buffer:
>
>   1 [2 times]
>   3 [3 times]
>   4
>   5 [2 times]
>   65
>   79
>   89
>   92

Haha, brilliant :)

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-16  7:51 ` Juri Linkov
  2022-11-16 12:10   ` Akib Azmain Turja
  2022-11-16 14:31   ` Emanuel Berg
@ 2022-11-16 14:54   ` Emanuel Berg
  2022-11-16 16:14   ` Rudolf Adamkovič
  3 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-16 14:54 UTC (permalink / raw)
  To: help-gnu-emacs

Juri Linkov wrote:

>> or maybe
>>
>>   (apply #'+ '(5 7 10))
>>
>> or ... well, what do you prefer?
>
> This reminds the implementation of sleep sort:
>
>   (dolist (i '(3 1 4 1 5 92 65 3 5 89 79 3))
>     (run-with-timer (* i 0.001) nil 'message "%d" i))

This made my day :)

(defun sleep-sort (&rest lst)
  (let ((sorted))
    (dolist (i lst)
      (run-with-timer (* i 0.001) nil (lambda () (push i sorted))) )
    (while (> (length lst) (length sorted))
      (sleep-for 1) )
    (nreverse sorted) ))

(sleep-sort 3 1 4 1 5 92 65 3 5 89 79 3)

-> (1 1 3 3 3 4 5 5 65 79 89 92)

Maybe one can integrate the busy wait somehow since the
maximum wait time is known ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-16  7:51 ` Juri Linkov
                     ` (2 preceding siblings ...)
  2022-11-16 14:54   ` Emanuel Berg
@ 2022-11-16 16:14   ` Rudolf Adamkovič
  2022-11-16 17:17     ` Emanuel Berg
  3 siblings, 1 reply; 23+ messages in thread
From: Rudolf Adamkovič @ 2022-11-16 16:14 UTC (permalink / raw)
  To: Juri Linkov, help-gnu-emacs

Juri Linkov <juri@linkov.net> writes:

> This reminds the implementation of sleep sort:

LOL!  Thanks for sharing.

Rudy
-- 
"Be especially critical of any statement following the word
'obviously.'"
-- Anna Pell Wheeler, 1883-1966

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



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

* Re: problems of everyday life
  2022-11-16 16:14   ` Rudolf Adamkovič
@ 2022-11-16 17:17     ` Emanuel Berg
  0 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-16 17:17 UTC (permalink / raw)
  To: help-gnu-emacs

Rudolf Adamkovič wrote:

>> This reminds the implementation of sleep sort
>
> LOL! Thanks for sharing.

I wonder if there are input data for which it is
actually superior?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-16 12:10   ` Akib Azmain Turja
@ 2022-11-16 20:39     ` Emanuel Berg
  2022-11-17  3:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-16 20:39 UTC (permalink / raw)
  To: help-gnu-emacs

Akib Azmain Turja wrote:

> Someone implemented addition using sleep.  Now I have implemented
> subtraction:
>
> (defun subtract (x y)
>   (when (< y x)
>     (let ((tmp x))
>       (setq x y)
>       (setq y tmp)))
>   (let ((time-a (current-time)))
>     (sleep-for x)
>     (let ((time-b (current-time)))
>       (while (< (float-time (time-subtract nil time-a)) y)
>         (sleep-for 0.9))
>       (floor (float-time (time-subtract nil time-b))))))
>
> (subtract 0 1)     ; => 1
> (subtract 3 5)     ; => 2

What about recursive counting?

(defun recursive-count (n)
  (if (zerop n)
      0
    (1+ (recursive-count (1- n))) ))

(recursive-count 5) ; 5

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-15 15:19 problems of everyday life Emanuel Berg
                   ` (3 preceding siblings ...)
  2022-11-16  7:51 ` Juri Linkov
@ 2022-11-16 20:54 ` North Year
  2022-11-16 21:06   ` Emanuel Berg
                     ` (2 more replies)
  2022-11-17  6:33 ` Jean Louis
  5 siblings, 3 replies; 23+ messages in thread
From: North Year @ 2022-11-16 20:54 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

Emanuel Berg <incal@dataswamp.org> writes:

> If you are to boil one egg for 5 minutes, the other for
> 7 minutes, and the third one for 10 minutes, how long time
> does it take to boil all three eggs?
>
> In Lisp, there are several ways to solve this, it can be
> put as
>
>   (+ 5 7 10)
>
> or maybe
>
>   (apply #’+ ’(5 7 10))
>
> or … well, what do you prefer?

This leads to a dynamic programming problem I guess.

x eggs to be boiled each of which need x_i times to be boiled.
y pots can be used to boil egges each of which has capacity to cook y_i eggs at one time.

Never tried to writing algorithm codes in elisp. This would be interesting.


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

* Re: problems of everyday life
  2022-11-16 20:54 ` North Year
@ 2022-11-16 21:06   ` Emanuel Berg
  2022-11-16 21:30   ` Emanuel Berg
  2022-11-16 21:38   ` Emanuel Berg
  2 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-16 21:06 UTC (permalink / raw)
  To: help-gnu-emacs

North Year wrote:

> This leads to a dynamic programming problem I guess.
>
> x eggs to be boiled each of which need x_i times to be
> boiled. y pots can be used to boil egges each of which has
> capacity to cook y_i eggs at one time.
>
> Never tried to writing algorithm codes in elisp. This would
> be interesting.

Be sure to post it here :)

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-16 20:54 ` North Year
  2022-11-16 21:06   ` Emanuel Berg
@ 2022-11-16 21:30   ` Emanuel Berg
  2022-11-16 21:38   ` Emanuel Berg
  2 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-16 21:30 UTC (permalink / raw)
  To: help-gnu-emacs

North Year wrote:

> This leads to a dynamic programming problem I guess.
>
> x eggs to be boiled each of which need x_i times to be
> boiled. y pots can be used to boil egges each of which has
> capacity to cook y_i eggs at one time.
>
> Never tried to writing algorithm codes in elisp. This would
> be interesting.

Is this correct?

(require 'cl-lib)

(defun boil-eggs (eggs pots)
  (setq eggs (sort eggs #'>))
  (setq pots (sort pots #'>))
  (setf (cdr (last pots)) pots)
  (let ((time 0))
    (while eggs
      (cl-incf time (car eggs))
      (setq eggs (cl-subseq eggs (min (car pots) (length eggs))))
      (pop pots) )
    time) )

(boil-eggs '(5 7 8 10)   '(2)) ; 17
(boil-eggs '(5 7 8 10) '(2 3)) ; 15

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-16 20:54 ` North Year
  2022-11-16 21:06   ` Emanuel Berg
  2022-11-16 21:30   ` Emanuel Berg
@ 2022-11-16 21:38   ` Emanuel Berg
  2 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-16 21:38 UTC (permalink / raw)
  To: help-gnu-emacs

North Year wrote:

> This leads to a dynamic programming problem I guess.
>
> x eggs to be boiled each of which need x_i times to be
> boiled. y pots can be used to boil egges each of which has
> capacity to cook y_i eggs at one time.
>
> Never tried to writing algorithm codes in elisp. This would
> be interesting.

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/eggs.el

(require 'cl-lib)

(defun boil-eggs (eggs pots)
  (unless pots
    (error "No pot! Have you been smoking some weed in Sweeden?"))
  (setq eggs (sort eggs #'>))
  (setq pots (sort pots #'>))
  (setf (cdr (last pots)) pots)
  (let ((time 0))
    (while eggs
      (cl-incf time (car eggs))
      (setq eggs (cl-subseq eggs (min (car pots) (length eggs))))
      (pop pots) )
    time) )

;; (boil-eggs '(5) ())            ; DNC
;; (boil-eggs  () '(5))           ; 0
;; (boil-eggs '(5 7 8 10)   '(2)) ; 17
;; (boil-eggs '(5 7 8 10) '(2 3)) ; 15

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-16 12:10   ` Akib Azmain Turja
  2022-11-16 20:39     ` Emanuel Berg
@ 2022-11-17  3:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-11-17  4:56       ` Emanuel Berg
                         ` (2 more replies)
  1 sibling, 3 replies; 23+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-11-17  3:04 UTC (permalink / raw)
  To: help-gnu-emacs

Reminds me of those analog logic circuits which use "standard" digital
gates but represent analog values as durations during which a signal is
asserted, so you can implement the `max` and `min` functions with `or`
and `and` gates respectively.


        Stefan


Akib Azmain Turja [2022-11-16 18:10:54] wrote:

> Juri Linkov <juri@linkov.net> writes:
>
>>> or maybe
>>>
>>>   (apply #'+ '(5 7 10))
>>>
>>> or ... well, what do you prefer?
>>
>> This reminds the implementation of sleep sort:
>>
>>   (dolist (i '(3 1 4 1 5 92 65 3 5 89 79 3))
>>     (run-with-timer (* i 0.001) nil 'message "%d" i))
>>
>> The sorted output printed in the *Messages* buffer:
>>
>>   1 [2 times]
>>   3 [3 times]
>>   4
>>   5 [2 times]
>>   65
>>   79
>>   89
>>   92
>>
>
> Someone implemented addition using sleep.  Now I have implemented
> subtraction:
>
> --8<---------------cut here---------------start------------->8---
> (defun subtract (x y)
>   (when (< y x)
>     (let ((tmp x))
>       (setq x y)
>       (setq y tmp)))
>   (let ((time-a (current-time)))
>     (sleep-for x)
>     (let ((time-b (current-time)))
>       (while (< (float-time (time-subtract nil time-a)) y)
>         (sleep-for 0.9))
>       (floor (float-time (time-subtract nil time-b))))))
>
> (subtract 0 1)     ; => 1
> (subtract 3 5)     ; => 2
> --8<---------------cut here---------------end--------------->8---




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

* Re: problems of everyday life
  2022-11-17  3:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-11-17  4:56       ` Emanuel Berg
  2022-11-17  5:48       ` tomas
  2022-11-17  6:13       ` Yuri Khan
  2 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2022-11-17  4:56 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

> Reminds me of those analog logic circuits which use
> "standard" digital gates but represent analog values as
> durations [...]

Reminds me what happens if you do 1 + 1 on a Norwegian
calculator, it says "Computing ..."

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: problems of everyday life
  2022-11-17  3:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-11-17  4:56       ` Emanuel Berg
@ 2022-11-17  5:48       ` tomas
  2022-11-17  6:13       ` Yuri Khan
  2 siblings, 0 replies; 23+ messages in thread
From: tomas @ 2022-11-17  5:48 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

On Wed, Nov 16, 2022 at 10:04:18PM -0500, Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> Reminds me of those analog logic circuits which use "standard" digital
> gates but represent analog values as durations during which a signal is
> asserted, so you can implement the `max` and `min` functions with `or`
> and `and` gates respectively.

Neurons do it in a similar way (OK, OK, it is shot frequency,
but hey).

The other way around, and and or are just threshold functions.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: problems of everyday life
  2022-11-17  3:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-11-17  4:56       ` Emanuel Berg
  2022-11-17  5:48       ` tomas
@ 2022-11-17  6:13       ` Yuri Khan
  2022-11-17  6:25         ` Stefan Monnier
  2 siblings, 1 reply; 23+ messages in thread
From: Yuri Khan @ 2022-11-17  6:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

On Thu, 17 Nov 2022 at 10:05, Stefan Monnier via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Reminds me of those analog logic circuits which use "standard" digital
> gates but represent analog values as durations during which a signal is
> asserted, so you can implement the `max` and `min` functions with `or`
> and `and` gates respectively.

Assuming all signals are phase-synchronized. Otherwise:

     _._._._._._
    |           |_._._._.  x = 6/10
           _._._._._._
    ._._._|           |_.  y = 6/10
           _._._
    ._._._|     |_._._._.  (x and y) = 3/10



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

* Re: problems of everyday life
  2022-11-17  6:13       ` Yuri Khan
@ 2022-11-17  6:25         ` Stefan Monnier
  0 siblings, 0 replies; 23+ messages in thread
From: Stefan Monnier @ 2022-11-17  6:25 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs

>> Reminds me of those analog logic circuits which use "standard" digital
>> gates but represent analog values as durations during which a signal is
>> asserted, so you can implement the `max` and `min` functions with `or`
>> and `and` gates respectively.
>
> Assuming all signals are phase-synchronized. Otherwise:
>
>      _._._._._._
>     |           |_._._._.  x = 6/10
>            _._._._._._
>     ._._._|           |_.  y = 6/10
>            _._._
>     ._._._|     |_._._._.  (x and y) = 3/10

Indeed, these are synchronous circuits just like in standard
digital circuits.


        Stefan




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

* Re: problems of everyday life
  2022-11-15 15:19 problems of everyday life Emanuel Berg
                   ` (4 preceding siblings ...)
  2022-11-16 20:54 ` North Year
@ 2022-11-17  6:33 ` Jean Louis
  5 siblings, 0 replies; 23+ messages in thread
From: Jean Louis @ 2022-11-17  6:33 UTC (permalink / raw)
  To: help-gnu-emacs

* Emanuel Berg <incal@dataswamp.org> [2022-11-15 19:40]:
> If you are to boil one egg for 5 minutes, the other for
> 7 minutes, and the third one for 10 minutes, how long time
> does it take to boil all three eggs?
> 
> In Lisp, there are several ways to solve this, it can be
> put as
> 
>   (+ 5 7 10)
> 
> or maybe
> 
>   (apply #'+ '(5 7 10))
> 
> or ... well, what do you prefer?

I prefer Kottbullar with eggs on side, and you are the one to cook.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

end of thread, other threads:[~2022-11-17  6:33 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-15 15:19 problems of everyday life Emanuel Berg
2022-11-15 16:45 ` Heime
2022-11-15 16:46 ` Dmitry Gutov
2022-11-15 17:17   ` Heime
2022-11-16 12:02     ` Akib Azmain Turja
2022-11-15 18:38 ` tomas
2022-11-16  7:51 ` Juri Linkov
2022-11-16 12:10   ` Akib Azmain Turja
2022-11-16 20:39     ` Emanuel Berg
2022-11-17  3:04     ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-11-17  4:56       ` Emanuel Berg
2022-11-17  5:48       ` tomas
2022-11-17  6:13       ` Yuri Khan
2022-11-17  6:25         ` Stefan Monnier
2022-11-16 14:31   ` Emanuel Berg
2022-11-16 14:54   ` Emanuel Berg
2022-11-16 16:14   ` Rudolf Adamkovič
2022-11-16 17:17     ` Emanuel Berg
2022-11-16 20:54 ` North Year
2022-11-16 21:06   ` Emanuel Berg
2022-11-16 21:30   ` Emanuel Berg
2022-11-16 21:38   ` Emanuel Berg
2022-11-17  6:33 ` Jean Louis

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.