Skip to content

Instantly share code, notes, and snippets.

Avatar

Boleslav Březovský rebolek

View GitHub Profile
View array
array: func [
"Makes and initializes a series of a given size."
[catch]
size [integer! block!] "Size or block of sizes for each dimension"
/initial "Specify an initial value for all elements"
value {Initial value (will be called each time if a function)}
/local block rest
][
if block? size [
if tail? rest: next size [rest: none]
@rebolek
rebolek / info.sh
Last active Apr 23, 2020
Get Red website running
View info.sh
#!/bin/sh
# This is what needs to be done on fresh Ubuntu 19.10
# update your system, just in cause
sudo apt-get update
sudo apt-get -y upgrade
# install required tools: curl, gnupg (applies to LXC version of Ubuntu, ISO has them)
sudo apt-get -y install curl gnupg
View incremancer
N4IghgrgLg9gylMAnKIBcAzMAbAzgUwBoRt8A3fbAVQDtsYBjAa3wBN0BGANmNIuwTIobTj3DZsAFQCWAW3wAJaQHMAFvlxQAMuUqcArMQBG9GOzQcALPu4A6DgAZ9AdmcAON10sBmNx2NIYNI0uOj6DsYwNBqcnpHRuJIwiNic1n7EEAAOyoGsMWgA2qDS5v4gNGDy6CAAQqasUKrSSJogxAwwmpIAnln4NSYwZu0ggTRM6N5iUH0DaCCsVWDKA8T4GBj4DKgWAL6EJeYATMfEldULAApIcjgABABKG6QAHjEdXVC9-YOBwaFiONJhYziBZr8Frh+iJ1pttrsOAcjugwRd5iAtNIWPcdGAmvgkKNOt05oMGqNgai3MQIRj1DgmqMNlsdpwHMiQKUpucqhiAMIwbCse4IGCBVbEr4-DFDEZAsATAy0skLIz-EL8sBZZnwtlocKc7loY4RCp8moAUWiSGUPSeEFwqilpMhIHVQRClMVIOcKrd+Btdse+LWIBZCPQDls+iNJ3K6JqAFkwJpCaKILJZFFCS7vqr3RrAWMfegAJz+jGBwl2rU6uGs3axw5ck6WXmXEC0VRC+2CkJQJAQHbSKJ5mV-T3FqkWSs1ToDocjscNyP7FvG47eDsY+rDEUKZAUNqfV2yovepUWGYFuWsMUS-BXfm6xtR+xx9CWM2Jha1HP3JIqhIDm463jm06lgac4LNWto9HWr5ro4n5oJYCYWgs-IgQA7jQ9wwBg9z-gkYFukYEGXiC7bggWcHBqGSH6tGxyoTRv4gM8DA9Aw2DBMo9zSLg9yCkKZGyhSCpXo4MGFp6XEwBQSD8qoioMGGEbMR+G7mIY5qdgAmjAEBIKKxnYIJwlJsE+AAITieS+5Ueysm3AQABiIGyEB+AACL4GArAqWpGl6rs0ZIjpX5ophdQ5kYyC4cWJL5uRlFSSCYJ0oMOaChICLinWYAMNIsxMU2bHbvpu4Ac8wQYOK6kipIPrJdK4GkRlPK0eRDSIau+qmg4HIALq
@rebolek
rebolek / missing
Created Oct 4, 2019
Missing ===end-group=== marks
View missing
>> foreach-script %./ [sg: eg: 0 parse mold data [some ["===start-group===" (sg: sg + 1) | "===end-group===" (eg: eg + 1) | skip]] unless equal? sg eg [print filename]]
./source/units/auto-tests/interp-find-test.red
./source/units/auto-tests/interp-load-test.red
./source/units/auto-tests/interp-binding-test.red
./source/units/auto-tests/run-all-interp.red
./source/units/auto-tests/run-all/recycle-test.red
./source/units/auto-tests/run-all/load-test.red
./source/units/auto-tests/run-all/find-test.red
./source/units/auto-tests/run-all/binding-test.red
./source/units/auto-tests/interp-recycle-test.red
@rebolek
rebolek / print-table.red
Created Sep 18, 2019
Print table in console
View print-table.red
Red[]
test-table: [
["Name" "Mass" "Orbit"]
["Mercury" 0.055 0.4]
["Venus" 0.815 0.7]
["Earth" 1.0 1.0]
["Mars" 0.107 1.5]
]
View test-csv.red
Red[]
#include %profile.red
#include %make-csv.red
right-now: func [][now/time/precise]
test-files: function [
][
files: read %.
View csv-results.md

Every executable is compiled 5 times, extreme values are thrown away and compile time is average of three times.

Encap versions are wrapped in do [] block.

Source code size of CSV codec is 10181 bytes for full version and 4988 bytes for lite version (~49%).

Lite version supports block of records only as Red format, full version suppoorts block of maps and map of columns also, plus some additional features like header handling.

name compile time (ms) % of original compile time difference (ms) size (bytes) % of original size difference (bytes)
@rebolek
rebolek / make-csv.red
Created Sep 1, 2019
Make CSV from simple dialect
View make-csv.red
Red[
Dialect: {
pair! (req) - block size: record size x number of records
[MAX] integer! (opt) - value size: string length for values in records. MAX
switches to variable size
}
]
make-string: func [
"Return random string!"
@rebolek
rebolek / nsource.red
Last active Jun 19, 2019
Provides source of Red native functions
View nsource.red
Red [
Title: "Nsource - native source"
Purpose: "Print source for native functions"
Author: "Boleslav Březovský"
Date: "8-6-2017"
]
indent: func [
"(Un)indent text by tab"
string [string!] "Text to (un)indent"
View build.r
Rebol [
Title: "Build"
Author: ["Ladislav Mecir" "Brian Hawley"]
File: %build.r
Date: 2-May-2006/13:36:38+2:00
History: [
7/apr/2003/19:02 {using INSERT and ONLY keywords}
30/Oct/2004/12:55 {intermediate version - alpha}
31/Oct/2004/9:49 {intermediate - word - insert/only, :word - insert}
4/Nov/2004/6:55 {word - insert and evaluate, :word - insert/only}
You can’t perform that action at this time.