File: test-examples.R

package info (click to toggle)
r-cran-lambda.r 1.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 284 kB
  • sloc: sh: 9; makefile: 2
file content (12 lines) | stat: -rw-r--r-- 295 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
assert('example_1', {
  reciprocal(x) %::% numeric : numeric
  reciprocal(x) %when% { x != 0 } %as% { 1 / x }
  reciprocal(x) %::% character : numeric
  reciprocal(x) %as% { reciprocal(as.numeric(x)) }

  act.1 <- reciprocal(4)
  act.2 <- reciprocal("4")

  (act.1 == 0.25)
  (act.2 == 0.25)
})