Skip to content

Instantly share code, notes, and snippets.

Red []
forth: context [
prog: [1 2 3 4 5 6 7 8 '+ '+ '* 150 '+ '* '+ '* '*]
registers: ['eax 'ebx 'ecx 'edx]
register-taint: [] ; registers we've touched in this set
register-goop: [] ; registers we need to pop to use
register-sets: 0
next-register: head registers
@greggirwin
greggirwin / What's missing in Red.txt
Last active December 11, 2016 22:29
A quick list of Rebol words not yet in Red
*I tried to eliminate all my local words*
# Most important
abs ; just an alias
apply ; But, PLEASE, a better way to propagate refinements
array ; I rarely use this myself
assert
build-markup ; More general interpolation this is built on
build-tag ; Need tag! first
@greggirwin
greggirwin / arity-of.red
Last active April 12, 2021 17:47
Red arity-of function
; We have other reflective functions (words-of, body-of, etc.), but
; this is a little higher level, sounded fun to do, and may prove
; useful as we write more Red tools. It also shows how to make your
; own typesets and use them when parsing.
arity-of: function [
"Returns the fixed-part arity of a function spec"
spec [any-function! block!]
/with refs [refinement! block!] "Count one or more refinements, and add their arity"
][
@greggirwin
greggirwin / greggs-mezz.red
Last active June 21, 2018 18:54
A bunch of general purpose mezzanine funcs for Red.
Red [
File: %greggs-mezz.red
Author: "Gregg Irwin"
Purpose: "An interim mezzanine dump, while Red is still moving fast."
Tabs: 4
Comment: {
Not everything here has been well-tested or, well, tested. Most
of the functions are ports from R2, with many more to come. I'm
combining everything in one file for ease of experimentation, so
you don't have to worry about includes or dependencies with the
@greggirwin
greggirwin / trig-lab.red
Last active October 23, 2017 19:53
Interactive trig function laboratory
Red [
Title: "trig-lab.red"
Author: "Gregg Irwin"
File: %trig-lab.red
Needs: 'View
Purpose: {
See %math-lab comments for details. This script focuses
on trigonometric functions.
}
]
@DideC
DideC / Livecode enhanced
Last active February 20, 2018 19:32
Based on Dockimbel VID livecode, this is a little more advanced version where you can define Red's values used by the VID code. The window is resizable and there is spliters to rearange space.
Red [
Title: "Simple GUI livecoding demo"
Author: "Nenad Rakocevic / Didier Cadieu"
File: %livecode.red
Version: 1.2.1
Needs: 'View
Usage: {
Type VID code in the bottom right area, you will see the resulting GUI components
rendered live on the left side and fully functional (events/actors/reactors working live).
The top right area let you define Red's values to be used in your VID code, even functions or anything.
@meijeru
meijeru / %grep.red
Last active January 21, 2017 05:21
Red [
Title: "Partial grep implementation"
Purpose: {To search the input for lines containing a match
to the given pattern, specified as a regular expression}
Author: "Rudolf W. MEIJER"
File: %grep.red
Version: 0.4.0
Date: "24-Nov-2016"
Rights: "(c) Copyright 2016 Rudolf W. MEIJER"
History: [
Red [
description: {
Attempt to copy Haiku Editor
http://forthsalon.appspot.com/haiku-editor
}
todo: {
* Optimize GUI
* Add memory and words: @ !
* Add return stack and words: push pop r@
* Add mouse handling: mx my button buttons
@DideC
DideC / red-basic-editor.red
Last active January 25, 2017 21:04
A very basic text editor in VID. Handling only load and save of a file. Needs `call` to handle compilation and test of script
Red [
title: "Red basic Editor"
author: "Didier Cadieu"
version: 0.1.1
date: "25-01-2017"
]
script: make string! 10000
saved?: true
@meijeru
meijeru / split-url.red
Last active May 8, 2017 21:46
Split a url! value into components
Red [
Title: "URL splitter"
Purpose: {split a url into its compoments}
Author: "Rudolf W. MEIJER"
File: %split-url.red
Version: 0.2.0
Date: "02-Apr-2017"
Rights: "Copyright (c) Rudolf W. MEIJER"
History: [
[0.0.0 "25-Mar-2017" {Start of project}]