Skip to content

Instantly share code, notes, and snippets.

@xiaq
xiaq / compl-ls.elv
Created September 9, 2016 23:15
elvish completion for GNU ls
ls-options=[
[&short=a &long=all &desc='do not ignore entries starting with .']
[&short=A &long=almost-all &desc='do not list implied . and ..']
[&long=author &desc='with -l, print the author of each file']
[&short=b &long=escape &desc='print C-style escapes for nongraphic characters']
[&long=block-size=SIZE &desc='scale sizes by SIZE before printing them; e.g., ''--block-size=M'' prints sizes in units of 1,048,576 bytes; see SIZE format below']
[&short=B &long=ignore-backups &desc='do not list implied entries ending with ~']
[&short=c &desc='with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first']
[&short=C &desc='list entries by columns']
[&long=color &desc='colorize the output; WHEN can be ''always'' (default if omitted), ''auto'', or ''never''; more info below']
#include <cstdio>
struct S {
const char *name = "none";
int i = 0;
};
int main() {
S s;
printf("%s %d\n", s.name, s.i);
@xiaq
xiaq / ha.elv
Last active April 4, 2016 17:48
谈笑风生
fn +1s []{
advices=[
见得多了
闷声发大财
谈笑风生
不知道高到哪里去了
还需要学习个
提高姿势水平
]
echo $advices[(randint 0 (count $advices))]
package main
import (
"fmt"
"log"
"os"
)
func e(err error) {
if err != nil {
~/tmp❱ cat fib.py
i = 1
j = 1
try:
while True:
print i
k = j
j = i + k
i = k
except IOError:
@xiaq
xiaq / up.go
Created February 18, 2016 04:51
An agent for accepting uploaded file
package main
import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
@xiaq
xiaq / up.go
Created February 9, 2016 23:52
package main
import (
"io"
"log"
"net/http"
"os"
"strings"
)
@xiaq
xiaq / tmux.conf
Last active February 8, 2016 22:43
set -s escape-time 20
if-shell "test $TERMINAL = roxterm" "set -s set-clipboard off"
elvish='$GOPATH/bin/elvish'
if-shell "test -x $elvish" "set -g default-shell $elvish"
set -g base-index 1
set -g renumber-windows on
set -g mouse

From the original README of elvish, just in case one day I finish this piece. Also this article in its full glory will be too lengthy for a README.

The power of pipelines

A Concatenative Programming Facility

Pipelines make for a natural notation of concatenative programming.

So what's concatenative programming? In some of its most common use cases, we can say it's just functional programming without [lots of irritating

You appear to be advocating a new:
[x] functional [x] imperative [ ] object-oriented [ ] procedural [ ] stack-based
[x] "multi-paradigm" [ ] lazy [ ] eager [ ] statically-typed [x] dynamically-typed
[ ] pure [ ] impure [ ] non-hygienic [ ] visual [x] beginner-friendly
[x] non-programmer-friendly [x] completely incomprehensible
programming language. Your language will not work. Here is why it will not work.
You appear to believe that:
[x] Syntax is what makes programming difficult
[x] Garbage collection is free [x] Computers have infinite memory