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 405955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:26:58+00:00 2026-05-12T17:26:58+00:00

As a newbie in functional languages (I started touching Erlang a couple of weeks

  • 0

As a newbie in functional languages (I started touching Erlang a couple of weeks ago — the first functional language I could get my hands on).

I started to writing some small algorithms (such as left_rotate_list, bubble_sort, merge_sort etc.). I found myself often getting lost in decisions such as “should I use a helper List for intermediate result storage?” and “should I create a helper function to do this?”

After a while, I found that functional programming (bear with me if what I am talking does not make sense at all) encourages a “top down” design: i.e., when I do merge_sort, you first write down all the merge sort steps, and name them as individual helper functions; and then you implement those helper functions one by one (and if you need to further dividing those helper functions, do it in the same approach).

This seems to contradict OO design a little, in which you can start from the bottom to build the basic data structure, and then assemble the data structure and algorithms into what you want.

Thanks for comments. Yes, I want to get advice about how to “think in functional language” (just like “thinking in Java”, “thinking in C++”).

  • 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-05-12T17:26:58+00:00Added an answer on May 12, 2026 at 5:26 pm

    After a while, I found that functional programming […] encourages a “top down” design.

    I’m not sure this is an accurate statement. I’ve been recently trying to teach myself functional programming, and I’ve found that a sort “bottom-up” style of programming really helps me. To use your example of merge sort:

    • First look at the base case. How do you sort an array of 0/1 elements?
    • Next, look at the base + 1, base + 2, … cases. Eventually, you should see a pattern (splitting into subproblems, solving subproblems, combining subsolutions) that allows you to write a general recursive case than eventually reaches the base case.
    • Splitting into subproblems is easy, but combining the subsolutions is a bit harder. You need a way to merge two sorted arrays into one sorted array.
    • Now put everything together. Congratulations, you’ve just written merge sort. :)

    I could be misusing the term, but this feels like bottom-up design to me. Functional programming is different than object-oriented programming, but you shouldn’t need to totally abandon existing design techniques when switched between the two.

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

Sidebar

Related Questions

I am a newbie to the realm of functional programming and have just started
I am a long time OO programmer and a functional programming newbie. From my
I am a Clojure newbie. I am trying to get two copies of a
Another newbie (Common) LISP question: Basically in most programming languages there's a mean for
For a functional programming assignment, I am writing a scheme macro that translates scheme
I'm newbie in Functional Programming. I have a huge neural network with thousands of
Haskell newbie here. I wrote an evaluator for a minimal assembly-like language. Now, I
I am a newbie to haskell and functional programming. This might be a very
I am a Scala newbie, just starting to learn the language. I solved Problem
I'm a PostgreSQL (v8.4) newbie, and I'm trying to get some simple functions written.

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.