Solution Focused Consulting
[ | smalltalk dot org ].
Where community and industry meet
to invent the future.™


smalltalk.org
20th Annual ACM Conference on Object Oriented Programming, Systems, Languages, and Applications. Portland, Oregon, USA, October 22nd - 26th, 2006.
Some Basic F-Script Examples
posted by Peter William Lount
version 1, 20040920 12:30pm PDT

Get the names of the employees:
Smalltalk:
employees collect:[:anEmployee | anEmployee name]

F-Script:
employees name

Get the names of the employees whose age is greater than 30:
Smalltalk:
(employees select:[: anEmployee | anEmployee age > 30]) collect:[: anEmployee | anEmployee name]

F-Script:
employees name at: employees age > 30

Get a list of employees sorted according to their salary:
Smalltalk:
employees asSortedCollection:[:e1 :e2| e1 salary < e2 salary]

F-Script:
employees at: employees salary sort

Increase the salary of each employee by a specific amount:
Smalltalk:
employees with:amounts do:[:anEmployee :anAmount| anEmployee raiseSalary:anAmount]

F-Script:
employees raiseSalary:amounts



Copyright 2006 by Smalltalk.org™, All Rights Reserved.
Tuesday
May 13 2008
Interoperate.org, the place to find out how to interoperate.
Google
Web
Smalltalk.org

64bits.net AMD64, Intel Pentium EM64T, Intel Itanium
Meet other Smalltalk people, contribute, learn, earn.