fold and (finite) Generator

2 views
Skip to first unread message

Ralf Hemmecke

unread,
Feb 13, 2017, 4:14:02 PM2/13/17
to aldor-devel
In lib/aldor/src/datastruc/sal_fold.as I see


Fold(T: with): FoldingTransformationCategory(T) with {
...
/: (f: (T,T) -> T, Generator T) -> T;
...
} == add { ... }

That makes, of course, only sense if the generator yields only finitely
many elements.

Would it make sense to introduce FiniteGenerator(T), a domain that
behaves exactly like Generator T, except that it asserts (just by its
name) that it only generates finitely many elements.

The burden to assure finiteness would be on the user, but at least in
the signature it would be visible that the generator has to be finite.
Otherwise, that condition must live in the corresponding documentation.

Ralf

Peter Broadbery

unread,
Feb 13, 2017, 5:26:30 PM2/13/17
to Ralf Hemmecke, aldor-devel
I think an additional domain won't work well as it would be a lot of extra syntax.. better to solve in the documentation. Things like [] $List have the same issue.


Ralf

--
You received this message because you are subscribed to the Google Groups "aldor-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aldor-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages