LINUX.ORG.RU

История изменений

Исправление ados, (текущая версия) :

Модели на CL не хватает:

CALC-LIB-EXP> (loop :repeat 1000000
                    :with experiments = 0
                    :with events = 0
                    :do
                       (let* ((set (copy-tree '((t t) (t nil) (nil nil))))
                              (choice (funcall (if (zerop (random 2))
                                                   #'identity
                                                   #'nreverse)
                                               (nth (random 3)
                                                    set))))
                         (when (pop choice)
                           (incf experiments)
                           (when (pop choice)
                             (incf events))))
                    :finally (return
                               (let ((p (/ events
                                           experiments)))
                                 (list :experiments experiments
                                       :events events
                                       :probability p
                                       :probability-float (coerce p
                                                                  'float)))))
(:EXPERIMENTS 500302 :EVENTS 333409 :PROBABILITY 333409/500302
 :PROBABILITY-FLOAT 0.6664155f0)
CALC-LIB-EXP> 

Исходная версия ados, :

Модели на CL не хватает:

CALC-LIB-EXP> (loop :repeat 1000000
                    :with experiments = 0
                    :with events = 0
                    :do
                       (let* ((set (copy-tree '((t t) (t nil) (nil nil))))
                              (ch (funcall (if (zerop (random 2))
                                               #'identity
                                               #'nreverse)
                                           (nth (random 3)
                                                set))))
                         (when (pop ch)
                           (progn (incf experiments)
                                  (when (pop ch)
                                    (incf events)))))
                    :finally (return
                               (let ((p (/ events
                                           experiments)))
                                 (list :experiments experiments
                                       :events events
                                       :probability p
                                       :probability-float (coerce p
                                                                  'float)))))
(:EXPERIMENTS 500390 :EVENTS 333131 :PROBABILITY 333131/500390
 :PROBABILITY-FLOAT 0.6657427f0)
CALC-LIB-EXP>