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

Ask A Question

Stats

  • Questions 539k
  • Answers 539k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to change the properties of the association in… May 17, 2026 at 2:22 am
  • Editorial Team
    Editorial Team added an answer "Any" is an extension method, not a method of HashSet<T>.… May 17, 2026 at 2:22 am
  • Editorial Team
    Editorial Team added an answer Im sure theres plenty of links been posted to get… May 17, 2026 at 2:22 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have two console apps, Query and Update, that share some functionality. I wanted
I have a simple form that is used to update an entity in my
I'm following the tutorial here: http://docs.jquery.com/Plugins/Authoring I just wanted to create a simple plugin
I wanted to save a flexible layout that I've already customized so that I
I have the following declaration in my code: u32 volatile __attribute__((nocast)) *A, *B; Is
Please consider the following snippet from an implementation of the Interpreter pattern: public override
I am using the following function to do a image upload/display The Target is
assume this following function: int binaryTree::findHeight(node *n) { if (n == NULL) { return
I have a function which returns only one row as array. I give a
I've got the following function prototype: bool key_pressed(enum key key) const; I documented it

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.