Skip to content

Instantly share code, notes, and snippets.

View sritchie's full-sized avatar
🎯
Focusing

Sam Ritchie sritchie

🎯
Focusing
View GitHub Profile
(ns examples.simulation.toroid
(:refer-clojure
:exclude [+ - * / = zero? compare
numerator denominator ref partial
infinite? abs])
(:require [emmy.env :as e :refer :all]
[emmy.expression.compile :as xc]
[nextjournal.clerk :as clerk]
[examples.manifold.pq-knot :as pq]))
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sicmutils</groupId>
<name>sicmutils</name>
<description>A port of the scmutils computer algebra/mechanics system to Clojure.</description>
<url>http://github.com/sicmutils/sicmutils</url>
<licenses>
<license>
<name>GPLv3</name>
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>MathLive Basic Example</title>
<style>
body {
color: #444;
background-color: #f9f9f9;
}
(ns demo.bench
(:require [sci.core :as sci]))
(def sci-context
(sci/init
{:classes {'Math js/Math}}))
(defn sci-eval [f-form]
(sci/eval-form (sci/fork sci-context) f-form))
🌐 Establishing connection…
🗂 Fetching git repository
⏬ Downloading deps
Cloning: https://github.com/nextjournal/clerk.git
Checking out: https://github.com/nextjournal/clerk.git at f18afd7e6165748765ea43c23604cc1965f20e35
Downloading: reagent/reagent/1.1.1/reagent-1.1.1.pom from clojars
Cloning: https://github.com/nextjournal/viewers.git
Downloading: thheller/shadow-cljs/2.20.7/shadow-cljs-2.20.7.pom from clojars
Checking out: https://github.com/nextjournal/viewers.git at 1aaedea7709611cbb393add4c85c7a2dd551260e
Cloning: https://github.com/babashka/sci.configs.git
(def ^{:doc "Docstring."}
Mathfield
(r/adapt-react-class
(react/forwardRef
(fn [props ref]
(let [[mf set-mf] (react/useState nil)
{:strs [children value options defaultValue onChange
soundsDirectory fontsDirectory] :as props}
(js->clj props)]
;;
;; Copyright © 2022 Sam Ritchie.
;; This work is based on the Scmutils system of MIT/GNU Scheme:
;; Copyright © 2002 Massachusetts Institute of Technology
;;
;; This is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3 of the License, or (at
;; your option) any later version.
;;
(/ (+ (* -1.35E9
'v_theta
'v_phi
(Math/pow (Math/sin 'theta) 2.0)
(Math/cos 'theta)
(Math/pow (Math/cos 'phi) 2.0))
(* 6.75E8
(Math/pow 'v_phi 2.0)
(Math/pow (Math/sin 'theta) 3.0)
(Math/sin 'phi)
(clojure.core/fn
[[y47090 y47091 y47092 y47093 y47094]
[p47095 p47096 p47097 p47098 p47099]]
(clojure.core/let
[G0000000000000020
(Math/pow y47094 2.0)
G0000000000000022
(Math/cos y47091)
G0000000000000024
(Math/pow p47097 2.0)
------ ERROR -------------------------------------------------------------------
File: /Users/sritchie/code/clj/programming-2022/src/demo/viewers.cljs:12:16
--------------------------------------------------------------------------------
9 | @sv/!sci-ctx
10 | {:namespaces {'demo.face
11 |
12 | (sci/copy-ns demo.face (sci/create-ns 'demo.face))}})
----------------------^---------------------------------------------------------
Encountered error when macroexpanding sci.core/copy-ns.
NullPointerException: Cannot invoke "clojure.lang.IFn.invoke(Object)" because the return value of "clojure.lang.Var.getRawRoot()" is null