chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] Re: Re : [Chicken-users] various questions


From: Kon Lovett
Subject: [Chicken-hackers] Re: Re : [Chicken-users] various questions
Date: Fri, 12 Jan 2007 10:04:41 -0800

On Jan 12, 2007, at 8:45 AM, John Cowan wrote:

Kon Lovett scripsit:

It uses the facilities of 'procedure-surface' to provide the
appropriate procedures.

Can you explain 'procedure-surface' in a little more detail, please?
It looks like just the thing for me, but it has too many procedures and
too few explanations.

Yes, lots of procedures. But, except for testing, I have barely strayed from the 'Syntax Interface' of procedure-surface in actual use. The 'Direct Call Interface' can safely be ignored. As can 'Signature Types'; the start of a contract-oriented programming facility that I never continued. While a signature is required for a procedure-surface definition, and will be parsed if provided, the signature can be '(). I provide signatures in 'levenshtein' since I think it helps w/ documentation.

The basic idea is to define a set of procedure-types that provide some fundamental API, such as numeric operations. Then supply actual procedures that meet the signatures of the API but implement support for a specialized datatype, such as fixnum. An algorithm is coded to use the generic API & at runtime the actual bindings for the real datatype are substituted. The substitution is not automatic so the 'let/means' form is used to bind local variables to the actual procedures.

Procedure-surface also takes care of loading libraries & extensions, delaying until a binding is needed. The 'levenshtein' egg doesn't have an example of this but the test in the procedure-surface egg does.

For now take a look at the code in the 'levenshtein' egg as an example. All the files named "*-surface.scm" are procedure-surface definitions & "*-means.scm" are procedure-means declarations. My use of the 'syntax-case' module system is incidental so do not be confused into thinking it is somehow necessary.

The only example of a "generic algorithm" is "levenshtein-generic- sequence.scm". It is a little more complicated than expected usage since it needs to handle conversion of various string character encodings into canonical vector form but I think that can be skipped over.

HTH,
Kon


Thanks.

--
On the Semantic Web, it's too hard to prove John Cowan address@hidden you're not a dog. --Bill de hOra http://www.ccil.org/ ~cowan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]