BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
587 stars 165 forks source link

Simplify definition of internal function `columns` #442

Closed ivanperez-keera closed 1 year ago

ivanperez-keera commented 1 year ago

The internal function columns is building a list with the first element of each sublist, applying an auxiliary function f to it, and then proceeding recursively with the tails of all lists.

This is the same as transposing the list of lists so that all the first elements of the sublists are grouped together, all the second elements are grouped together, and so on, and then applying f to each resulting sublist.

This commit simplifies the definition of columns by using Data.List.transpose.

ivanperez-keera commented 1 year ago

@andreasabel done!