File: callbacks.cdb

package info (click to toggle)
cadabra2 2.4.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,796 kB
  • sloc: ansic: 133,450; cpp: 92,064; python: 1,530; javascript: 203; sh: 184; xml: 182; objc: 53; makefile: 51
file content (20 lines) | stat: -rw-r--r-- 350 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# Testing of calling back on Python routines from C++.

def fun(e):
    print("received:    "+str(e))
    distribute(e, repeat=True)
    print("turned into: "+str(e))

\prod{#}::Distributable.
a:=A*(B+C)

callback(a)
callback(a, fun)
callback(callback=fun, ex=a)
callback(a, callback=fun)

spl = split_terms(a)
for t in spl:
	 print "term "+str(t)