Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can functions be overloaded in LISP like they can be in C#?

I find overloading very useful in my C# code. I know it can be done in many other languages too (C++ for sure).

Does LISP allow overloading or something equivalent?

like image 700
Robert Avatar asked Feb 13 '13 10:02

Robert


People also ask

Is it possible to overload a function in C?

This feature is present in most of the Object Oriented Languages such as C++ and Java. But C doesn't support this feature not because of OOP, but rather because the compiler doesn't support it (except you can use _Generic).

Which language method Cannot overload?

In which of the following languages is function overloading not possible? Explanation: Function Overloading is not possible in C as it is not an Object-Oriented Language.

Can we overload functions in C++?

C++ lets you specify more than one function of the same name in the same scope. These functions are called overloaded functions, or overloads. Overloaded functions enable you to supply different semantics for a function, depending on the types and number of its arguments.

Can we overload function?

Function overloading is a feature of object-oriented programming where two or more functions can have the same name but different parameters. When a function name is overloaded with different jobs it is called Function Overloading.


2 Answers

Common Lisp does not.

Common Lisp does not support 'overloading'.

Common Lisp provides polymorphism via CLOS, but not overloading.

like image 152
Rainer Joswig Avatar answered Oct 13 '22 07:10

Rainer Joswig


Yes it does have "something similar", but more powerful: generic functions.

EDIT: I wasn't aware that the definition of overloading implies compile-time resolution. Thanks Rainer Joswig.

like image 35
João Fernandes Avatar answered Oct 13 '22 06:10

João Fernandes