From 3d3bafce2dd07dd5b3f2ef2741fb1f8d893e10eb Mon Sep 17 00:00:00 2001 From: Stefan Israelsson Tampe Date: Thu, 7 Sep 2017 22:36:07 +0200 Subject: improved for loop methodology --- modules/oop/pf-objects.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'modules/oop/pf-objects.scm') 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 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

)) + (catch StopIteration + (lambda () ((ref o '__next__))) + (lambda (x) #:nil))) + + + + -- cgit v1.2.3