elonzyy

15 Reputation

3 Badges

4 years, 96 days

MaplePrimes Activity


These are replies submitted by elonzyy

@Carl Love Thank you for you detailed reply. It provides me a perfect direction for further exploring Maple programming techniques.

I've found Flatten in ListTools.

 

  to_list := a -> convert(a, list);
  map_i := (f, a) -> zip(f, to_list(a), [`$`(1..nops(to_list(a)))]);
  flat_map_i := (f, a) -> ListTools:-Flatten(map_i(f, a), 1);
  flat_map := (f, a) -> ListTools:-Flatten(map(f, a), 1);

 

flat_map defined in this way seems to be concise enough.

 

But, map_with_index is bloated.

Page 1 of 1