[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Can solve the N-queens - but can't count!

Subject: RE: Can solve the N-queens - but can't count!
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 15 Jun 1999 10:39:52 +0100
solve for n
> I've written an XSL stylesheet which solves the N queens 
> problem (place N chess queens on an NxN square board so that no queen 
> threatens another), just to see whether it can be done.

Brilliant. For the record, it ran first time on SAXON 4.3, in 76 seconds
under the interpreter, and in 21 seconds when compiled. (Pentium II 233MHz,
Win NT 4.0, Sun JDK 1.2)
> 
> Granted that solving the N-queens problem isn't what XSL was 
> designed for, but this problem is real. As things stand, one can only
count 
> things if they (i) can appear inside a 'count' expression or (ii) if you
are 
> willing to accept a nested template call for each increase in the count
(without
> exiting the nested template as long as you need the count!).

Yes. Functional programming depends on very efficient recursion, and on some
unfamiliar ways of thinking. Those are the two reasons I added an assignment
statement to SAXON!

> Have fun,
> 
>     Oren Ben-Kiki
> 
It's made my day... 
(But it will probably be spoilt when someone reports that SAXON's
performance is uncompetitive!)

Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.