From 2ce4da740250ae118e9edac8093ea0873911de82 Mon Sep 17 00:00:00 2001 From: buraq Date: Mon, 14 Jun 2004 13:16:00 +0000 Subject: new example of for comprehensions --- test/files/jvm/xmlstuff.check | 7 +++++++ test/files/jvm/xmlstuff.scala | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'test') diff --git a/test/files/jvm/xmlstuff.check b/test/files/jvm/xmlstuff.check index f8bab77aac..b348451a28 100644 --- a/test/files/jvm/xmlstuff.check +++ b/test/files/jvm/xmlstuff.check @@ -31,3 +31,10 @@ passed ok rem 2 List(Blabla) + + John + Elm Street + Dolphin City + +41 21 693 68 67 + +41 79 602 23 23 + diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala index 09bfcd084b..bf08aa348e 100644 --- a/test/files/jvm/xmlstuff.scala +++ b/test/files/jvm/xmlstuff.scala @@ -237,4 +237,42 @@ object Test with Application { yield t ); +val phoneBook = + + + This is the phonebook of the + ACME corporation. + + + John + +41 21 693 68 67 + +41 79 602 23 23 + + ; + + +val addrBook = + + + This is the addressbook of the + ACME corporation. + + + John + Elm Street + Dolphin City + + ; + + Console.println( new scala.xml.PrettyPrinter(80, 5).format ( + for( val t <- addrBook \\ "entry"; + val r <- phoneBook \\ "entry"; + t \ "name" == r \ "name") yield + + { t.child } + { r \ "phone" } + + )); + + } -- cgit v1.2.3