I use [Tcl] as my scripting language of choice, and recently someone asked me why. This article is an attempt to answer that question.
Ousterhout's dichotomy claims that there are two general categories of programming languages:
| #!/bin/bash | |
| wget -c https://9front.org/iso/9front-9442.0e66f87316e571f7edf5274369ec69a5905507aa.amd64.iso.gz | |
| gunzip -k 9front-9442.0e66f87316e571f7edf5274369ec69a5905507aa.amd64.iso.gz | |
| if ! [ -f plan9.raw ]; then | |
| qemu-img create plan9.raw 10G | |
| fi | |
| exec qemu-system-x86_64 -enable-kvm \ | |
| -smp $(nproc) \ | |
| -m $((8*1024)) \ |
| #lang racket | |
| ; | |
| ; A self-evaluating Lisp interpreter implemented without define, letrec, let | |
| ; | |
| ; Copyright (C) 2017 A. Carl Douglas | |
| ; | |
| ; without current-namespace, this racket error occurred: | |
| ; ?: function application is not allowed; | |
| ; no #%app syntax transformer is bound in: |
| : -range ( a-addr1 u -- a-addr2 a-addr1 ) | |
| cells over + ; | |
| : range ( a-addr1 u -- a-addr1 a-addr2) | |
| -range swap ; | |
| : map! ( xt a-addr u -- ) | |
| range ?do i @ over execute i ! cell +loop ; | |
| : foldl ( xt w1 a-addr u2 -- w2 ) |
| defmodule MyApp do | |
| use Application | |
| def start(_type, _args) do | |
| import Supervisor.Spec, warn: false | |
| children = [ | |
| Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [ | |
| dispatch: dispatch | |
| ]) |
| #include<stdio.h> | |
| #include<string.h> | |
| #include<stdlib.h> | |
| #include<sys/mman.h> | |
| typedef void V;typedef int I;typedef double F;typedef unsigned char C,*S;typedef long L; | |
| #define O printf | |
| #define R return | |
| #define I(a...) if(a) | |
| #define W(a...) while(a) |
Tips about implementing parse_transform
erlc -S to check what the compiled forms look likeI have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\