This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vim syntax file | |
" Language: Rebol | |
" Maintainer: Mike Williams <mrw@netcomuk.co.uk> | |
" Filenames: *.r | |
" Last Change: 2001 May 09 | |
" URL: N/A | |
" Changes-by: Barry Walsh <draegtun@gmail.com> | |
" Last updated: 17-May-2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
see: https://www.reddit.com/r/dailyprogrammer/comments/5wnbsi/20170228_challenge_304_easy_little_accountant/ | |
] | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Helper functions | |
tie: function [s delim /string] [ | |
s: next s | |
forskip s 2 [insert s delim] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REBOL [ | |
Title: "Rebocalc" | |
Date: 19-Jun-2001 | |
Version: 1.0.0 | |
File: %rebocalc.r | |
Author: "Carl Sassenrath" | |
Purpose: {The world's smallest spreadsheet program, but very powerful.} | |
Email: %carl--rebol--com | |
library: [ | |
level: 'beginner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
see: https://www.reddit.com/r/dailyprogrammer/comments/5go843/20161205_challenge_294_easy_rack_management_1/ | |
] | |
scrabble: function [rack word] [ | |
rack: reverse sort copy rack | |
score: 0 | |
score-and-remove: func [s] [ | |
score: score + score-letter s/1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
see: https://www.reddit.com/r/dailyprogrammer/comments/4cb7eh/20160328_challenge_260_easy_garage_door_opener/ | |
] | |
states: [ | |
'CLOSED [click: 'OPENING blocked: '*CLOSED] | |
'OPENING [click: 'STOPPED_WHILE_OPENING complete: 'OPEN blocked: '*OPENING] | |
'OPEN [click: 'CLOSING blocked: 'OPEN_BLOCKED] | |
'CLOSING [click: 'STOPPED_WHILE_CLOSING complete: 'CLOSED blocked: 'EMERGENCY_OPENING] | |
'STOPPED_WHILE_OPENING [click: 'CLOSING blocked: '*STOPPED_WHILE_OPENING] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [] | |
comma-quibbling: func [block] [ | |
rejoin [ | |
"^{" | |
to-string use [s] [ | |
s: copy block | |
s: next s | |
forskip s 2 [insert s either tail? next s [" and "] [", "]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [] | |
; see - http://stackoverflow.com/questions/18231434/in-a-series-what-is-the-best-way-of-removing-the-last-element | |
remove-last: func [ | |
"Removes value(s) from tail of a series." | |
series [series! port! bitset! none!] | |
/part range [number!] "Removes to a given length." | |
][ | |
either part [take/last/part series range] [take/last series] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [] | |
; PHP | |
; $string = preg_replace( '/^@(.*?)@$/', '#$1#', $string ); | |
; | |
; Perl | |
; $string =~ s/^\@(.*?)\@$/#$1#/; | |
; | |
; # or... | |
; $string =~ s/\A\@(.*?)\@\Z/#$1#/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
see-gist: https://gist.github.com/miyagawa/5455942 | |
also-this: https://gist.github.com/shanselman/5422230#comment-823247 | |
comment: "My fledgling Rebol port of this Perl code" | |
requires: "Rebol/View - for https:// port" | |
github-support: "Thank you Austin@Github for (initiating) the fix for Rebol syntax highlighting" | |
] | |
split-string: func [text delim /local s coll] [ | |
coll: copy [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REBOL [ | |
Purpose: "Providing Rebol example of a Lisp macro given in HN comment" | |
HNcomment: https://news.ycombinator.com/item?id=5482124 | |
usage: "select [word-value from collection-list]" | |
] | |
select: func [block /local totals] [ | |
parse block [ | |
set this word! | |
'from |