Skip to content

Instantly share code, notes, and snippets.

@Locke
Created December 15, 2015 07:37
Show Gist options
  • Save Locke/7e86fc814b45dfbf354a to your computer and use it in GitHub Desktop.
Save Locke/7e86fc814b45dfbf354a to your computer and use it in GitHub Desktop.
// @maxsteps 10
CoreASM SelfUndef
use Standard
option DebugInfo.activeChannels ALL
option Signature.TypeChecking strict
option Signature.NoUndefinedId strict
init Initialize
function dataList : -> LIST
function data : Agents -> NUMBER
rule Initialize = {
seq
dataList := [1, 2, 3, 4, 5, 6, 7, 8, 9]
next
forall x in dataList do {
extend Agents with a do {
data(a) := x
program(a) := @Run
}
}
program(self) := undef
}
/*
* @require "calculate(test) = test_1"
* @require "calculate(test) = test_2"
* @require "calculate(test) = test_3"
* @require "calculate(test) = test_4"
* @require "calculate(test) = test_5"
* @require "calculate(test) = test_6"
* @require "calculate(test) = test_7"
* @require "calculate(test) = test_8"
* @require "calculate(test) = test_9"
* @refuse "Run.self = undef"
*/
rule Run = {
print "Run.self = " + self
let x = calculate("test") in {
print "calculate(test) = " + x
}
}
function res : -> STRING
/*
* @refuse "calculate.self = undef"
*/
derived calculate(x) = return res in {
print "calculate.self = " + self
res := x + "_" + data(self)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment