📄 id.823516.mal
字号:
# Monet Mil to Mal compiler# Copyright (c) 2001-2004, CWI. All rights reserved.#Predefined code segment#The compiler can not guarantee an accurate compilation,#because MIL unlike MAL is a dynamically typed language.#A few guidelines to maximize usefullness.#- make the type of variables explicit, in particular 'nil'#- upon advice of M2m to remap identifiers, change it in your program directly#use the "mil_schema" for additional support routines# io.print("var b := new(oid, int).rename(\"b\");"); aa_a := new(nil:oid,nil:int); b := bat.setName(aa_a,"b");# io.print("b.insert(oid(1), 1);"); ba_a := oid(1); ca_a := insert(b,ba_a,1);# io.print("b.insert(oid(2), 2);"); da_a := oid(2); ea_a := insert(b,da_a,2);# io.print("b.insert(oid(3), 3);"); fa_a := oid(3); ga_a := insert(b,fa_a,3);# io.print("b.access(BAT_READ);"); BAT_READ:= mil.take("BAT_READ"); ha_a := access(b,BAT_READ);# io.print("# Create a view bat\n"); ia_a := int(nil); ja_a := int(nil); ka_a := select(b,ia_a,ja_a); c := bat.setName(ka_a,"c");# io.print("print(b.info(),c.info());"); la_a := info(b); ma_a := info(c); na_a := print(la_a,ma_a);# io.print("# save the list of BATs\n"); oa_a := bbp.getNames(); pa_a := copy(oa_a); pre := bat.setName(pa_a,"pre");# io.print("# build a histogram (accellerator) \n");# io.print("# on both the original BAT and the view BAT\n"); qa_a := histogram(b); ra_a := print(qa_a);# io.print("c.histogram().print();"); sa_a := histogram(c); ta_a := print(sa_a);# io.print("# remove both the view BAT and the original BAT\n"); c := 0;# io.print("b := 0;"); b := 0;# io.print("# check, which BATs still exist\n"); ua_a := bbp.getNames(); va_a := copy(ua_a); post := bat.setName(va_a,"post");# io.print("# both the original BAT and the view BAT\n");# io.print("# are gone. correct.\n"); wa_a := kdiff(pre,post); xa_a := print(wa_a);# io.print("# the post BAT is new. correct.\n");# io.print("# the histogram-accellerator BAT of the view \n");# io.print("# didn't get removed and is still there. Wrong!\n"); ya_a := kdiff(post,pre); ab_a := print(ya_a);#Identifer 'rename' mapped to 'bat.setName'#Identifer 'view_bbp_name' mapped to 'bbp.getNames()'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -