Mercurial > hg > ishara
comparison general/funutils/@thunk/thunk.m @ 27:5de03f77dae1
Added documentation about types and revised arrow type specifications.
author | samer |
---|---|
date | Sat, 19 Jan 2013 14:22:09 +0000 |
parents | e44f49929e56 |
children |
comparison
equal
deleted
inserted
replaced
26:8f4a21082c45 | 27:5de03f77dae1 |
---|---|
1 % thunk(B:arglist(M)) ~ a thunk is something that eventually yields M outputs | 1 % thunk(B@typelist(M)) ~ a thunk is something that eventually yields M outputs |
2 classdef thunk | 2 classdef thunk |
3 properties (GetAccess=private, SetAccess=immutable) | 3 properties (GetAccess=private, SetAccess=immutable) |
4 head % :: (A:arglist(N) -> B | thunk(B)) | 4 head % :: (A@typelist(N) -> B | thunk(B)) |
5 args % :: A:arglist(N) | 5 args % :: A@typelist(N) |
6 end | 6 end |
7 methods | 7 methods |
8 % thunk - create delayed evaluation | 8 % thunk - create delayed evaluation |
9 function f=thunk(h,varargin), f.head=h; f.args=varargin; end | 9 function f=thunk(h,varargin), f.head=h; f.args=varargin; end |
10 function s=tostring(f), s=sprintf('%s(%s)',tostring(f.head),commalist(map(@tostring,f.args))); end | 10 function s=tostring(f), s=sprintf('%s(%s)',tostring(f.head),commalist(map(@tostring,f.args))); end |