xo-pyjit: README: bring example up-to-date

This commit is contained in:
Roland Conybeare 2024-06-17 17:16:07 -04:00
commit 93819cbb6c

View file

@ -69,9 +69,9 @@ build an AST from within python
```
>>> x=make_var('x') # "x" a variable (context not yet known)
>>> f1=make_sin_pm() # "sin()"
>>> c1=make_apply(f1,x) # "sin(x)"
>>> c1=make_apply(f1,[x]) # "sin(x)"
>>> f2=make_cos_pm() # "cos()"
>>> c2=make_apply(f2,c1) # "cos(sin(x))"
>>> c2=make_apply(f2,[c1]) # "cos(sin(x))"
>>> lm=make_lambda('foo', ['x'], c2) # "def foo(x): cos(sin(x))"
>>> lm
<Lambda :name foo :argv [x] :body <Apply :fn <Primitive :name cos :type "double (*)(double)" :value 1> :argv "[<Apply :fn <Primitive :name sin :type \"double (*)(double)\" :value 1> :argv \"[<Variable :name x>]\">]">>
@ -97,7 +97,7 @@ JITDylib "<main>" (ES: 0x0000000000446ee0, State = Open)
Link order: [ ("<main>", MatchAllSymbols) ]
Symbol table:
"foo": <not resolved> [Callable] Never-Searched (Materializer 0x646fe0, xojit)
>>> fn=mp.lookup_dbl_dbl_fn('foo')
>>> fn=mp.lookup_dbl2dbl_fn('foo')
>>> mp.dump_execution_session()
JITDylib "<main>" (ES: 0x0000000000446ee0, State = Open)