Just a quick progress report, in case anyone is interested.

First, I added a RECURSE() function to Andl, similar to the CTE in SQLite.
The Mandelbrot algorithm looks like this.

xaxis := {{ x:=-2.0 }} recurse( {{ x:=x+0.05 }} [?(x<1.2)])
yaxis := {{ y:=-1.0 }} recurse( {{ y:=y+0.1 }} [?(y<1.1)])
m := ({{ iter:=0, x:=0, y:=0 }} join xaxis[{ cx:=x }] join yaxis[{ cy:=y }])
recurse( 
    {{ iter:=iter+1, x := x*x-y*y+cx, y:=2*x*y+cy, cx, cy, }} [?(x*x+y*y<4.0
and iter<28)]
    )
m2 := m[{ iter := fold(max,iter), cx, cy }] [$(cy,cx)]
m2 [ { cy, t := fold(&, right(left(' .+*#', 1 + iter div 6), 1)) }]

The output looks like this.

cy     | t
-------------------------------------------------------------
  -1.0 |                                     ....#           
  -0.9 |                                    ..#*..           
  -0.8 |                                  ..+####+.          
  -0.7 |                             .......+####+...   +    
  -0.6 |                            ..##+###########*.++++   
  -0.5 |                           .+.##################*.   
  -0.4 |               .............*###################+.*  
  -0.3 |               ..+*.+#+....*#####################+.  
  -0.2 |              ...+#######++#######################.  
  -0.1 |           ...++*################################.   
   0.0 |  #############################################...   
   0.1 |           ...++*################################.   
   0.2 |              ...+#######++#######################.  
   0.3 |               ..+*.+#+....*#####################+.  
   0.4 |               .............*###################+.*  
   0.5 |                           .+.##################*.   
   0.6 |                            ..##+###########*.++++   
   0.7 |                             .......+####+...   +    
   0.8 |                                  ..+####+.          
   0.9 |                                    ..#*..           
   1.0 |                                     ....#           

Still working on the Sudoku. The one in the SQLite documentation is a brute
force depth first search that got lucky on that particular puzzle. On most
puzzles I tried it takes forever.

The one provided by Pasma is faster, but really not a nice piece of code. My
hat goes off to the guy for getting it to work, but it's not something to
emulate.

My C# version solves all puzzles instantly, so I have the algorithms. The
question is: do they cross over to relation-land? The jury is still out on
that one.

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 10:54 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] User-defined types -- in Andl

At 13:50 09/06/2015, you wrote:
????
>BTW I don't remember the last time I saw SQL like this. Understanding 
>it might be the challenge
`---

Most probably! I can imagine that you don't encounter such style in common
business-like environments.

Take your time, this SQL piece is clearly beyond normal human understanding.
Perhaps getting in touch with the author could help. 
Everyone could possibly benefit of innovative views and avenues.

JcD 

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

Reply via email to