I needed a modulus operator to the language, it seems to be working but i
would like a feedback to see if i made it right.
I looked at lang_builtins.ml and added the following:
--------------------------------------------------------------------------------------------------------------------------------------
let ()=
 let t = Lang.univ_t ~constraints:[Lang_types.Num] 1 in

    add_builtin "mod" ~cat:Math ~descr:"Modules of number"
      ["",t,None,None;"",t,None,None] t
      (fun p ->
         match p with
           | ["",{Lang.value=Lang.Int a};"",{Lang.value=Lang.Int b}] ->
               Lang.int (a mod b)
           | _ -> assert false)
------------------------------------------------------------------------------------------------------------------------------------

In liquidsoap i call it like mod(10,2).

I also didn't understant what        ["",t,None,None;"",t,None,None] t is
worth for,i get that it is the proto parameter of add_builtin, but didn't
get it what it means.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to