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
Red [] | |
parser: context [ | |
state: [] | |
rules: [ | |
any [ | |
number! (append state 'number) | | |
word! (append state 'word) | | |
time! (append state 'time) | |
] |
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
Red [] | |
{ | |
grammar HTML | |
document <- (doctype / text / tag)* | |
tag <- open_tag (text / tag)* close_tag | |
open_tag <- "<" [0-9a-zA-Z \"'=-]+ ">" | |
close_tag <- "</" [0-9a-zA-Z]+ ">" | |
doctype <- "<!DOCTYPE " [0-9a-zA-Z]+ ">" | |
text <- [^<]+ | |
} |
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
Red [ | |
author: {Maxim Velesyuk} | |
description: { | |
Quick in-place function definitions without explicit arguments specification. | |
`_` is next arugment, `_N` is N-th argument | |
} | |
] | |
inc: func ['word] [set word 1 + get word] |
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
Red [ | |
author: {Maxim Velesyuk} | |
description: {draw dialect playground} | |
] | |
demo: trim { | |
fill-pen gray | |
box 0x0 400x400 | |
do [c: to-tuple reduce [ | |
random 255 random 255 random 255] |
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
* (defun f (x y) (/ x y)) | |
WARNING: redefining COMMON-LISP-USER::F in DEFUN | |
F | |
* (f 5 0) | |
debugger invoked on a DIVISION-BY-ZERO in thread | |
#<THREAD "main thread" RUNNING {100399C493}>: | |
arithmetic error DIVISION-BY-ZERO signalled | |
Operation was /, operands (5 0). |
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
Red [ | |
description: {simple game} | |
author: {Maxim Velesyuk} | |
version: 2.2 | |
changelog: { | |
2.2 | |
* added sleep to the loop to reduce CPU load | |
2.1 | |
* added win screen display time |
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
Red [ | |
author: "Maxim Velesyuk" | |
description: "Dynamic variables implementation for Red" | |
] | |
; utils | |
forskip: func ['series skipn body /local s] [ | |
s: get series | |
while [ not tail? s ] [ | |
do body |
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
Red [ | |
author: "Maxim Velesyuk" | |
description: "Common Lisp condition-restart system implementation for Red" | |
] | |
; utils | |
*word-counter*: 0 | |
gen-word: does [ | |
*word-counter*: *word-counter* + 1 | |
to-word append "G-" to-string *word-counter* |
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
Red [] | |
form-all: func [blk][ | |
forall blk [blk/1: form blk/1] | |
blk | |
] | |
types-of: function [value [typeset!]][ | |
; typesets don't support reflection | |
third load mold value |