diff options
| author | eeeickythump <devnull@localhost> | 2011-04-16 09:32:46 +1200 |
|---|---|---|
| committer | eeeickythump <devnull@localhost> | 2011-04-16 09:32:46 +1200 |
| commit | 17c34adec502b8d4368d7dd09a23041b9891cdaa (patch) | |
| tree | 24d190164bb14ee6ae73a84f90797ce07ddbb994 | |
| parent | 2d039d04295ab65f43dc86e1dbb8d2268e926e0b (diff) | |
| download | org-drill-17c34adec502b8d4368d7dd09a23041b9891cdaa.tar.gz org-drill-17c34adec502b8d4368d7dd09a23041b9891cdaa.zip | |
- At the end of a drill session, when re-presenting items that were failed
during the course of that session, we now avoid showing the same item
straight after itself (unless it is the only item left).
| -rwxr-xr-x | org-drill.el | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/org-drill.el b/org-drill.el index 64790c4..832afc0 100755 --- a/org-drill.el +++ b/org-drill.el @@ -1,7 +1,7 @@ ;;; org-drill.el - Self-testing using spaced repetition ;;; ;;; Author: Paul Sexton <eeeickythump@gmail.com> -;;; Version: 2.1 +;;; Version: 2.1.1 ;;; Repository at http://bitbucket.org/eeeickythump/org-drill/ ;;; ;;; @@ -394,6 +394,12 @@ for review unless they were already reviewed in the recent past?") (subseq ,place (1+ ,idx))))))))) +(defmacro push-end (val place) + "Add VAL to the end of the sequence stored in PLACE. Return the new +value." + `(setq ,place (append ,place (list ,val)))) + + (defun shuffle-list (list) "Randomly permute the elements of LIST (all permutations equally likely)." ;; Adapted from 'shuffle-vector' in cookie1.el @@ -416,7 +422,6 @@ Example: (round-float 3.56755765 3) -> 3.568" (let ((n (expt 10 fix))) (/ (float (round (* floatnum n))) n))) - (defun time-to-inactive-org-timestamp (time) (format-time-string (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]") @@ -645,7 +650,7 @@ from the entry at point." (t -1)))) (/ (+ 100 (* (* (/ -1 b) (log (- 1 (* (/ b a ) (abs p))))) (sign p))) - 100)))) + 100.0)))) (defun org-drill-early-interval-factor (optimal-factor @@ -1510,7 +1515,7 @@ maximum number of items." ;; After all the above are done, last priority is items ;; that were failed earlier THIS SESSION. (*org-drill-again-entries* - (pop-random *org-drill-again-entries*)) + (pop *org-drill-again-entries*)) (t ; nothing left -- return nil (return-from org-drill-pop-next-pending-entry nil))))) m))) @@ -1550,7 +1555,10 @@ RESUMING-P is true if we are resuming a suspended drill session." (t (cond ((<= result org-drill-failure-quality) - (push m *org-drill-again-entries*)) + (if *org-drill-again-entries* + (setq *org-drill-again-entries* + (shuffle-list *org-drill-again-entries*))) + (push-end m *org-drill-again-entries*)) (t (push m *org-drill-done-entries*)))))))))) |
