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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:18:23+00:00 2026-05-17T00:18:23+00:00

If i wanted to do the following: function1 stuff | condition1 = yay |

  • 0

If i wanted to do the following:

function1 stuff
| condition1 = "yay" 
| condition2 = "hey" 
| condition3 = "nay" 

and i wanted to have a statement that always ran, unconditionally, (e.g. “because”), how could i do this? The strings are placeholders.

Thanks!

Edit:

Before i give up on this, i want to try and rephrase it in terms of the problem at hand.

I have a function which takes two inputs (lists of lists).

If given a sample input of [[]] [[[]], [[]]] (or [[]] [[[“x”]], [[]]]) i want to

  • test to see if there exists an even amount of [[]]’s on each side and if so delete them all
  • test for an odd amount on each side then nub (delete all but one)
  • several other similar things

then following this combine the two inputs (cleaned up) and return them. So far i had decided on a guard syntax, after trying case and if-then-else. But that would only allow me to test one side (for example) then after the = sign to join and return. Unless it was inordinately long… So acknowledging that i have a lot to learn yet, how would i go about doing something like this in haskell?

  • 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-17T00:18:24+00:00Added an answer on May 17, 2026 at 12:18 am

    Your questions don’t really apply to functional programming languages, such as Haskell. Your first question is, I think, “how do I always do A here when I also want to do B?”. Your second question is similar: “how do I do A then B?”. These questions make sense for imperative languages (such as OO languages) where your program essentially tells the computer how to proceed. In functional languages, however, you say what you want computed, but it’s entirely up to the compiler how this is done (take that with a pinch of salt, but that’s the general idea).

    For example, your second question has

    number = number * 5
    number = number * 2
    

    In an imperative language this reads “update the memory cell named ‘number’ with its current contents times 5; then update the the memory cell named ‘number’ with its current contents times 2″.

    In a functional programming language these statements are either an error (you’re trying to define a scalar quantity “number” in terms of itself) or are Boolean expressions (“is number equal to number * 5?”).

    The best advice I can offer to help clear up your confusion is this: forget all about the idea of updating variables in a functional programming language because you can’t do it. Instead, think of always computing the value you want. For example, here’s the list length function:

    length []     = 0                 -- The empty list has zero items.
    length (x:xs) = 1 + length xs     -- The non-empty list (x:xs) has one more item than xs.
    

    Hope this helps.

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

Sidebar

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.