• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TuringLang / JuliaBUGS.jl / 11870001725
82%
main: 84%

Build:
Build:
LAST BUILD BRANCH: sg/#380
DEFAULT BRANCH: main
Ran 16 Nov 2024 12:27PM UTC
Jobs 1
Files 61
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

16 Nov 2024 12:16PM UTC coverage: 74.173% (+0.08%) from 74.092%
11870001725

push

github

web-flow
Permit dot call (like `Distributions.Normal`) to be used in model definition (#237)

The motivation for the PR is initially to allow the use
[`product_distribution`](https://juliastats.org/Distributions.jl/stable/multivariate/#Distributions.product_distribution)
in JuliaBUGS model. By writing

```julia
@bugs begin
    x[1:2] ~ Distributions.product_distribution(fill(Normal(), 2))
end
```

It also enables

```julia
julia> foo(x) = x + 1
foo (generic function with 1 method)

julia> model_def = @bugs begin
           a = Main.foo(b)
       end
quote
    a = Main.foo(b)
end

julia> compile(model_def, (;b=2))
BUGSModel (parameters are in transformed (unconstrained) space, with dimension 0):

  Model parameters:

  Variable sizes and types:
    a: type = Int64
    b: type = Int64
```

i.e., an easier way to introduce external functions into JuliaBUGS. 

This can't fully replace `@register_primitive` yet, because using `Main`
module is relying on Julia runtime behavior and not very intuitive.
Examples:

```julia
julia> module TestModule
           bar(x) = x + 1
       end
Main.TestModule

julia> model_def = @bugs begin
           a = TestModule.bar(b)
       end
quote
    a = TestModule.bar(b)
end

julia> compile(model_def, (; b = 1))
ERROR: UndefVarError: `TestModule` not defined in `JuliaBUGS`
...
```

one would need to do 

```julia
julia> model_def = @bugs begin
           a = Main.TestModule.bar(b)
       end
quote
    a = Main.TestModule.bar(b)
end
```

also

```julia
julia> @testset "t" begin
           foo1(x) = x + 1
           model_def = @bugs begin
               a = Main.foo1(b)
           end
           compile(model_def, (; b= 1))
       end
t: Error During Test at REPL[18]:1
  Got exception outside of a @test
  UndefVarError: `foo1` not defined in `Main`
...
```

2 of 2 new or added lines in 1 file covered. (100.0%)

1390 of 1874 relevant lines covered (74.17%)

144623.41 hits per line

Jobs
ID Job ID Ran Files Coverage
1 11870001725.1 16 Nov 2024 12:27PM UTC 0
74.17
GitHub Action Run
Source Files on build 11870001725
Detailed source file information is not available for this build.
  • Back to Repo
  • 26ef6624 on github
  • Prev Build on master (#11832739597)
  • Next Build on master (#11897946581)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc