+ method rwtable : signal_type -> signal_type ->
+ signal_type -> signal_type -> signal_type =
+ fun init -> fun wstream -> fun windex -> fun rindex ->
+ let freq = self#check_freq [init; wstream; windex; rindex] in
+ let () = init#add_memory ((self#at 0)#to_int) in
+ let () = wstream#add_memory ((self#at 0)#to_int) in
+ let func : time -> value_type = fun (ti : time) ->
+ let rec table : time -> index -> value_type =
+ fun t -> fun i ->
+ if t > 0 then
+ (if i = (windex#at t)#to_int then (wstream#at t)
+ else table (t - 1) i)
+ else if t = 0 then
+ (if i = (windex#at 0)#to_int then (wstream#at 0)
+ else init#at i)
+ else raise (Signal_operation "signal time should be > 0") in
+ table ti ((rindex#at ti)#to_int) in
+ new signal freq func
+