Skip to content

Instantly share code, notes, and snippets.

View mfikes's full-sized avatar

Mike Fikes mfikes

View GitHub Profile
@mfikes
mfikes / README.md
Last active September 24, 2025 04:49
eval in ClojureScript

ClojureScript master now has cljs.core/eval. This delegates to cljs.core/*eval* which, by default throws, but you can bind it to any implementation that can compile and evaluate ClojureScript forms.

If you require the cljs.js namespace (which is the main support namespace for self-hosted ClojureScript), then cljs.core/*eval* is set to an implementation that uses self-hosted ClojureScript for this capability. This means that all self-hosted ClojureScript environments will now have a first-class eval implementation that just works. For example, Planck master:

$ planck -q
cljs.user=> (eval '(+ 2 3))
5
@mfikes
mfikes / README.md
Last active August 18, 2024 19:33
Playing with BigInt in ClojureScript

Usage

Fire up a REPL using any of the following forms.

Node

clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:git/url "https://github.com/mfikes/clojurescript" :sha "ed1e7373a9ecd8b52084dc438e6c21d23dba47ca"}}}' -m cljs.main -re node
@mfikes
mfikes / shor.m
Created July 13, 2024 21:10
Simulate Shor's algorithm in a 4-qubit computer
% Number to factor
N = 15; % Example number
a = 7; % Randomly chosen integer coprime to N
% Number of qubits
n = 4;
dim = 2^n;
% Initialize the state vector to |0000>
state = zeros(dim, 1);
@mfikes
mfikes / shor.m
Last active July 13, 2024 21:03
Simulate Shor in a 3-qubit computer
% Number to factor
N = 6; % Example number
a = 5; % Randomly chosen integer coprime to N
% Number of qubits
n = 3;
dim = 2^n;
% Initialize the state vector to |000>
state = zeros(dim, 1);
@mfikes
mfikes / concurrency.clj
Last active June 7, 2024 18:33
Concurrency comparison Swift async/await and Clojure core.async
(require '[clojure.core.async :refer [go <!]])
(defn fetch-user-id [server]
(go
(if (= server "primary")
97
501)))
(defn fetch-username [server]
(go
@mfikes
mfikes / fast.md
Last active January 6, 2024 07:19
Fast Clojure REPL

An experimental change for fast Clojure REPL startup:

  1. Download the JAR: clojure-1.8.0-fast.jar
  2. Launch it via java -jar clojure-1.8.0-fast.jar

The code used to create this JAR is on GitHub.

What's it doing?

It is:

@mfikes
mfikes / polyglot.md
Created April 30, 2018 03:02
Polyglot Graal from ClojureScript

You need to first install GraalVM, and then set your PATH so that you get the GraalVM binaries (incluing the GraalVM version of node).

You can then install R and Ruby via

gu -c install org.graalvm.r
gu -c install org.graalvm.ruby
@mfikes
mfikes / cljs.md
Last active January 6, 2024 07:13
cljs command

If you wan't a cljs that acts like clj, but for ClojureScript, there are a few minor changes you can make:

First, add the following entry to ~/.clojure/deps.edn under the :deps key:

org.clojure/clojurescript {:mvn/version "1.10.439"}

Then make copies of clj and clojure named cljs and clojurescript, and put those copies on your path.

@mfikes
mfikes / clojurists-together-clojurescript.md
Last active December 29, 2023 04:52
Clojurists Together Q2 2018 Funding Round - ClojureScript

This page logs work being done under Clojurists Together Q2 2018 Funding Round towards the ClojureScript project. High level progress reports will be published formally with Clojurists Together, but you can follow here if you are interested in low-level details, progress notes, etc.

Themes

The concrete themes identified include:

  • Fixing CLJS-2702, which prevents us from upgrading to newer versions of Closure Library.
  • Work on highly voted ClojureScript tickets. Please take some time and vote in this list of tickets in need of patches.
  • Work on issues related to NPM dependency management. (In particular NPM issues in the list above will be given extra emphasis).
@mfikes
mfikes / main.c
Last active May 14, 2023 16:52
Modified nrf/samples/bluetooth/peripheral_hids_keyboard/main.c
/*
* Copyright (c) 2018 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#include <zephyr/types.h>
#include <stddef.h>
#include <string.h>
#include <errno.h>