Hello everyone,
I'm excited to share a package that I've recently developed, built on top of Qi, called Qi-circuit: https://github.com/chansey97/qi-circuit
Qi-circuit a domain-specific language designed for creating stream circuits; in some literature, they are also referred to as signal flow graphs. The main aim of this package is to reveal the connection between Qi and signal flow graphs.
A quick example of calculating the Fibonacci sequence by Qi-circuit.
#lang racket
(require qi)
(require "../qi-circuit-lib/circuit.rkt")
(define zero (stream-cons 0 zero))
(define one (~>> (zero) (c-reg 1)))
(define-flow sf
(~>> (c-loop (~>> (== _ (c-reg 0))
(c-add +)
(c-loop (~>> (== _ (c-reg 0)) (c-add +) (-< _ _)))
(c-reg 0)
(-< _ _)))))
(define fib ((☯ sf) one))
(~>> (fib) (stream-take _ 20) stream->list)
;; '(0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181)
I have written a tutorial about it, including many examples, such as integral, factorial, fibonacci, catalan numbers, and ODE. Each example contains a step-by-step diagram reasoning to transform a general circuit to Qi-circuit.
Give it a try and let me know what you think about. Any insights, suggestions, and criticism are highly appreciated.
Thanks!