/usr/share/hol88-2.02.19940316/lisp/f-lis.l is in hol88-source 2.02.19940316-28.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; HOL 88 Version 2.0 ;;;
;;; ;;;
;;; FILE NAME: f-lis.l ;;;
;;; ;;;
;;; DESCRIPTION: ML list functions ;;;
;;; ;;;
;;; USES FILES: f-franz.l (or f-cl.l), f-constants.l, f-macro.l ;;;
;;; ;;;
;;; University of Cambridge ;;;
;;; Hardware Verification Group ;;;
;;; Computer Laboratory ;;;
;;; New Museums Site ;;;
;;; Pembroke Street ;;;
;;; Cambridge CB2 3QG ;;;
;;; England ;;;
;;; ;;;
;;; COPYRIGHT: University of Edinburgh ;;;
;;; COPYRIGHT: University of Cambridge ;;;
;;; COPYRIGHT: INRIA ;;;
;;; ;;;
;;; REVISION HISTORY: Original code: lis (lisp 1.6) part of Edinburgh LCF ;;;
;;; by M. Gordon, R. Milner and C. Wadsworth (1978) ;;;
;;; Transported by G. Huet in Maclisp on Multics, Fall ;;;
;;; 1981 ;;;
;;; ;;;
;;; V3.2: cleaning-up of functions ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(eval-when (compile)
#+franz (include "lisp/f-franz")
(include "lisp/f-constants")
(include "lisp/f-macro"))
#+franz (declare (localf succeeds))
(dml |length| 1 length ((%a |list|) -> |int|) )
(dml |rev| 1 reverse ((%a |list|) -> (%a |list|)))
(dml |flat| 1 ml-flat (((%a |list|) |list|) ->(%a |list|)))
(defun ml-flat (ll) (apply #'append ll)) ;ml-flat
;;; ---------------------------------------------------------------
;;; PAIRED list utilities which later get REDEFINED to be curried
;;; functions (in ml/ml-curry.ml)
;;; --------------------------------------------------------------
(dml |mem| 2 #+franz member #-franz member-equal-function
((%a |#| (%a |list|)) -> |bool|))
#-franz
(defun member-equal-function (x y)
(member x y :test #'equal))
(dml |map| 2 ml-map (((%a -> %b) |#| (%a |list|)) -> (%b |list|)))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-map (%%f l)
(mapcar #'(lambda (x) (%ap %%f x)) l)) ;ml-map
(dml |exists| 2 ml-exists (((%a -> |bool|) |#| (%a |list|)) -> |bool|))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-exists (p l) ;ml-exists
(block found (while l (if (%ap p (pop l)) (return-from found t))) nil))
(dml |forall| 2 ml-forall (((%a -> |bool|) |#| (%a |list|)) -> |bool|))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-forall (p l)
(block found
(while l (ifn (%ap p (pop l)) (return-from found nil))) t)) ;ml-forall
(dml |find| 2 ml-find (((%a -> |bool|) |#| (%a |list|)) -> %a))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-find (p l)
(block found
(while l
(let ((x (pop l))) (if (%ap p x) (return-from found x))))
(throw-from evaluation '|find|))) ;ml-find
(dml |tryfind| 2 ml-tryfind (((%a -> %b) |#| (%a |list|)) -> %b))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-tryfind (%%f %l)
(block found
(while %l
(catch-throw evaluation (return-from found (%ap %%f (pop %l)))))
(throw-from evaluation '|tryfind|))) ;ml-tryfind
(dml |filter| 2 ml-filter
(((%a -> |bool|) |#| (%a |list|)) -> (%a |list|)))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-filter (p l)
(let ((r nil))
(while l (let ((x (pop l))) (if (%ap p x) (push x r))))
(reverse r))) ;ml-filter
(dml |mapfilter| 2 ml-mapfilter
(((%a -> %b) |#| (%a |list|)) -> (%b |list|)))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-mapfilter (%%f %l)
(let ((r nil))
(while %l
(catch-throw evaluation (push (%ap %%f (pop %l)) r)))
(reverse r))) ;ml-mapfilter
(dml |rev_itlist| 3 ml-rev_itlist
(((%a -> (%b -> %b)) |#| ((%a |list|) |#| %b)) -> %b))
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun ml-rev_itlist (f l x)
(while l (setq x (%ap (%ap f (pop l)) x))) x) ;ml-rev_itlist
;;; ap changed to %ap for HOL version 12 [TFM 90.11.11]
(defun succeeds (%%f x)
(block OK
(catch-throw evaluation (%ap %%f x) (return-from OK t))
nil)) ;succeeds
|