World: r3wp
[Core] Discuss core issues
older newer | first last |
Tomc 5-Oct-2008 [10995] | so the mention of a block in your original question wasn't an actual trequirement |
Terry 6-Oct-2008 [10996] | yeah, I was thinking post parse |
BrianH 6-Oct-2008 [10997x2] | TAKE is slower in R2.7.6+ than R3 because it is a mezzanine (but useful for forward compatibility), and because REMOVE from the beginning of a series is faster in R3. A faster way to do your last example is this: set [one two] three: parse ie none three: reform skip three 2 |
TAKE is one of the most useful new backports from R3 though :) | |
Terry 6-Oct-2008 [10999x2] | Another question. Let's say I have a func .. xyz: func[msg] [print msg] and I have a string "xyz this message" that I convert to a block blk: [xyz "this message" ] How can i set xyz in that block to equal my xyz function.. so that I can DO the block and end up with this message ? |
In other words, execute a string as though it was a function? | |
Sunanda 6-Oct-2008 [11001] | Like this? xyz: func[msg] [print msg] blk: [xyz "this message" ] blk/1: :xyz ;; set the first entry to be the function do blk ;; then do it this message ;; result! |
Terry 6-Oct-2008 [11002x2] | what if you don't know that bkl/1 will be xyz? |
hmm.. this works do load blk | |
Sunanda 6-Oct-2008 [11004] | If you are sure that bl/1 is the word that holds a function: do get to-word blk/1 blk/2 You'll need some error trapping. |
Terry 6-Oct-2008 [11005] | yeah.. and some validation too. |
Sunanda 6-Oct-2008 [11006] | Do load only seems to do what you want: do load ["xxx" "xxx" "xxx" "xxx" "end"] == "end" |
Chris 6-Oct-2008 [11007x2] | ; Also: do load/next "xyz This Message" ; is the same as do [xyz " This Message"] |
func [cmd][ all [ cmd: attempt [load/next cmd] word? cmd/1 value? cmd/1 any-function? get cmd/1 do cmd ] ] | |
Graham 7-Oct-2008 [11009x7] | Never noticed this before |
>> to-file join %test "[0].png" == %test%5B0%5D.png | |
why exactly is this necessary? Is [ and ] special characters in a filing system? | |
Getting really confused now | |
>> f: %test.png == %test.png >> f: %test[0].png ** Script Error: .png has no value ** Near: .png | |
Ok, anyone know how to access a file like this ? test[0].png | |
escaping with ^ doesn't work | |
Steeve 7-Oct-2008 [11016] | file: to-file "test[0].png" seems working on Vista |
Graham 7-Oct-2008 [11017x2] | I'm on vista ... |
>> to-file "test[0].png" == %test%5B0%5D.png | |
Steeve 7-Oct-2008 [11019] | yes but you can read or write with that, it's correctly traduced |
Graham 7-Oct-2008 [11020x3] | I'll try |
Interesting .... | |
works :) | |
Steeve 7-Oct-2008 [11023x2] | ;-) |
i'm wondering what result is produced if the real file name contains various % caracters | |
Graham 7-Oct-2008 [11025] | I don't want to know! |
Steeve 7-Oct-2008 [11026x2] | ha ha |
it's really incredible. >>to-file "test]" == %test%5D >>to-file "test%5D" == %test%5D seems identical, but rebol make the difference. Probably an obscufated stuff in the path. | |
Graham 7-Oct-2008 [11028] | needs to be consistent |
Anton 8-Oct-2008 [11029x2] | Yes, that looks like a mold bug. Or it could be a feature ! :) |
%file[0].png is loaded as three values: >> load "%test[0].png" == [%test [0] .png ] | |
amacleod 8-Oct-2008 [11031] | Any way to find the creation date of a file. I see modified? |
Gabriele 8-Oct-2008 [11032x2] | it's not a mold bug, [ is not a valid char in REBOL file! values, it has nothing to do with the OS. |
>> file: %"test[0].png" == %test%5B0%5D.png >> pick file 1 == #"t" >> pick file 5 == #"[" >> pick file 6 == #"0" >> to string! file == "test[0].png" | |
Graham 8-Oct-2008 [11034x2] | I think you can use get-modes on a file to get that data |
Should that remain that way? [ being a non-valid char in file! type | |
BrianH 8-Oct-2008 [11036] | Yes, because you can always use %"test[0].png" instead, no need for to-file. |
Graham 8-Oct-2008 [11037] | except the name is being generated programmatically |
BrianH 8-Oct-2008 [11038] | So generate all of your names in quotes. |
Graham 8-Oct-2008 [11039] | I'm interested to know why the restriction exists |
BrianH 8-Oct-2008 [11040] | It's not a restriction, it's REBOL syntax. [ is a delimiter, just like space (which also requires quotes if put in a filename). Parens too. |
Graham 8-Oct-2008 [11041x2] | and why can't we escape it? |
^[0^] | |
BrianH 8-Oct-2008 [11043] | Because escaping for file! literals is done with %, not ^. The file! type has a different syntax than the string! type. |
Graham 8-Oct-2008 [11044] | ok. |
older newer | first last |