██████╗  █████╗ ██████╗ ██╗ ██████╗██╗     ███████╗
██╔══██╗██╔══██╗██╔══██╗██║██╔════╝██║     ██╔════╝
██████╔╝███████║██║  ██║██║██║     ██║     █████╗
██╔══██╗██╔══██║██║  ██║██║██║     ██║     ██╔══╝
██║  ██║██║  ██║██████╔╝██║╚██████╗███████╗███████╗
╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝ ╚═════╝╚══════╝╚══════╝
      

A language for peer-to-peer collaboration

Example of radicle code

This example shows you how one would program an issues chain. In this example, we require that chains have an author, title, description, and failing test case.

    "first lines cannot be comments"

    ;; Issues for rad prelude

    (define create-rad-issue-chain (lambda ()
      (define issues (ref nil))
      (define should-be (lambda (name x y) (eq? x y)))
      (define current-prelude (ref (dict :env (dict 'should-be should-be 'eval eval) :refs nil)))


      (define failing? (lambda (expr)
        (define res (catch 'any
                            (head (eval-with-env expr (read-ref current-prelude)))
                            (lambda (x) #f)))
        (eq? res #f)))

      (define new-issue (lambda (creator title desc failing-test)
        (if (failing? failing-test)
            (modify-ref
              issues
              (lambda (x)
                (cons (dict
                  :creator creator
                  :title title
                  :description desc
                  :failing-test failing-test) x)))
            "Test is not failing")))

      (define list-issues (lambda () (read-ref issues)))

      (define dispatch (lambda (m)
        (if (eq? m 'new-issue) new-issue
        (if (eq? m 'list-issues) list-issues
            "error: unknown message"))))

      dispatch))

    (define rad-issue-chain (create-rad-issue-chain))

    (define rad-issue-chain-eval (lambda (expr)
          (if (eq? (head expr) 'new-issue)
              (apply (rad-issue-chain 'new-issue) (tail expr))
          (if (eq? (head expr) 'list-issues)
              ((rad-issue-chain 'list-issues))
              "must be one of: 'new-issue', 'list-issues'"))
          ))
    

For more examples, check here