From 1712f331cae5fd829de0d6b5cbd4fe3c322b14e5 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 24 Aug 2010 13:03:36 -0400 Subject: [PATCH] OCaml lambda interp: parens Signed-off-by: Jim Pryor --- using_the_programming_languages.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/using_the_programming_languages.mdwn b/using_the_programming_languages.mdwn index 5684823e..89dba4dd 100644 --- a/using_the_programming_languages.mdwn +++ b/using_the_programming_languages.mdwn @@ -135,7 +135,7 @@ know much OCaml yet to use it. Using it looks like this: * The expression that's spliced in is done so as a single syntactic unit. In other words, the lambda expression `<< w x y z >>` is parsed via usual conventions as `<< (((w x) y) z) >>`. Here `<< x y >>` is not any single syntactic constituent. But if you do instead `let a = << x y >>;; let b = << w $a$ z >>`, then what you get *will* have `<< x y >>` as a constituent, and will be parsed as `<< ((w (x y)) z) >>`. - * `<< fun x y -> something >>` is equivalent to `<< fun x -> fun y -> something >>`, which is parsed as `<< fun x -> (fun y -> something) >>` (everything to the right of the arrow as far as possible is considered together). At the moment, this only works for up to five variables, as in `<< fun x1 x2 x3 x4 x5 -> something >>`. + * `<< fun x y -> something >>` is equivalent to `<< fun x -> fun y -> something >>`, which is parsed as `<< fun x -> (fun y -> (something)) >>` (everything to the right of the arrow as far as possible is considered together). At the moment, this only works for up to five variables, as in `<< fun x1 x2 x3 x4 x5 -> something >>`. * The `<< >>` and `$`-quotes aren't part of standard OCaml syntax, they're provided by this add-on bundle. For the most part it doesn't matter if other expressions are placed flush beside with the `<<` and `>>`: you can do either `<< fun x -> x >>` or `<x>>`. But the `$`s *must* be separated from the `<<` and `>>` brackets with spaces or `(` `)`s. -- 2.11.0