The quasiquote is a templating language for creating nested
lists using a notation which looks like those lists, rather
than hard-to-read nested constructor calls.
A quasiquote can be nested and it can insert material into
any level of nesting.
This templating notation is heavily used in writing macros,
and other code-to-code transformation situations.
Sometimes it is used in manipulating data which isn't code, too.
On Wed, 7 Jun 2023 20:26:03 -0000 (UTC)
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
The quasiquote is a templating language for creating nested
lists using a notation which looks like those lists, rather
than hard-to-read nested constructor calls.
A quasiquote can be nested and it can insert material into
any level of nesting.
This templating notation is heavily used in writing macros,
and other code-to-code transformation situations.
Sometimes it is used in manipulating data which isn't code, too.
For 2 or more levels of nesting , I find it a lot more readable
to use explicit calls instead of nested backquotes.
With the
explicit calls , you push all the quoting to the innermost level
and otherwise the usual evaluation rules apply. It usually is
more verbose but I find it more readable.
On Wed, 7 Jun 2023 20:26:03 -0000 (UTC)
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
The quasiquote is a templating language for creating nested
lists using a notation which looks like those lists, rather
than hard-to-read nested constructor calls.
A quasiquote can be nested and it can insert material into
any level of nesting.
This templating notation is heavily used in writing macros,
and other code-to-code transformation situations.
Sometimes it is used in manipulating data which isn't code, too.
For 2 or more levels of nesting , I find it a lot more readable
to use explicit calls instead of nested backquotes. With the
explicit calls , you push all the quoting to the innermost level
and otherwise the usual evaluation rules apply. It usually is
more verbose but I find it more readable.
In article <nzRJAvWCQBiyNSZoM@bongo-ra.co>,
Spiros Bousbouras <spibou@gmail.com> wrote:
For 2 or more levels of nesting , I find it a lot more readable
to use explicit calls instead of nested backquotes. With the
explicit calls , you push all the quoting to the innermost level
and otherwise the usual evaluation rules apply. It usually is
more verbose but I find it more readable.
I have been experimenting with a reverse polish like language.
The main elements are bracket pairs.
{ } is deferred code
{ do something } leaves a token that can be "run".
Normally code is executed, but you can execute code
while in deferred mode by [ ]
So you got
{ [ 1 2 + "addition result:" type . ] "hello world" type }
This types the addition result while the line is entered.
It leaves a token that can be run to type the "hello world| message.
Normally a deferred token is given a name via ':' like so.
{ "hello world" type } : hellow
The idea is that the brackets can be nested indefinitely.
{ [ variable x ] .... x ... }
{
[
variable x
{ 2 * + } : add-a-duplicate
] .... x add-a-duplicate ...
} : do-something
Is that idea related?
On Mon, 19 Jun 2023 11:41:44 +0200
albert@cherry.(none) (albert) wrote:
In article <nzRJAvWCQBiyNSZoM@bongo-ra.co>,
Spiros Bousbouras <spibou@gmail.com> wrote:
For 2 or more levels of nesting , I find it a lot more readable
to use explicit calls instead of nested backquotes. With the
explicit calls , you push all the quoting to the innermost level
and otherwise the usual evaluation rules apply. It usually is
more verbose but I find it more readable.
I have been experimenting with a reverse polish like language.
The main elements are bracket pairs.
{ } is deferred code
{ do something } leaves a token that can be "run".
Normally code is executed, but you can execute code
while in deferred mode by [ ]
So you got
{ [ 1 2 + "addition result:" type . ] "hello world" type }
This types the addition result while the line is entered.
It leaves a token that can be run to type the "hello world| message.
Normally a deferred token is given a name via ':' like so.
{ "hello world" type } : hellow
The idea is that the brackets can be nested indefinitely.
{ [ variable x ] .... x ... }
{
[
variable x
{ 2 * + } : add-a-duplicate
] .... x add-a-duplicate ...
} : do-something
Is that idea related?
It is related to the overall discussion but it is kind of the opposite to what I was saying in my post you are directly replying to. I find it harder to read where you have nested scopes and , depending on the level of nesting , the evaluation happens during translation time or later and that's the kind of thing I aim to avoid. I find your notation better than backquotes and commas but basically with something like { .... } , you still have to read deeper to see if there are any [ ... ] and within a [ ... ] deeper to see if there are any { ... } and so forth ; whereas with Common Lisp's QUOTE , you know right away that everything in the scope of QUOTE will be taken as is. Actually this isn't completely accurate because CL also offers read time evaluation but I've never used it , I don't think it's a good idea and I turn it off by setting *READ-EVAL* to NIL .
(expand '(list (macro-time (uname).sysname) (uname).sysname))(list "Linux" (slot (uname) 'sysname))
On Mon, 19 Jun 2023 11:41:44 +0200
albert@cherry.(none) (albert) wrote:
In article <nzRJAvWCQBiyNSZoM@bongo-ra.co>,
Spiros Bousbouras <spibou@gmail.com> wrote:
For 2 or more levels of nesting , I find it a lot more readable
to use explicit calls instead of nested backquotes. With the
explicit calls , you push all the quoting to the innermost level
and otherwise the usual evaluation rules apply. It usually is
more verbose but I find it more readable.
I have been experimenting with a reverse polish like language.
The main elements are bracket pairs.
{ } is deferred code
{ do something } leaves a token that can be "run".
Normally code is executed, but you can execute code
while in deferred mode by [ ]
So you got
{ [ 1 2 + "addition result:" type . ] "hello world" type }
This types the addition result while the line is entered.
It leaves a token that can be run to type the "hello world| message.
Normally a deferred token is given a name via ':' like so.
{ "hello world" type } : hellow
The idea is that the brackets can be nested indefinitely.
{ [ variable x ] .... x ... }
{
[
variable x
{ 2 * + } : add-a-duplicate
] .... x add-a-duplicate ...
} : do-something
Is that idea related?
It is related to the overall discussion but it is kind of the opposite to >what I was saying in my post you are directly replying to. I find it harder >to read where you have nested scopes and , depending on the level of nesting >, the evaluation happens during translation time or later and that's the kind >of thing I aim to avoid. I find your notation better than backquotes and >commas but basically with something like { .... } , you still have to read >deeper to see if there are any [ ... ] and within a [ ... ] deeper to see >if there are any { ... } and so forth ; whereas with Common Lisp's QUOTE , >you know right away that everything in the scope of QUOTE will be taken as >is. Actually this isn't completely accurate because CL also offers read time >evaluation but I've never used it , I don't think it's a good idea and I turn >it off by setting *READ-EVAL* to NIL .
Apart from that , I find your approach interesting. How far are you planning >to develop your language ? How high level is it going to be ? For example >with CL macros , one of the arguments of the macro often is some user >provided code and the macro produces some code of its own and combines it >with the user code to achieve a desired effect. The analogous for your >language would be to pass some user code on the stack. Perhaps the same >effects can be achieved by passing an execution token on the stack , it >depends on what else the language can do.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 298 |
Nodes: | 16 (2 / 14) |
Uptime: | 23:20:21 |
Calls: | 6,678 |
Calls today: | 1 |
Files: | 12,222 |
Messages: | 5,341,913 |
Posted today: | 1 |