brokenix,

when you reverse a list in

aux_reverse [] out = out aux_reverse (x:xs) out = aux_reverse xs (x:out)<br></br>reverse l = aux_reverse l []<br></br>

does it keep the reference to the original list (using max space) ? ll do the same?

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@brokenix It will keep it until the next GC sweep, and that will keep it only if it is referenced elsewhere.

Of course laziness can complicate that a little bit -- but reducing reverse list to WHNF does release the closure's reference to list (and reverse).

  • All
  • Subscribed
  • Moderated
  • Favorites
  • haskell
  • DreamBathrooms
  • magazineikmin
  • ethstaker
  • khanakhh
  • rosin
  • Youngstown
  • everett
  • slotface
  • ngwrru68w68
  • mdbf
  • GTA5RPClips
  • kavyap
  • thenastyranch
  • cisconetworking
  • JUstTest
  • cubers
  • Leos
  • InstantRegret
  • Durango
  • tacticalgear
  • tester
  • osvaldo12
  • normalnudes
  • anitta
  • modclub
  • megavids
  • provamag3
  • lostlight
  • All magazines