From 06696bd0f46b2ca11a445413b26b15f1dd5ec824 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 29 Nov 2024 22:07:28 +0000 Subject: [PATCH] Fix pluralisation in progress message --- src/sample.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sample.jl b/src/sample.jl index 0559876..bf0a7e6 100644 --- a/src/sample.jl +++ b/src/sample.jl @@ -1,6 +1,8 @@ # Default implementations of `sample`. const PROGRESS = Ref(true) +_pluralise(n; singular="", plural="s") = n == 1 ? singular : plural + """ setprogress!(progress::Bool; silent::Bool=false) @@ -372,7 +374,7 @@ function mcmcsample( N::Integer, nchains::Integer; progress=PROGRESS[], - progressname="Sampling ($(min(nchains, Threads.nthreads())) threads)", + progressname="Sampling ($(min(nchains, Threads.nthreads())) thread$(_pluralise(min(nchains, Threads.nthreads())))", initial_params=nothing, initial_state=nothing, kwargs..., @@ -489,7 +491,7 @@ function mcmcsample( N::Integer, nchains::Integer; progress=PROGRESS[], - progressname="Sampling ($(Distributed.nworkers()) processes)", + progressname="Sampling ($(Distributed.nworkers()) process$(_pluralise(Distributed.nworkers(); plural="es")))", initial_params=nothing, initial_state=nothing, kwargs...,