X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=topics%2Fweek1_advanced_notes.mdwn;h=2137d114a5afeb4fdb27dcdce05fc194fcc8997b;hp=dd143fc61cb4746e96f60eaea27e89081fea3b49;hb=a363ca06fde540cfd6c0abb062c88611f1a84c45;hpb=c8d77fee6e911a407c542aa6c4f0211b87ac20c8 diff --git a/topics/week1_advanced_notes.mdwn b/topics/week1_advanced_notes.mdwn index dd143fc6..2137d114 100644 --- a/topics/week1_advanced_notes.mdwn +++ b/topics/week1_advanced_notes.mdwn @@ -2,6 +2,7 @@ These are some advanced notes extending the material presented this week. Don't [[!toc]] + ### More on multivalues ### A multivalue is a series of *zero or more* values. They are the result of evaluating expressions that consist of *zero or more* expressions, separated by commas, and enclosed in parentheses. So these expressions evaluate to multivalues: @@ -47,7 +48,7 @@ In OCaml, there are no until-the-end-of-the-line comments. The only comments sta I agree it's annoying that these conventions are so diverse. There are plenty other commenting conventions out there, too. - + ### Matching function values ### A function value doesn't have any structure---at least none that's visible to the pattern-matching system. You can only match against simple patterns like `_` or the variable `f`. @@ -129,6 +130,7 @@ Both of these strategies work. But they are a bit inefficient. I said you didn't end + ### $ Syntax ### Haskell has a useful bit of syntax that we will adopt. They use `$` as an infix operator that has the same kind of effect as Russell & Whitehead's period. It is semantically inert, and only affects grouping. It enables you to avoid some parentheses in lots of situations. For example, if you want to check that a sequence `xs` is not empty, you'd express that like this: