Skip to content

Instantly share code, notes, and snippets.

@nedzadarek
Created September 3, 2018 14:56
Show Gist options
  • Save nedzadarek/177b33cc11fade1e2ec6070ae9ad1e62 to your computer and use it in GitHub Desktop.
Save nedzadarek/177b33cc11fade1e2ec6070ae9ad1e62 to your computer and use it in GitHub Desktop.
Red [
author: "Nędza Darek"
license: "point to this gist/github"
]
get-with-paren: function [:word [word! path! paren!]] [
case [
word? word [
get get :word
]
path? word [
get get :word
]
paren? word [
do reduce [head insert back tail word 'get]
]
]
]
a: 'b
b: 42
get-with-paren a
p: 'arr/foo/baz
arr: [foo [baz 111]]
get-with-paren p
arr2: [a [1 2] b [3 4]]
p2: 'arr2/b
get-with-paren (remove next p2)
arr2; == [a [1 2] b [3]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment