<A HREF="manual_contents.html"><img align=center src="contents.gif" ALT="Contents"></A> Up Previous Next

Set repeat string -r<string>


Hugs allows the user to recall the last expression entered into the interpreter by typing the characters $$ as part of the next expression:

 Prelude> map (1+) [1..10]

 [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

 Prelude> filter even $$

 [2, 4, 6, 8, 10]

 Prelude>

A -r<str> option can be used to change the repeat string---the symbol used to recall the last expression---to <str>. For example, users of Standard ML might be more comfortable using:

 Prelude> :set -rit

 Prelude> 6 * 7

 42

 Prelude> it + it

 84

 Prelude> 

Another reason to change the repeat string is to avoid clashes with uses of the same symbol in a particular program; for example, if $$ is defined as an operator in a program.

Note that the repeat string must be a valid Haskell identifier or symbol, although it will always be parsed as an identifier. If the repeat string is set to a value that is neither an identifier or symbol (for example, -r0), then the repeat last expression facility will be disabled.