This file contains hidden or 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
#!/usr/bin/env stack | |
-- stack exec ghc --resolver lts-16.2 --package criterion -- -threaded -O2 -rtsopts -with-rtsopts=-N -eventlog | |
import Control.Monad (replicateM_, void) | |
import Criterion.Main | |
import Data.Foldable (foldl') | |
import Data.Tree | |
treeFoldStrict :: (b -> [a] -> b) -> b -> Tree a -> b | |
treeFoldStrict f init (Node val children) = |
This file contains hidden or 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
a | a | a | a | a | a |
---|
This file contains hidden or 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
#lang racket | |
(define-syntax-rule (swap x y) | |
(let ([tmp x]) | |
(set! x y) | |
(set! y tmp))) | |
;; this | |
(let ([tmp 5] | |
[other 6]) | |
(swap tmp other) ;; swap also has a tmp in its body, however it is guaranteed to be a different object |
This file contains hidden or 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
#lang racket | |
(define a 1) | |
(define b 2) | |
; quote | |
'(+ a b) ; '(+ a b) | |
; quasiquote | |
`(+ a ,b) ; '(+ a 2) | |
; nested quasi-quote expr |
This file contains hidden or 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 test-module (quote #%builtin-kernel) | |
(#%plain-module-begin | |
(#%require /libs/racket/base) | |
(#%provide test-result) | |
(#%require /libs/racket/private/syntax-case) | |
(define-syntax defun | |
(#%plain-lambda (stx) | |
(#%plain-app | |
(#%variable-reference console-log) | |
(#%variable-reference stx) |
This file contains hidden or 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
#include <stdio.h> | |
int main() | |
{ | |
int *ip = NULL; //just a convenient way to crash a program :-) | |
int i, trigger; | |
printf("Trigger at (positive int): "); | |
scanf("%d", &trigger); |
This file contains hidden or 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
> ./scripts/run-ethereum-test-net.ss | |
Running: (echo geth --datadir /home/noel/.local/share/glow/geth --identity GlowPrivateEthereumTestNet --verbosity 4 --miner.etherbase 0x25c0bb1A5203AF87869951AEf7cF3FEdD8E330fC --nodiscover --maxpeers 0 --nousb --networkid 17 --nat any --vmdebug --unlock 0x25c0bb1A5203AF87869951AEf7cF3FEdD8E330fC account import --password /dev/null /tmp/croesus-tmp-WYZhrO.prv ; geth --datadir /home/noel/.local/share/glow/geth --identity GlowPrivateEthereumTestNet --verbosity 4 --miner.etherbase 0x25c0bb1A5203AF87869951AEf7cF3FEdD8E330fC --nodiscover --maxpeers 0 --nousb --networkid 17 --nat any --vmdebug --unlock 0x25c0bb1A5203AF87869951AEf7cF3FEdD8E330fC account import --password /dev/null /tmp/croesus-tmp-WYZhrO.prv) < /dev/null >> /home/noel/.local/share/glow//log/geth/geth.log 2>&1 | |
Gerbil-ethereum v0.0-260-gb151403 on Gerbil-persist v0.0-19-g75d4c45, Gerbil-crypto ef0ef55, Gerbil-poo 5b2290f, Gerbil-utils v0.0-316-g3c748ed, Gerbil v0.16-178-g17fbcb95, Gambit v4.9.3-1389-g55b21ed9 | |
In th |
This file contains hidden or 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
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Arrow((>>>), (&&&)) | |
import Data.Maybe (catMaybes) | |
import qualified Data.Text as T | |
import Data.Text (Text) | |
import Data.List.NonEmpty (NonEmpty, nonEmpty) |
This file contains hidden or 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
>>> compiling gerbil core | |
*** WARNING -- Variable "macro-readtable-brace-keyword-set!" used in module "gx-gambc1" is undefined | |
*** WARNING -- Variable "macro-readtable-bracket-keyword-set!" used in module "gx-gambc1" is undefined | |
build.sh: line 107: 12092 Segmentation fault (core dumped) "${GERBIL_STAGE0}/bin/gxi" "${GERBIL_BUILD}/build1.ss" | |
*** ERROR; build failed | |
builder for '/nix/store/qvhfwb9r400dmxwxgckdfidasxhxcydl-gerbil-unstable-2021-06-08.drv' failed with exit code 1 | |
error: build of '/nix/store/fs655cfzsbq0yx87639c3ff9r9847brr-gerbil-crypto-unstable-2021-05-10.drv', '/nix/store/h3ahfn7imahhaxfahgn9xsykq79wdgsv-gerbil-utils-unstable-2021-05-10.drv', '/nix/store/hf7llw081hsdyvyajciq6cmas3a4glav-gerbil-persist-unstable-2021-03-15.drv', '/nix/store/j8zmqkdny97bwq08fx7gkbgbi8h6ac4x-gerbil-poo-unstable-2021-05-21.drv', '/nix/store/k4yb4jgjx8rjizqh9k9ipvkm0akxam1l-smug-gerbil-unstable-2020-12-12.drv', '/nix/store/m0nh7d37qvk1zzq2067pl6yp6j6g98yn-glow-lang-unstable-2021-06-18.drv', '/nix/store/nq5vq4r4b |
This file contains hidden or 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
#include <stdio.h> | |
#include <string.h> | |
// Try it out: | |
// gcc multicall.c -o multi | |
// chmod +x multi | |
// ln -s multi hello | |
// ./hello | |
// ln -s multi bye | |
// ./bye |