Skip to content

Commit 0886be8

Browse files
authored
Merge pull request #394 from ClojureCivitas/jank-smaller-example
made the jank example smaller to avoid a bug
2 parents e044e5b + 0592958 commit 0886be8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/jank/hello.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Annotate a value with `^:kind/...` to tell Janqua how to render it:
4343

4444
## Random samples from `<random>`
4545

46-
The blocks below use Jank's C++ interop to draw samples from the standard library. We construct a [`std::mt19937`](https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine) (the [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister) PRNG) and a [`std::normal_distribution<double>`](https://en.cppreference.com/w/cpp/numeric/random/normal_distribution) from the [C++ standard library](https://en.cppreference.com/w/cpp/header/random), generate ten thousand samples, and collect them into a Jank vector. The `cpp/` forms sit inline with the ordinary Jank code.
46+
The blocks below use Jank's C++ interop to draw samples from the standard library. We construct a [`std::mt19937`](https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine) (the [Mersenne Twister](https://en.wikipedia.org/wiki/Mersenne_Twister) PRNG) and a [`std::normal_distribution<double>`](https://en.cppreference.com/w/cpp/numeric/random/normal_distribution) from the [C++ standard library](https://en.cppreference.com/w/cpp/header/random), generate a thousand samples, and collect them into a Jank vector. The `cpp/` forms sit inline with the ordinary Jank code.
4747

4848
First, the include:
4949

@@ -57,7 +57,7 @@ Then the sampling:
5757
(def samples
5858
(let [gen (cpp/std.mt19937. 42)
5959
dist (#cpp (std.normal_distribution double) 0.0 1.0)]
60-
(loop [i 10000 acc []]
60+
(loop [i 1000 acc []]
6161
(if (zero? i)
6262
acc
6363
(recur (dec i) (conj acc (dist gen)))))))

0 commit comments

Comments
 (0)