efficiency, deep lists

Ulf Wiger <>
Wed Oct 3 17:11:39 CEST 2001


On Wed, 3 Oct 2001, Richard Carlsson wrote:

>If the input has the form [[a,b,c],[d,e,f],[g,h,i]], the
>version using foldl and ++ yields [g',h',i',d',e',f',a',b',c'],
>since it appended to the left. However, appending to the right
>would give quadratic behaviour. Changing to foldr would solve
>it.

You're right, of course. Anyway, the order didn't matter in this
case.  (:

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list