|
|
|
|
|
by greggirwin
3368 days ago
|
|
I'll add to my reply, because this is a really good question. Red doesn't have all types in place yet (e.g. date! is coming, and maybe an @ref type, among others), but can still load the following: at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
delete %/c/temp/junk.dat
assign #DECAFBAD-7337 to John
make the main window 800x600 with a color of 255.0.0
answer: yes
Here's a quick console session showing what types it found: >> blk: [ at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
[ delete %/c/temp/junk.dat
[ assign #DECAFBAD-7337 to John
[ make the main window 800x600 with a color of 255.0.0
[ answer: yes
[ ]
== [at 10:00:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
delete %/c/temp/junk.dat
>> unique collect [foreach val blk [keep type? val]]
== [word! time! email! url! paren! file! issue! pair! tuple! set-word!]
And you can parse at that level: >> parse blk [
[ some [
[ 'window set val pair! (print ["size:" val])
[ | 'assign set val issue! (print ["issue:" val])
[ | 'link 'to set val url! (print ["link:" val])
[ | skip
[ ]
[ ]
link: http://red-lang.org
issue: DECAFBAD-7337
size: 800x600
Of course, you could do something similar in ES6. If you use template literals, your data might look like this: at time`10:00` send email`gregg@host.dom` a link to url`http://red-lang.org` paren`(ipv4`216.239.32.21`)`
delete file`%/c/temp/junk.dat`
assign issue`#DECAFBAD-7337` to John
make the main window pair`800x600` with a color of color`255.0.0`
name`answer:` bool`yes`
Sorry for getting carried away. :) |
|