Skip to content

Instantly share code, notes, and snippets.

@hinjolicious
hinjolicious / .red
Created June 2, 2026 17:18 — forked from maximvl/.red
@steveGit's version of LC in Red
Red []
lc: function [rule] [
parse rule [
some [
s: word! 'in skip
(in: last reduce/into ['foreach s/1 s/3 make block! 4] in)
| 'if skip
(in: last reduce/into ['if to-paren s/2 make block! 4] in)
| skip '|
@hinjolicious
hinjolicious / lazy-range.red
Created May 29, 2026 06:56 — forked from toomasv/lazy-range.red
Range for on-demand evaluation
Red [
Author: "Toomas Vooglaid"
Date: 27-11-2017
]
lazy-range: function [
"Returns function that generates next value in (possibly infinite) range"
val [scalar!] "Initial value"
/step stp [scalar! block!] "By which to increment each next value"
/limit lim [integer!] "How many new values to generate"
/stop stopval [scalar! block!] "On which value to stop generation of new values; if block, then also after how may matches"
@hinjolicious
hinjolicious / range.red
Created May 29, 2026 06:55 — forked from toomasv/range.red
Range function for multiple datatypes
Red [
Author: "Toomas Vooglaid"
Date: 26-11-2017
]
range: function [val1 val2 /step stp /limit /enbase ebase /debase dbase /unicode][
stp+?: none
stp: any [stp either any [percent? val1 percent? val2] [1%][1]]
if any [all [block? stp zero? stp/3] zero? stp] [return none]
case [
debase [
@hinjolicious
hinjolicious / matrix.red
Created May 29, 2026 06:49 — forked from toomasv/matrix.red
Little matrix DSL
Red [
Author: "Toomas Vooglaid"
Date: 7-9-2017
Last-update: 4-10-2017
]
mx: context [
ctx: self
mtx: object [
rows: cols: data: none
get-col: func [col][extract at data col cols]