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
f1: function [][parse [1] [set n integer!]] | |
; func [][parse [1] [set n integer!]] | |
f1 | |
; true | |
n | |
; 1 | |
f2: function [][set 'm 1] | |
; func [][set 'm 1] | |
f2 |
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
s: {^/ 2^/ 2^/ 3} | |
heredoc2: function [str [ string!] ][ | |
str: remove copy str | |
number-of-spaces-in-line: spaces: 0 ; initialize in order not to leak by parse | |
lines: split str "^/" | |
indentation: 99999999 | |
foreach line lines [ | |
parse line [copy spaces any space (number-of-spaces-in-line: length? spaces) to end] | |
if indentation > number-of-spaces-in-line [ | |
indentation: number-of-spaces-in-line |
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
b: make bitset! "ajfnxiermnpqpau" | |
; b: make bitset! "z" | |
solution1: [ | |
; make bitset! #{0000000000000000000000004A3810} | |
bl: copy [] | |
; [] | |
repeat w (length? b) [ | |
if b/:w [append bl w] | |
] | |
; bl |
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
Red [ | |
author: "Nędza Darek" | |
license: { | |
Just mention me/link to gist/github. | |
} | |
version: 0.0.1 | |
] | |
; not cached: | |
long-fact: func [ | |
n |
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
Red [ | |
info: { | |
Adds support for `op!`/`function!` based heavily on http://red.qyz.cz/dependent-types.html | |
} | |
] | |
my-assert: func [bl] [ | |
unless true = do bl [cause-error 'user 'message ["Wrong assertion!!"]] | |
] | |
afunc: func [ | |
"Make function with more checks" |
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
Red [ | |
author: "Nędza Darek" | |
license: { | |
- use/modify everywhere | |
- point to this gist | |
} | |
url: https://gitter.im/red/help?at=5b0301c3d245fe2eb7ca406c | |
info: { | |
Code that I used: | |
`profile`: https://gist.github.com/greggirwin/908d44dc069ed84cf69f053e1308390d |
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
; https://gitter.im/red/help?at=5afd5cecf04ce53632e4ae07 | |
; ex: [block! paren! path! lit-path! set-path! get-path! hash! | |
; image! ; only tuple! | |
; vector! binary! ] ; support not all data | |
; series1: [block! paren! string! file! url! path! lit-path! set-path! | |
; get-path! vector! hash! binary! tag! email! image!] | |
; any-string1: [string! file! url! tag! email!] | |
collect: func [ |
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
; rea: make deep-reactor! [ | |
rea: object [ | |
a: [1 2 3 4 5] | |
s: "abbccbba" | |
on-deep-change*: func [ | |
owner | |
word | |
target | |
action | |
new |
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
; more info here: | |
; https://gitter.im/red/red?at=5aef1a635cf0b830045e6264 | |
from: make op! func [a b] [reduce [a b]] | |
each: make op! func ['a b] [reduce [a b]] | |
keep each [x y] from [1 2 3 4] | |
; == [[keep [x y]] [1 2 3 4]] | |
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
bl: [a b | |
c | |
] | |
parse bl [any [pos: if (not new-line? pos) skip] 'c] | |
; == true | |
bl: [ a b -> a + b | |
c d -> c * (c + d) | |
] |