World: r3wp
[I'm new] Ask any question, and a helpful person will try to answer.
older newer | first last |
todun 8-Oct-2011 [4370] | I wonder why rebol didn't flag that... |
Henrik 8-Oct-2011 [4371] | it simply writes a new file, so the code is syntactically correct. |
todun 8-Oct-2011 [4372] | oh ok.. |
Henrik 8-Oct-2011 [4373] | as for my writing above, an approach would be to load the cards file and parse it into a format that is comfortable to work with in REBOL. |
todun 8-Oct-2011 [4374x2] | ok |
what about the issue of swapping though? | |
Henrik 8-Oct-2011 [4376x4] | perhaps you can try moving back one element after swapping. that might put you in the correct location. |
or perhaps use MOVE instead of SWAP | |
here is a cheap console version: http://pastebin.com/K9w9BEQ1 it does not work entirely the same as yours, but you can use it for inspiration. just ask, if there is something that you don't understand. | |
it will crash at the end, so I leave it as an exercise on how to fix that :-) | |
todun 8-Oct-2011 [4380x5] | @Henrik, thanks. How does using MOVE update the original list? |
going back to my question about using SWAP. | |
I see you moving it within the list but the file doesn't dynamically get changed using MOVE... | |
I get the following error and haven't a clue what is wrong. What normally causes this? Thanks. | |
** Access Error: Cannot open file.txt ** Where: forever ** Near: were: read/lines %were-file.txt | |
Henrik 8-Oct-2011 [4385x2] | MOVE modifies the list like SWAP does, but does not require any adjustments to index. |
** Access Error: Cannot open file.txt ** Where: forever ** Near: were: read/lines %were-file.txt That is possibly because file.txt does not exist and you are trying to read it somewhere near that line of code. | |
todun 8-Oct-2011 [4387] | @Henrik, I see. I will try to better trace the path the file takes to open. thanks. |
todun 9-Oct-2011 [4388x2] | I'm trying to trouble shoot this error I get, but not sure what it means: |
** Script Error: button-press? has no value ** Near: do view button-press? | |
Ladislav 9-Oct-2011 [4390] | It means, that you use the button-press? variable in the above expression. But, you forgot to define that variable. |
todun 9-Oct-2011 [4391x7] | @Ladislav, I'm trying to use the VID dialect. This is how I start my definition of button-press?.... |
button-press: layout [ .....] | |
@Ladislav, I figured out my problem. My typo. | |
thanks. | |
@Henrik, thanks for your help. I think I've figured out most of the code and how to apply it to my situation aka HW. My previous approach was totally confusing me. | |
@Henrik, do you have any advice as to the sort of things I can be learning if I want to understand REBOL better? Like specific problem sets for instance.. The tutorials are good, but they don't seem to be getting across to me. | |
Is there a standard list of what goes into the block following the REBOL flag? I'm thinking javadocs here. Thanks. | |
Ladislav 9-Oct-2011 [4398] | http://www.rebol.com/r3/docs/concepts/scripts-headers.html |
todun 9-Oct-2011 [4399] | @Ladislav, thank you. |
Henrik 9-Oct-2011 [4400x2] | todun, I would work on learning about the design of REBOL, since this is one of the primary features; It's generally well designed, very deep and ignores conventions of other languages in that it was not designed to be a "satellite language" for java or some such. It was developed on its own merits by a person who is very difficult to outsmart. I've used it for a decade and there are still concepts in it that are beyond my intellectual reach. Once you get the basic design, the rest comes on its own. |
todun, also, the structure of the program that you wrote hopefully shows that it requires a bit of discipline in organizing REBOL code, as it can be extremely free form, and it can be a little frustrating around generating VID code, because there is a lot going on in that type of code. So learning what the LAYOUT function does, (it simply generates a tree of objects, that's all), helps you to handle layout data with more confidence. I didn't write the console version through some kind of convention (other than basic formatting), but by knowing how to organize data sensibly in REBOL for the needs of the program and how simple it is to store and retrieve that from disk. There are dozens of ways that program could have been written, each equally as valid as the other. | |
todun 9-Oct-2011 [4402x3] | @Henrik, thanks for hte advice. How do I go about learning about the design of REBOL without going through specification manuals? Did you have a resource in mind? |
@Henrik, looking at your example code again, I'm not quite sure what the refinement qa/1/2 does. I thought it meant that "get list item 2 at 1 place away" but I'm not sureanymore.. | |
@Henrik, I ask because I get my results being one off. | |
Henrik 9-Oct-2011 [4405] | todun: qa/1/2, it means "get block at first position and get second item in that block" it's similar to: second first qa |
Sunanda 9-Oct-2011 [4406] | Nick Antonaccio's tutorial is an excellent place to start: http://re-bol.com/rebol.html |
todun 9-Oct-2011 [4407x8] | @Henrik, for seem reason I always get the second item in the next block. Using the same notation is there a way of getting the second item in the current block(head)? |
@Sunanda, thanks. I'm looking at it now. | |
@Henrik, I figured out the problem. I make call next on the input at the end of the button press. This causes the list to change. | |
@Henrik, I do need to do a next in the button so that whenever the button is pressed, the next question comes up. Is there a way of "holding" the list so it doesn't move around while I try to modify it? | |
@Sunanda, the tutorial helped me figure out a solution. I made a temporary variable to hold the current series then used "back". Then simply read the new series. | |
@Sunanda, thanks. | |
Is there a way of making the name of a file the header of the view? | |
For instance, in the REBOL block, the Title will be displayed as the title of the layout view. Is there a way to make this title be the name of the file read in the program? | |
Henrik 9-Oct-2011 [4415x2] | view/title layout [button] form %my-file.r |
the FORM converts the file! to a string!. | |
todun 9-Oct-2011 [4417x2] | @Henrik, I have the layout grouping all the buttons before I call the view on it like so: button-press: layout [ ...} view button-press |
trying the scheme you suggest gives me an error, and I suspect it is because of my layout | |
Henrik 9-Oct-2011 [4419] | what error do you get? |
older newer | first last |