Forum Discussion

Dicken's avatar
Dicken
Post Prodigy
2 months ago
Solved

Lazy evaluation

Hi i have found this, and think it's dow to  Lazy /eager  evaluation; so  single  empty  list  = {}  = let alist = {} , tr = List.Transform( alist,(x)=> x {0} ), p_indi = alist {0} in tr tr...
  • krishnakanth240's avatar
    2 months ago

    Hi Dicken 

    List.Transform operates on empty list {}, so transformation function (x) => x{0} is never executed resulting empty list.alist{0} directly attempts to access first element of an empty list which immediately raises an index out of range error

     

    alist = {{}} contains one element (an empty list). List.Transform execute once passing {} as x and x{0} fails because inner list is empty, so tr becomes an error. alist{0} returns first element of the outer list which is the empty list {}, so no error