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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:12:53+00:00 2026-05-28T16:12:53+00:00

Is there a programming language (may be a concept or research paper), which allows

  • 0

Is there a programming language (may be a concept or research paper), which allows
a polymorphism over function/method arguments values? Kind of:

function factorial(int value > 0){ /* code here */}
function factorial(int value == 0){ /* code here */}
function factorial(int value < 0){ /* code here */}

And, what is the official name, if any, for this kind of polymorphism?

  • 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-28T16:12:54+00:00Added an answer on May 28, 2026 at 4:12 pm

    I guess what you’re looking for is pattern matching and/or guards. Erlang for instance allows this:

    foo(X) when X > 0  -> bar(X);
    foo(X) when X == 0 -> baz(X);
    foo(X)             -> X.
    
    foo("bar", X) -> bar(X);
    foo(42, X)    -> baz(X);
    foo(_, X)     -> X.
    

    The former demonstrates the use of guards, the latter is a simple pattern match, where the first argument is either "bar", 42 or anything else. Both techniques can be found in many functional languages.

    Just in case you’re not familiar with the syntax, that’s equivalent to (as much as it can be compared):

    function foo("bar", x) {
        return bar(x);
    }
    function foo(42, x) {
        return baz(x);
    }
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any programming language (or type system) in which you could express the
I wondered if there is a programming language which compiles to machine code/binary that
Are there any open source or commercial web programming language that function much like
Is there a programming language suitable for building web applications, that is compiled, strongly-typed,
background: - there are formal languages for expressing programming language valid lexicon and syntax
Is there any really low level programming language that can get access the memory
I am starting to learn the Clojure programming language. Are there any recommendations for
many (may be all?) programming language consist of assembly language how lisp implemented in
So this may seem like a general question..but for learning a programming language quickly
Update: This question is a duplicate of Are there any programming languages targeting PHP,

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.