• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Programming v
« Previous 1 2 3 4
Tidy recursion

 
  • 0 Vote(s) - 0 Average
Tidy recursion

nemyax
Offline

Member

Posts: 128
Threads: 14
Joined: Nov 2012
#3
05-19-2013, 09:14 PM
micheus
Thanks for the tips.
My doubts are due to Joe Armstrong saying this in Programming Erlang in a section about tail recursion:
Quote:if you write a function F that never returns (such as loop()), make sure that you never call anything after calling F, and don’t use F in a list or tuple constructor.
In both 1 and 2, the last expression looks like a list constructor, so it might inflate the stack noticeably if the binary is huge (I don't know for sure — no idea how these expressions would be compiled).
I think I picked up the trick with the arity bump and the introduction of an accumulator from the Wings source, so there must be a reason why this is used.
By contrast, the Haskell examples I've seen don't make a fuss about using the x:myFunction xs notation, and it really does look neat.

(05-18-2013, 06:22 AM)micheus Wrote: It's good see someone else coding for Wings3d. Smile
Well, what's the use. No one seems to be using my crap =)
« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)



Messages In This Thread
Tidy recursion - by nemyax - 05-17-2013, 12:22 PM
RE: Tidy recursion - by micheus - 05-18-2013, 06:22 AM
RE: Tidy recursion - by nemyax - 05-19-2013, 09:14 PM
RE: Tidy recursion - by dgud - 05-20-2013, 01:50 PM
RE: Tidy recursion - by micheus - 05-20-2013, 01:58 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode