B4J Code Snippet Calling Clojure from B4J

Discussion in 'B4J Code Snippets' started by B4JExplorer, Jan 28, 2015.

  1. B4JExplorer

    B4JExplorer Active Member Licensed User

    Download Clojure 1.6.0 file from http://clojure.org/downloads

    (Specifically http://repo1.maven.org/maven2/org/clojure/clojure/1.6.0/clojure-1.6.0.zip)


    Extract clojure-1.6.0.jar from clojure-1.6.0.zip, and put it in the Additional Libraries classpath.

    Then

    Code:
    '...
    '...
    #AdditionalJar: clojure-1.6.0
    '...
    '...

    Dim oClojure As JavaObject
    Dim oIFn As JavaObject
    Dim sResult As String

    oClojure.InitializeStatic( 
    "clojure.java.api.Clojure" )
        
    oIFn =  oClojure.RunMethodJO( 
    "var"Array As Object( "clojure.core""+" ) )

    sResult =  oIFn.RunMethodJO( 
    "invoke"Array As Object( 12 ) )            '// Returns 3
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice