Type of ==>

67 views
Skip to first unread message

nha...@gmail.com

unread,
Jun 9, 2023, 3:13:30 PM6/9/23
to Shen
curry-type expands the ==> synonym to this:  
[In ==> Out] -> (curry-type [[In * (protect A)] --> [[vector boolean] --> [In * Out]]])

but isn't it supposed to be:

[[list A] ==> C] -> [[str [list A] B] --> [str [list A] C]] 



I'm trying to pass in a (fn <syntax>) as "Rule" below,  and the typecheck fails because the synonym isn't what compile expects.


____________________________________________________________ 50778 inferences
?- &&Rule : ((str (list Var34) Var33) --> (str (list Var34) (_boot#expr.expr (_boot#_ir_lambda_calculus.lc _boot#_ir_kl.expr _boot#_ir_kl.name symbol))))

1. &&Rule : (((list _boot#any.any) * &&&A) --> ((vector boolean) --> ((list _boot#any.any) * &&&Ex)))

nha...@gmail.com

unread,
Jun 9, 2023, 3:32:06 PM6/9/23
to Shen
Another bug is that (fn <syntax>) does not work in the body of a defcc expression.

The yacc compiler treats <syntax> as if it had been bound in the head, regardless if it actually is or not, and thus transforms it (fn (shen.<-out <syntax>)))

dr.mt...@gmail.com

unread,
Jun 10, 2023, 2:08:01 PM6/10/23
to Shen
The first is indeed a bug - a left-over from an earlier Shen-YACC which used a less efficient modus operandus.
The second is less so because 99% of the time when <syntax> does not occur in the head, it is a clerical error.
It fairly easy to replace (compile <syntax> ...) by (f ...) and define f as 

(define f 
   X -> (compile <syntax> X))

I'll fix up the curry-type bug.

M.

nha...@gmail.com

unread,
Jun 10, 2023, 3:49:09 PM6/10/23
to Shen

One could maybe argue that ‘protect’ should work on the <syntax>symbol then. It is a one line addition to process-yacc-semantics: 

[protect X] -> X


dr.mt...@gmail.com

unread,
Jun 10, 2023, 4:17:44 PM6/10/23
to Shen
Seems sensible;  I'll do it.

M.

Reply all
Reply to author
Forward
0 new messages