[Rebol School] REBOL School
hmm, I just tried for i 1 str 1, and it screams ... but maybe if given the same type, a string for e.g., maybe it takes their index value?
>> index? str == 1 >> index? end == 4
you should know, that 'end is just a reference to still the same str, which can be proven, by inserting new element into str ....
Yes, index? does it! Thanks Pekr
end: find str "d" ==> search for "d" in the "abcdef" series in memory, then create a word! 'end that hold the position of "d" in this same serie.
>> insert str "0" == "abcdef" >> str == "0abcdef" >> end == "cdef"
so 'str and 'end just hold different position in a unique string!
good point, DideC
Tried that myself, but no change in end, which Rebol version are you using?
Then, the 'for loop can work as it's positions in a unique serie!
Kees - beware - rebol series concept needs really carefull aproach - it caused me a headache when working with series, till I became accustomed to it. And still, sometimes, I use trial and error aproach in console ...
Kees - better start with a fresh session, fresh series ....
If I replace the text in str, end still equals to def", so it does not point at str any more." How do you replace the text in 'str ? If it's like this: str: "new text" then you have created a new string! in memory and point 'str to this new serie. 'str and 'end does not point anymore the same string!
try on one line in console: >> str: "abcdef" end: find str "d" print end insert str "0" print end def cdef
Kees: there are 'replace and 'change functions ....
or: >> str/3: #"1" == #"1" >> str == "0a1cdef"
to change the content of the "abcdef" string! you create in first place you have to change it in some way. Pekr used 'insert to add a character in the begining. You can change all its content like this: insert clear str "new content" then probe end give " content" So we have acted on the same string in memory.
Yes I see that now
Thank you both!
You may read the series page http://www.rebol.com/docs/core23/rebolcore-6.html
Thanks DideC, I will
Yes, that chapter is kind of ... essential imo :-)
If the two words represent the same string (but different position), then this will return true: >> same? head str head end == true
The key with series programming in Rebol is always "Is this the same serie or a new one ?" Sometimes you want to act on the same. sometimes you want to act on another. FUNDAMENTAL
#[[DIdeC str: "abcdef" ==> Create a string! in memory, put "abcdef" as its content, create a word! 'str an make it point to its head. ]] - that is not true, in fact. The proper description is as follows: str: "abcdef" is a Rebol source (or a part of it). That source is first processed by LOAD. LOAD creates the Rebol value representing "abcdef". Also, LOAD does *not* set the 'str value (yet). Later on, when the DO function evaluates the (already LOAD-ed code), it just makes the 'str variable to refer to the string value not creating anything at all (this difference is crucial).
Dide, you should make sure you understand this difference.
There is even a possibility to write: end: #[string! "abcdef" 4]
I can give you a similar description as above even for this case, if you like.
Yes you are right.
Ladislav: "this difference is crucial" Could you please explain why this difference is important? Or better why it is important to understand? I understand there is a big difference, but why it is important to know?
Endo, you may know this case: my-code: [s: "" append s #"x"] do my-code do my-code ; == "xx" my explanation is accurate for this case as well. You can see that the string (the "" value following the s: set-word) was created by LOAD only once, while append occurred twice expanding the string to contain "xx".
created by *LOAD* only once , Ok I got it now. Thanks for the explanation.
I have a question about timezones. I need to make a selector for workonomic where user can set the TimeZone Like "Europe/Ljubljana" instead of TZ offset which changes between summer/winter time depending on the timezone etc..
I assume rebol doesn't have "Labeled Timezon => current offset" capability so I am wondering if anybody had to do this and what (s)he found the best solution was? I see two ways, using external service in a lang that has such database/library (like php's ) or using the OS below (from bash) "TZ=":Pacific/Auckland" ; date +%z" ... also is there anything still I can do inside rebol, like getting some prefilled sqlite db using some lib I don't know of..
QTask may have solved this, and the source should be available somewhere. It might have been Bolek that worked on it, but I can't remember.
Yes, it's in Qtask source. I used a script to translate the TZ database to REBOL, then made a REBOL function to convert between timezones. Note, if you are using MySQL, you can have it handle timezone conversions too.
Thanks Gabriele, I found by googling that mysql can have timezone database installed and has the functions to handle it then. http://stackoverflow.com/questions/805538/in-mysql-caculating-offset-for-a-time-zone (the second answer, with a link of how to install if anyone else will be looking)
I always found I was missing some foundation about this Rebol's behaviour. I have to note it elsewhere in my own documentation system as to be able to report it someday when I'll be publishing some formal learning material about Rebol, Red and other Rebol-inspired languages. Thanks.
>> import %./cURL-binding.so ** access error: cannot open: %./cURL-binding.so reason: "not found or not valid"
Sujoy, I've also had problems loading my cURL extension library
It seems to depend on the R3 version and the Linux system
Have you tried the latest community R3 build? If that doesn't work, perhaps Carl's last release?
These problems seem quite random, so I don't feel like doing more work on R3 extensions in C. I'm having similar problems with Red extensions for different R3 versions, but at least it solves most of the dependency problems with different Linuxes
If all else fails, you need to compile the cURL extension on your system from the C source code
You have a better chance of me seeing such a question if you pose it in !R3 Extensions
When R3 was open sourced, I presume the SDK was not also open sourced? I am looking for the 'C' source code for the RSA, AES and Blowfish encryption functions.
The SDK is only for REBOL2, which was not open sourced.
To find source codes, you will need to search with google or so. "blowfish source code c" first result looks promising http://www.schneier.com/blowfish-download.html