[sqlite] User-defined types -- in Andl
Andl does contain an Sudoku solver, far shorter than Pasma's. See http://www.andl.org/2015/06/recursive-queries-sudoku-solver/. 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] User-defined types -- in Andl
If you have some test data I'll happily do that one. Meanwhile here is something similar, using the test data from the SQLite CTE page. orgchart name | boss - Alice | Bob | Alice Cindy | Alice Dave | Bob Emma | Bob Fred | Cindy Gail | Cindy ua := {{ name:= 'Alice', level := 0 }} recurse({{ boss := name, level := level+1 }} compose orgchart) ua [{ t:=fill('.', level*3) & name }] t -- Alice ...Bob ...Cindy ..Dave ..Emma ..Fred ..Gail 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 Petite Abeille Sent: Monday, 15 June 2015 1:56 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl > On Jun 14, 2015, at 4:01 PM, david at andl.org wrote: > > First, I added a RECURSE() function to Andl, similar to the CTE in SQLite. Nice. > The Mandelbrot algorithm looks like this. Could we see something more, hmmm, pedestrian? Perhaps a simple recursive query, showing, say, all the managers of an employee given the following structure: create table employee( id integer not null, manager_id integer, constraint employee_pk primary key( id ), constraint employee_manager_fk foreign key( manager_id ) references employee( id ) ) ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
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
[sqlite] User-defined types -- in Andl
> On Jun 14, 2015, at 4:01 PM, david at andl.org wrote: > > First, I added a RECURSE() function to Andl, similar to the CTE in SQLite. Nice. > The Mandelbrot algorithm looks like this. Could we see something more, hmmm, pedestrian? Perhaps a simple recursive query, showing, say, all the managers of an employee given the following structure: create table employee( id integer not null, manager_id integer, constraint employee_pk primary key( id ), constraint employee_manager_fk foreign key( manager_id ) references employee( id ) )
[sqlite] User-defined types -- in Andl
That's about 30 hours from here. I might have to pass, for now. But if it's on Youtube I'd be interested. I think I understand recursive CTEs well enough now from the description in the documentation and studying the code. I'm impressed at the brevity of your solution, although in practice it does not perform well. The far more complex implementation from Pasma performs better, I think largely because it applies rules to narrow the search space. My challenge now is to implement that feature in Andl. 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 Richard Hipp Sent: Thursday, 11 June 2015 2:01 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl On 6/9/15, david at andl.org wrote: > I don't remember the last time I saw SQL like this. Understanding it > might be the challenge... I'll be giving a talk on CTEs this Saturday at the Southeastern Linuxfest (http://www.southeastlinuxfest.org/) during which I will explain and demonstrate how to write a simple CTE that solves a sudoku puzzle. If you cannot attend in person, I'm told that the talk will be streamed live to youtube. -- D. Richard Hipp drh at sqlite.org ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
Yes, I had noticed those. Thank you. Both these and the 'challenge' depend on the recursive CTE. As noted elsewhere, I need to implement that before going any further with these. If you have any other challenges I would still 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 Dominique Devienne Sent: Tuesday, 9 June 2015 9:57 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl On Tue, Jun 9, 2015 at 1:50 PM, wrote: > Thank you. Exactly so. One of the problems with this kind of project > is finding 'good enough' challenges to tackle. > See also from the CTE doc: - https://www.sqlite.org/lang_with.html#sudoku - https://www.sqlite.org/lang_with.html#mandelbrot Thanks, --DD ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
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
[sqlite] User-defined types -- in Andl
> On Jun 9, 2015, at 2:53 PM, Jean-Christophe Deschamps > wrote: > > Most probably! I can imagine that you don't encounter such style in common > business-like environments. Just for ?corporate' fun: analytic recursive common table expression - oh, my? with Clock( start_at, end_at, interval, tick ) as ( select date '2015-01-01' as start_at, timestamp '2015-01-01 23:59:59' as end_at, interval '15' minute as interval, date '2015-01-01' as tick fromdual union all select start_at, end_at, interval, tick + interval as tick fromClock where tick + interval between start_at and end_at ) selectClock.tick, lead( Clock.tick ) over( order by Clock.tick ) as next_tick from Clock order by Clock.tick;
[sqlite] User-defined types -- in Andl
On 6/9/15, david at andl.org wrote: > I don't remember the last time I saw SQL like this. Understanding it > might be the challenge... I'll be giving a talk on CTEs this Saturday at the Southeastern Linuxfest (http://www.southeastlinuxfest.org/) during which I will explain and demonstrate how to write a simple CTE that solves a sudoku puzzle. If you cannot attend in person, I'm told that the talk will be streamed live to youtube. -- D. Richard Hipp drh at sqlite.org
[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] User-defined types -- in Andl
I think you'd be in a minority. I went through the first 50 questions about SQLite on Stack Overflow and only one was C++. Android/Java are dominant, with a smattering of C# and various other languages. Those are my target users, eventually. C/C++ is the drug of choice for low-level byte and bit twiddling like implementing SQLite. I know: I've written many tens of thousands of lines of the stuff but I can get more done faster in C#. The higher the language, the faster you get results. Try coding your own joins, compared to just using SQL. 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. 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 Nelson, Erik - 2 Sent: Monday, 8 June 2015 11:51 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl david at andl.org wrote on Monday, June 08, 2015 9:23 AM > > Ultimately, I don't think it will really matter, because the role of > Andl is to be platform independent. Do you care what your SQL product > is written in? > Absolutely. I wouldn't be using SQLite if it wasn't C/C++, and I suspect that I'm not the only one. It wouldn't even make sense for me to spend time looking at Andl, no matter how good it is. Implementation technology is critical to anyone that embeds SQLite. I'd guess that the SQLite developers' choice to use C was not accidental. Many people are perfectly productive using C/C++. Erik -- This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
You need to see code to know if you're interested. But I take your point: the grammar is here: http://www.andl.org/downloads/. 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 Eduardo Morras Sent: Tuesday, 9 June 2015 4:02 AM To: sqlite-users at mailinglists.sqlite.org Subject: Re: [sqlite] User-defined types -- in Andl On Mon, 8 Jun 2015 15:28:11 +1000 wrote: > Thanks for pointing it out, but I knew that the best way to show off a > language is with examples. That's why there are nine sample Andl > scripts comprising dozens of individual examples in the Samples > folder. My guess is if that you're asking me to write examples, the > real lesson is that I didn't make them easy enough to find. > > I have a formal grammar, but I don't expect anyone to read that. More > and better examples is the way to go. No, a big bold No. If I want implement your language in some product I need the formal grammar. Learn by example means learn white rules (the dos), I need to know the black rules too (the don'ts) to get full knowledge of the language. > Regards > David M Bennett FACS > > Andl - A New Database Language - andl.org --- --- Eduardo Morras ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[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] User-defined types -- in Andl
On Tue, Jun 9, 2015 at 1:50 PM, wrote: > Thank you. Exactly so. One of the problems with this kind of project is > finding 'good enough' challenges to tackle. > See also from the CTE doc: - https://www.sqlite.org/lang_with.html#sudoku - https://www.sqlite.org/lang_with.html#mandelbrot Thanks, --DD
[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-March/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] User-defined types -- in Andl
I hope you do try it. I'm looking for feedback. Sorry about the C#. Problem is, I'm way more productive in C# than any other language. C/C++ is just too slow to get things done and Java is still lagging. It would have taken far longer to do the SQLite C interface without .NET interop (JNI is seriously horrible). It was just the pragmatic choice. Ultimately, I don't think it will really matter, because the role of Andl is to be platform independent. Do you care what your SQL product is written in? If Andl turns out to be a good direction, then porting the VM and libraries is a straightforward exercise. First I need to find out if it's a good idea! Regards David M Bennett FACS Andl - A New Database Language - andl.org On Sun, Jun 7, 2015 at 4:17 AM, wrote: > I've been reading this thread with great interest. It parallels the > project I've been working on: Andl. > > Andl is A New Database Language. > > Andl does what SQL does, but it is not SQL. Andl has been developed as > a fully featured database programming language following the > principles set out by Date and Darwen in The Third Manifesto. It > includes a full implementation of the Relational Model published by > E.F. Codd in 1970, an advanced extensible type system, database > updates and other SQL-like capabilities in a novel and highly expressive > syntax. > > The intended role of Andl is to be the implementation language for the > data model of an application. It is already possible to code the > business model of an application in an SQL dialect, but few people do > this because of limitations in SQL. Andl aims to provide a language > free of these problems that works on all these platforms. > > The current implementation on SQLite uses a mixture of generated SQL > and a runtime VM. User-defined types are blobs, which the VM > understands. A future implementation could generate SQLite VM code > directly instead of SQL, which would save some overhead. > > The website is andl.org. The GitHub project is > https://github.com/davidandl/Andl. It's a work in progress. Any > feedback welcomed. > ?Looks interesting. Too bad it's written in C#. I'm basically a Linux-only guy (use Windows at work under protest, so to speak). Yes, I can use Mono on Linux to compile C# and run it. And I may.? > > Regards > David M Bennett FACS > > Andl - A New Database Language - andl.org > > -- Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be. My sister opened a computer store in Hawaii. She sells C shells down by the seashore. If someone tell you that nothing is impossible: Ask him to dribble a football. He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
On Mon, 8 Jun 2015 15:28:11 +1000 wrote: > Thanks for pointing it out, but I knew that the best way to show off a > language is with examples. That's why there are nine sample Andl > scripts comprising dozens of individual examples in the Samples > folder. My guess is if that you're asking me to write examples, the > real lesson is that I didn't make them easy enough to find. > > I have a formal grammar, but I don't expect anyone to read that. More > and better examples is the way to go. No, a big bold No. If I want implement your language in some product I need the formal grammar. Learn by example means learn white rules (the dos), I need to know the black rules too (the don'ts) to get full knowledge of the language. > Regards > David M Bennett FACS > > Andl - A New Database Language - andl.org --- --- Eduardo Morras
[sqlite] User-defined types -- in Andl
There are nine sample scripts and dozens of examples in the Samples folder. Obviously that's the area I need to work on. Regards David M Bennett FACS MD Powerflex Corporation, creators of PFXplus To contact us, please call +61-3-9548-9114 or go to www.pfxcorp.com/contact.htm -Original Message- From: sqlite-users-boun...@mailinglists.sqlite.org [mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Simon Slavin Sent: Monday, 8 June 2015 12:26 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl On 8 Jun 2015, at 3:14am, wrote: > I suggest you just read the samples off GitHub. They cover the entire > language. Download the binary, run them and you see what they do. Sorry but no. You have it reversed. Your code isn't going to touch my computer unless you have already convinced me that it's worth me investigating it. Just describe a few examples on your site. If you can show me "Look, it's a whole page in SQL but only half a page in Andl." or some similar advantage then so much the better. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
Thanks for pointing it out, but I knew that the best way to show off a language is with examples. That's why there are nine sample Andl scripts comprising dozens of individual examples in the Samples folder. My guess is if that you're asking me to write examples, the real lesson is that I didn't make them easy enough to find. I have a formal grammar, but I don't expect anyone to read that. More and better examples is the way to go. 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 Simon Slavin Sent: Monday, 8 June 2015 12:23 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl On 8 Jun 2015, at 3:12am, wrote: > Is there a PDF? No, but that's a good idea. Did you check out the samples? > They cover the entire language, and I could turn those into a PDF much > faster than a real language. It would take about a month to write a > decent tutorial and reference, but that might make a good shortcut. My guess is that, if your objective is to attract readers, your time will be best spent composing a few examples. Formal grammar will be needed in the long run but only the real geeks will read it. Many people can read a few examples and figure out whether it's worth investigating the language further, whereas a formal grammar or a full tutorial would take more time to read than they would be willing to invest. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
david at andl.org wrote on Monday, June 08, 2015 9:23 AM > > Ultimately, I don't think it will really matter, because the role of > Andl is to be platform independent. Do you care what your SQL product > is written in? > Absolutely. I wouldn't be using SQLite if it wasn't C/C++, and I suspect that I'm not the only one. It wouldn't even make sense for me to spend time looking at Andl, no matter how good it is. Implementation technology is critical to anyone that embeds SQLite. I'd guess that the SQLite developers' choice to use C was not accidental. Many people are perfectly productive using C/C++. Erik -- This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
[sqlite] User-defined types -- in Andl
On 8 Jun 2015, at 6:28am, wrote: > Thanks for pointing it out, but I knew that the best way to show off a > language is with examples. That's why there are nine sample Andl scripts > comprising dozens of individual examples in the Samples folder. My guess is > if that you're asking me to write examples, the real lesson is that I didn't > make them easy enough to find. I will admit that I didn't want to go find the depository before I was sufficiently interested in the language. So the only site I looked through was www.andl.com. If you make one blog entry for each example, then tag them all with the same tag, then have one of your navigation links show all posts with that tag, that should allow you to present the examples to people who are only getting as far as your blog. Simon.
[sqlite] User-defined types -- in Andl
I suggest you just read the samples off GitHub. They cover the entire language. Download the binary, run them and you see what they do. 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 Simon Slavin Sent: Monday, 8 June 2015 4:00 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl On 7 Jun 2015, at 6:51pm, Scott Doctor wrote: > Do you have a PDF that explains the language? There are plenty of blog entries which explain the language. I spent more time looking for some examples (I understand better from examples) and eventually found one. Simon. ___ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] User-defined types -- in Andl
Thank you for your thoughts. You covered quite a few topics. Is there a PDF? No, but that's a good idea. Did you check out the samples? They cover the entire language, and I could turn those into a PDF much faster than a real language. It would take about a month to write a decent tutorial and reference, but that might make a good shortcut. Why a new language? 1. Because although I know over a hundred computer languages and dialects, I don't know one that I could adapt to this job. The only possible candidates are the functional languages (Haskell et al) and they come with too much baggage (for some definition of baggage). 2. Because the aim is to do one thing and do it well. Andl is a small language -- you can learn it all in a few hours. Don't be fooled -- it's amazingly expressive. 3. Productivity. I have written over 100K lines of production C code and I hope I never write another line -- it just takes too long to get stuff done. 4. Why not SQL? Because Andl does what SQL does, but better. It hides the same things, but fixes the flaws and gaps. 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 Scott Doctor Sent: Monday, 8 June 2015 3:52 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] User-defined types -- in Andl Do you have a PDF that explains the language? My opinion is that I have seen many languages come and go. Consider general programing languages. C is far superior to just about any language available. In fact the underlying code for most languages is written in C. So the question becomes, why does everyone see a need to keep creating new languages? Beyond the assembler instruction compiler for a new processor, a C compiler is usually the first compiler written for that processor. It is simple and straight forward to do, and I have done so many times. If you look at the evolution of the C language (even considering that bastard child C++) it has changed very little in 35 years, is available for all architectures, properly written code will compile for any architecture unmodified, and it has every hook needed to do any programming task. Many decades ago, an attempt was made to make a more efficient keyboard to replace the QWERTY keyboard. Some of the fledgling computer companies in the 1970's and 80's tried to get them accepted. From a straight technical perspective, they are more efficient. They all failed to be accepted. Consider what is easier. To train a new generation on the old stuff? or to re-train half a dozen generations on the new stuff? Choices are usually made on which is easier now versus the long term benefits later. What I find interesting is how many of these "New" languages are so similar to C. Java, PHP, and such, take the base constructs of C, then add "Special" additions to do what is basically just a C function. They change some syntax to make it more BASIC like, but the general technique still follows C. So why not just use C? In my current project, I debated just writing a bunch of C functions to handle my data. Once I got into it, I realized that beyond simply reading/writing some data structures, the code was getting complex very fast. SQLite lets me offload the low level details and just write a query with SQLite handling the parsing and search. Is it ideal, hardly. But the alternative is much more complicated and not worth the effort. If your data is just a few simple data structures, sure, just write some C code. But the reality is that most well developed programs quickly branch into ever increasing complexity. Regarding SQL, many companies are attempting to replace SQL with their flavor of an interface. Embarcadero (the old Borland) has in their development system a "Universal" database interface to make accessing databases "Universal". The idea being that a database designer just wants their data and does not care about the underlying mechanisms. Wait, that is the entire concept behind every programming language. If programmers cared about the underlying mechanism at every level and just wanted to write the most optimal code possible (which is a far off concept no longer desired for some reason) then all programs would be written in assembler. I used their system for a while. Now I just write the SQL directly and just link in SQLite instead of using Embarcadero's stuff. Although some of their constructs "seemed" to simplify some tasks, the program as a whole was actually more complex. My opinion why SQL has endured is that it actually hides from the programmer the internal complexity required to implement a task. While some of the syntax may be a bit quirky, so is talking to a teenager, but we adapt. If SQL did not do what is needed then people would not use it. The reality
[sqlite] User-defined types -- in Andl
On Sun, Jun 7, 2015 at 4:17 AM, wrote: > I've been reading this thread with great interest. It parallels the project > I've been working on: Andl. > > Andl is A New Database Language. > > Andl does what SQL does, but it is not SQL. Andl has been developed as a > fully featured database programming language following the principles set > out by Date and Darwen in The Third Manifesto. It includes a full > implementation of the Relational Model published by E.F. Codd in 1970, an > advanced extensible type system, database updates and other SQL-like > capabilities in a novel and highly expressive syntax. > > The intended role of Andl is to be the implementation language for the data > model of an application. It is already possible to code the business model > of an application in an SQL dialect, but few people do this because of > limitations in SQL. Andl aims to provide a language free of these problems > that works on all these platforms. > > The current implementation on SQLite uses a mixture of generated SQL and a > runtime VM. User-defined types are blobs, which the VM understands. A > future > implementation could generate SQLite VM code directly instead of SQL, which > would save some overhead. > > The website is andl.org. The GitHub project is > https://github.com/davidandl/Andl. It's a work in progress. Any feedback > welcomed. > ?Looks interesting. Too bad it's written in C#. I'm basically a Linux-only guy (use Windows at work under protest, so to speak). Yes, I can use Mono on Linux to compile C# and run it. And I may.? > > Regards > David M Bennett FACS > > Andl - A New Database Language - andl.org > > -- Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be. My sister opened a computer store in Hawaii. She sells C shells down by the seashore. If someone tell you that nothing is impossible: Ask him to dribble a football. He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown
[sqlite] User-defined types -- in Andl
Any properly written documentation on any subject always begins with an executive summary (no more than a few pages), an overview (usually a dozen more pages), then gets into the nitty gritty. Consider if I want you to write a paragraph in Egyptian Hieroglyphics. So I provide you with a few "sample" sentences already written in Egyptian Hieroglyphics. Would you be able to both understand my examples, and write a proper paragraph in Egyptian Hieroglyphics? Regarding a formal definition. That should be the first thing you write when creating something new. That is where the details start to show collisions, issues, problems. To the contrary, when I start using something new, I do not want to sift through 22k pages of text just to get the concept. Very few manuals are written well. You need to be able to explain the entire language in "A Few" pages. A summary of the hieroglyphics. (operators. This is what, a dozen or so symbols) A one or two sentence description of each key word. (e.g. JOIN, SELECT, INSERT,... especially anything new) A one or two sentence explanation for each key word (or symbol) how it relates to the equivalent SQL. Any documentation on any topic should be structured as such. The need for a formal definition is obvious, but is usually used in the same fashion as a dictionary (the printed on paper kind). A few people will read the entire book. But most will just turn to the entry of interest skipping everything else. The trick is being able to find that one word quickly and getting "All" the needed information in a concise deliberate fashion. - Scott Doctor scott at scottdoctor.com - On 6/7/2015 10:28 PM, david at andl.org wrote: > Thanks for pointing it out, but I knew that the best way to show off a > language is with examples. That's why there are nine sample Andl scripts > comprising dozens of individual examples in the Samples folder. My guess is > if that you're asking me to write examples, the real lesson is that I didn't > make them easy enough to find. > > I have a formal grammar, but I don't expect anyone to read that. More and > better examples is the way to go.
[sqlite] User-defined types -- in Andl
On 8 Jun 2015, at 3:14am, wrote: > I suggest you just read the samples off GitHub. They cover the entire > language. Download the binary, run them and you see what they do. Sorry but no. You have it reversed. Your code isn't going to touch my computer unless you have already convinced me that it's worth me investigating it. Just describe a few examples on your site. If you can show me "Look, it's a whole page in SQL but only half a page in Andl." or some similar advantage then so much the better. Simon.
[sqlite] User-defined types -- in Andl
On 8 Jun 2015, at 3:12am, wrote: > Is there a PDF? No, but that's a good idea. Did you check out the samples? > They cover the entire language, and I could turn those into a PDF much > faster than a real language. It would take about a month to write a decent > tutorial and reference, but that might make a good shortcut. My guess is that, if your objective is to attract readers, your time will be best spent composing a few examples. Formal grammar will be needed in the long run but only the real geeks will read it. Many people can read a few examples and figure out whether it's worth investigating the language further, whereas a formal grammar or a full tutorial would take more time to read than they would be willing to invest. Simon.
[sqlite] User-defined types -- in Andl
I've been reading this thread with great interest. It parallels the project I've been working on: Andl. Andl is A New Database Language. Andl does what SQL does, but it is not SQL. Andl has been developed as a fully featured database programming language following the principles set out by Date and Darwen in The Third Manifesto. It includes a full implementation of the Relational Model published by E.F. Codd in 1970, an advanced extensible type system, database updates and other SQL-like capabilities in a novel and highly expressive syntax. The intended role of Andl is to be the implementation language for the data model of an application. It is already possible to code the business model of an application in an SQL dialect, but few people do this because of limitations in SQL. Andl aims to provide a language free of these problems that works on all these platforms. The current implementation on SQLite uses a mixture of generated SQL and a runtime VM. User-defined types are blobs, which the VM understands. A future implementation could generate SQLite VM code directly instead of SQL, which would save some overhead. The website is andl.org. The GitHub project is https://github.com/davidandl/Andl. It's a work in progress. Any feedback welcomed. 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 Darko Volaric Sent: Thursday, 4 June 2015 8:55 AM To: General Discussion of SQLite Database; ott at mirix.org Subject: Re: [sqlite] User-defined types I've tackled this problem from a couple of different angles. My goal was to allow arbitrary user defined types, based on the builtin types (essentially subtypes of the existing types), with a minimum of work and minimum disruption of the normal/existing use of the database and API. The approaches I considered were: - encoding the user type codes for each data column in a separate column dedicated to the purpose. This is a low impact but cumbersome, for instance using a function that interprets the user type would have to have the user type passed in for each argument, along with the actual data. - modifying the data file format to carry user type information. There is space in the record/row header where you can encode this information in a backwards compatible way, but the source code for data record access is not friendly, basically a dense blob of code with a lot of integer literals which are all very important, but it's hard to be sure what they entail and that you haven't introduced a subtle bug and ultimately data corruption. Additionally the user type would have to be passed around internally - for example in the sqlite3_value object - and tracking down all of those reliably is a bit of work. - using blobs. Although using text representation is friendly when looking at the data with standard tools, it's slower and takes up more memory in various places. I found that encoding some user types as blobs with a type marker at their start (a single byte with extensions) and interpreting them was a simple and low impact approach. I also split the standard integer type four ways (negative and positive, odd and even) to get the scalar user types I needed. User defined functions and collations need to be defined for interpreting these user types of course. The first option isn't very practical. The second option is the fastest and most robust solution and my long term approach which I will be going back to after development has progressed a bit more. Currently I'm using the third approach as an interim measure. I'm supporting arbitrary prec ints and reals, arrays and tuples and other types this way. On Wed, May 27, 2015 at 3:48 AM, Matthias-Christian Ott wrote: > I want to define user-defined types, i.e. types not SQLite has not > built-in and make sure that I didn't overlook something. Is it correct > that values of user-defined types should be stored as text and have a > collation defined if there is an order relation for the type if the > type cannot be represented as a subset of integer or float? > > Example: > Suppose I want to store arbitrary precision integers in SQLite. I > would create a column with text affinity, (uniquely) serialize and > deserialize the integers to text (e.g. by converting them into decimal > representation) and define and declare a collation that deserializes > the texts to arbitrary integers and compares the integers. > > Is there another way to define user-defined types despite this method > and virtual tables? > > - Matthias-Christian > > ___ > 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://ma
[sqlite] User-defined types -- in Andl
On 7 Jun 2015, at 6:51pm, Scott Doctor wrote: > Do you have a PDF that explains the language? There are plenty of blog entries which explain the language. I spent more time looking for some examples (I understand better from examples) and eventually found one. Simon.
[sqlite] User-defined types -- in Andl
So we are supposed to learn this new language by osmosis? Scott Doctor scott at scottdoctor.com On 6/7/2015 11:00 AM, Simon Slavin wrote: > On 7 Jun 2015, at 6:51pm, Scott Doctor wrote: > >> Do you have a PDF that explains the language? > There are plenty of blog entries which explain the language. I spent more > time looking for some examples (I understand better from examples) and > eventually found one. > > Simon. > ___ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > >
[sqlite] User-defined types -- in Andl
Do you have a PDF that explains the language? My opinion is that I have seen many languages come and go. Consider general programing languages. C is far superior to just about any language available. In fact the underlying code for most languages is written in C. So the question becomes, why does everyone see a need to keep creating new languages? Beyond the assembler instruction compiler for a new processor, a C compiler is usually the first compiler written for that processor. It is simple and straight forward to do, and I have done so many times. If you look at the evolution of the C language (even considering that bastard child C++) it has changed very little in 35 years, is available for all architectures, properly written code will compile for any architecture unmodified, and it has every hook needed to do any programming task. Many decades ago, an attempt was made to make a more efficient keyboard to replace the QWERTY keyboard. Some of the fledgling computer companies in the 1970's and 80's tried to get them accepted. From a straight technical perspective, they are more efficient. They all failed to be accepted. Consider what is easier. To train a new generation on the old stuff? or to re-train half a dozen generations on the new stuff? Choices are usually made on which is easier now versus the long term benefits later. What I find interesting is how many of these "New" languages are so similar to C. Java, PHP, and such, take the base constructs of C, then add "Special" additions to do what is basically just a C function. They change some syntax to make it more BASIC like, but the general technique still follows C. So why not just use C? In my current project, I debated just writing a bunch of C functions to handle my data. Once I got into it, I realized that beyond simply reading/writing some data structures, the code was getting complex very fast. SQLite lets me offload the low level details and just write a query with SQLite handling the parsing and search. Is it ideal, hardly. But the alternative is much more complicated and not worth the effort. If your data is just a few simple data structures, sure, just write some C code. But the reality is that most well developed programs quickly branch into ever increasing complexity. Regarding SQL, many companies are attempting to replace SQL with their flavor of an interface. Embarcadero (the old Borland) has in their development system a "Universal" database interface to make accessing databases "Universal". The idea being that a database designer just wants their data and does not care about the underlying mechanisms. Wait, that is the entire concept behind every programming language. If programmers cared about the underlying mechanism at every level and just wanted to write the most optimal code possible (which is a far off concept no longer desired for some reason) then all programs would be written in assembler. I used their system for a while. Now I just write the SQL directly and just link in SQLite instead of using Embarcadero's stuff. Although some of their constructs "seemed" to simplify some tasks, the program as a whole was actually more complex. My opinion why SQL has endured is that it actually hides from the programmer the internal complexity required to implement a task. While some of the syntax may be a bit quirky, so is talking to a teenager, but we adapt. If SQL did not do what is needed then people would not use it. The reality is that SQL actually is a well thought out language, even if the syntax can be a bit bulky and awkward. If you consider "Who" will be using the language, I find that many of the "Users" are not computer scientists, but people that are trying to make a database for their business purposes, and their specialty is not the intricacies and philosophies of coding architecture. Some of us are those brainiac computer geek types. But I see a large number of users as people who "Learned Enough" to do their job. Another issue is the ability for someone a decade, or two, or three, later, who is handed the database code without any documentation, to be able to decipher the program. (remember the Y2K bug). As you develop your language, consider if someone without having read the manual, but has a background in programming, could decipher a program written in your language. Scott Doctor scott at scottdoctor.com On 6/7/2015 2:17 AM, david at andl.org wrote: > I've been reading this thread with great interest. It parallels the project > I've been working on: Andl. > > Andl is A New Database Language. > > Andl does what SQL does, but it is not SQL. Andl has been developed as a > fully featured database programming language following the principles set > out by Date and Darwen in The Third Manifesto. It includes a full > implementation of the Relational Model published by E.F. Codd in 1970, an > advanced extensible type system, database updates