projects
/
Faustine.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'OOP'
[Faustine.git]
/
interpretor
/
signal.ml
diff --git
a/interpretor/signal.ml
b/interpretor/signal.ml
index
b493b6c
..
2dd9f73
100644
(file)
--- a/
interpretor/signal.ml
+++ b/
interpretor/signal.ml
@@
-32,7
+32,7
@@
class signal : int -> (time -> value_type) -> signal_type =
else raise (Signal_operation "frequency not matched.") in
List.fold_left check self#frequency sl
else raise (Signal_operation "frequency not matched.") in
List.fold_left check self#frequency sl
- method
private
add_memory : int -> unit =
+ method add_memory : int -> unit =
fun (length : int) ->
assert (length >= 0);
if memory_length >= length then ()
fun (length : int) ->
assert (length >= 0);
if memory_length >= length then ()
@@
-98,13
+98,13
@@
class signal : int -> (time -> value_type) -> signal_type =
let func : time -> value_type =
fun (t : time) ->
let i = (s#at t)#to_int in
let func : time -> value_type =
fun (t : time) ->
let i = (s#at t)#to_int in
- self#delay_by
t i
in
+ self#delay_by
i t
in
new signal freq func
method mem : signal_type =
let freq = self#frequency in
let () = self#add_memory 1 in
new signal freq func
method mem : signal_type =
let freq = self#frequency in
let () = self#add_memory 1 in
- let func = fun (t : time) -> self#delay_by
t 1
in
+ let func = fun (t : time) -> self#delay_by
1 t
in
new signal freq func
method rdtable : signal_type -> signal_type -> signal_type =
new signal freq func
method rdtable : signal_type -> signal_type -> signal_type =
@@
-141,10
+141,11
@@
class signal : int -> (time -> value_type) -> signal_type =
method prefix : signal_type -> signal_type =
fun (s_init : signal_type) ->
method prefix : signal_type -> signal_type =
fun (s_init : signal_type) ->
+ let () = self#add_memory 1 in
let func : time -> value_type =
fun t ->
if t = 0 then s_init#at 0
let func : time -> value_type =
fun t ->
if t = 0 then s_init#at 0
- else if t > 0 then self#at
t
+ else if t > 0 then self#at
(t - 1)
else raise (Signal_operation "prefix time < 0.") in
new signal self#frequency func
else raise (Signal_operation "prefix time < 0.") in
new signal self#frequency func