Nice TWiki > Doc > CodeExamples (r1.16) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
This section is a repository for code fragments and programs, for illustration purposes.

Please create a specific page for each example. Its WikiWord should end with the word Example.

Examples for novices

HelloWorldNoviceExample: Setup, compile and run Hello World.

AckermannNoviceExample: Setup, compile and run Ackermann's function.

FiboNoviceExample: Setup, compile and run Fibonnaci function.

Examples for beginners

HashBeginnerExample: HashMap with type parameter <String,Cell>

ListsBeginnerExample: ArrayList with type parameter <int>

MethcallBeginnerExample: Define a class and subclass.

ObjinstBeginnerExample: Import Nice classes from MethcallBeginnerExample.

RandomBeginnerExample: Import Java package.

ShapesBeginnerExample: Alternative ways to define methods.

SieveBeginnerExample: Type inference for array variable.

StrcatBeginnerExample: Type inference for object variable.

SpellcheckBeginnerExample: Anonymous functions help reduce boiler-plate code.

MomentsBeginnerExample: Read numbers from a file and compute basic statistics.

CollectionExample: How to use collections with generic types.

Examples for intermediates

ShapesIntermediateExample: Extend existing ShapesBeginnerExample classes to implement an abstract interface and new methods.

MethcallIntermediateExample: Define a Java class JavaToggleExample and subclass it in Nice - compare with MethcallBeginnerExample.

MethcallIntermediateTwoExample: Define a Nice class NiceToggleExample and subclass it in Java - compare with MethcallBeginnerExample.

WordfreqIntermediateExample: Read words from a file and compute word frequencies - generic HashMap and ArrayList, sort, local functions.

BenchIntermediateExample: Martin Richards systems language benchmark Bench, written in an ordinary OO style. PacketBenchExample declares enums, TcbBenchExample uses a class initializer, SchedulerBenchExample uses enum.hashCode, TaskBenchExample declares an interface. "Benchmarking Java with the Richards benchmark" provides some background information.

More advanced examples

HelloSwingWorld : shows how to write (a little more complex :-) helloworld program.

SwingLibraryExample : shows how to write a GUI program using the Swing Library.

HaskellPreludeExample: Selected parts of the Haskell prelude, lots of functions which are useful when programming in functional style.

LazyVectorExample: A Vector subclass which computes its elements as they are they requested.

Topic CodeExamples . { Edit | Attach | Ref-By | Printable | Diffs | r1.57 | > | r1.56 | > | r1.55 | More }
Revision r1.16 - 02 Sep 2003 - 20:29 GMT - DuncanLissett
Parents: WebHome
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.