Skip to main content
added 29 characters in body
Source Link

OCaml + Batteries, 164163 characters

As straightforward as it gets:

Scanf.scanf"%fx%fy=%f\n%fx%fy=%f\n"Float.(fun a b c d e f->let u=b*df-a*e in Printf>Printf.(iffun u->if u=0.then printf"parallel"else printf"(%.2f,%.2f)"((b*f-c*e)/u)((d*c-a*f)/u))(b*d-a*e)) 

Edit:

  • Initial version, 169
  • Use Batteries for delimited overloading of operators, 164
  • Lambda binding of u, 163

OCaml + Batteries, 164 characters

As straightforward as it gets:

Scanf.scanf"%fx%fy=%f\n%fx%fy=%f\n"Float.(fun a b c d e f->let u=b*d-a*e in Printf.(if u=0.then printf"parallel"else printf"(%.2f,%.2f)"((b*f-c*e)/u)((d*c-a*f)/u))) 

Edit:

  • Initial version, 169
  • Use Batteries for delimited overloading of operators, 164

OCaml + Batteries, 163 characters

As straightforward as it gets:

Scanf.scanf"%fx%fy=%f\n%fx%fy=%f\n"Float.(fun a b c d e f->Printf.(fun u->if u=0.then printf"parallel"else printf"(%.2f,%.2f)"((b*f-c*e)/u)((d*c-a*f)/u))(b*d-a*e)) 

Edit:

  • Initial version, 169
  • Use Batteries for delimited overloading of operators, 164
  • Lambda binding of u, 163
Delimited overloading of math operators
Source Link

OCaml + Batteries, 169164 characters

As straightforward as it gets:

Scanf.scanf"%fx%fy=%f\n%fx%fy=%f\n"scanf"%fx%fy=%f\n%fx%fy=%f\n"Float.(fun a b c d e f->let u=b*.du=b*d-.a*.ea*e in Printf.(if u=0.then printf"parallel"else printf"(%.2f,%.2f)"((b*.fb*f-.c*.ec*e)/.u)((d*.cd*c-.a*.fa*f)/.u))) 

Suitable for execution as a script if included as-is in a file headed by #! /usr/local/bin/ocamlrun ocaml.Edit:

  • Initial version, 169
  • Use Batteries for delimited overloading of operators, 164

OCaml, 169 characters

As straightforward as it gets:

Scanf.scanf"%fx%fy=%f\n%fx%fy=%f\n"(fun a b c d e f->let u=b*.d-.a*.e in Printf.(if u=0.then printf"parallel"else printf"(%.2f,%.2f)"((b*.f-.c*.e)/.u)((d*.c-.a*.f)/.u))) 

Suitable for execution as a script if included as-is in a file headed by #! /usr/local/bin/ocamlrun ocaml.

OCaml + Batteries, 164 characters

As straightforward as it gets:

Scanf.scanf"%fx%fy=%f\n%fx%fy=%f\n"Float.(fun a b c d e f->let u=b*d-a*e in Printf.(if u=0.then printf"parallel"else printf"(%.2f,%.2f)"((b*f-c*e)/u)((d*c-a*f)/u))) 

Edit:

  • Initial version, 169
  • Use Batteries for delimited overloading of operators, 164
Source Link

OCaml, 169 characters

As straightforward as it gets:

Scanf.scanf"%fx%fy=%f\n%fx%fy=%f\n"(fun a b c d e f->let u=b*.d-.a*.e in Printf.(if u=0.then printf"parallel"else printf"(%.2f,%.2f)"((b*.f-.c*.e)/.u)((d*.c-.a*.f)/.u))) 

Suitable for execution as a script if included as-is in a file headed by #! /usr/local/bin/ocamlrun ocaml.