0.1.8 • Published 9 years ago
@buggyorg/lisgy v0.1.8
lisgy
create simple buggy graphs from lisp code
(defco newCoName [inputA inputB]
{:output1 (math/less inputA inputB)
:output2 (math/add inputA inputB)})TODO
- Anonymous functions
#(...) - Better error handling with lines for components/edn objects
DONE
- set a specific input port e.g.
(FN :portB (exprs1) :portA (exprs2)) - get a specific output port with
(port :outputPort node) - let
- support for new components with just one default output port
- if same as logic/mux ->
(defco if [check truePath falsePath] (logic/mux truePath falsePath check)) (import ...)Include default mappings e.g. + to math/add- Extra node infos with
{:var value} - syntax errors with lines
API
; new component with named output ports
(defco name [inputs*] [:output (exprs1) ...])
; new component with just one output port (default name 'value')
(defco name [inputs*] (exprs1))
; Anonymous functions
(lambda [args] (...))
(fn [args] (...))
; Define
(def name value)
; Example: use + instead of math/add
(def + math/add)
(+ 2 3)
; Let
(let [var1 (exprs1) var2 (exprs2) ...]
... ; use new variables
; only the last exprs node is 'returned'
)
; Example
(stdout
(let [a 5
txt "some text"
tt "check true"
ff "check false"
check (< a 3)]
(stdout txt)
(if check tt ff)))
; Import
(import all) ; or math,logic,io,control,functional,array,translator
(+ 2 3)
; Set extra node infos, e.g. the name with {}
(+ 2 3 {:name add23})
; Intern
; Define the ports of a extern component
(defcop name [inputs*] [outputs*])
; TODO / NYI (Not yet implemented) !!!
; Anonymous functions
#(...) ; with %n for the nth arg (1-based)example code
(def add math/add) ; rename math/add to add
(defcop add [s1 s2] [sum]) ; define the input/output ports for add
(def mul math/multiply) ; rename math/multiply to mul
; lisgy will get the defcop for math/ multiply automatic
; define a new component 'add2' with a default output port 'value' and the input port 'a''
(defco add2 [a] (add a 2))
(defco sub [a b] (add a (mul b -1)))
(defco math
[a b]
[:add (add a b)
:mul (mul a b)
:sub (sub a b)
:a2 (add2 a)
:b2 (add2 b)])
(defco math2
[a]
(let [* mul
a2 (* a 2)]
(* a2 8)))
; full example
(defcop math/less [isLess than] [value])
(defcop math/add [s1 s2] [sum])
(def + math/add)
(def < math/less)
(defco test [a b] [:add (+ a b)
:less (< a b)
:fn (fn [c d] (< (+ a c)
(+ b d)))])cli
Usage: lisgy [options] [command]
Commands:
parse [lisp_code]
Options:
-h, --help output usage information
-V, --version output the version number
-e, --elastic <host> The elastic server to connect to. Defaults to BUGGY_COMPONENT_LIBRARY_HOST=http://localhost:9200
-n, --nice Pretty print all JSON output
-k, --kgraph Print the graph in kgraph format
-r, --resolve Print the resolved json
-v, --verbose [depth] Print further information.
--nocolor Disable color outputinstallation
npm i @buggyorg/lisgyalternativ via git
git clone https://github.com/BuggyOrg/lisgy.git
# global
cd lisgy
npm i -g
# or as alias
npm i
alias lisgy='PATH TO LISGY FOLDER/lib/cli.js'examples
lisgy parse -n '(lambda (a b) (math/add a b))' > parsed.json
# with stdin
echo '(lambda (a b) (math/add a b))' | lisgy parse -n > parsed.json
# open an editor (default nano)
lisgy parse -n > parsed.json
# use a input file
lisgy parse code.lisp -n > parsed.json0.2.0-pre.15
9 years ago
0.2.0-pre.14
9 years ago
0.2.0-pre.13
9 years ago
0.2.0-pre.12
9 years ago
0.2.0-pre.11
9 years ago
0.2.0-pre.10
9 years ago
0.2.0-pre.9
9 years ago
0.2.0-pre.8
9 years ago
0.2.0-pre.7
9 years ago
0.2.0-pre.6
9 years ago
0.2.0-pre.5
9 years ago
0.2.0-pre.4
9 years ago
0.2.0-pre.3
9 years ago
0.2.0-pre.2
9 years ago
0.2.0-pre.1
9 years ago
0.2.0-pre.0
9 years ago
0.1.8
10 years ago
0.1.7
10 years ago
0.1.6
10 years ago
0.1.5
10 years ago
0.1.4
10 years ago
0.1.3
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago