This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://blog.veitheller.de/Carp.html | |
(def x 1) | |
(+ x 1) ;; ??? | |
x | |
(IO.println &(Int.str (+ x 10))) | |
(defn id [a] a) | |
(id x) | |
(deftype Point [x Int, y Int]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Counter a = { value : a, | |
tick : (a -> a) } | |
tock : (state -> Counter a) | |
-> (Counter a -> state -> state) | |
-> state | |
-> (a, state) | |
tock sc css s = | |
c = sc s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- basic algebraic effect with just 2 capabilities | |
ability Effect where | |
print : Text ->{Effect} () | |
input : {Effect} Text | |
-- `run main` will run the code | |
main = 'handle !prog with IOHandler | |
-- this is the program | |
prog _ = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JsonTest where | |
import Prelude (bind, pure, ($), (=<<)) | |
import Data.Argonaut.Core (Json, fromObject, stringify, toObject) | |
import Data.Argonaut.Decode (JsonDecodeError(..), decodeJson, parseJson) | |
import Data.Argonaut.Encode (encodeJson) | |
import Data.Either (Either, note) | |
import Foreign.Object as O | |
import Data.Tuple (Tuple(..)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JsonTest where | |
import Prelude (bind, pure, ($), (<<<)) | |
import Data.Argonaut.Core (Json, fromObject, stringify, toObject) | |
import Data.Argonaut.Decode (JsonDecodeError(..), decodeJson, parseJson) | |
import Data.Argonaut.Encode (encodeJson) | |
import Data.Either (Either, note) | |
import Foreign.Object as O | |
import Data.Tuple (Tuple(..)) | |
import Data.Maybe (Maybe, fromJust) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module JsonTest where | |
import Prelude (bind, pure, (#), ($), Unit) | |
import Data.Argonaut.Core (Json, caseJsonObject, fromNumber, fromObject, fromString) | |
import Data.Argonaut.Decode (JsonDecodeError, decodeJson, parseJson) | |
import Debug.Trace (spy) | |
import Effect | |
import Effect.Console (log) | |
import Data.Either (Either) | |
import Foreign.Object as O |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- attempt to port `chainl1` example from | |
-- https://hackage.haskell.org/package/parsec-3.1.14.0/docs/Text-Parsec-Combinator.html#v:chainl1 | |
module Main where | |
import Prelude hiding (between) | |
import Text.Parsing.StringParser | |
import Text.Parsing.StringParser.Combinators | |
import Text.Parsing.StringParser.CodePoints | |
import Control.Alt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using ApprovalTests.Core; | |
using System; | |
using TextCopy; | |
namespace ApprovalTests.Reporters | |
{ | |
/// Reporter class to work in `dotnet watch test` in VSCode | |
/// terminal window on Mac. | |
public class CLIReporter : IApprovalFailureReporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Sketch of https://explainshell.com/ like output, in plain text | |
$ python explain.py | |
git diff-tree -M -r --name-status <commit> | |
└───┬───┘ ├┘ ├┘ └─────┬─────┘ └──┬───┘ | |
┌───────┘ │ │ │ │ | |
│┌────────────┘ │ │ │ | |
││┌──────────────┘ │ │ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.zip :as zip]) | |
(def s '(0 3 0 1 -3)) | |
(defn step [z] | |
(let [v (zip/node z) | |
dir (if (pos? v) zip/right zip/left)] | |
(->> z | |
(#(zip/edit % inc)) | |
(iterate dir) | |
(take (inc (Math/abs v))) |
NewerOlder