Skip to content
Pannous edited this page Mar 23, 2021 · 9 revisions

A quote is an uninterpreted, unevaluated and possibly unanalyzed and unparsed block of data. In a sense, a block is a first-level quote of code as data.

Strings are extreme forms of quotes, in which every character is literally uninterpreted. Templates are strings in which some parts ($values) are interpreted: ॓I am $age years old ॓
other forms such as macros have at least partial inner semantics. There is a historic reasons why strings are denoted with double-quotes: "example". Literals are strings without quotes. The occur in contexts, where no code is expected (after certain keywords and functions) :

In the examples

import "test.h"
import test.h
import graphics
import github:pannous/angle

The arguments of the keyword import are read self-quoted, meaning that they are parsed literally (letter by letter instead of interpreted) without semantic connections to the programs references and symbols such as variables. Even if graphics is an object declared before the import statement, it is naturally obvious that import graphics does not refer to it. (todo:wording)

Auto-quoting keywords and functions are those which are followed by quotes without needing special notation upon occurrence. The import keyword is an example of an auto-quoting keyword, as seen above.

Another form of quotes are blocks, expressed with curly braces:

{a:b} 
{1+2}
{x y z}
{if 1<2 : 3 else 4 }
person:{name=James}

Even though they are often predestined to be evaluated (1+2)=3 the point of blocks is that they can be passed around lazyly and evaluated later, if at all. This is different to groups (1+2), which (often) get evaluated on the spot.

For more on the difference between data and blocks see evaluation and closures.

To turn functions into auto-quoting symbols, there are two mechanisms:

It could be defined via the literal argument type as import package:literal := download(package) and interpret result

Depending on the signature of download, the package literal could be auto converted to a string:= download package:string := curl(package,cache=/tmp)

TODO:

A more structured definition of import would be import package:path where path has a reduced/specified? literal constructur which expects specific forms such as github:pannous/angle. (protocol':'domain'/'resource) curl path:string cache:path?:= ... where path=literal of form "/"+…

This contrasts with block as type keyword in function arguments:

if condition:block then:block else:block = … Here the then-block is not evalutated when the (fictional) if-function is called but handed over as a block which is lazyly only applied if the condition block evaluates to true (inside the call, or outside the call does not matter).

  • The := construct acts as a soft-macro, taking any symbol as group f x := 2x

A quote can be unquoted and applied, whence it may become evaluatable depending on the context.

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally