;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'stream) #@412 Return a stream of the elements of STREAM before REST. REST is a rest of STREAM: it must either be `eq' to STREAM or to one of the subsequent calls of `stream-rest' on STREAM. The return value is a newly created stream containing the first elements of STREAM with REST cut off. When REST appears multiple times as a rest of STREAM, a stream with the minimal number of elements is returned. (fn STREAM REST) (defalias 'stream-substream-before #[514 "\300\301\302\303\304\305\"\306\"\307$B\207" [--stream-fresh-- make-byte-code 0 "\300\301=?\205\302\300!\303\304\300!\301\"B\207" vconcat vector [stream-first stream-substream-before stream-rest] 4] 10 (#$ . 427)]) #@383 Divide STREAM into two parts according to GET-REST-FUN. The return value is a list (S R) where R is the result of (funcall get-rest-fun STREAM) and S a stream of minimal length so that (stream-append S R) is equivalent to STREAM. Calling GET-REST-FUN on STREAM must be `eq' to one of STREAM, (stream-rest STREAM), (stream-rest (stream-rest STREAM)), ... (fn STREAM GET-REST-FUN) (defalias 'stream-divide-with-get-rest-fun #[514 "\211!\300\"D\207" [stream-substream-before] 6 (#$ . 1107)]) #@965 Divide STREAM between the first pair of elements for that PREDICATE fails. When STREAM generates the elements S_1, S_2, ..., call (PREDICATE S_i, S_i+1) for i=1,2,... until the first index i=k is found so that (funcall PREDICATE S_k S_k+1) returns nil. The return value is a list of two streams (HEAD REST) where HEAD generates the elements S_1, ... S_k and REST is the rest of STREAM generating the remaining elements S_k+1, ... Example: (mapcar #'seq-into-sequence (stream-divide (stream (list 1 2 3 5 6 7 9 10 11 23)) (lambda (this next) (< (- next this) 2)))) ==> ((1 2 3) (5 6 7 9 10 11 23)) If STREAM is finite and no index k with (funcall PREDICATE S_k S_k+1) ==> nil is found, return (STREAM E) where E is an empty stream. When STREAM is infinite and no such index is found, this function will not terminate. See `stream-divide-with-get-rest-fun' for a generalization of this function. (fn STREAM PREDICATE) (defalias 'stream-divide #[514 "\300\301!\"\207" [stream-divide-with-get-rest-fun stream-divide--get-rest-fun] 6 (#$ . 1610)]) #@13 (fn PRED) (defalias 'stream-divide--get-rest-fun #[257 "\300\301\302\303\304!\305\"\306\307%\207" [make-byte-code 257 "\301!\204 \302!\303!\262\301!?\205\300\302!\"\262\204\207" vconcat vector [stream-empty-p stream-first stream-rest] 6 "\n\n(fn S)"] 7 (#$ . 2709)]) #@761 Partition STREAM into bunches where PREDICATE returns non-nil for subsequent elements. The return value is a stream S: S_1, S_2, ... of streams S_i of maximal length so that (stream-concatenate S) is equivalent to STREAM and for any pair of subsequent elements E, F in any S_i (PREDICATE E F) evals to a non-nil value. Often, but not necessarily, PREDICATE is an equivalence predicate. Example: (seq-into-sequence (seq-map #'seq-into-sequence (stream-partition (stream (list 1 2 3 5 6 7 9 10 15 23)) (lambda (x y) (< (- y x) 2))))) ==> ((1 2 3) (5 6 7) (9 10) (15) (23)) See `stream-partition-with-get-rest-fun' for a generalization of this function. (fn STREAM PREDICATE) (defalias 'stream-partition #[514 "\300\301!\"\207" [stream-partition-with-get-rest-fun stream-divide--get-rest-fun] 6 (#$ . 2999)]) #@398 Call `stream-divide-with-get-rest-fun' on stream ad finitum. The return value is a (not necessarily finite) stream S of streams S_i where (stream-concatenate S) is equivalent to STREAM, (S_1 R_1) := (stream-divide-with-get-rest-fun STREAM get-rest-fun) and (S_i+1 R_i+1) := (stream-divide-with-get-rest-fun R_i get-rest-fun) as long as R_i is not empty. (fn STREAM GET-REST-FUN) (defalias 'stream-partition-with-get-rest-fun #[514 "\300\301\302\303\304\305\"\306\"\307$B\207" [--stream-fresh-- make-byte-code 0 "\302\300!?\205\303\300\301\"\211@\304A@\301\"B\262\207" vconcat vector [stream-empty-p stream-divide-with-get-rest-fun stream-partition-with-get-rest-fun] 5] 10 (#$ . 3901)]) (provide 'stream-x)