Lines Matching refs:function

9 (* sion, no nested functions exist; and function call is made by dispatching on the closure*)
12 (* tion definition, a constructor taking the free variables of this function is created. *)
13 (* For each arrow type we create a dispatch function, which converts the definition of a *)
14 (* function of this arrow type into a closure constructor application. *)
15 (* A nested function is hoisted to the top level with its free variables to be passed as *)
16 (* extra arguments. After that, the calling to the original function is replaced by a *)
17 (* calling to the relevant dispatch function passing a closure containing the values of *)
18 (* this function's free variables. The dispatch function examines the closure tag and *)
19 (* passes control to the appropriate hoisted function. Thus, higher order operations on *)
47 fun is_fun t = (* the term is a function? *)
59 (* Format: [function's name |-> function's body] *)
61 (* Format: [function's type |-> a set of function names] *)
69 (* Format: [function's name |-> (new function's lhs, constructor)] *)
80 fun record_f fname = (* store the name of a higher order function *)
97 in if is_pabs M then (* an embedded function, should be lifted *)
131 fun identify_closure defs = (* Identify higher order functions in a list of function definitions *)
166 (* the arguments of a constructor, these arguments are the free variables of a function body *)
241 fun type2dispatch tp = (* from an original type to its dispatch function *)
246 val df_var = mk_const("dispatch" ^ f_index, (* the dispatch function has been defined *)
248 handle e => mk_var("dispatch" ^ f_index, (* the dispatch function has not been defined *)
256 (* A dispatch function is in pattern-matching format. *)
328 (* format: function name |-> new definition *)
332 if is_pabs M then (* an embedded function *)
364 else if is_fun M then (* function application *)
365 if not (M.peek(!Redefined, M) = NONE) then (* a pre-defined function *)
369 handle _ => fname_var (* recursive function *)
385 handle _ => t (* not function application *)
387 case M.peek(!HOFunc, t) of (* Higher order function *)
402 if M.peek(!HOFunc, fname) = NONE then (* not higher order function *)
415 else (* a higher order function *)
463 (* Convert function arguments to closure arguments *)
489 (* Build the equivalence statement for a function. *)