r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

MikeL
22-Aug-2005
[1727]
Topic - needs or includes.... I am just cleaning up some scripts 
and want to use the dynamic load capability that I thought was enabled 
by pre-requisite setting in the REBOL header.    The only link I 
can find is to the Values.R in the library.   Is there a standard 
approach to this?   Now I am using Carl's %include.r from the script 
library but it does not check for prior loading.
Geomol
23-Aug-2005
[1728]
I don't think, it's initially possible to check, if a certain script 
has been loaded or not. One approach, that is often seen in C includes, 
is to have a big 'if' in the script around all the code there, which 
checks on a define, and inside the 'if' define the thing being checked 
on.


I'm searching for a good 'include' myself from time to time. One 
where it's possible to include something without full path. Maybe 
variables like system/options/path, system/options/home or system/options/boot 
should be used.
Ladislav
23-Aug-2005
[1729]
wrong, my include does it
Geomol
23-Aug-2005
[1730x2]
:-)
Ladislav, clever approach with the included block! Thanks!
Ladislav
23-Aug-2005
[1732]
check the latest INCLUDE now, http://www.fm.vslib.cz/~ladislav/rebol/include.r
Geomol
23-Aug-2005
[1733x2]
How do you include "include.r" in your projects? Something like putting 
it in the home directory and type:
do join system/options/home %include.r
It should be part of REBOL.
Ladislav
23-Aug-2005
[1735x2]
yes, I put it in %user.r together with a definition of a suitable 
INCLUDE-PATH
OTOH, if you mean how can I build a script containing INCLUDE, it 
can be done too, the easiest way is to use #include-string for that 
to prevent the "execution" of the preprocessor instructions defined 
in %include.r
Geomol
23-Aug-2005
[1737x2]
The new Core 2.6.0 in View 1.3 is running the user.r found by the 
environment variable APPDATA, it seems. On my Windows computer, it's 
in C:\Documents and Settings\John\Application Data\rebol\ , even 
if I install REBOL/View in E:\rebol\view\. Is it a good way of doing 
it? I find it a bit confusing.
WinXP, that is. I wonder, how it is under Win98, Win2000 and Linux?
MikeL
23-Aug-2005
[1739]
Thank you Ladislav.  More than I had hoped for.   p.s. is there much 
of a penalty for using include/check instead of include?
Ladislav
23-Aug-2005
[1740x3]
I didn't measure that but it doesn't matter to me, because Include 
isn't used often anyway
I think, that it is unnoticeable
the slowest part of INCLUDE work is read anyway
MikeL
23-Aug-2005
[1743]
Great then I will use include/check as the default usage and may 
save some slow file access time in sub-modules.  Thanks again.
Gabriele
23-Aug-2005
[1744]
Geomol: you should be able to change the location of user.r and so 
on during installation (note that installation location and user 
files location are two different places, but can be set to the same 
dir)
Ingo
23-Aug-2005
[1745]
Geomol: This way the executable may reside on a readonly file system. 
Sounds good to me.
BrianH
24-Aug-2005
[1746]
Geomol, that way of locating user.r on Windows is really for the 
best. Windows is a multiuser OS after all, and the APPDATA directory 
on Windows is used roughly the same as the home directory on Linux. 
Global settings can be loaded from rebol.r in the same directory 
as the View executable.
Geomol
24-Aug-2005
[1747]
I see, thanks!
Anton
24-Aug-2005
[1748]
Geomol, I have an include system as well.  It doesn't check for already 
loaded scripts but you may want to look at it.
http://www.lexicon.net/antonr/rebol/library/include.r
Geomol
24-Aug-2005
[1749]
Can't find www.lexicon.net, it seems.
Anton
24-Aug-2005
[1750]
URL is correct, perhaps try again later.
Pekr
24-Aug-2005
[1751]
I would like once again, if find/match on blocks has correct behavior? 

blk: ["Petr Krenzelok" "Richard Smolak" "Ladislav Mecir"]
find/match blk "Richar"


... will not work, and I would expect it to. At least RebDB gives 
me such functionality and it is nice to have ...
Henrik
24-Aug-2005
[1752]
doesn't find/match only work on a per element basis? otherwise it 
would be much more complex... if not strings, how would you search 
words, objects, integers, etc.?
Pekr
24-Aug-2005
[1753x2]
if it would work on per-element basis, it would work ...
actually I want someone to explain me, how is supposed find/match 
to work with blocks, if it was ever supposed to work? ;-)
Henrik
24-Aug-2005
[1755]
with per element basis, I meant full strings, not parts of a string... 
does find/match blk "Petr Krenzelok" not work?
Pekr
24-Aug-2005
[1756x3]
well, it works in a following way - find/match blk ["Petr Krenzelok" 
"Richard Smolak"] - will return block in "Ladislav Mecir" element 
position ...
which is, maybe consistent, but practically - unusable ...
I want find-each native then, like we have remove-each ...
Henrik
24-Aug-2005
[1759x2]
well, I wrote a function a while ago, which is pretty speedy for 
this purpose. I used it for real-time elimination of names in a list
it equivalents a find/all blk "petr"
Pekr
24-Aug-2005
[1761]
well, iteration - that is not the way to go in scripting language, 
is it?
Henrik
24-Aug-2005
[1762]
iteration can get very complex, very quickly... unless you only want 
to search strings
Pekr
24-Aug-2005
[1763]
but maybe RebDB does exactly that, so maybe fast enough for some 
10K of records :-)
JaimeVargas
24-Aug-2005
[1764]
How many global-mezz are necessary. You could code this one your 
self and re-used as needed.
Pekr
24-Aug-2005
[1765x2]
I don't talk about mezzs, but natives ...
ask Carl why he added remove-each as a native? ;-) you could use 
mezz too, no? ;-)
Anton
24-Aug-2005
[1767]
The FIND/MATCH behaviour seems correct to me, Pekr.
Pekr
24-Aug-2005
[1768]
correct yes - usefull - no :-)
Anton
24-Aug-2005
[1769]
In your particular case, perhaps.
Pekr
24-Aug-2005
[1770x2]
we started with remove-each, we could continue with change-each, 
find-each, no?
dunno - I would find them being consistent additions and they would 
be fast ...
Henrik
24-Aug-2005
[1772x2]
do http://hmkdesign.dk/rebol/rch4.r
requires View 1.2
code is messy, many one-letter variables :-)
JaimeVargas
24-Aug-2005
[1774x2]
find-each: func [dataset [series!] value /local result][
    result: copy []
    parse dataset [

        any [set word string! (if find word value [append result word])]
    ]
    result
]

>> find-each ["Jaime" "Carl" "Cyphre"] "a"
== ["Jaime" "Carl"]
>> find-each ["Jaime" "Carl" "Cyphre"] "y"
== ["Cyphre"]
Small modification it takes care of non-string values in the block.
Pekr
24-Aug-2005
[1776]
Ha! That is so cool. Never thought function which serves different 
purpose can be used in such case ;-)