专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 其他开发语言

ALGOL语言为何没有被广泛使用

发布时间:2011-06-30 07:24:22 文章来源:www.iduyao.cn 采编人员:星星草
ALGOL语言为什么没有被广泛使用?
又为什么数学家吴文俊最推崇这种语言?
什么是面向算法?
ALGOL语言适应解决哪种类型的问题?
我可以学习这种语言吗?
------解决方案--------------------
所谓“面向算法”,只是面向算法的描述,也就是强类型、数据抽象、逻辑表达能力比较强。

至于“问这些模仿的语言,跟Algol有什么区别”,抄一个wiki上ALGOL 68的代码例子:

begin # Algol-68 prime number sieve, functional style #
  
  proc error = (string s) void:
     (print(( newline, " error: ", s, newline)); goto stop);
  proc one to = (int n) list:
     (proc f = (int m,n) list: (m>n 
------解决方案--------------------
 nil 
------解决方案--------------------
 cons(m, f(m+1,n))); f(1,n));
  
  mode list = ref node;
  mode node = struct (int h, list t);
  proc cons = (int n, list l) list: heap node := (n,l);
  proc hd   = (list l) int: ( l is nil 
------解决方案--------------------
 error("hd nil"); skip 
------解决方案--------------------
 h of l );
  proc tl   = (list l) list: ( l is nil 
------解决方案--------------------
 error("tl nil"); skip 
------解决方案--------------------
 t of l );
  proc show = (list l) void: ( l isnt nil 
------解决方案--------------------
 print((" ",whole(hd(l),0))); show(tl(l)));
  
  proc filter = (proc (int) bool p, list l) list:
     if l is nil then nil 
     elif p(hd(l)) then cons(hd(l), filter(p,tl(l)))
     else filter(p, tl(l))
     fi;
  
  proc sieve = (list l) list:
     if l is nil then nil 
     else
        proc not multiple = (int n) bool: n mod hd(l) ≠ 0;
        cons(hd(l), sieve( filter( not multiple, tl(l) )))
     fi;
  
  proc primes = (int n) list: sieve( tl( one to(n) ));
  
  show( primes(100) )
end

看起来是不是很象C和Pascal的混合体。
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: