📄 test_02.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("setoid(oid(20000000));"); aa_a := calc.oid(20000000); ba_a := calc.setoid(aa_a);# io.print("var s:= bat.new(str,int);"); s := bat.new(nil:str,nil:int);# io.print("insert(s,\"hello\",1);"); ca_a := bat.insert(s,"hello",1);# io.print("print(find(s,\"hello\"));"); da_a := algebra.find(s,"hello"); ea_a := io.print(da_a);# io.print("insert(s,\"bello\",2);"); fa_a := bat.insert(s,"bello",2);# io.print("insert(s,\"cello\",3);"); ga_a := bat.insert(s,"cello",3);# io.print("insert(s,\"dello\",4);"); ha_a := bat.insert(s,"dello",4);# io.print("insert(s,\"eello\",5);"); ia_a := bat.insert(s,"eello",5);# io.print("insert(s,\"fello\",6);"); ja_a := bat.insert(s,"fello",6);# io.print("insert(s,\"gello\",7);"); ka_a := bat.insert(s,"gello",7);# io.print("insert(s,\"hello\",8);"); la_a := bat.insert(s,"hello",8);# io.print("printf(\"#~BeginVariableOutput~#\\n\"); info(s).print(); printf(\"#~EndVariableOutput~#\\n\");"); ma_a := io.printf("#~BeginVariableOutput~#\n"); na_a := bat.info(s); oa_a := io.print(na_a); pa_a := io.printf("#~EndVariableOutput~#\n");# io.print("print(find(s,\"cello\"));"); qa_a := algebra.find(s,"cello"); ra_a := io.print(qa_a);# io.print("delete(s,\"cello\",3);"); sa_a := bat.delete(s,"cello",3);# io.print("print(s);"); ta_a := io.print(s);# io.print("var sn:= algebra.select(s,1,5);"); sn := algebra.select(s,1,5);# io.print("print(sn);"); ua_a := io.print(sn);# io.print("var s2:= semijoin(s.reverse(),sn.reverse());"); va_a := bat.reverse(s); wa_a := bat.reverse(sn); s2 := algebra.semijoin(va_a,wa_a);# io.print("print(s2);"); xa_a := io.print(s2);# io.print("var x:= algebra.join(s,s2);"); x := algebra.join(s,s2);# io.print("print(x);"); ya_a := io.print(x);# io.print("quit();"); ab_a := clients.quit();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -