Skip to content

Commit

Permalink
Merge pull request #31 from Clonkk/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
Clonkk authored Sep 29, 2021
2 parents 3f387b3 + f17cd5d commit 3c39afc
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 5 deletions.
7 changes: 5 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changelog for Nimjl. Date in format YYYY_MM_DD

Release v0.5.8 - 2021_09_29
===========================
* Renamed examples so it's easier to read in order


Release v0.5.7 - 2021_08_16
===========================
* Added dot operators and broadcast mechanism.
Expand Down Expand Up @@ -71,7 +76,6 @@ Release v0.4.2 - 2021_03_18

Release v0.4.1 - 2021_03_10
===========================

* Add seq support when converting types
* Add Tensor support when converting types
* Improved dispatch using generic proc instead of ``when T is ...``
Expand All @@ -82,7 +86,6 @@ Release v0.4.1 - 2021_03_10

Release v0.4.0 - 2021_03_08
===========================

* First official release
* Support Arrays / Tuple / Dict of POD
* Supports Julia Arrays from Buffer.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion examples/ex_module.nim → examples/ex05_module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type
Julia.init() # Initialize Julia VM. This should be done once in the lifetime of your program.

# Include Julia file
jlInclude("ex_module.jl")
jlInclude("localmodule.jl")
# Use the module. If you're confused by the syntax, go and read through Julia's Manual where module usage is explained
jlUseModule(".nimjlExample")

Expand Down Expand Up @@ -63,3 +63,8 @@ block:
echo jlfoo
echo foo

block:
let res = Julia.returnDoubleValue()
echo res.myint
echo res.mystr

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ proc do1darray() =

echo s1
echo s
# s1 was created using s buffer therefore assigning s1 modify s
doAssert s == @[122, 2, 123, 4, 124, 6, 7, 125, 9]

block:
var s = @[1, 2, 3, 4, 5, 6, 7, 8, 9]
Expand All @@ -23,6 +25,8 @@ proc do1darray() =

echo s1
echo s
# s1 was created by copy therefore assigning s1 does not modify s
doAssert s == @[1, 2, 3, 4, 5, 6, 7, 8, 9]

proc do2darray() =
block:
Expand Down
5 changes: 5 additions & 0 deletions examples/ex_module.jl → examples/localmodule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ module nimjlExample
foo.z *= " -> AppendMeBaby"
end

function returnDoubleValue()
return (myint=36, mystr="Hello, world")
end

export returnDoubleValue
export customFunction
export Foo
export makeFoo
Expand Down
9 changes: 9 additions & 0 deletions nimjl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ proc jlVmProcessExit() =
jlVmExit(0.cint)

addExitProc jlVmProcessExit

runnableExamples:
import nimjl

Julia.init() # Initialize Julia VM. Subsequent call to init will be ignored
var myval = 4.0'f64
discard Julia.println("Hello world") # No need for \n with Julia println function
var res = Julia.sqrt(myval).to(float64) # Call Julia function "sqrt" and convert the result to a float
echo res # sqrt(4.0) == 2.0
2 changes: 1 addition & 1 deletion nimjl.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nimjl
# Licensed and distributed under MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
version = "0.5.7"
version = "0.5.8"
author = "Regis Caillaud"
description = "Nim Julia bridge"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ echo res # 2.0
```

Take a look at the ``examples/`` folder for more examples. There's also the ``tests/`` folder with more application.
Take a look at ``tests/`` or ``examples/`` folder for typical examples.


# License
Expand Down

0 comments on commit 3c39afc

Please sign in to comment.