Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[bc2bbe]: s-package.lisp Maximize Restore History

Download this file

s-package.lisp    175 lines (157 with data), 6.4 kB

  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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
;;;;-*- Mode: lisp; Package: (SERIES :use "COMMON-LISP" :colon-mode :external) -*-
;;;; The package initialization stuff is done here now, instead of in s-code.lisp. This is based a comment by Bruno Haible who said
;;;;
;;;; "The important point is that the packages setup when you compile
;;;; a file must be identical to the packages setup when you load the
;;;; file.... What will help, 100%, is to have a file which issues
;;;; all the necessary `defpackage' forms, and make sure this file is
;;;; loaded before anything else and before any `compile-file'.
;;;; $Id: s-package.lisp,v 1.8 2000/09/22 15:58:39 rtoy Exp $
;;;;
;;;; $Log: s-package.lisp,v $
;;;; Revision 1.8 2000/09/22 15:58:39 rtoy
;;;; Add support for MCL (from Rainer Joswig).
;;;;
;;;; Revision 1.7 2000/03/28 10:23:49 matomira
;;;; polycall et all are now tail recursive.
;;;; LETIFICATION WORKS COMPLETELY!!
;;;;
;;;; Revision 1.8 2000/03/14 10:48:10 matomira
;;;; Workaround for ACL 5.0.1 TAGBODY bug added.
;;;; ALL-TIME SERIES BUG FIX: wrappers now inserted more precisely.
;;;; Abstracted use of wrapper component of frags.
;;;; GENERATOR deftyped to CONS, not LIST, when necessary.
;;;;
;;;; Revision 1.7 2000/03/11 17:36:34 matomira
;;;; Added eval-when compatibility magic.
;;;;
;;;; Revision 1.6 2000/03/03 19:17:15 matomira
;;;; Series 2.0 - Change details in RELEASE-NOTES.
;;;;
;;;; Revision 1.4 1999/12/01 16:09:05 toy
;;;; Need to import compiler-let from the extensions package in CMUCL.
;;;;
;;;; Revision 1.3 1999/09/14 20:19:43 toy
;;;; Export the new function collect-stream.
;;;;
;;;; Revision 1.2 1999/07/02 20:38:13 toy
;;;; Forgot a few items from s-code.lisp, and had to put the in-package
;;;; stuff back into s-code.lisp.
;;;;
;;;; Revision 1.1 1999/07/02 19:52:32 toy
;;;; Initial revision
;;;;
;;; Add a feature to say if we are a Lisp that can hack ansi-cl style
;;; stuff, as far as series goes anyway. This implies:
;;; ansi style packages (DEFPACKAGE, CL not LISP as main package)
;;;
;;; if you don't have this you need to make the LISP package have CL
;;; as a nickname somehow, in any case.
;;;
#+gcl
(eval-when (compile load eval)
(unless (find-package "CL")
(rename-package "LISP" "COMMON-LISP" '("LISP" "CL"))))
#+(or :cmu :sbcl)
(cl:eval-when (load eval compile)
(cl:pushnew ':pittsburgh cl:*features*))
;;; Note this is really too early, but we need it here
#+(or draft-ansi-cl draft-ansi-cl-2 ansi-cl allegro :pittsburgh Genera Harlequin-Common-Lisp CLISP mcl)
(cl:eval-when (load eval compile)
(cl:pushnew ':SERIES-ANSI cl:*features*))
#+(or Series-ANSI)
(defpackage "SERIES"
(:use "CL")
(:export
;;(2) readmacros (#M and #Z)
;;(5) declarations and types (note dual meaning of series)
"OPTIMIZABLE-SERIES-FUNCTION" "OFF-LINE-PORT" ;series
"SERIES-ELEMENT-TYPE" "PROPAGATE-ALTERABILITY"
"INDEFINITE-EXTENT"
;;(10) special functions
"ALTER" "TO-ALTER" "ENCAPSULATED" "TERMINATE-PRODUCING"
"NEXT-IN" "NEXT-OUT"
"GENERATOR"
"GATHERER" "RESULT-OF"
"GATHER-NEXT" "GATHER-RESULT" "GATHERLET" "GATHERING"
"FGATHER-NEXT" "FGATHER-RESULT" "FGATHERLET" "FGATHERING"
;;(55) main line functions
"MAKE-SERIES" "SERIES" "SCAN" "SCAN-MULTIPLE" "SCAN-RANGE"
"SCAN-SUBLISTS" "SCAN-FN" "SCAN-FN-INCLUSIVE" "SCAN-LISTS-OF-LISTS"
"SCAN-LISTS-OF-LISTS-FRINGE" "SCAN-FILE" "SCAN-STREAM" "SCAN-HASH" "SCAN-ALIST"
"SCAN-PLIST" "SCAN-SYMBOLS" "COLLECT-FN" "COLLECT" "COLLECT-APPEND"
"COLLECT-NCONC" "COLLECT-FILE" "COLLECT-ALIST" "COLLECT-PLIST"
"COLLECT-HASH" "COLLECT-LENGTH" "COLLECT-STREAM"
"COLLECT-SUM" "COLLECT-PRODUCT" "COLLECT-MAX" "COLLECT-MIN"
"COLLECT-LAST" "COLLECT-FIRST" "COLLECT-NTH"
"COLLECT-AND" "COLLECT-OR" "PREVIOUS" "MAP-FN" "ITERATE" "MAPPING"
"COLLECTING-FN" "COTRUNCATE" "LATCH" "UNTIL" "UNTIL-IF" "POSITIONS"
"CHOOSE" "CHOOSE-IF" "SPREAD" "EXPAND" "MASK" "SUBSERIES" "MINGLE"
"CATENATE" "SPLIT" "SPLIT-IF" "PRODUCING" "CHUNK"
;;(5) variables
"*SERIES-EXPRESSION-CACHE*"
"*LAST-SERIES-LOOP*"
"*LAST-SERIES-ERROR*"
"*SUPPRESS-SERIES-WARNINGS*"
)
(:shadow
"LET" "LET*" "MULTIPLE-VALUE-BIND" "FUNCALL" "DEFUN" #+cmu "COLLECT" #+cmu "ITERATE")
#+Harlequin-Common-Lisp
(:import-from "LISPWORKS" "COMPILER-LET")
#+Genera
(:import-from "LISP" "COMPILER-LET")
#+Allegro
(:import-from "CLTL1" "COMPILER-LET")
#+CLISP
(:import-from "LISP" "COMPILER-LET")
#+cmu
(:import-from "EXT" "COMPILER-LET")
#+mcl
(:import-from "CCL" "COMPILER-LET")
)
#-(or Series-ANSI)
(export ;74 total concepts in the interface
'(;(2) readmacros (#M and #Z)
;(5) declarations and types (note dual meaning of series)
indefinite-extent
optimizable-series-function off-line-port ;series
series-element-type propagate-alterability
;(10) special functions
alter to-alter encapsulated terminate-producing
next-in next-out generator gatherer result-of
gather-next gather-result fgather-next fgather-result
gathering fgathering gatherlet fgatherlet
;(55) main line functions
make-series series scan scan-multiple scan-range scan-sublists scan-fn
scan-fn-inclusive scan-lists-of-lists scan-lists-of-lists-fringe scan-file
scan-stream scan-hash scan-alist scan-plist scan-symbols collect-fn collect
collect-append collect-nconc collect-file collect-alist collect-plist
collect-hash collect-length
collect-sum collect-product collect-max collect-min
collect-last collect-first collect-nth collect-and collect-or
previous map-fn iterate mapping collecting-fn cotruncate
latch until until-if positions choose choose-if
spread expand mask subseries mingle catenate split split-if
producing chunk
;(5) variables
*series-expression-cache*
*last-series-loop*
*last-series-error*
*suppress-series-warnings*))
#-(or Series-ANSI)
(eval-when (compile load eval)
(in-package "SERIES" :use '("LISP"))
(shadow '(let let* multiple-value-bind funcall defun eval-when #+cmu collect #+cmu iterate))
) ; end of eval-when
#-(or Series-ANSI)
(cl:eval-when (compile load eval)
(defmacro eval-when ((&rest times) &body body)
`(cl:eval-when ,(append
(when (member :compile-toplevel times)
'(compile))
(when (member :load-toplevel times)
'(load))
(when (member :execute times)
'(eval)))
,@body))
) ; end of eval-when