extra/
umieszczone sa dodatkowe pliki, przydatne przy korzystaniu z FunAlga.
Znajdziesz tam:
fag.stx
- definicja skladni jezyka dla edytorow kodu (np. Edit Plus
)
GNU-GPL
- kopia GNU General Public Licence
OCaml natomiast samodzielnie znajduje argumenty polimorficzne i szuka najbardziej ogolnego typu danego wyrazenia. Dzieki temu funkcje OCamla sa bardziej zwiezle. Jednak jak sie okazuje, algorytm nie jest perfekcyjny, co pokazuje ponizszy kod:
type t =
| MyInt of int
| MyFloat of float
| MyString of string;;
let foo printerf value =
match value with
| MyInt i -> printerf string_of_int i
| MyFloat x -> printerf string_of_float x
| MyString s -> printerf (fun x -> x) s;;
# type t = MyInt of int | MyFloat of float | MyString of string
# Characters 95-110:
| MyFloat x -> printerf string_of_float x
^^^^^^^^^^^^^^^
This expression has type float -> string but is here used with type int -> string
Y λ
,
czyli aplikacje operatora Y
, do lambdy - funkcji.