根据此页面:
http://tutor.rascal-mpl.org/Rascalopedia/List/List.html
这是您在列表中使用 cons 的方式:
cons(1,[2,3]); //should return [1,2,3]
在 Rascal 控制台中尝试此操作:
import List;
cons(1,[2,3]);
给我这个错误:
|stdin:///|(1,13,<1,1>,<1,14>): The called signature: cons(int, list[int]),
does not match any of the declared (overloaded) signature patterns:
Symbol = cons(Symbol,str,list[Symbol])
Production = cons(Symbol,list[Symbol],set[Attr])
Symbol = cons(Symbol,str,list[Symbol])
Production = cons(Symbol,list[Symbol],set[Attr])
与标准导入函数和数据类型有一些名称冲突吗?