demo_native_lib.py 397 B

123456789101112131415
  1. # Demo of a library that can be imported into the action language with the import-statement.
  2. import time
  3. def meaning_of_life():
  4. time.sleep(0.001) # takes a while to compute ;)
  5. return 42
  6. from sccd.action_lang.static.types import *
  7. SCCD_EXPORTS = {
  8. # adapt native Python to action language's static type system
  9. "meaning_of_life": (meaning_of_life, SCCDFunction([], SCCDInt)),
  10. }