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
// This version allows LHS to be any expression | |
// (and makes sure it's only evaluated once by storing the result) | |
let (?.) = macro { | |
rule infix { $lhs:expr | $rhs:ident } => { | |
(function ($tmp) { | |
return $tmp === null ? null : $tmp.$rhs; | |
})($lhs) | |
} | |
} |
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
#!/bin/bash | |
# Usage: cwd.sh /app /usr/bin/python example.py | |
cd $1 && exec "${@:2}" |
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
(ns fancy-defn | |
(:require [schema.core :as s] | |
[clojure.core.typed :as t] | |
[circle.schema-typer :as st])) | |
;; Schemas created with s/defn end up using this. | |
(defmethod st/convert schema.core.One [schema] | |
(assert (= false (:optional? schema))) ;; No support for optional arguments yet. | |
(st/convert (:schema schema))) |
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
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Optional; | |
import java.util.Set; | |
import java.util.stream.Stream; | |
import static java.util.stream.Collectors.toList; | |
import static java.util.stream.Collectors.toSet; | |
public class Optionals { |
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
#!/usr/bin/env ruby | |
# | |
# textile+lhs2html | |
# | |
# A script for transforming Literate Haskell | |
# with Textile-formatted text to HTML with | |
# the help of Ruby and RedCloth. | |
# | |
# Written by Christoffer Sawicki in 2009. | |
# Released into the public domain. |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
XSL = <<-EOXSL | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml" encoding="ISO-8859-1"/> | |
<xsl:param name="indent-increment" select="' '"/> |
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
#!/usr/bin/env ruby | |
ARGV.each do |arg| | |
name, line = arg.split(":") | |
system("mate", name, "--line", line) | |
end |
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
#lang racket ; Requires Racket >= 5.1.1 | |
(provide (rename-out (objective-r-read read) | |
(objective-r-read-syntax read-syntax))) | |
(require syntax/stx) | |
(define (rewrite-method-calls stx) | |
(if (stx-list? stx) | |
(let ((stx* (stx-map rewrite-method-calls stx))) |
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
user=> (use 'clojure.walk) | |
nil | |
user=> (macroexpand-all '(-> x (1 a) (2 b))) | |
(2 (1 x a) b) | |
user=> (macroexpand-all '(->> x (1 a) (2 b))) | |
(2 b (1 a x)) |
OlderNewer