Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6784d57ea1
Fetching contributors…

Cannot retrieve contributors at this time

83 lines (76 sloc) 8.207 kb
;ELC
;;; Compiled by toups@deluge on Fri Apr 8 14:29:37 2011
;;; from file /home/toups/elisp/utils/monad-stream.el
;;; in Emacs version 23.1.1
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
(< (aref emacs-version (1- (length emacs-version))) ?A)
(or (and (boundp 'epoch::version) epoch::version)
(string-lessp emacs-version "19.29")))
(error "`monad-stream.el' was compiled for Emacs 19.29 or later"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'monads)
(defalias 'stream-case-names #[(sub-form) "@\207" [sub-form] 1])
(defalias 'stream-case-one #[(sub-form stream) "\303!\304\305\306\nD\307\310\nDDED\311 @\312\nDDCA)BBD\207" [sub-form names stream stream-case-names not and pair\? functionp cdr let car] 6])
(defalias 'stream-case-more #[(sub-form stream) "\305!A\306\307\n@\310 DD\n\211A@)\311 DDD *BBD\207" [sub-form body names stream x stream-case-names t let car cdr] 7])
(defalias 'stream-case '(macro . #[(expr on-zero on-one on-more) "\305\306!\307 DC\310\311D\nD\312 \"\313\f\"FE)\207" [stream expr on-zero on-one on-more gensym "stream" let cond not stream-case-one stream-case-more] 8]))
(defalias 'stream-cdr #[(stream) "\211\204 \304 \202(\305 !\203\306 A!\204 @\210\304\202( @ A\n *)\207" [stream #1=#:stream65771 f a nil pair\? functionp] 3])
(defalias 'mk-stream '(macro . #[(car expr) "\302\303\304 BBE\207" [car expr cons lambda nil] 5]))
(defalias 'choice '(macro . #[(a f) "\302 E\207" [a f cons] 3]))
(defalias 'transform-binder #[(binder) "9\203 \211D\207<\203#G\301U\203@\211D\207G\302U\205&\207\303\304!\207" [binder 1 2 error "mk-stream-close needs binders which are symbols, lists of one symbol, or a let-like bind pair."] 3])
(defalias 'mk-stream-close '(macro . #[(binders car expr) "\303\304\305\"\306 \nEE\207" [binders car expr lexical-let mapcar transform-binder cons] 5]))
(defalias '->choice*binders #[(thing) "9\203\n\211DC\207<\205\301\302\"\207" [thing mapcar transform-binder] 3])
#@42 Not documented
(fn A F &key (WITH nil))
(defalias 'choice* '(macro . #[(a f &rest #1=#:--cl-rest--) "\305>A@\n\2032\n@\306>\203\nAA\211\202 \307>A@\203)\310\211\202 \311\312\n@\"\210\202)\313\314 !\315 \fEE)\207" [#1# with #2=#:--cl-keys-- a f :with (:with :allow-other-keys) :allow-other-keys nil error "Keyword argument %s not one of (:with)" lexical-let ->choice*binders cons] 6 (#$ . 2110)]))
(defalias 'stream-zero #[nil "\300\207" [nil] 1])
#@20 Stream monad zero.
(defvar stream-zero nil (#$ . 2579))
(defalias 'stream-unit #[(x) "\301!\207" [x stream-return] 2])
#@2 
(defalias 'stream-plus #[(stream f &optional as) "\306\307 \203S\307\n\211\204\310\311\f! \"\202N\312 !\203&\313 A!\2047 @\f\310\311\f\fB! \")\202N @ A \f\306 \f\fB*\307)\202*\207" [#1=#:return-value65773 #2=#:loop-sentinal65772 stream #3=#:stream65774 as f t nil improper-suffix reverse pair\? functionp a f0] 5 (#$ . 2704)])
(defalias 'stream-plus-non-rec #[(stream f) "\211\204 \n \2025\306 !\203\307 A!\204$ @\310 \n*B\2025 @ A\310\n \311 \n\"+B)\207" [stream #1=#:stream65778 f a #2=#:--cl-nil-- f0 pair\? functionp nil stream-plus #3=#:--cl-nil--] 5])
(defalias 'stream-plus^i #[(stream f) "\211\204 \n \2025\306 !\203\307 A!\204$ @\310 \n*B\2025 @ A\310\n \311\n \"+B)\207" [stream #1=#:stream65779 f a #2=#:--cl-nil-- f0 pair\? functionp nil stream-plus^i #3=#:--cl-nil--] 5])
(defalias 'stream-bind #[(stream g) "\211\204 \306 \202O\307 !\203\310 A!\204\" @ \n!)\202O @ A\311 \n!\312\313!\312\314!\211\fL\210 L\210\315\316\317\320\321 D\321D\322\257E*\"*)\207" [stream #1=#:stream65780 a g f #2=#:--cl-g-- stream-zero pair\? functionp stream-plus make-symbol "--f--" "--g--" lambda (&rest --cl-rest--) apply #[(#3=#:G65781 #4=#:G65782) "\302J J\"\207" [#4# #3# stream-bind] 3] quote --cl-rest-- #5=#:--cl-f--] 10])
(defalias 'stream-bind^i #[(stream g) "\211\204 \306 \202O\307 !\203\310 A!\204\" @ \n!)\202O @ A\311 \n!\312\313!\312\314!\211\fL\210 L\210\315\316\317\320\321 D\321D\322\257E*\"*)\207" [stream #1=#:stream65783 a g f #2=#:--cl-g-- stream-zero pair\? functionp stream-plus^i make-symbol "--f--" "--g--" lambda (&rest --cl-rest--) apply #[(#3=#:G65784 #4=#:G65785) "\302J J\"\207" [#4# #3# stream-bind^i] 3] quote --cl-rest-- #5=#:--cl-f--] 10])
(defalias '%fail #[(s) "\300 \207" [stream-zero] 1])
(byte-code "\301B\302\301!\204\303\301\211\"\210\301\207" [current-load-list %fail default-boundp set-default] 3)
(defalias '%succeed #[(s) "\301!\207" [s stream-unit] 2])
(byte-code "\301B\303\301!\204\304\301\211\"\210\305B\303\305!\204\304\305 \"\210\306B\303\306!\204-\304\306\n\"\210\301\207" [current-load-list %succeed %fail default-boundp set-default %s %u] 3)
(defalias 'stream-return #[(x) "\301B\207" [x #[nil "\300\207" [nil] 1]] 2])
(byte-code "\301B\302\301!\204\303\301\304\305\306\307\310\311\312&\"\210\313B\302\313!\204.\303\313\304\305\314\307\310\311\312&\"\210\301\207" [current-load-list monad-stream default-boundp set-default tbl! :m-bind stream-bind :m-return stream-return :m-zero stream-zero monad-stream^i stream-bind^i] 9)
(defalias 'stream '(macro . #[(&rest expressions) "\204\301\207G\302U\203\303@\304BB\207\303@\305\301\306ABEE\207" [expressions nil 1 choice (nil) lambda stream] 6]))
(defalias 'streamc '(macro . #[(&rest expressions) "\204\301\207G\302U\203\303@\304BB\207\303@\305\301\306ABEE\207" [expressions nil 1 choice (nil) lambdac stream] 6]))
(defalias 'stream-cdr #[(stream) "\211\204\n\304\202'\305 !\203\306 A!\204 @\210\304\202' @ A\n *)\207" [stream #1=#:stream65786 f a nil pair\? functionp] 3])
(defalias 'stream-car #[(stream) "\211\204\n\302\202!\303 !\203\304 A!\204 @\202! @ A\210)\207" [stream #1=#:stream65787 nil pair\? functionp] 3])
#@29 An infinite stream of ones.
(defvar ones (cons 1 #[nil "\207" [ones] 1]) (#$ . 5986))
#@30 An infinite stream of zeros.
(defvar zeros (cons 1 #[nil "\207" [zeros] 1]) (#$ . 6079))
#@48 Return a stream of numbers from N to infinity.
(defalias 'nums-from #[(n) "\302\303!\211 L\210J\304\305\306\307\310D\311FE)B\207" [#1=#:--cl-n-- n make-symbol "--n--" lambda (&rest --cl-rest--) apply #[(#2=#:G65788) "\301JT!\207" [#2# nums-from] 2] quote --cl-rest--] 8 (#$ . 6175)])
#@33 An infinite stream of integers.
(defvar positive-integers (nums-from 1) (#$ . 6469))
#@2 
(defalias 'take-n #[(stream n &optional output) "\306\307 \203Z\307\n\310U\203\311 !\202V\f\211\204\"\311 !\202U\312 !\203/\313 A!\204= @ \311 B!)\202U @ A \306\314\f!\nS B*\307)\202*\207" [#1=#:return-value65790 #2=#:loop-sentinal65789 n output stream #3=#:stream65791 t nil 0 reverse pair\? functionp stream-cdr a f] 5 (#$ . 6559)])
(byte-code "\301B\302\301!\204\303\301\304\305B\"\210\306\307!\207" [current-load-list fibs default-boundp set-default 1 #[nil "\300\301B\207" [1 #[nil "\306\307!\211\205\f\307K\310\216\307\311M\210\306\312!\211\205\312K\313\216\312\314M\210\306\315!\211\205/\315K\316\216\315\317M\210\307\320\".\n\207" [monad-stream current-monad #1=#:--cl-letf-bound-- #2=#:--cl-letf-save-- #3=#:--cl-letf-bound-- #4=#:--cl-letf-save-- fboundp m-bind ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#1# #2# m-bind fmakunbound] 2)) #[(v f) "\303\304\" \n\"\207" [current-monad v f tbl :m-bind] 3] >>= ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#3# #4# >>= fmakunbound] 2)) #[(v f) "\303\304\" \n\"\207" [current-monad v f tbl :m-bind] 3] m-return ((byte-code "\203 \302 M\210\202\303\302!\210\302\207" [#5=#:--cl-letf-bound-- #6=#:--cl-letf-save-- m-return fmakunbound] 2)) #[(v) "\302\303\" !\207" [current-monad v tbl :m-return] 3] #[(a) "\303\304!\211 L\210\305\306\n!\307\310\311\312\313D\314FE\")\207" [#:--cl-a-- a fibs make-symbol "--a--" m-bind stream-cdr lambda (&rest --cl-rest--) apply #[(#7=#:G65795 b) "\303\nJ\301J\\!)\207" [b #:--cl-b-- #7# m-return] 3] quote --cl-rest--] 9] #5# #6# fibs] 4]] 2] provide monad-stream] 4)
Jump to Line
Something went wrong with that request. Please try again.