Skip to main content
8 votes

Tar implementation

The recursion here is not tail recursion. A tail-call is one where no further processing is needed between the called function's return and that of the calling function (this means that the current ...
Toby Speight's user avatar
  • 88.7k
5 votes
Accepted

Tar implementation

What’s the Deal Here Tail recursion is an extremely useful pattern. You’d normally use it to transform a loop into an equivalent function that calls itself. All the state that carries over from one ...
Davislor's user avatar
  • 9,175
4 votes
Accepted

tail recursive directory traversal in Rust

This is Not Tail-Recursive, Because You Recurse from a Closure The return traverse_directory(...) statement would be tail-...
Davislor's user avatar
  • 9,175
3 votes

Prevent stack memory usage for recursive function in C

Check the return value of malloc(): malloc() and family returns NULL to signify an error. ...
Madagascar's user avatar
  • 10.1k
3 votes

Implementations of unzip in Racket

The apply+foldl approach in WorBlux's answer can be simplified by using the split-at-right ...
Shawn's user avatar
  • 431
3 votes
Accepted

Implementations of unzip in Racket

Doing it with folds pretty much begs you to create a custom accumulator and recursive function or fold within a fold like that. A couple notes. I don't think foldr...
WorBlux's user avatar
  • 521
2 votes
Accepted

F# - Recursively find the first available item in a range definition

preliminaries: Let us ignore IPv6 and focus on this proposed scope, supported by a router port: 192.168.0.0/24 interval endpoints I find this ambiguous; it needs documentation in the Review Context ...
J_H's user avatar
  • 43.3k
2 votes

Prevent stack memory usage for recursive function in C

Clean-Up Use calloc() Where Appropriate You currently have: ...
Davislor's user avatar
  • 9,175
2 votes

Prevent stack memory usage for recursive function in C

Some side issues for OP. Deeper math issues Best to use float constants rather than double ones to initialize a ...
chux's user avatar
  • 36.5k
2 votes

What is better to use for mapping value to Map of functions: tail recursion or foreach?

You never use your Map to lookup a filter function by its key. If you don't need any of the keys then you don't really need a Map...
jwvh's user avatar
  • 1,473

Only top scored, non community-wiki answers of a minimum length are eligible