Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9006337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:23:04+00:00 2026-06-16T01:23:04+00:00

For instance, since the following function don’t have an accumulator, is it still tail

  • 0

For instance, since the following function don’t have an accumulator, is it still tail recursive?

belong:: (Ord a) => a -> [a] -> Bool
belong a [] = False
belong a (h:t) 
    | a == h = True
    | otherwise = belong a t

All the computations in the function are processed before the recursive call, is it a sufficient condition to be considered tail recursive?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:23:05+00:00Added an answer on June 16, 2026 at 1:23 am

    Tail recursion does not necessarily need an accumulator. Accumulators are used in tail recursion as a way of communicating a partial result down through the recursive call chain without requiring extra space to be used at each level of the recursion. For example, the canonical tail recursive factorial function needs an accumulator to propagate the partial product built up so far. However, if you don’t need to communicate any information from a recursive call down to its subcall, then the accumulator isn’t necessary.

    The function you’ve provided is indeed tail recursive, but it doesn’t need or use an accumulator. When searching for an element in a list, the recursion doesn’t need to remember that all of the elements it has looked at so far aren’t equal to the particular element being searched for. It just needs to know what element to look for and what list to search.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since the equals function in array only check the instance, it doesn't work well
I have a spring application that uses an embedded Jetty instance. Since I am
I have a program doing something like the following: class SomeObject{} { void function(int
I have the following legacy VB6 function that I want to call from C#.
Require a huge help here, since this is affecting our production instance. One of
In C++, since you can have class-instances as members in structs, the compiler has
For instance, if I have an class: public class StuffHolder { List<Stuff> myList; public
For instance: I have a swf, lets say A, that loads another swf, B.
Is there a clean way to have a decorator call an instance method on
I have a hierarchy table with the following data : SOURCE TARGET Level ID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.