After some code review...

The main problem with this code is the use of integers to maintain bit flags
tracking cell usage. The advantage is that when the Sudoku search phase with
its associated backtracking has to make a copy of the game board, the amount
of data to copy is low. The disadvantage is that the code is unreadable.
Trying to manage a bit mask with 81 bits using 64 bit integers makes it at
least twice as bad.

But really the core of the algorithm is that it relies on 4 recursive CTEs.
These are to construct the cell layout bit masks and digits, one to process
the game rules, and one to do the backtracking search. They are crucial to
the query.

Currently Andl has recursive function calls but it does not have recursive
CTEs. A recursive CTE is something special because rather than being true
recursion it is actually a generator that populates a table with new rows
according to a query. It does this by means of a queue rather than a stack.
Andl could implement this algorithm using recursion, but it would be slow
and might well produce a stack overflow, and would not be a good outcome.

So the answer is: I plan to add 'recursive' queries to Andl. This may take a
little while.

Thanks for the challenge. If in the meantime you have any others that do not
use recursive CTEs I would be interested.

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org

-----Original Message-----
From: sqlite-users-boun...@mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of
david at andl.org
Sent: Tuesday, 9 June 2015 9:51 PM
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] User-defined types -- in Andl

Thank you. Exactly so. One of the problems with this kind of project is
finding 'good enough' challenges to tackle.

I'll let you know how I get on.

[BTW I don't remember the last time I saw SQL like this. Understanding it
might be the challenge...]

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org

-----Original Message-----
From: sqlite-users-boun...@mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of
Jean-Christophe Deschamps
Sent: Tuesday, 9 June 2015 5:16 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] User-defined types -- in Andl

At 08:27 09/06/2015, you wrote:
????
>Andl is at a slightly higher level than SQL for writing simple queries.
>Where it shines is writing complex queries that involve user-defined 
>types, custom transformations and custom aggregations. For complex 
>relational operations there is nothing I know that can come close, 
>productivity wise.
`---

You call for complexity, you get it!

What I would find pretty convincing is seeing how andl would translate the
self-contained sudoku solver posted by E. Pasma in this post: 
http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/2014-Mar
ch/051982.html

Granted, this is far from the typical SQL you can find in routine use, but I
believe that andl being able to elegantly translate it would certainly
impress a number of readers and make many of us more interested in digging
further.

I'm not throwing such a mayhem challenge at you in the tone of "if andl
can't do that, then shut up". Maybe andl is not yet complete enough today to
achieve that and this wouldn't be a big issue. But if it can I'm sure andl
will attract more attention.

JcD 

_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to