Slides from my Scala presentation at the Seattle Tech Startups meeting

53 views
Skip to first unread message

Tim Underwood

unread,
Feb 18, 2011, 4:08:54 PM2/18/11
to scala-user
Hi all,

I gave a short talk on Scala last night at the Seattle Tech Startups meeting (http://www.seattletechstartups.com/).  I've posted my slide deck if anybody needs material for their own Scala presentation:  http://www.startupmonkeys.com/2011/02/scala-frugal-mechanic/

-Tim

mepcotterell

unread,
Feb 19, 2011, 8:52:55 AM2/19/11
to scala...@googlegroups.com
I like this. I actually referred a friend of mine who is interested in learning Scala to these slides (along with links to some other material too). Great job!

Brick Red

unread,
Feb 22, 2011, 12:33:51 AM2/22/11
to Tim Underwood, scala-user
Cool scala language summary.

Stefan Wagner

unread,
Feb 22, 2011, 6:17:33 AM2/22/11
to Tim Underwood, scala-user
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Tim, Hi list

The java example on page 12 could be more fair with the simplified
for-loop, introduced about 5 years ago:

for (Character c: name.toCharArray ())
if (Character.isUpperCase (c)) {
hasUpperCase = true;
break;
}

and still be impressive. ;)

- --

Tsch���--->...Stefan
- ---------------------------
Don't visit my homepage at:
http://home.arcor-online.net/hirnstrom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAk1jm00ACgkQQeATqGpDnRrGogCdGcvu/MkEU1U5m9aL2AtSukIF
XDsAn08jaqI8YY0/kXms4wxgSA000tqX
=1cdY
-----END PGP SIGNATURE-----

Tim Underwood

unread,
Feb 22, 2011, 11:32:28 AM2/22/11
to Stefan Wagner, scala-user
Sure. Except using toCharArray has a potential performance hit since it creates a newly allocated character array.  If my string is something like:

Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.......repeat for a long time....

The Scala and Java versions from the slides only need to look at the first character (without any allocation*).  Using toCharArray will first convert the entire string to a character array and then start iterating over it.

-Tim


* - Okay the Scala version might include allocating a wrapper class for the string (which is better than duplicating the entire string), but I think escape analysis might optimize that away.


On Tue, Feb 22, 2011 at 3:17 AM, Stefan Wagner <wagner...@berlin.de> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Tim, Hi list

The java example on page 12 could be more fair with the simplified
for-loop, introduced about 5 years ago:

for (Character c: name.toCharArray ())
       if (Character.isUpperCase (c))  {
               hasUpperCase = true;
               break;
       }

and still be impressive. ;)

- --

Tschööö--->...Stefan
Reply all
Reply to author
Forward
0 new messages