diff options
author | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2017-09-07 22:36:07 +0200 |
---|---|---|
committer | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2017-09-07 22:36:07 +0200 |
commit | 3d3bafce2dd07dd5b3f2ef2741fb1f8d893e10eb (patch) | |
tree | 756c47d9b25f662edbf51961b1e1baeb8df97b36 /modules/oop | |
parent | 0e6cb5e8b165925597fe5f3d01867d873c16aa9d (diff) |
improved for loop methodology
Diffstat (limited to 'modules/oop')
-rw-r--r-- | modules/oop/pf-objects.scm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/oop/pf-objects.scm b/modules/oop/pf-objects.scm index ecb94f6..44674fb 100644 --- a/modules/oop/pf-objects.scm +++ b/modules/oop/pf-objects.scm @@ -2,12 +2,13 @@ #:use-module (oop goops) #:use-module (ice-9 vlist) #:export (set ref make-pf <pf> call with copy fset fcall make-p put put! - pcall pcall! get + pcall pcall! get next mk def-pf-class mk-pf-class make-pf-class def-p-class mk-p-class make-p-class def-pyf-class mk-pyf-class make-pyf-class - def-py-class mk-py-class make-py-class)) + def-py-class mk-py-class make-py-class + StopIteration)) #| Python object system is basically syntactic suger otop of a hashmap and one @@ -553,4 +554,12 @@ explicitly tell it to not update etc. it (error "not a class"))) - +(define StopIteration (list 'StopIteration)) +(define-method (next (o <p>)) + (catch StopIteration + (lambda () ((ref o '__next__))) + (lambda (x) #:nil))) + + + + |