Skip to content

Instantly share code, notes, and snippets.

> *e
#error {
:cause "Could not resolve symbol: clojure.stacktrace/print-cause-trace"
:data {:type :sci/error, :line 1, :column 2, :file nil, :phase "analysis"}
:via
[{:type clojure.lang.ExceptionInfo
:message "Could not resolve symbol: clojure.stacktrace/print-cause-trace"
:data {:type :sci/error, :line 1, :column 2, :file nil, :phase "analysis"}
:at [sci.impl.utils$throw_error_with_location invokeStatic "utils.cljc" 49]}]
:trace
{:via
[{:type clojure.lang.ExceptionInfo,
:message
"No implementation of method: :getName of protocol: #'sci.impl.vars/HasName found for class: nil",
:data
{:type :sci/error,
:line 1,
:column 1,
:message
"No implementation of method: :getName of protocol: #'sci.impl.vars/HasName found for class: nil",
@phronmophobic
phronmophobic / cli-experience-report.md
Last active March 11, 2021 20:45
CLI experience report

I started using clojure cli a few months ago and I'm already sold on switching all my projects to work with deps.edn.

It works really well for projects and tools that I write, but I struggle when trying to use the cli to run tools like depstar and deps-deploy.

My conceptual model for how to use clojure cli:

  1. specify the clojure environment (deps, java command flags, initial values)
  2. specify a clojure function to run
  3. specify arguments to pass to pass the #2

As a clojure cli user, is there a better conceptual model? I tend to struggle because the available clj command line options aren't organized into those 3 steps.

@phronmophobic
phronmophobic / gist:97ea46dfae51958e2e7686243ac27860
Last active March 11, 2021 18:54
Reorganized clojure cli help
Usage:
Start a REPL clj [clj-opt*] [-A:aliases] [init-opt*]
Exec function clojure [clj-opt*] -X[:aliases] [a/fn] [kpath v]*
Run main clojure [clj-opt*] -M[:aliases] [init-opt*] [main-opt] [arg*]
Prepare clojure [clj-opt*] -P [other exec opts]
clj-opts:
-Jopt Pass opt through in java_opts, ex: -J-Xmx512m
-Sdeps EDN Deps data to use as the last deps file to be merged
-Spath Compute classpath and echo to stdout only
;; Display a single todo item
(defui todo-item [ & {:keys [todo]}]
(horizontal-layout
(translate 5 5
(on
:mouse-down
(fn [[mx my]]
[[:delete $todo]])
(delete-X)))
(translate 10 4
import UIKit
protocol Lens {
associatedtype ParentType
associatedtype ChildType
func lget(_ parent: ParentType) -> ChildType
func lset(_ parent: ParentType, _ child: ChildType) -> ParentType
}
import UIKit
protocol LensProtocol {
func lget(data: Any?) -> Any?;
func lset(data: Any?, val: Any?) -> Any?;
}
@phronmophobic
phronmophobic / lens.py
Last active April 7, 2019 22:54
python lens
from pprint import pprint
from copy import copy
class KeyLens(object):
def __init__(self, key):
self.key = key
def lget(self, data):
return data[self.key]