"Defining constants with `=>` at the top level makes sure they are interpreted as constant functions; hence, they are evaluated every time they are needed.\n\n"+

"Defining constants with `=>` makes sure they are interpreted as constant functions; hence, they are evaluated every time they are needed.\n\n"+

"This is the default understanding of `=` in global scope.\n\n"+

"The inverse is {{`=:`}}, which defines an identifier to be a graph."

,syntax_doc_locations=[CLR5"3.6""_Toc311798007"]

...

...

@@ -271,13 +271,35 @@ bs_function_definition =

{syntax_title="function definition"

,syntax_patterns=mapexact["="]

,syntax_code=["... = ..."]

,syntax_description="Specifies the implementation of a function."

,syntax_description=join"\n"

["Specifies the implementation of a function\n."

,"Instead of `=`, also {{`=:`}} and {{`=>`}} may be used to separate the pattern from the right-hand side."

,"These have different semantics."

]

,syntax_doc_locations=[CLR5"3""_Toc311797995"]

,syntax_examples=mapEX

["map :: (a -> b) [a] -> [b]\nmap f [] = []\nmap f [x:xs] = [f x:map f xs]"

]

}

bs_guard=

{syntax_title="guard"

,syntax_patterns=mapexact["\\|","=","otherwise"]

,syntax_code=["| ... = ...","| otherwise = ..."]

,syntax_description=join"\n"

["Guards let you specify function alternatives with boolean expressions."

,"A final `otherwise` guard can be used to ensure the function is total.\n"

,"Guards can be nested with indentation."

,"However, only the toplevel guards may be partial.\n"

,"To separate the guard from the alternative, both {{`=`}} and {{`=>`}} may be used (with different semantics; see {{`=>`}})."

,"However, one must be consistent with this throughout the function."

]

,syntax_doc_locations=[CLR5"3.3""_Toc311797998"]

,syntax_examples=mapEX

["sign :: !Int -> Int\nsign n\n| n < 0 = -1 // Negative number\n| n == 0 = 0 // Zero\n| otherwise = 1 // Must be positive"

,syntax_examples=[EX"unpack :: Dynamic -> Maybe a\nunpack (x :: a^) = Just x // Only values of type a\nunpack _ = Nothing"]

}

bs_otherwise=

{syntax_title="otherwise"

,syntax_patterns=mapexact["otherwise"]

,syntax_code=["otherwise"]

,syntax_description="The (optional) last alternative in a guard. It caches all other cases, and makes sure your program does not crash if none of the cases matches."

,syntax_doc_locations=[CLR5"3.3""_Toc311797998"]

,syntax_examples=

[EXs"macrorhs""| otherwise = ..."

,EXs"macro""sign :: !Int -> Int\nsign n\n| n < 0 = -1 // Negative number\n| n == 0 = 0 // Zero\n| otherwise = 1 // Must be positive"