Hacker News new | past | comments | ask | show | jobs | submit login

"this is a function that takes data that includes a student's email and enrolment date"

You can do this using a row type, e.g. OCaml:

    # let foo student =
      Printf.printf "Email: %s\nEnrolment: %d" student#email student#enrolment
    val foo : < email : string; enrolment : int; .. > -> unit = <fun>
The second line is the output from the OCaml REPL. Note how it automatically infers that the input is an object which includes an email and an enrolment field, with the correct types.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: