Skip to content

Instantly share code, notes, and snippets.

http://news.e-scribe.com/193
To move, you tell the computer how many numbers (counting from the left) to reverse.
For example, if the current list is 2 3 4 5 1 6 7 8 9 and you reverse 4,
the result will be 5 4 3 2 1 6 7 8 9. Now if you reverse 5, you win.
• Comment from Pascal
Funny game, here is a REBOL version of this game. An interesting thing is its readability.
numbers: random ordered: [1 2 3 4 5 6 7 8 9]
Red [
Title: "Example of definitional scoping"
Date: 20-Mar-2017
Author: https://github.com/9214
File: %(s)puny-mortals.red
]
meditate: function ['on thing] [
print "ॐ"
@meijeru
meijeru / word-finder.red
Last active April 6, 2020 09:06
Word-finder: find occurrences of any word in the toolchain source files
Red [
Title: "Word finder"
Purpose: {Find occurrences of words in the source files
of the Red toolchain and display them}
Author: "Rudolf W. MEIJER"
File: %word-finder.red
Needs: 'View
Rights: "Copyright (c) 2019 Rudolf W. MEIJER"
History: [
[0.0 23-Jan-2019 {Start of project}]
@dockimbel
dockimbel / check-brackets.red
Last active January 4, 2019 20:24
PoC script for checking if brackets/parens are matching in a Red file
Red [
Purpose: "PoC script for checking if brackets/parens are matching in a Red file"
]
check-brackets: function [file [file!]][
line: 1
stack: clear []
skip-chars: complement charset "[]()^/"
parse read file [
@greggirwin
greggirwin / inject.red
Last active May 14, 2020 10:59
INJECT func experiment. Alternative to REDUCE or COMPOSE.
Red [
name: 'inject
file: %inject.red
author: "Gregg Irwin"
notes: {
Red version of Ladislav Mecir's R2 `build` func. I can't find his on
the net, to link to, but can post his original if desired. His point
was that `compose` isn't always easy to use, when parens are part of
block you're composing, or how your blocks are structured, whether you
can use `/only` with `compose`. e.g.
@hiiamboris
hiiamboris / benchcollect.red
Created May 19, 2018 16:46
A `collect` mezzanine variant of improved performance and RAM footprint
Red []
; outright improvement of collect mezzanine's performance and RAM footprint
; the compiled default "collect"
collect1: :collect
; the interpreted default "collect"
collect2: func spec-of :collect body-of :collect
@dockimbel
dockimbel / persist-faces.red
Last active March 22, 2018 04:18
Save and reload a View face tree
Red [
Purpose: "Demo how to serialize/deserialize a face tree on disk"
]
mold-face: function [root [object!] return: [string!]][
foreach-face root [
face/parent: none face/state: none
if font: face/font [font/parent: none font/state: none]
if para: face/para [para/parent: none]
]
@DideC
DideC / animate.red
Created February 26, 2018 08:32
First try of an animation dialect for Red VID. Computation is not precise enough, but just a proof of concept ;-)
Red [
Purpose: "Animation system for VID"
Needs: 'View
Notes: {
Simplyfied Ease in/out formulas : http://gizma.com/easing/#l
See at the end of page source for javascripts formulas (included elastic) : http://easings.net/en
}
]
@rebolek
rebolek / Dispatch
Last active February 18, 2018 06:29
Red[]
dispatcher: func [
"Return dispatcher function that can be extended with DISPATCH"
spec [block!] "Function specification"
][
func spec [
case []
]
]
@rebolek
rebolek / where.red
Last active February 16, 2018 14:58
Find where function is defined
Red[
Title: "Where"
Purpose: "Find where function is defined"
Author: "Boleslav Březovský"
]
where: function [
"Return file where function is defined or NONE, if the definition can't be found"
'name
/in