But this typechecks and I don't understand why: fun foo(s:int): stream_vt(stream_vt(@(int,int))) = stream_vt_map_cloptr<int><stream_vt(@(int,int))>( streamize_intrange_lr(1,10), lam(i) =<cloptr1> let val i = i (* added this *) in stream_vt_map_cloptr<int><(int,int)>( streamize_intrange_lr(1,10), lam(j) =<cloptr1> @(i,j) ) end )
On Sunday, January 6, 2019 at 6:32:27 AM UTC-6, aditya siram wrote: > > Hi, > I'm trying to take the cross product of two finite streams using nested > 'cloptr' and I can't get it to typecheck, here's what I have: > > fun foo(s:int): stream_vt(stream_vt(@(int,int))) = > stream_vt_map_cloptr<int><stream_vt(@(int,int))>( > streamize_intrange_lr(1,10), > lam(i) =<cloptr1> > stream_vt_map_cloptr<int><(int,int)>( > streamize_intrange_lr(1,10), > lam(j) =<cloptr1> @(i,j) > ) > ) > > I want to cross (1..10) with (1..10) and get a stream of (1,1),(1,2),(1,3) > ... but I get an error on the 'lam(j) =<cloptr1> @(i,j)' line: > > ...: dereference cannot be performed: the proof search for view located at > [S2Evar(i(14251))] failed to turn up a result. > ...: the dynamic expression cannot be assigned the type [S2Etyrec(flt0; > npf=-1; 0=S2Ecst(int), 1=S2Ecst(int))]. > > > The same thing works if instead of nesting a 'stream_vt_map_cloptr' I > construct an explicit 'fun loop' inside the body of the first 'lam' that > takes 'i' as an argument. > > Why is there a difference? > > -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscr...@googlegroups.com. To post to this group, send email to ats-lang-users@googlegroups.com. Visit this group at https://groups.google.com/group/ats-lang-users. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/1806cb52-56fd-4d46-ae12-47badce80b14%40googlegroups.com.