Ralf Hemmecke wrote:
> 
> All the following is in the context of turning the internal GETDATABASE
> stuff into *static* HTML pages.
> 
> >From GETDATABASE I can also get expressions like
> 
>   (has #2 (Foo #1))
> 
> now, usually #1 and #2 will be replaced by the names of the parameters
> that are given to the constructor but in when I go down the inheritance,
> it might happen that #1 is (OutputForm) #2 is (Integer) and Foo =
> CoercibleTo. For such cases I would like to turn the condition into T.
> My problem is, how would I evaluate that? There is certainly already an
> approriate function, but which one?

There is 'HasCategory' function in 'interop.boot'.  The first argument
has to be fully evaluated domain (that is domain vector).  The second
normally is unevaluated (but code makes some effort to handle
evaluated categories).

> Furthermore, these expressions are of type SExpression, so that would be
> my input type. All should be done from SPAD, but calling foo(...)$Lisp
> wouldn't be a problem, since all this is low-level anyway.
> 
> What complicates the situation is that I might have the following expression
> 
>   (has R (Foo (Integer)))
> 
> where R is the name of a parameter of the constructor. In that case, I
> would like to get back the expression as it is, since that is a
> condition, I would like to show on the webpage.

Currently HyperDoc uses all or nothing approach: if you gives all
arguments to a constructor HyperDoc will evaluate the constructor
and give unconditional results.  Otherwise conditions remain
unevaluated.  There is code in compiler to simplify conditions,
but that is tricky (you may look at 'InvestigateConditions' in
'functor.boot').

> 
> I haven't checked, but it looks as if a can recognise the formal
> parameters, because they are symbols and not lists like (Integer). So,
> perhaps, it's possible to go through the expression and test in advance
> whether it still contains a formal parameter.
> 
> Also how would I deal with $ (or rather %) somewhere in the expression?

Conditions are "almost" executable Lisp code (they are transformed
a bit but this does not change main thing).  They are evaluated
in context of a particular domain.  One of the first thing done
when initializing a domain is substitution proper value for '$'.
More precisely, code initializing a domain has local variable
named '$'.  One of first thing done during initialization
is to assign "empty" domain vector to this variable.  Thanks
to this other parts may access '$' and get sensible results.
Note: code generated by Spad compiler is carefuly structured
so that noramlly information from domain vector is used only
when available.  In some cases of crazy use of '%' you will
get error at compile time.  And of course there may be bugs.

-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to