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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:40:02+00:00 2026-05-26T01:40:02+00:00

I got this very newb and simple function in erlang: function_x(L) -> X =

  • 0

I got this very newb and simple function in erlang:

function_x(L) ->
    X = lists:filter((fun(N)-> N =:= 2 end), L),
    Y = lists:filter((fun(N)-> N =:= 3 end), L),
    LX = length(X),
    LY = length(Y),
    LX == 2 or LY == 2.

Compile the source, and I get this error:

syntax error before: '=='

I pull of one of the expressions from the or clausule and it works. I’m very newb in erlang as you see and really don’t understand why this happens if it seems so simple. Any help? Thanks

  • 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-26T01:40:03+00:00Added an answer on May 26, 2026 at 1:40 am

    According to the operator precedence in Erlang, the precedence of or is higher than that of ==. So your expression as written is treated as

    LX == (2 or LY) == 2
    

    which is a syntax error. To fix this, you must use parentheses around each term:

    (LX == 2) or (LY == 2).
    

    Alternatively, you can use orelse which has a lower precedence than ==:

    LX == 2 orelse LY == 2.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a very simple WPF UserControl that looks like this: namespace MyUserControl {
I've got a very simple WPF UserControl that looks like this: namespace WpfControlLibrary1 {
Let's say I've got this very simple code: for(int i = 0; i <
I've got a simple Listbox on a HTML form and this very basic jQuery
Quick facts, I got this function from http://lua-users.org/wiki/SplitJoin at the very bottom, and am
I got this code from someone and it works very well, I just want
I posted this very same item on SERVERFAULT, but got no reply. So here
Today I got this question for which I think I answered very bad. I
We've got this very annoying problem with Scriptaculous and Internet Explorer 7/8. We have
Hey there, i got this very annoying problem: I have a CheckBoxList getting items

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.