A couple nice references on the visitor pattern:
The code in this Gist implements a simple visitor using nonsensical, but reasonably clear, types.
List<dynamic> _stuff = []; | |
void inject(dynamic thing) { | |
_stuff.add(thing); | |
} | |
T request<T>() => _stuff.firstWhere((thing) => thing is T, orElse: () => null); | |
class MyThing { | |
final String value = 'hello, world'; |
A couple nice references on the visitor pattern:
The code in this Gist implements a simple visitor using nonsensical, but reasonably clear, types.
#!/usr/bin/env bash | |
# Switches between various Julia versions. By default, looks for versions in | |
# $HOME/local/julia/, but this can be configured by setting the JVM_BIN_PREFIX | |
# variable. Also links the corresponding packages directory to $HOME/julia-pkgs | |
# for convenience. | |
JVM_PKG_PREFIX=${JVM_PKG_PREFIX:-"$HOME/.julia"} | |
JVM_BIN_PREFIX=${JVM_BIN_PREFIX:-"$HOME/local/julia"} |
module Landscape | |
data Landscape : Nat -> Nat -> Double -> Type where | |
NK : (n : Nat) -> (k : Nat) -> Landscape n k 0.0 | |
NKp : (n : Nat) -> (k : Nat) -> (p : Float) -> Landscape n k p | |
getN : Landscape n _ _ -> Nat | |
getN _ = n | |
getK : Landscape _ k _ -> Nat |