September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,8 @@
// version 1.0.6
infix fun Double.pwr(exp: Double) = Math.pow(this, exp)
fun main(args: Array<String>) {
val d = 2.0 pwr 8.0
println(d)
}

View file

@ -1,2 +0,0 @@
say "Foo = $foo\n"; # normal double quotes
say Q:qq Foo = $foo\n; # a more explicit derivation, new quotes

View file

@ -0,0 +1,10 @@
#lang racket
(define-syntax-rule (list-when test body)
(if test
body
'()))
(let ([not-a-string 42])
(list-when (string? not-a-string)
(string->list not-a-string)))

View file

@ -0,0 +1,8 @@
(require (for-syntax syntax/parse))
(define-syntax list-when
(syntax-parser
[(_ test:expr body:expr)
#'(if test
body
null)]))

View file

@ -9,12 +9,12 @@ var colors = Hash(
'white' => "fff",
)
colors.each { |color, code|
for color,code in colors {
String.def_method("in_#{color}", func (self) {
'<span style="color: #' + code + '">' + self + '</span>'
})
}
say "blue".in_blue;
say "red".in_red;
say "white".in_white;
say "blue".in_blue
say "red".in_red
say "white".in_white

View file

@ -0,0 +1,3 @@
#define name [0|1]
#if [0|1|name]
#else, #endif

View file

@ -0,0 +1,3 @@
//Full zkl functionality but limited access to the parse stream; only #defines
#ifdef name
#fcn name {code}

View file

@ -0,0 +1,3 @@
// Shove text into the parse stream
#text name text
#tokenize name, #tokenize f, #tokenize f(a)

View file

@ -0,0 +1,3 @@
#<<<#
text, any text, inside #<<<# pairs is ignored
#<<<#

View file

@ -0,0 +1,8 @@
string:=
#<<<
"here docs:
all text in #<<< pairs is collected into one [long] line and passed
verbatim to the tokenizer. Illustrated here as quoted (\") strings
can not span lines.";
#<<<
println(string); // contains newlines

View file

@ -0,0 +1,4 @@
const{ var _n=-1; var [proxy] N=fcn{ _n+=1 } }
const X=N; // → 0
println(_n); // → 2 code time is after const time
const Y=N,Z=N; // → 1,2