Red Mezz Warehouse
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hiiamboris a22e4c1d84 FIX: get-word notation 2 weeks ago
README.md FEAT: step function 4 weeks ago
apply.red FEAT: support for lit-args/get-args 1 year ago
assert.md DOC: unconditional tests 1 year ago
assert.red FEAT: dump stack trace on assertions 3 months ago
bind-only.red DOC: better intro 1 year ago
bmatch.red FEAT: BMATCH now based on lexer/transcode 2 years ago
bulk.red FEAT: #assert full redesign 1 year ago
catchers.red FEAT: #assert full redesign 1 year ago
clock-each.red FEAT: proper inline profiler 1 year ago
clock.red FEAT: switch clock to utc 4 months ago
collect-set-words.red DOC: notes on collecting approaches' quirks 2 1 year ago
composite.md DOC: added rawstrings 1 year ago
composite.red FIX: comment the failing test 1 month ago
contrast-with.red FIX: comment out tests 9 months ago
count.red FEAT: enhanced count 9 months ago
debug.red FIX: #debug set didn't trigger default #debug 1 year ago
do-atomic.red initial commit 2 years ago
do-queued-events.red initial commit 2 years ago
do-unseen.red FEAT: DO-UNSEEN mezz 2 years ago
embed-image.red FEAT: #embed-image macro 1 year ago
error-macro.red FIX: workarounds for R2 compileability 9 months ago
everything.red FEAT: step function 4 weeks ago
expect.red FIX: simpler expect 2 years ago
explore.red crashing commit 1 year ago
extremi.red DOC: design note for extremi 2 years ago
for-each-reshape.red added RESHAPE variant of FOR-EACH 2 years ago
for-each.red FIX: redirect old *each to new 1 month ago
foreach-design.md added a note about mixed offset types 6 months ago
format-number.red FEAT: space padding support 1 year ago
format-readable.red FIX: minor formatting 11 months ago
forparse.red FIX: match the rule at the end as well 3 months ago
glob-test.red initial commit 2 years ago
glob.md Update glob.md 2 years ago
glob.red FIX: compiler friendlier GLOB per Nenad's idea 2 years ago
include-once.red FEAT: sacrificed x: #include y for context [#include x] 2 months ago
is-face.red FIX: remove old map-each inclusion 4 months ago
keep-type.red initial commit 2 years ago
leak-check.red FEAT: leak checker 6 months ago
localize-macro.red DOC: note on naming 1 year ago
map-each.red FIX: redirect old *each to new 1 month ago
mapparse.red FIX: match the rule at the end as well 3 months ago
median.red FEAT: added median 11 months ago
modulo-plot.red FEAT: added MODULO 2 years ago
modulo.red FEAT: #assert full redesign 1 year ago
morph.md FEAT: a few more tests 10 months ago
morph.red FIX: preserve new-line status 9 months ago
new-apply.red FIX: get-word notation 2 weeks ago
new-count.red FEAT: #assert full redesign 1 year ago
new-each.red FIX: bug with series not at head 4 months ago
new-replace.red FEAT: attempt at new replace 1 year ago
prettify.red FEAT: Draw support 5 months ago
print-macro.red FEAT: #print macro 1 year ago
profiling.red FIX: workaround for some rounding bug: /size=0 -> 0.0% 4 months ago
pull-react.red FEAT: second pull reactivity experiment 5 months ago
pull-react2.red FEAT: second pull reactivity experiment 5 months ago
reactor92.red DOC: comment on reordering 10 months ago
relativity.red FIX: workaround for #4740 on GTK 1 year ago
reshape.md typo in headache inducing example 1 year ago
reshape.red FIX: no need in #4980 workaround anymore 1 month ago
scoping.red FIX: added scopes 4 months ago
scrollpanel-test.red FIX: smaller demo window 2 years ago
scrollpanel.md FIX: gif size issues 2 years ago
scrollpanel.red FIX: missing 'tail' 2 years ago
selective-catch.red DOC: warning memo to myself ugh 3 months ago
setters.red FIX: support get-word/get-path by quietly 3 weeks ago
shallow-trace.red FIX: no longer shadowing internal TRACE 5 months ago
show-deep-trace.red FEAT: added preview to trace-deep 1 year ago
show-trace.red FIX: no longer shadowing internal TRACE 5 months ago
sift-locate.md DOC: 201730163 1 year ago
sift-locate.red FIX: multiple regressions in the new build 7 months ago
smartload.red FEAT: BMATCH mezz & SMARTLOAD experiment 2 years ago
step.red FEAT: step function 4 weeks ago
stepwise-func.red FIX: no longer shadowing internal TRACE 5 months ago
stepwise-macro.red FIX: for the old preprocessor not to freeze 2 years ago
table-test.red FIX: updated for newer builds 5 months ago
table.red FIX: updated for newer builds 5 months ago
tabs.red FEAT: #assert full redesign 1 year ago
timestamp.red initial commit 2 years ago
trace-deep.red FIX: prevent word leakage 7 months ago
tracing.md DOC: longer apostrophes 8 months ago
typecheck.red FIX: some bugs 4 months ago
with.red FEAT: #assert full redesign 1 year ago
xyloop.red FEAT: XYLOOP supports set-word counter for automatic /local-ization 2 years ago

README.md

Official URL of this project: https://codeberg.org/hiiamboris/red-common

A collection of my Red mezzanines & macros

Some of these are trivial. Some may look simple in code, but are a result long design process. Some are only emerging experiments. See headers of each file for usage, info, design info!

Notes:

  • most scripts are standalone, I tried to keep dependencies at minimum
  • mostly untested for compileability so far; optimized for the interpreted use
  • use #include %everything.red to include all the scripts at once and play

Navigate by category:

By category:

Recent implementations, not yet incorporated into the whole

Source file Description
map, fold, scan, sum, partition (external) Fast FP-like HOFs, as alternative to dialected *each (routines, require compilation)
new apply Waits for #4854 to be fixed and then I can start porting it to R/S
new for-each, map-each, remove-each Waits for Gregg's review then I can start porting it to R/S
new count Based on the new apply, waits for it's R/S implementation
sift & locate Based on the new-each and new-apply. Read more
new replace Based on the new apply, but awaits team consensus on design

General purpose

Source file Description
setters Contains ONCE, DEFAULT, MAYBE, QUIETLY, ANONYMIZE value assignment wrappers, and IMPORT/EXPORT to expose some object's words globally
step STEP - increment & decrement function useful for code readability
catchers TRAP - enhanced TRY, FCATCH - Filtered catch, and PCATCH - Pattern-matched catch
#include macro Smart replacement for #include directive that includes every file only once
with A convenient/readable BIND variant
#localize macro Automatic set-word and loop counter hiding
bind-only Selectively bind a word or a few only
apply Call a function with arguments specified as key-value pairs
timestamp Ready-to-use and simple timestamp formatter for naming files
stepwise-macro and stepwise-func Allows you write long compound expressions as a sequence of steps
trace Step-by-step evaluation of a block of expressions with a callback
trace-deep Step-by-step evaluation of each sub-expression with a callback
selective-catch Catch break/continue/etc. - for use in building custom loops
prettify Automatically fill some (possibly flat) code with new-line markers for readability
reshape Advanced code construction dialect to replace compose and build. Read more
leak-check Find words leaking from complex code
modulo Working modulo implementation with tests
Source file Description
extremi Find minimum and maximum points over a series
median Find median value of a sample
count Count occurences of an item in the series
keep-type Filter list using accepted type or typeset
collect-set-words Deeply collect set-words from a block of code
morph Dialect for persistent local series mapping. Read more

Loops

Source file Description
xyloop Iterate over 2D area - image or just size
forparse Leverage parse power to filter series
for-each Experimental design of an extended FOREACH
map-each Map one series into another, leveraging FOR-EACH power
bulk Bulk evaluation syntax support. Read more]

Interestingly, for-each and map-each code showcases how limited compose is when building complex nested code with a lot of special cases. It works, but uglifies it so much that a question constantly arises: can we do something better than compose? These two functions will serve as a great playground for such an experiment.

Debugging

These functions mainly help one follow design-by-contract guidelines in one's code.

Source file Description
debug Simple macro to include some debug-mode-only code/data
assert Allow embedding sanity checks into the code, to limit error propagation and simplify debugging. Read more
typecheck Mini-DSL for type checking and constraint validity insurance
expect Test a condition, showing full backtrace when it fails
show-trace Example TRACE wrapper that just prints the evaluation log to console
show-deep-trace Example TRACE-DEEP wrapper that just prints the evaluation log to console

Profiling

Source file Description
clock Simple, even minimal, mezz for timing code execution
clock-each Allows you to profile each expression in a block of code (obsolete)
profiling Inline profiling macros and functions (documented in the header)

Formatting

Source file Description
entab & detab Tabs to spaces conversion and back
format-number Simple number formatter with the ability to control integer & fractional parts size

String interpolation

Source file Description
composite macro & mezz String interpolation both at run-time and load-time. Read more
ERROR macro Shortcut for raising an error using string interpolation for the message. Read more
#print macro Shortcut for print #composite

Filesystem scanning

Source file Description
glob Allows you to recursively list files. Read more. Run tests

Graphics & Reactivity

Source file Description
relativity Face coordinate systems translation mezzanines
contrast-with Pick a color that would contrast with the given one
is-face? Reliable replacement for FACE? which doesn't work on user-defined faces
do-queued-events Flush the View event queue
do-atomic Atomically execute a piece of code that triggers reactions
do-unseen Disable View redraws from triggering during given code evaluation
embed-image Macro to compile images into exe
explore & image-explorer style Show UI to explore an image in detail (TODO: support any Red value)
scrollpanel style Automatic scrolling capability to a panel, until such is available out of the box. Read more
table style WIP experiment on VID-based table construction