Created
June 3, 2011 18:01
-
-
Save SethTisue/1006805 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Last login: Fri Jun 3 10:39:02 on ttys004 | |
~ % scala29 | |
Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> :implicits | |
No implicits have been imported other than those in Predef. | |
scala> :imports | |
1) import java.lang._ (153 types, 158 terms) | |
2) import scala._ (797 types, 812 terms) | |
3) import scala.Predef._ (16 types, 167 terms, 96 are implicit) | |
scala> def timed[T](body: => T): T = { val start = System.nanoTime; try body; finally println((System.nanoTime - start) + "nanos elapsed.") } | |
<console>:1: error: illegal start of statement | |
def timed[T](body: => T): T = { val start = System.nanoTime; try body; finally println((System.nanoTime - start) + "nanos elapsed.") } | |
^ | |
scala> def timed[T](body: => T): T = { val start = System.nanoTime; try body fin | |
ally println((System.nanoTime - start) + "nanos elapsed.") } | |
timed: [T](body: => T)T | |
scala> :wrap timed | |
wrap: no such command. Type :help for help. | |
scala> "new on trunk I guess?" | |
res0: java.lang.String = new on trunk I guess? | |
scala> :power | |
** Power User mode enabled - BEEP BOOP WHIR ** | |
** scala.tools.nsc._ has been imported ** | |
** global._ and definitions._ also imported ** | |
** New vals! Try repl, intp, global, power ** | |
** New cmds! :help to discover them ** | |
** New defs! Type power.<tab> to reveal ** | |
scala> :wrap timedSet wrapper to 'timed' | |
scala> Thread.sleep(1) | |
605000nanos elapsed. | |
562000nanos elapsed. | |
555000nanos elapsed. | |
1677000nanos elapsed. | |
scala> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment