Running examples in 'gestalt-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: constant
> ### Title: Values as Functions
> ### Aliases: constant variable
> 
> ### ** Examples
> 
> # Function with a constant return value
> val <- {message("Computing from scratch"); mtcars} %>>>%
+   split(.$cyl) %>>>%
+   lapply(function(data) lm(mpg ~ wt, data)) %>>>%
+   lapply(summary) %>>>%
+   sapply(`[[`, "r.squared")
> 
> # With every invocation, `val()` is computed anew:
> val()
Computing from scratch
        4         6         8 
0.5086326 0.4645102 0.4229655 
> val()
Computing from scratch
        4         6         8 
0.5086326 0.4645102 0.4229655 
> 
> # Declaring `val` as a constant ensures that its value is computed only once.
> # On subsequent calls, the computed value is simply fetched:
> const <- constant(val)
> const()
Computing from scratch
        4         6         8 
0.5086326 0.4645102 0.4229655 
> const()
        4         6         8 
0.5086326 0.4645102 0.4229655 
> 
> # As values, `val()` and `const()` are identical. But `const()`, moreover,
> # has structure, namely the function `const`:
> const
Constant Function:
<Function Composition>
In order of application:

[[1]]
  function (..., . = ..1) 
  {
      message("Computing from scratch")
      mtcars
  }
  <environment: 0x2c99f30>

[[2]]
  function (..., . = ..1) 
  split(., .$cyl)
  <environment: 0x2c99f30>

[[3]]
  function (..., . = ..1) 
  lapply(., function(data) lm(mpg ~ wt, data))
  <environment: 0x2c90d00>

[[4]]
  function (..., . = ..1) 
  lapply(., summary)
  <environment: 0x2c8e318>

[[5]]
  function (..., . = ..1) 
  sapply(., `[[`, "r.squared")
  <bytecode: 0x31e66d8>

Recover the list of functions with 'as.list()'.
> 
> # For instance, you can inspect the intermediate summaries:
> head(const, -1)()
Computing from scratch
$`4`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-4.1513 -1.9795 -0.6272  1.9299  5.2523 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   39.571      4.347   9.104 7.77e-06 ***
wt            -5.647      1.850  -3.052   0.0137 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.332 on 9 degrees of freedom
Multiple R-squared:  0.5086,	Adjusted R-squared:  0.454 
F-statistic: 9.316 on 1 and 9 DF,  p-value: 0.01374


$`6`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
     Mazda RX4  Mazda RX4 Wag Hornet 4 Drive        Valiant       Merc 280 
       -0.1250         0.5840         1.9292        -0.6897         0.3547 
     Merc 280C   Ferrari Dino 
       -1.0453        -1.0080 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   28.409      4.184   6.789  0.00105 **
wt            -2.780      1.335  -2.083  0.09176 . 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.165 on 5 degrees of freedom
Multiple R-squared:  0.4645,	Adjusted R-squared:  0.3574 
F-statistic: 4.337 on 1 and 5 DF,  p-value: 0.09176


$`8`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.1491 -1.4664 -0.8458  1.5711  3.7619 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  23.8680     3.0055   7.942 4.05e-06 ***
wt           -2.1924     0.7392  -2.966   0.0118 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.024 on 12 degrees of freedom
Multiple R-squared:  0.423,	Adjusted R-squared:  0.3749 
F-statistic: 8.796 on 1 and 12 DF,  p-value: 0.01179


> 
> # Which can itself be a constant:
> summ <- constant(head(const, -1))
> summ()
Computing from scratch
$`4`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-4.1513 -1.9795 -0.6272  1.9299  5.2523 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   39.571      4.347   9.104 7.77e-06 ***
wt            -5.647      1.850  -3.052   0.0137 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.332 on 9 degrees of freedom
Multiple R-squared:  0.5086,	Adjusted R-squared:  0.454 
F-statistic: 9.316 on 1 and 9 DF,  p-value: 0.01374


$`6`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
     Mazda RX4  Mazda RX4 Wag Hornet 4 Drive        Valiant       Merc 280 
       -0.1250         0.5840         1.9292        -0.6897         0.3547 
     Merc 280C   Ferrari Dino 
       -1.0453        -1.0080 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   28.409      4.184   6.789  0.00105 **
wt            -2.780      1.335  -2.083  0.09176 . 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.165 on 5 degrees of freedom
Multiple R-squared:  0.4645,	Adjusted R-squared:  0.3574 
F-statistic: 4.337 on 1 and 5 DF,  p-value: 0.09176


$`8`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.1491 -1.4664 -0.8458  1.5711  3.7619 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  23.8680     3.0055   7.942 4.05e-06 ***
wt           -2.1924     0.7392  -2.966   0.0118 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.024 on 12 degrees of freedom
Multiple R-squared:  0.423,	Adjusted R-squared:  0.3749 
F-statistic: 8.796 on 1 and 12 DF,  p-value: 0.01179


> summ()
$`4`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-4.1513 -1.9795 -0.6272  1.9299  5.2523 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   39.571      4.347   9.104 7.77e-06 ***
wt            -5.647      1.850  -3.052   0.0137 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.332 on 9 degrees of freedom
Multiple R-squared:  0.5086,	Adjusted R-squared:  0.454 
F-statistic: 9.316 on 1 and 9 DF,  p-value: 0.01374


$`6`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
     Mazda RX4  Mazda RX4 Wag Hornet 4 Drive        Valiant       Merc 280 
       -0.1250         0.5840         1.9292        -0.6897         0.3547 
     Merc 280C   Ferrari Dino 
       -1.0453        -1.0080 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   28.409      4.184   6.789  0.00105 **
wt            -2.780      1.335  -2.083  0.09176 . 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.165 on 5 degrees of freedom
Multiple R-squared:  0.4645,	Adjusted R-squared:  0.3574 
F-statistic: 4.337 on 1 and 5 DF,  p-value: 0.09176


$`8`

Call:
lm(formula = mpg ~ wt, data = data)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.1491 -1.4664 -0.8458  1.5711  3.7619 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  23.8680     3.0055   7.942 4.05e-06 ***
wt           -2.1924     0.7392  -2.966   0.0118 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.024 on 12 degrees of freedom
Multiple R-squared:  0.423,	Adjusted R-squared:  0.3749 
F-statistic: 8.796 on 1 and 12 DF,  p-value: 0.01179


> 
> ## Not run: 
> ##D # Think of `%>>>%` combined with `constant()` as a lazy, structured
> ##D # alternative to the magrittr `%>%` operator.
> ##D library(magrittr)
> ##D 
> ##D val2 <- mtcars %>%
> ##D   split(.$cyl) %>%
> ##D   lapply(function(data) lm(mpg ~ wt, data)) %>%
> ##D   lapply(summary) %>%
> ##D   sapply(`[[`, "r.squared")
> ##D 
> ##D # `val2` and `const()` are identical values. But whereas `val2` is computed
> ##D # immediately and carries no structure, `const` embodies the process that
> ##D # produces its value, and allows you to defer its realization to the
> ##D # invocation `const()`.
> ##D stopifnot(identical(val2, const()))
> ## End(Not run)
> 
> <ERROR: re-encoding failure from encoding 'UTF-8'>
# Use `variable()` to recover the original (+ val_var <- variable(const)
> stopifnot(identical(val_var, val))
Error in identical(val_var, val) : object 'val_var' not found
Calls: stopifnot -> identical
Execution halted