package batteries
 sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >
  
  
  A community-maintained standard library extension
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
  
    
      batteries-3.10.0.tar.gz
    
    
        
    
  
  
  
    
  
  
    
  
        md5=b7f3b99f12f21b1da6b6aa13d993206d
    
    
  sha512=8b7f2479eb0271bcfd9168887c1e4a9a815c512eab3ee61b150fc4dfa9ec803e4f73115155f20b3017e4a822148d0e6d1c1e8e5f96790fd691b419dd39a908a2
    
    
  doc/batteries.unthreaded/BatReturn/index.html
Module BatReturnSource
Local exceptions/labels/goto/return.
This module defines a mechanism akin to SML's exception generators or to a generalization of C's return, i.e. the ability to define local labels, which may be used for immediately terminating an expression and returning a value. By opposition to usual OCaml exceptions, this mechanism
- allows polymorphic return values
- makes accidental exception catching slightly harder (while a local exception can escape its scope, it cannot be caught again by accident from this module).
Example:
  let find_in_array a e =
    label (fun label ->
      for i = 0 to Array.length a - 1 do
        if Array.get a i = e then return label (Some i)
      done;
      None)@documents Return
A label which may be used to return values of type 'a
label f creates a new label x and invokes f x. If, during the execution of f, return x v is invoked, the execution of f x stops immediately and label f returns v. Otherwise, if f x terminates normally and returns y, label f returns y.
Calling return x v from outside scope f is a run-time error and causes termination of the program.
 sectionYPositions = computeSectionYPositions($el), 10)"
  x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
  >