Re: Non-determinism

Liste des GroupesRevenir à cl scheme 
Sujet : Re: Non-determinism
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.lisp comp.lang.scheme
Date : 24. Jul 2024, 10:18:24
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240723231718.796@kylheku.com>
References : 1 2 3
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-07-24, B. Pym <Nobody447095@here-nor-there.org> wrote:
B. Pym wrote:
>
Problem 4.42 in SICP
 
Five school girls took an exam. As they think thattheir
parents are too much interested in their score, they promise
that they write one correct and one wrong informations to
their parents. Followings are parts of their letters
concerning their result:
 
Betty: Kitty was the second and I third.
Ethel: I won the top and Joan the second.
Joan: I was the third and poor Ethel the last.
Kitty: I was the second and Mary the fourth.
Mary: I was the fourth. Betty won the top.
 
Guess the real order of the five school girls.
>
Shorter:

[ snip astonishing 130 line continuation-driven spaghetti behemoth ]

((kitty joan betty mary ethel))

$ txr girls.tl
#(kitty joan betty mary ethel)

$ cat girls.tl
(defun one-truth (g i1 n1 i2 n2)
  (neq (eq [g i1] n1) (eq [g i2] n2)))

(each ((g (perm #(kitty ethel joan mary betty) 5)))
  (when (and (one-truth g 1 'kitty 2 'betty)
             (one-truth g 0 'ethel 1 'joan)
             (one-truth g 2 'joan 4 'ethel)
             (one-truth g 1 'kitty 3 'mary)
             (one-truth g 3 'mary 0 'betty))
    (prinl g)))

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
24 Jul 24 * Non-determinism4B. Pym
24 Jul 24 `* Re: Non-determinism3B. Pym
24 Jul 24  `* Re: Non-determinism2B. Pym
24 Jul 24   `- Re: Non-determinism1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal