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

World: r3wp

[Core] Discuss core issues

Ladislav
5-Sep-2005
[1849]
and, moreover, copy the example I posted, don't forget #include !
Geomol
5-Sep-2005
[1850x4]
So I do
#include %prg2.r
inside mycontext in prg1.r? And then write
include %prg1.r
to run it?
>> include %prg1.r
** Script Error: o has no value
** Where: f2
** Near: o/f
oops sorry, forgot something. I got it working now.
Thanks!
Ladislav
5-Sep-2005
[1854]
you are welcome, what did you forget, btw? (asking to be able to 
warn other users)
Geomol
5-Sep-2005
[1855]
Mixed include with #include
Ladislav
5-Sep-2005
[1856x3]
yes, that is a gotcha
I should probably write some instructions
do you find INCLUDE useful?
Geomol
5-Sep-2005
[1859]
I wish, something like your include would be part of core. I'm about 
to use such a functionality with my Canvas project, but it's not 
optimal, as it is now.
Ladislav
5-Sep-2005
[1860]
INCLUDE is available for you, it would be even better if you wrote 
a few usage notes
Geomol
5-Sep-2005
[1861]
The functionality is very usefull. (Maybe your include can do a bit 
too much. I like it simple.) Maybe I could just do %include.r at 
the start of canvas.r, so people doesn't have to do it in their user.r 
files. Or I should go another way and make it one big file for now!? 
Hmmm well, I would like to do modules later on, so only the parts 
needed is included.
Ladislav
5-Sep-2005
[1862x2]
generally #include %something means "put here the contents of %something", 
while include %something means "find %something, process it and do 
the result"
regarding your questions: you can use INCLUDE to make a one big file 
if you like
Geomol
5-Sep-2005
[1864]
But as I understand it, rebol doesn't allow contexts to be mix-matched, 
like I would like to do with a simple: do %something.r
Ladislav
5-Sep-2005
[1865x3]
There is a way how to do %include in your files, if required, of 
course
DO doesn't work as that, it simply does the file without including 
its contents
in this case holds, that DO isn't the instrument that can be used 
for this kind of work
Geomol
5-Sep-2005
[1868]
How do I use INCLUDE to make one big file from scripts?
Ladislav
5-Sep-2005
[1869x3]
include/link %input-file %output-file will create a big %output-file
(which contains everything necessary to DO it)
you can try it on your example to see the difference
Geomol
5-Sep-2005
[1872x3]
Like:
include/link %prg1.r %output.r
include/line %prg2.r %output.r
?
line = link
It just makes %output.r the same as %prg2.r
Ladislav
5-Sep-2005
[1875x2]
include/link %prg1.r %complete-prg.r is enough
the %complete-prg.r will contain %prg2.r
Geomol
5-Sep-2005
[1877]
ah! :-)
Gabriele
5-Sep-2005
[1878x3]
one possible "simple" way:
do bind load %prg2.r self
but if you have nexting contexts, you're going to need multiple binds. 
also, while DO changes dir to the script's location, LOAD doesn't. 
so there is a difference. but, you can get into this kind of problems 
with #include too.
Ladislav
6-Sep-2005
[1881x2]
yes, that is another variant, although I prefer #include in this 
case (it changes dir, btw.)
(but only when doing preprocessing, i.e. some care needed anyway)
Geomol
6-Sep-2005
[1883x2]
Gabriele, thanks! That "do bind load <something> self" is, what I'm 
after. :-)
That should be in the "Idiom Dictionary", Carl was talking about: 
http://www.rebol.net/article/0113.html
(When REBOL/Services or LNS is out.)
Graham
12-Sep-2005
[1885]
anyone got a definition for ++ ?  I thought I had seen one before 
but google failed me :(
Anton
12-Sep-2005
[1886]
; original simple functions
;;++: func ['a][do compose [(to-set-word a) (a) + 1]]
;;--: func ['a][do compose [(to-set-word a) (a) - 1]]
;;+=: func ['a 'b][do compose [(to-set-word a) (a) + (b)]]
;;-=: func ['a 'b][do compose [(to-set-word a) (a) - (b)]]

;++: func ['word][set word 1 + get word]
;--: func ['word][set word -1 + get word]

; handles paths 

++: func ['v [word! path!]][do reduce [either path? v [to-set-path 
v][to-set-word v] v '+ 1]]

--: func ['v [word! path!]][do reduce [either path? v [to-set-path 
v][to-set-word v] v '- 1]]

+=: func ['v [word! path!] value][do reduce [either path? v [to-set-path 
v][to-set-word v] v '+ value]]

-=: func ['v [word! path!] value][do reduce [either path? v [to-set-path 
v][to-set-word v] v '- value]]
Graham
12-Sep-2005
[1887]
Gee, you've got a few piled away there!
Anton
12-Sep-2005
[1888]
I don't actually use them. (maybe in one old program somewhere).
Ingo
12-Sep-2005
[1889]
Just a small question: is it possible to delete directories from 
Rebol? 'delete seems not to work, or is it because the dir is not 
empty?
james_nak
12-Sep-2005
[1890x2]
Try placing a "/" at the end of the dir:  make-dir %test  delete 
%test/
Oh, and yes, it needs to be empty.
Gregg
12-Sep-2005
[1892]
There's also DELETE-DIR.
james_nak
12-Sep-2005
[1893]
See Gregg, another secret solved. I didn't see that in the dictionary.
Ingo
12-Sep-2005
[1894]
I _think_ that I had the slash, I'll be using delete-dir now. Funny 
thing I didn't know about it ... 
Thanks Gregg and James!
Volker
12-Sep-2005
[1895]
Its quite new ;)
Ingo
12-Sep-2005
[1896]
Ahh, I see ... most of the time I try things like 

>> del <tab><tab> to see if there are other words like the one which 
_just_ does not do the job, but I forgot it this time. :-)
Volker
12-Sep-2005
[1897x2]
yup. And help "set" if it is somewhere in between. Note the {"},else 
it would show help for 'set in this case. (i guess you know that, 
just in case ;)
Better example would be: help "dir" ;)