let interpret_ident = fun s -> fun input_beam ->
let n = List.length input_beam in
match s with
|Pass -> if n = 1 then input_beam else raise (Evaluation_Error "Ident _")
|Stop -> if n = 1 then [] else raise (Evaluation_Error "Ident !")
|Add -> if n = 2 then [signal_add (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident +")
|Sup -> if n = 2 then [signal_sub (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident -")
|Mul -> if n = 2 then [signal_mul (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident *")
|Div -> if n = 2 then [signal_div (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident /")
|Delay -> if n = 2 then [signal_delay (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident @")
|Mem -> if n = 1 then [signal_mem (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident mem")
|Vectorize -> if n = 2 then [signal_vectorize (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident vectorize")
|Serialize -> if n = 1 then [signal_serialize (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident serialize")
|Concat -> if n = 2 then [signal_append (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident #")
|Nth -> if n = 2 then [signal_nth (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident []")
|Floor -> if n = 1 then [signal_floor (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident floor")
|Int -> if n = 1 then [signal_int (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident int")
|Sin -> if n = 1 then [signal_sin (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident sin")
|Cos -> if n = 1 then [signal_cos (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident cos")
|Atan -> if n = 1 then [signal_atan (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident atan")
|Atantwo -> if n = 2 then [signal_atantwo (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident atantwo")
|Sqrt -> if n = 1 then [signal_sqrt (List.nth input_beam 0)]
else raise (Evaluation_Error "Ident sqrt")
|Rdtable -> if n = 3 then [signal_rdtable (List.nth input_beam 0)
(List.nth input_beam 1) (List.nth input_beam 2)]
else raise (Evaluation_Error "Ident rdtable")
|Selecttwo -> if n = 3 then [signal_select2 (List.nth input_beam 0) (List.nth input_beam 1)
(List.nth input_beam 2)]
else raise (Evaluation_Error "Ident select2")
|Selectthree -> if n = 4 then [signal_select3 (List.nth input_beam 0) (List.nth input_beam 1)
(List.nth input_beam 2) (List.nth input_beam 3)]
else raise (Evaluation_Error "Ident select3")
|Prefix -> if n = 2 then [signal_prefix (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident prefix")
|Mod -> if n = 2 then [signal_mod (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident %")
|Larger -> if n = 2 then [signal_sup (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident >")
|Smaller -> if n = 2 then [signal_inf (List.nth input_beam 0) (List.nth input_beam 1)]
else raise (Evaluation_Error "Ident <")