<s> from pycket import values <EOL> from pycket import values_parameter <EOL> from pycket . argument_parser import ArgParser , EndOfInput <EOL> from pycket . arity import Arity <EOL> from pycket . base import W_Object <EOL> from pycket . error import SchemeException <EOL> from pycket . prims . expose import expose , expose_val , default , procedure <EOL> from rpython . rlib import jit <EOL> @ expose ( "<STR_LIT>" , <EOL> [ values . W_Object , default ( values . W_Object , values . w_false ) ] ) <EOL> def make_parameter ( init , guard ) : <EOL> return values_parameter . W_Parameter ( init , guard ) <EOL> @ expose ( "<STR_LIT>" , <EOL> [ values_parameter . W_BaseParameter , procedure , procedure ] ) <EOL> def make_derived_parameter ( param , guard , wrap ) : <EOL> return values_parameter . W_DerivedParameter ( param , guard , wrap ) <EOL> @ expose ( "<STR_LIT>" , arity = Arity . geq ( <NUM_LIT:1> ) ) <EOL> @ jit . unroll_safe <EOL> def scheme_extend_parameterization ( args ) : <EOL> if len ( args ) == <NUM_LIT:0> : <EOL> raise SchemeException ( "<STR_LIT>" ) <EOL> config = args [ <NUM_LIT:0> ] <EOL> argc = len ( args ) <EOL> if argc < <NUM_LIT:2> or not isinstance ( config , values_parameter . W_Parameterization ) or argc % <NUM_LIT:2> != <NUM_LIT:1> : <EOL> return config <EOL> parser = ArgParser ( "<STR_LIT>" , args , start_at = <NUM_LIT:1> ) <EOL> while parser . has_more ( ) : <EOL> param = parser . parameter ( ) <EOL> key = parser . object ( ) <EOL> config = config . extend ( [ param ] , [ key ] ) <EOL> return config <EOL> def call_with_parameterization ( f , args , paramz , env , cont ) : <EOL> cont . update_cm ( values . parameterization_key , paramz ) <EOL> return f . call ( args , env , cont ) <EOL> @ expose ( "<STR_LIT>" , <EOL> [ values . W_Object , values_parameter . W_Parameterization ] , simple = False ) <EOL> def call_w_paramz ( f , paramz , env , cont ) : <EOL> return call_with_parameterization ( f , [ ] , paramz , env , cont ) <EOL> def call_with_extended_paramz ( f , args , keys , vals , env , cont ) : <EOL> from pycket . values import parameterization_key <EOL> paramz = cont . get_mark_first ( parameterization_key ) <EOL> assert isinstance ( paramz , values_parameter . W_Parameterization ) <EOL> paramz_new = paramz . extend ( keys , vals ) <EOL> return call_with_parameterization ( f , args , paramz_new , env , cont ) <EOL> expose_val ( "<STR_LIT>" , values . parameterization_key ) <EOL> expose_val ( "<STR_LIT>" , values_parameter . W_Parameter ( values . w_false ) ) <EOL> expose_val ( "<STR_LIT>" , values_parameter . W_Parameter ( values . w_false ) ) </s>
