"Julia" (External Evaluation System)


ExternalEvaluate Usage

  • ExternalEvaluate["Julia",code] executes the code string in a Julia REPL and returns the results as a Wolfram Language expression.
  • ExternalEvaluate["Julia""String",code] executes the code string in a Julia REPL and returns the output as a Wolfram Language string.

Data Types

  • The following Julia built-in types are supported:
  • BoolTrue | FalseBoolean True/False values
    Int8, Int16, Int32, etc.Integerinteger
    Float16, Float32, etc.Realreal number
    Complex{Float16}, Complex{Float32}, etc.Complexcomplex number (returning from Julia only)
    StringStringstring of characters
    ArrayListlist of objects
    DictAssociationassociative array
    SetListunordered set without duplicates
    TupleListfixed-length container
    Date, DateTimeTemplateBox[{DateObject, paclet:ref/DateObject}, RefLink, BaseStyle -> {3ColumnTableMod}]dates, date intervals
    nothingNullno return value

Usage Notes

  • String templates (<**>) can be used to evaluate and insert Wolfram Language expressions into the Julia code string.


open allclose all

Basic Examples  (1)

Evaluate 2+2 in Julia and return the result:

Arrays are returned as lists:

Type > and select Julia from the drop-down menu to get a code cell that uses ExternalEvaluate to evaluate:

map(sqrt, 1:1:10)

Dates are returned from Julia as DateObject expressions:

Scope  (3)

Start a session:

Concatenate strings in Julia and return the result:

Dictionaries in Julia are returned as associations:

Close the session:

Start a session:

Define a Wolfram Language function that calls a Julia function:

Close the session:

A NumericArray is sent to Julia as an array with the same element type:

This shows the native Julia type for the incoming array:

Close the session: