Tuesday 19 April 2016

Julia: Define module using baremodule

When you define a module using baremodule, it does not contain using Base, import Base.call (Usually these are imported by default). But it still imports Core module.
julia> baremodule Arithmetic
              export addition, subtraction
              function addition(x, y)
                     x+y
              end

              function subtraction(x, y)
                     x-y
              end

              function mul(x, y)
                     x*y
              end

              function div(x, y)
                     x/y
              end
       end
Arithmetic

julia> typeof(Arithmetic)
Module


Previous                                                 Next                                                 Home

No comments:

Post a Comment