(评论)
(comments)
原始链接: https://news.ycombinator.com/item?id=38981639
至少,它似乎给 Fortran 代码增加了过度的复杂性。 相比之下,APL 的核心设计理念直接融入了简洁性和易用性。
在Java中也是如此。 如果我有一个代表小数分数的 BigDecimal 值列表,Java 会强制我使用字符串或数字文字来在这些值之间执行算术运算,除非我创建代表这些值进行数学运算的方法或类。 有些库(例如 Apache Commons Math)提供了用于执行此转换过程的静态方法,但创建支持在这些值之间本机执行计算的自定义对象也是一种选择。
此外,当具体处理矩阵时,在矩阵之间定义运算符的想法对于 APL 或一般面向数组的语言来说并不是独一无二的,因为 Fortran 已经提供了用于处理矩阵的内在函数。 然而,虽然可以通过中缀表示法在 APL 中的矩阵之间轻松执行矩阵运算,但使用前缀或后缀表示法可能会导致 Fortran 中的代码看起来明显难看,这些代码往往严重依赖于复杂的函数调用,这些函数调用可能会让人感觉做作,以便于矩阵操作。 这些内在函数和数组样式的赋值语法可以在 APL 中发挥巨大作用,用于数值计算、统计分析、科学建模和模拟等目的,为用户提供不仅仅是简单定义自定义类或数据类型来表示数学的选项 constructs。
Existing array languages are typically not limited in terms of data types in the manner suggested above in regards to Fortran。 Rather, they usually expose native array data types and primitive constructs that allow the programmer to intuitively interact with data directly through their respective operators or function call semantics, thereby avoiding unnecessary indirection layers introduced by object oriented encapsulation schemes that hide this functionality beneath wrappers。 *、//、**、^、% 和 \| 等运算符 are examples of shorthand syntactic sugar provided for free in APL that can sometimes replace hundreds of lines of Fortran code involving the creation and invocation of various kinds of wrapper objects in order to enable these same operations。
在 Fortran 中,使用数字和索引经常会导致整数和指针索引技术的混合,这对初学者或直观友好来说并不友好; 而在 APL 中,整数和索引本身都可以充当
reply