Skip to content

Instantly share code, notes, and snippets.

View whilo's full-sized avatar

Christian Weilbach whilo

View GitHub Profile
@swannodette
swannodette / inference.md
Last active August 7, 2023 16:13
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

(def ^:dynamic foo [])
(def ^:dynamic bar)
(defn state []
{#'foo foo, #'bar bar})
(defn helper []
(uses bar)
@frenchy64
frenchy64 / 0_before.clj
Created February 15, 2017 21:20
Loop inference
(ns clojure.core.typed.test.rt-infer.loop
{:lang :core.typed
:core.typed {:features #{:runtime-infer}}}
(:require [clojure.core.typed :as t]))
(defn b [coll]
(loop [c coll
out []]
(if (seq c)
(recur (next c) (conj out (inc (first c))))
@hal3
hal3 / mini_sequence_labeler.py
Last active January 24, 2019 20:56
PyTorch implementation of a sequence labeler (POS taggger).
"""
PyTorch implementation of a sequence labeler (POS taggger).
Basic architecture:
- take words
- run though bidirectional GRU
- predict labels one word at a time (left to right), using a recurrent neural network "decoder"
The decoder updates hidden state based on:
- most recent word
@jamesdavidson
jamesdavidson / proj.cljr
Last active November 8, 2024 06:48
Using PROJ from ClojureCLR on .NET 8 for fun and profit (at your own risk, no implied warranty etc)
;; Using proj from ClojureCLR on .NET 8 for fun and profit (at your own risk, no implied warranty etc)
;;
;; Inspired by https://ericsink.com/entries/native_library.html
;; Tested on Ubuntu 22.04 with libproj-dev 8.2.1
;
;<Project Sdk="Microsoft.NET.Sdk">
; <PropertyGroup>
; <OutputType>Exe</OutputType>
; <TargetFramework>net8.0</TargetFramework>
; <ImplicitUsings>enable</ImplicitUsings>