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

  • Home
  • SEARCH
  • 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 8183167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:04:46+00:00 2026-06-07T01:04:46+00:00

Regarding finger trees, as seen in this paper and mentioned in this post by

  • 0

Regarding finger trees, as seen in this paper and mentioned in this post by Eric Lippert.

I do not understand why an explicit tuple arrangement is used, as opposed to some sort of linked list structure for each finger. That is, why do we define One(x), Two(x, y), Three(x, y, z), Four(x, y, z, a) and not just have a less optimal deque object and do LessOptimalDeque.AddLeft(x)?

Is it somehow slower? I mean, even though you could use some data structure that re-uses the memory of some nodes/groups of nodes?

In the paper, it’s even mentioned:

Exercise 1. In the above presentation, we represented digits as lists for simplicity.
A more accurate and efficient implementation would use the type

data Digit a = One a  
| Two a a
| Three a a a
| Four a a a a

Rework the above denitions to use this denition of Digit.

I don’t know why it’s more efficient though. Is it only something relevant to the functional language the author was using, and otherwise could also be done using the data structures I proposed above?

Edit
enter image description here

What about implementing the finger like this?

  • 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-07T01:04:47+00:00Added an answer on June 7, 2026 at 1:04 am

    To see why this is more efficient in Haskell:

    data Digit a
               = One a  
               | Two a a
               | Three a a a
               | Four a a a a
    

    than this (the obvious encoding of a vector):

    data List a = One a
                | Many a (List a) -- a linked list of at least one element.
    

    we can observe the heap structure necessary to allocate a Digit vs a List.

    Four 'x' 'y' 'z' 'd'
    

    vs

    Many 'x' (Many 'y' (Many 'z' (One 'd')))
    

    In the former case, we save 3 constructors. In the latter we are forced to allocate additional heap objects for the (possibly infinite) tail of the structure. In general, the Digit representation will allocate O(n-1) fewer heap cells, as the size of the structure is encoded in the outermost constructor. We can also determine the size in O(1) as a result.

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

Sidebar

Related Questions

Regarding PHP security with cookies and sessions, this is what i have done so
Regarding TJvRichEdit and Delphi... How? Load/Save rtf (including text and images - not only
Regarding this SO article and this SO article. I looked at these after noticing
Regarding a line of this script: function Vehicle(hasEngine, hasWheels) { this.hasEngine = hasEngine ||
After reading this question regarding Linux: Open Terminal From Eclipse I have the same
Regarding to cookbook we can cache elements like this: echo $this->element('helpbox', array(), array('cache' =>
regarding to this question , i have a problem if use that query for
In the jQuery docs regarding Deferreds , there's this example of returning ajax args
This is a genuine question, not intended to start a flame war. I've used
Regarding the ASP.NET Universal Providers (System.Web.Providers), do they automatically offer the retry logic when

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.