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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:30:39+00:00 2026-05-25T19:30:39+00:00

I am trying to get better at functional programming. As a start I am

  • 0

I am trying to get better at functional programming. As a start I am planning on trying out with couple of languages like Pascal, Scheme, ML etc. First I started with Pascal. I am trying to insert user input into a integer array in pascal and then get them reverse.

  1 program ReverseList;
  2 
  3 var
  4         i: Integer;
  5         k: Integer;
  6         a: array[1..100] of Integer;
  7 begin   
  8         i := 0;
  9         repeat  
 10                 writeln('Enter a number');
 11                 readln(k);
 12                 if k > -1 then 
 13                         i := i + 1;
 14                         a[i] := k;
 15         until(k < 0);
 16         for i := 1 to i do    
 17                 writeln(a[i]);
 18 end.

In past I have mostly been a java developer so I was so custom to using all the lists thats available. Also ideally I was wondering if I can build a list where I can iterate over the list based on the number of elements in that list.

It would be great if anyone could point me on the direction of good tutorials in functional programming as well as syntax on above mentioned programming languages.

  • 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-25T19:30:40+00:00Added an answer on May 25, 2026 at 7:30 pm

    It was a good practice and I managed to figure a solution for this. I am sure there are better ways to do, and also this doesn’t look like I am using the functionalities of functional programming. But if anyone wants to provide a better solution please do so,

    {author: Null-Hypothesis}
    
    program ReverseList;
    
    var
            i: Integer; {integer to keep the array length}
            k: Integer; {user input value}
            a: array[1..100] of Integer; {array to store the user inputs}
    begin
            i := 0;
            repeat  {iterate until user input is negative or number of inputs exceed array size}
    
                    writeln('Enter a number or enter negative value to exit the program.');
                    readln(k);
                    if(k > -1) and (i < 100) then   {check for negative value and size of the array}
                    begin
                            i := i + 1;     {increase array index}
                            a[i] := k       {assign value to array}
                    end
                    else
                            break;  {exit if array size exceed the limit of array}
            until(k < 0);
    writeln;
    
    {Printing the user input before the reversing the list}
    writeln('Original order of the list');
    for i := 1 to i do
            writeln(a[i]);
    writeln;
    
    {Printing the reverse list}
    writeln('Reversed List');
    for i := i downto 1 do  {decrement array index}
            writeln(a[i]);
    writeln('Bye!!!');
    end.
    

    Happy Coding, off to the next language…

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

Sidebar

Related Questions

I'm working through previous years ACM Programming Competition problems trying to get better at
I'm really trying to get better with this stuff. I'm pretty functional with internationalization
I'm trying to get better at using Jquery and therefore would like feedback on
I'm trying to get better at using MVC/MVP style patterns with my WinForm apps
I am trying to get better about minimizing any unnecessary markup and using optimal
I'm trying to get a better understanding of how Windows, 32-bit, calculates the virtual
I am trying to get a better working knowledge of JavaScript. So, I have
Just trying to get diff to work better for certain kinds of documents. With
I'm trying to get this piece of code working a little better. I suspect
Trying to get my css / C# functions to look like this: body {

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.