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

World: r3wp

[Core] Discuss core issues

Joe
4-Sep-2007
[8696]
It seems to use the first reverse 3 but ignore the second comparator. 
Any ideas ?
btiffin
4-Sep-2007
[8697x2]
Joe;  I think you need to pass sort/compare a function! not a block! 
 The function template is [a b] and returns true or false or whether 
to swap.  Something like
sort/compare data func [a b] [a > b]

(Note: the names a and b could be any words but the function is called 
with two arguments).
Never mind my blabbering.  Learned something new today.  :)
Graham
5-Sep-2007
[8699]
Can someone remind me how bind a bunch of words to a different context? 
 I want to use the named colors in a special context.
Chris
6-Sep-2007
[8700]
colors: context [red: 255.0.0 green: 0.255.0 blue: 0.0.255]
reduce bind [red green blue] in colors 'self
Graham
6-Sep-2007
[8701]
I'll give it a go :)
[unknown: 5]
6-Sep-2007
[8702]
anyone know if REBOL runs on PocketPC?
Graham
6-Sep-2007
[8703x2]
core used to ...
wince 1.1 ?
james_nak
6-Sep-2007
[8705]
I don't know if the CE version does but: http://www.rebol.com/platforms-core.html
 (Note: these are oldies but goodies)
btiffin
7-Sep-2007
[8706]
Graham;  To quickly get all the colours, try
rebol []


do-thru http://www.rebol.org/library/scripts/capture.rcapture on 
help tuple! capture off
colors: copy []
parse to block! find get-captured newline [
    some [set col word! (append colors col) word! tuple!]
]

;; This will fail, no context
print disarm try [get first colors]
;; Now bind the words to the REBOL context
bind colors 'red  print get first colors
Gregg
10-Sep-2007
[8707]
Joe, did you try "[reverse 3 forward 2]" as your comparator?
btiffin
11-Sep-2007
[8708]
Request for opinions;  What would you rather read? 
   var: none
...
   var: either flag [value] [none]
or 
   var: if flag [value]


Assuming var can safely be none or a value but the init may not be 
close to the code.
Graham
12-Sep-2007
[8709x2]
var: pick [ value ] flag
was I allowed that option??
btiffin
12-Sep-2007
[8711]
Certainly, but that would not bounce out at me during a quick grok...perhaps 
with exposure.
Chris
12-Sep-2007
[8712]
var: all [flag value]
Gregg
12-Sep-2007
[8713]
I favor EITHER or ALL for this, in general.
Izkata
12-Sep-2007
[8714]
I'd go with the 'either or the 'if
Graham
12-Sep-2007
[8715]
Forth does it the pick way to avoid using logic
Ashley
12-Sep-2007
[8716]
'all is faster than 'if or 'either ... also more "extensible" in 
that it scales, as in:

	var: all [flag1 flag2 flag3 value]
	var: any [flag1 flag2 flag3 value]
btiffin
12-Sep-2007
[8717x2]
Thanks for the opinions gentlemen.  All over the map of course.  
But Gregg's matters most, so either it is.  :)   And I've found the 
either to be the easier grok when quick scanning, no double think 
required.  This is not in tight code, so readability wins over performance 
concerns.


And just an aside;  all [false false] returning none...kinda sucks. 
  all [none none] returning none, sure; but all [false true] should 
be false, not none.  Or change the help doc to ...and returns NONE 
at the first FALSE or NONE.  Well, it doesn't suck persay, it just 
doesn't behave as the help would suggest.
Oh, now Ashley fills in more of the picture as I was typing.  Seeing 
as I can use either or all, perhaps I'll start getting used to all 
for this idiom. :)
Chris
13-Sep-2007
[8719x2]
It's like 'if in that regard though.  'if returns none when the condition 
is false...
I guess 'all could be considered "all or nothing".
btiffin
13-Sep-2007
[8721]
Yeah, I was just griping about docs.  :)  none is fair return, and 
consistent for all cases, pun intended.
Henrik
13-Sep-2007
[8722]
this is spinning my brain:

foreach [a b] [1 2 3 4] [print get load "a"]
** Script error: a has no value

How do I bring "a" under the correct context?
Gregg
13-Sep-2007
[8723]
foreach [a b] [1 2 3 4] [print get bind load "a" 'b]
Henrik
13-Sep-2007
[8724]
gregg, thanks, it works :-)
Joe
13-Sep-2007
[8725]
Gregg, thanks, forward worked ! It's hard to know without documentation. 
How did you know ?
Gregg
14-Sep-2007
[8726]
Joe, Sorry, I thought you must have found the docs, since you got 
as far as you did. :-)

http://www.rebol.com/docs/core25.html#sect4.1.4.
james_nak
14-Sep-2007
[8727]
How do you clear out a local variable within a function? I have this 
scenario and I can't get the function to run more than once. I could 
copy the contents to a temp var but that seems silly.

a: func [ some-var /local s] [

	s: "example %text% string"
	replace/all s "%text%" some-var
]

Once I run this thing "s" never gets its orginal value.
Thanks
Alberto
14-Sep-2007
[8728]
s: copy "example %text% string"
james_nak
14-Sep-2007
[8729]
So simple. Thanks Alberto. Estas en Mexico?
Alberto
14-Sep-2007
[8730]
así es
james_nak
14-Sep-2007
[8731]
DF?
Alberto
14-Sep-2007
[8732x2]
sí, en el DF
tu dónde estás?
james_nak
14-Sep-2007
[8734]
Estoy en California acerca de Los Angeles.
Alberto
14-Sep-2007
[8735]
ok, podríamos pasar al grupo "rebol spanish" :)
james_nak
14-Sep-2007
[8736]
Habia uno hace uno o dos anos. A ver si puedo hallar lo....
PatrickP61
19-Sep-2007
[8737x2]
While doing a google search on "Rebol AS400"  I came across this 
entry dated Nov 19th 1999: 


One of the best aspects of REBOL is that it is supported on over 
35 platforms, with support for 50 or more platforms expected by the 
end of the year. One of those platforms, fortunately, is the AS/400...With 
the strength of REBOL’s cross-platform support, REBOL scripts will 
run exactly the same way on the AS/400 as they do on any other platform, 
so you can start REBOL programming before the final release of the 
AS/400 version...

--Chuck Lundgren


I work on an AS/400 and would like to get more info on this ability. 
 Anyone know of any updated info for Rebol and AS/400?
I was able to find one link at the IBM site:  http://www.ibm.com/developerworks/edu/l-dw-linuxrebol-i.html
Gregg
20-Sep-2007
[8739]
AS/400 isn't on the current short list of OSs that are kept up to 
date. It looks like the old download page has moved as well, so I 
don't know what the most recent version is.
PhilB
21-Sep-2007
[8740]
Partrick, I work on AS400's and have never seen any rebol release 
for it. The Core release for the platform was always marked as 'pending'.
PatrickP61
24-Sep-2007
[8741]
Hi Phil.  I guess it depends on what OS the AS/400 is running.  I 
have seen some references to AIX  or Linix, which Rebol does have 
a version for, although it is probably an old version.  http://www.rebol.com/platforms-core.html
james_nak
1-Oct-2007
[8742]
I was loading a file, one which contained a block of make object! 
and the other with a single make object!  I noticed that I could 
do a  "reduce" on the block and get the expected results of having 
a block of objects but I had to use "do" on the single object instead 
of reduce. What is the difference between do and reduce?
btiffin
2-Oct-2007
[8743]
It's not directly related, but Ladislav has some pretty good articles 
on this.

http://en.wikibooks.org/wiki/REBOL_Programming/Advanced/Interpreter
and http://www.fm.tul.cz/~ladislav/rebol

The core manual kind of explains things at http://rebol.com/docs/core23/rebolcore-4.html#section-4.4
Gregg
2-Oct-2007
[8744]
DO returns the last value in the block it DOes, but both evaluate, 
so I'm not sure what the exact data looks like that you're loading, 
or how you're loading it. LOAD can behave differently, based on file 
contents; returning a block or not.
james_nak
2-Oct-2007
[8745]
Thank you guys, that explains some of the behavior right off the 
bat. It was just one of those odd things to me that pops up once 
in a while.