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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:59:34+00:00 2026-06-17T16:59:34+00:00

I use a number of libraries in Clojure that produce higher order functions that

  • 0

I use a number of libraries in Clojure that produce higher order functions that conform to the “clojure.lang.IFn” interface.

It has multiple arity overloads, I.e. the interface looks something like:

public interface IFn extends Callable, Runnable{
  public Object invoke() ;
  public Object invoke(Object arg1) ;
  public Object invoke(Object arg1, Object arg2) ;
  public Object invoke(Object arg1, Object arg2, Object arg3) ;
  .... etc.
  public Object applyTo(ISeq arglist) ;
}

Will I be able to use objects of this type directly in Java 8 as callable lambda functions?

  • 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-06-17T16:59:35+00:00Added an answer on June 17, 2026 at 4:59 pm

    What do you mean, use objects of this type as callable lambdas?

    In very simple cases, Java 8 lambdas can be thought as syntactic sugar + some type inference for anonymous classes for certain type of interfaces, namely functional interfaces [1]:

    The interface ActionListener, used above, has just one method. Many
    common callback interfaces have this property, such as Runnable and
    Comparator. We’ll give all interfaces that have just one method a
    name: functional interfaces.

    Remark: lambdas are really not just a sugar; internally they are implemented differently than anonymous classes, and there are also some semantic differences; see this excellent answer on ProgrammersExchange for more on this matter. However, this is not really important in context of this question and answer.

    Anywhere where a value of some functional interface is expected (method argument, local variable, field declaration etc.) it will be possible to use short syntax for creating an entity resemling anonymous class implementing this method, that is, a lambda expression:

    Runnable r = () -> {
        System.out.println("Hi");
    };
    // Equivalent to
    Runnable r = new Runnable() {
        public void run() {
            System.out.println("Hi");
        }
    };
    
    public interface Function<F, T> {
        T call(F arg);
    }
    
    Function<String, char[]> c = s -> ("<" + s + ">").toCharArray();
    // Equivalent to
    Function<String, char[]> c = new Function<>() {
        public char[] call(String s) {
            return ("<" + s + ">").toCharArray();
        }
    };
    

    So your question can only be interpreted in the following way: is it possible to create objects of type IFn using Java 8 lambda syntax?

    The answer is no. Lambda syntax is possible only with functional interfaces. clojure.lang.IFn is not a functional interface because it contains much more than single method, so it won’t be possible to do something like

    IFn f = (String s) -> s.toLowerCase();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our company produces a number of Java / Scala libraries for use by our
Would you rather use a version number (that will increment) or a timestamp to
I have inherited a web site project that makes use of a number of
For the Flyway Maven plugin, I need to call a number of libraries that
I've got a number of scripts that use common definitions. How do I split
I have a few libraries I use in my project that are unsigned. Because
I notice a number of java libraries use this as a suffix: log4j, couchdb4j,
We have a c# app that uses a number of libraries (that we wrote
I must generate a random number using boost libraries, I use this code: boost::mt19937
We've got a number of python libraries that need to be called from inside

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.