@@ -307,37 +307,37 @@ Activity analysis classifies values in a function into these categories:
307
307
Here is the result of activity analysis for this example:
308
308
309
309
``` swift
310
- // Varied values are in all caps .
310
+ // Varied values are surrounded by asterisks .
311
311
// These values depend on the input (`x`).
312
312
@differentiable
313
- func f (_ X : Float ) -> Float {
314
- let SINX = sin (X )
313
+ func f (_ **x** : Float ) -> Float {
314
+ let ** sinx ** = sin (** x ** )
315
315
let cos3 = cos (3 )
316
- let RESULT = SINX * cos3
317
- print (RESULT )
318
- return RESULT
316
+ let ** result ** = ** sinx ** * cos3
317
+ print (** result ** )
318
+ return ** result **
319
319
}
320
320
321
- // Useful values are in all caps .
321
+ // Useful values are surrounded by asterisks .
322
322
// These values contribute to the output (`result`).
323
323
@differentiable
324
- func f (_ X : Float ) -> Float {
325
- let SINX = sin (X )
326
- let COS3 = cos (3 ) // 3 should be treated as if capitalized.
327
- let RESULT = SINX * COS3
328
- print (RESULT )
329
- return RESULT
324
+ func f (_ **x** : Float ) -> Float {
325
+ let ** sinx ** = sin (** x ** )
326
+ let ** cos3 ** = cos (** 3 ** )
327
+ let ** result ** = ** sinx ** * ** cos3 **
328
+ print (** result ** )
329
+ return ** result **
330
330
}
331
331
332
- // Active values are in all caps .
332
+ // Active values are surrounded by asterisks .
333
333
// These values are varied and useful, and thus need a derivative.
334
334
@differentiable
335
- func f (_ X : Float ) -> Float {
336
- let SINX = sin (X )
335
+ func f (_ **x** : Float ) -> Float {
336
+ let ** sinx ** = sin (** x ** )
337
337
let cos3 = cos (3 )
338
- let RESULT = SINX * cos3
338
+ let ** result ** = ** sinx ** * cos3
339
339
let void = print (result)
340
- return RESULT
340
+ return ** result **
341
341
}
342
342
```
343
343
0 commit comments