Skip to content

Commit

Permalink
paren
Browse files Browse the repository at this point in the history
  • Loading branch information
vmchale committed Feb 11, 2025
1 parent 08abdd9 commit e06191c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ Thus the same implementation can be used interpreted, compiled, or called from
another language.

```
> [((+)/x)%ℝ(:x)]\`7 (frange 1 10 10)
> [(+)/x%ℝ(:x)]\`7 (frange 1 10 10)
Arr (4) [4.0, 5.0, 6.0, 7.0]
```

```python
>>> import apple
>>> import numpy as np
>>> sliding_mean=apple.jit('([((+)/x)%ℝ(:x)]\`7)')
>>> sliding_mean=apple.jit('([(+)/x%ℝ(:x)]\`7)')
>>> sliding_mean(np.arange(0,10,dtype=np.float64))
array([3., 4., 5., 6.])
```

```janet
repl:1:> (import apple)
@{_ @{:value <cycle 0>} apple/jit @{:private true} apple/tyof @{:private true}}
repl:2:> (def sliding-mean (apple/jit ``([((+)/x)%ℝ(:x)]\`7)``))
repl:2:> (def sliding-mean (apple/jit ``([(+)/x%ℝ(:x)]\`7)``))
<jit Vec (i + 7) float → Vec i float>
repl:3:> (sliding-mean @[0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0])
@[3 4 5 6 7]
```

```R
> source("R/apple.R")
> sliding_mean<-jit("([((+)/x)%ℝ(:x)]\\`7)")
> sliding_mean<-jit("([(+)/x%ℝ(:x)]\\`7)")
> run(sliding_mean,seq(0,10,1.0))
[1] 3 4 5 6 7
```
Expand Down

0 comments on commit e06191c

Please sign in to comment.