Documentation ¶
Index ¶
- Constants
- Variables
- func ExecLgoEntryPoint(parent LgoContext, main func()) error
- func ExitIfCtxDone()
- func FinalizeGoroutine(e *ExecutionState)
- func LgoPrintln(args ...interface{})
- func LgoRegisterVar(name string, p interface{})
- func RegisterLgoPrinter(p LgoPrinter)
- func UnregisterLgoPrinter(p LgoPrinter)
- func ZeroClearAllVars()
- type DataDisplayer
- type ExecutionState
- type LgoContext
- type LgoPrinter
Constants ¶
const SelfPkgPath = "github.com/yunabe/lgo/core"
SelfPkgPath is the package path of this package
Variables ¶
var AllVars = make(map[string][]interface{})
var Bailout = errors.New("canceled")
Functions ¶
func ExecLgoEntryPoint ¶
func ExecLgoEntryPoint(parent LgoContext, main func()) error
func ExitIfCtxDone ¶
func ExitIfCtxDone()
func FinalizeGoroutine ¶
func FinalizeGoroutine(e *ExecutionState)
func LgoPrintln ¶
func LgoPrintln(args ...interface{})
func LgoRegisterVar ¶
func LgoRegisterVar(name string, p interface{})
func RegisterLgoPrinter ¶
func RegisterLgoPrinter(p LgoPrinter)
func UnregisterLgoPrinter ¶
func UnregisterLgoPrinter(p LgoPrinter)
func ZeroClearAllVars ¶
func ZeroClearAllVars()
Types ¶
type DataDisplayer ¶
type DataDisplayer interface { JavaScript(s string, id *string) HTML(s string, id *string) Markdown(s string, id *string) Latex(s string, id *string) SVG(s string, id *string) PNG(b []byte, id *string) JPEG(b []byte, id *string) GIF(b []byte, id *string) PDF(b []byte, id *string) Text(s string, id *string) }
DataDisplayer is the interface that wraps Jupyter Notebook display_data protocol. The list of supported content types are based on Jupyter Notebook implementation[2]. Each method receives a content and an display id. If id is nil, the method does not use id. If id is not nil and it points an empty string, the method reserves a new display ID and stores it to id. If id is not nil and it points a non-empty string, the method overwrites a content with the same ID in Jupyter Notebooks.
References: [1] http://jupyter-client.readthedocs.io/en/latest/messaging.html#display-data [2] https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/js/outputarea.js
type ExecutionState ¶
type ExecutionState struct { Context LgoContext // contains filtered or unexported fields }
func InitGoroutine ¶
func InitGoroutine() (e *ExecutionState)
type LgoContext ¶
type LgoContext struct { // Go context.Context. context.Context // Display displays non-text content in Jupyter Notebook. Display DataDisplayer }
A LgoContext carries a context of lgo execution.
func GetExecContext ¶
func GetExecContext() LgoContext
type LgoPrinter ¶
type LgoPrinter interface {
Println(args ...interface{})
}