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

World: r3wp

[Core] Discuss core issues

Volker
12-Dec-2005
[2934]
http://www.rebol.net/cgi-bin/rambo.r?sort=1&limit=1&cmd=Search&id=&pattern=forall
MichaelB
12-Dec-2005
[2935]
you're right the versions differ pretty much when doing a 'source 
on 'forall
Henrik
12-Dec-2005
[2936]
1.3.61 and 2.6.50 is somewhat older than 1.3.2. I think there are 
quite a lot of bugfixes in 1.3.2...
MichaelB
12-Dec-2005
[2937]
Yes, I'm right now just a little bit confused with the numbers anyway. 
I have to sets of icons, alphas and official and used the alphas 
for testing funcs and the like and thought they're at least as new/fixed 
as the official releases, but maybe my alpha isn't completely up-to-date 
either.
DideC
12-Dec-2005
[2938]
See http://www.rebol.net/cgi-bin/rambo.r?id=3925&
Volker
12-Dec-2005
[2939]
currently 1.3.2 is the newest version. but because no rebcode it 
gets a 0.0.-59 added.
Anton
13-Dec-2005
[2940]
Yes, FORALL was modified very recently, and the return was a bug.
MichaelB
13-Dec-2005
[2941]
can somebody give me a quick rule, why the pick-path notation evaluates 
it's picked value and pick does not (and first...) (as it should 
be a shorthand for pick)
as in:
bl: [] 
append bl func [a][print a]
bl/1 "hello" ;evaluates the function
pick bl 1 "hello" 
first bl "hello"  ; both do not

I have to do an extra 'do - I'm just curious for a reason ?!
Geomol
13-Dec-2005
[2942]
The explanation might be, that it should be possible to get the function 
without evaluating it. You can do that with PICK or FIRST:
f: pick bl 1
f: first bl

Now if bl/1 worked the same way, you always had to add DO to get 
it evaluated. So my guess is, Carl desided, that wouldn't be too 
smart, and I agree. It's the same with objects. To call a method 
(a function) within an object, you just write:
o/some-func

No DO is needed in front of that. So using path notation to get to 
a function within a block or an object will evaluate the function.
Volker
13-Dec-2005
[2943x3]
Functions in paths must be executed because of objects. Pick is used 
for data, evaluating there would lead to surprises.
Also in rebol some things do nearly the same, but not straight. So 
one can made an implicit choice. I guess that is by intention. For 
example, out of range: "pick s 1" returns none, 'first throws error. 
Or deep copy/make: blocks are copied, objects are not.
straight -> fully
MichaelB
14-Dec-2005
[2946]
Thanks for the answers. Maybe this should be noted somewhere especially 
- when I was searching for it, the only thing I found is in the documentation 
in the examples for unnamed functions. There only the path notation 
was used to extract and evaluate the functions immediately.

I agree that this evaluation is good to have and on purpose, just 
a bit too hidden for my taste (one again has to have quite some undestanding 
how Rebol works to have a resonable model for these things or a big 
memory) - as some other things in Rebol.
Ladislav
14-Dec-2005
[2947]
my Series article: http://en.wikibooks.org/wiki/REBOL_Programming/Language_Features/Series
mentions this for quite some time
MichaelB
14-Dec-2005
[2948]
:-) I didn't remember this - I guess my brain-capacity is too small. 
;-)
Ladislav
14-Dec-2005
[2949]
I don't think so
MichaelB
14-Dec-2005
[2950x2]
and I hope so :-)
I actually really think, that one of the problems Rebol has, especially 
for beginners and people from other languages, is that it's hard 
to have a small model in the head of how things work  and why, so 
that out of a small amount of knowledge most stuff can be infered, 
at least sometimes it's not too consistent. (I know belongs a bit 
into the steep vs. shallow vs. deep learning curve topic)
Geomol
14-Dec-2005
[2952x2]
Research suggest, that intelligence and memory are mutual exclusive. 
If you remember too much, it'll have a bad influence on your intelligence. 
On the other way, the ability to forget information will mean higher 
IQ. This is in agreement with, how Claude Shannon defined informatin 
in 1948 at Bell laboratories.

The trick is to remember only the absolutely crucial information 
and forget the rest. ;-)
informatin = information
MichaelB
14-Dec-2005
[2954]
Was it always like that, that make object! 'block didn't copy the 
block before and that one get's the real block used for creation 
also via third 'object ? I was a little bit surprised to be able 
to change the binding of the words in an object after creation - 
I thought this is not possible with objects - now if we only could 
extend objects ...
Henrik
14-Dec-2005
[2955]
extend?
MichaelB
14-Dec-2005
[2956]
I mean extend an object after creation
Henrik
14-Dec-2005
[2957]
as in new-obj: make old-obj [newstuff] ?
MichaelB
14-Dec-2005
[2958x2]
no, without creating a new one, just like append third 'object [x: 
'new-value]
aka extending an existing context
Henrik
14-Dec-2005
[2960]
don't know if that is possible...
MichaelB
14-Dec-2005
[2961]
unfortunately not - but anyway it's nice to be able to rebind the 
words in an objects context
Henrik
14-Dec-2005
[2962]
michaelB, see latest blog entry
MichaelB
14-Dec-2005
[2963]
yes I'm pretty surprised :-) (of course in a positive way)
Ladislav
15-Dec-2005
[2964]
any notes on this?:

>> trim/tail/with "0100" "0"
** Script Error: Invalid path value: with
** Near: trim/tail/with "0100" "0"
sqlab
15-Dec-2005
[2965]
I found that many times annoying, but it reflects the description.(
/tail and /all are mutually exclusive.
Ladislav
15-Dec-2005
[2966]
I didn't read the description, as it looks. It isn't mentioned in 
the help string, though.
sqlab
15-Dec-2005
[2967x2]
I meant the help string.
all can not be only at the tail.
only at the tail and the head
Ladislav
15-Dec-2005
[2969]
>> rebol/version
== 1.3.2.3.1
the information you mentioned is missing
sqlab
15-Dec-2005
[2970]
probably I interpreted the help string according to the observed 
behaviour.
Ladislav
15-Dec-2005
[2971x2]
aha :-)
so now the question is, if it deserves to be mentioned in RAMBO?
sqlab
15-Dec-2005
[2973]
There are many places, where I wish that the mixture of refinements 
would be more relaxed.
eg open/append/lines
Ladislav
15-Dec-2005
[2974]
maybe all these cases really deserve their place in RAMBO...
MichaelB
15-Dec-2005
[2975x5]
this is from the blog-chat: 

I liked Ladislavs function and just extended it a little bit: maybe 
bind would be nice like that - one can bind only the words one wants 
to and also only the types one likes, unless using plain, then all 
words of the same spelling get bound

old-bind: :bind

bind: func append copy third :bind [
	/only only-words [block! any-word!]
    /plain
    /local pos rule item
][
	if copy [words: copy words]
		
	either only [
		if any-word? only-words [only-words: reduce [only-words]]
    	if any-word? known-word [known-word: bind? known-word]

     if plain [forall only-words [change only-words to word! only-words/1]]

		parse words rule: [
			any [
				pos:
				set item any-word! (
					if any [
                	    all [plain find only-words to word! item]
                	    find only-words item
                	][
						item: old-bind :item known-word
						change pos :item
					]
				) | into rule | skip
			]
		]	
	][
		old-bind words known-word
	]	
]

f: g: h: i: 1
bl: ['f g h i]
c: context [f: 2 g: 3 h: 'hello]

bind/only bl c [f 'h]
get-values: [
	get to-word first bl
	get to-word second bl
	get to-word third bl
	get to-word fourth bl
]
probe reduce get-values

bind/only/plain bl c [f 'h]
probe reduce get-values

bind bl 'system
probe reduce get-values

bind/only bl c 'g
probe reduce get-values
sorry - layout got a little bit destroyed :-(
the function has still some small problems: eg: doesn't return the 
newly bound block and might change with 'plain refinement the 'only-words 
block
I hope a more correct version of only 'bind-only - just to have not 
something too wrong lurcking around

bind-only: func [

    {Binds only selected words to a context. If taken 'lit'erally even 
    just words of the same kind.} 
    words [block!]
    known-word [any-word! object! port!]
    only-words [block! any-word!]
    /lit
    /local pos rule item
][
    if any-word? only-words [only-words: reduce [only-words]]
    if any-word? known-word [known-word: bind? known-word]
    unless lit [
        only-words: copy only-words 

        forall only-words [change only-words to word! only-words/1]
    ]
	
      parse words rule: [
		any [
			pos:
			set item any-word! (
				if any [
                    				find only-words to word! :item
                    				all [lit find only-words :item]
                			][
					item: bind :item known-word
					change pos :item
				]
			) | into rule | skip
		]
	]
    words
]
I find it useful - just used it. :-)
BrianH
16-Dec-2005
[2980]
I have a simple question (I hope): What types does the hash! type 
hash? I recall it hashing strings, but does it hash words and other 
types as well? I'm wondering for what key types it would be useful 
to use a hash! to store the records. If the key type isn't hashed, 
there is no benefit over using blocks.
Volker
16-Dec-2005
[2981]
IIRC it hashes a lot now. And a benchmark is easy, fill a big block, 
search, if it is linear its hashed.
Louis
17-Dec-2005
[2982]
Is there a special symbol in the REBOL language for the Indonesian 
rupiah? I need to make a script to convert funds from US$ to Indonesian 
Rupiah.
Geomol
17-Dec-2005
[2983]
Take a look:
for i 32 255 1 [prin to-char i]