World: r3wp
[Core] Discuss core issues
older newer | first last |
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. |
BrianH 8-Oct-2008 [11045] | The file! and url! types use url-encoding for their literals. At least with files you can quote them. |
Anton 8-Oct-2008 [11046x3] | Gabriele, see above where Steeve wrote "it's really incredible." |
The first one is url-encoded, the second one isn't (when it probably should, I think). | |
Or maybe that's exactly what you're saying ... | |
amacleod 8-Oct-2008 [11049] | get-modes! That's it ! Thanks Graham! |
BrianH 8-Oct-2008 [11050] | Anton, Steeve, you have found a bug in file display. The % should definitely be url-encoded. |
Brock 9-Oct-2008 [11051x2] | QUESTION: I have a function that takes on parameter. This parameter can be one of many variables. I then want to see what the name of the parameter was that was processed by the function. How do I do this? |
sample function calls: my-trim name my-trim address my-trim phone what I would like to get from this is the name of the word that was passed to the function, so I can conditionaly process the data. | |
Dockimbel 9-Oct-2008 [11053] | I guess that you're searching for this : http://www.rebol.com/docs/core23/rebolcore-9.html#section-3.2 |
Brock 9-Oct-2008 [11054x2] | I'll take a look. Thanks. |
Hmm, after looking at this, I then have the reverse problem for the remainder of the code, it now doesn't get the value of the parameter that was passed. I'll need to play with this a while longer, but it looks like I'm heading in the right direction. Tx. | |
Dockimbel 9-Oct-2008 [11056] | >> name: "rebol" == "rebol" >> my-trim: func ['word][print [word ":" get word]] >> my-trim name name : rebol |
Gregg 9-Oct-2008 [11057] | I've gotten away from using lit-word params for the most part. Instead, I use the lit-word as the arg. my-trim: func [word] [print [word ":" get word]] my-trim 'name |
Will 9-Oct-2008 [11058] | why that Gregg? |
Terry 11-Oct-2008 [11059] | I knew this at one time, but is there a way to test if a word has been set / exists, that doesn't involve error trapping? >> if error? try [n][print "error"] error |
Graham 11-Oct-2008 [11060x2] | value? ''word |
'word | |
Terry 11-Oct-2008 [11062] | wasn't there an isset? function one time? |
Graham 11-Oct-2008 [11063] | php? |
Terry 11-Oct-2008 [11064x3] | hmm. .yeah |
:) | |
>> value? to-lit-word "monkey" == false >> isset?: func[str][value? to-lit-word str] == [value? to-lit-word str] >> isset? "monkey" == "monkey" ?? | |
Pekr 11-Oct-2008 [11067] | >> isset?: func[str][value? to-lit-word str] >> isset? "monkey" == false |
Terry 11-Oct-2008 [11068] | hmm.. working here now too. must have messed up the function somehow. |
Graham 11-Oct-2008 [11069] | >> isset?: :value? >> isset? 'test == false >> isset? 'rebol == true |
Henrik 11-Oct-2008 [11070] | don't you have to be careful with the binding when doing value? to-word "something" ? |
Terry 11-Oct-2008 [11071] | Im using it to check a parsed block to see if the value is set.. is there a better way? |
Claude 11-Oct-2008 [11072x2] | hi, i would like to know how to open a port with rebol in FTP to connect a ISERIES or IBM I or AS400 and execute commande like this on "quote namemft 1" or "cd /" or "quote syscmd call a PGM" |
i would like to do it like in dos windows that the FTP command can take a file as input and then execute all commands in that file | |
BrianH 11-Oct-2008 [11074x4] | If you do to-word "something" in R2 the word returned will be bound to the global context, so it will only have a value if a word of that name in the global context already has a value. It doesn't matter if you do to-word in a function. |
Terry, I have found that the best way to check if a value has been set to a word in a parse rule, the best way is to set the word to none before you run the parse rule (or at the beginning of the rule in a paren), then check to see if it is still none afterwards. | |
You can use NONE? to do that, or the checker for whatever datatype you are looking for if you want a positive result. The IF function also treats NONE as false, so if you are not looking for logic values you can use it directly. Like this: a: none parse [1 2 3] [set a integer!] ; will return false if a [ ; you found it, do something ] If you think the value you are testing might be an active value (like a function), refer to it with a get-word! for safety, like :a. | |
The none technique especially words for string parsing and the copy operation because it sets the word to none if there was an empty string copied, useful to know. | |
older newer | first last |