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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

Geomol
4-Aug-2007
[717x2]
:-) We're getting closer!

Ok, we have words and we have datatypes. Words are also a datatype, 
namely of the type: word!

The exercise then is to figure out, which datatypes can be put in 
a block with a simple assignment, and which are simple words, even 
if they look like being of another datatype, when they are typed 
in.
A summary of REBOL datatype values can be found here: http://www.rebol.com/docs/core23/rebolcore-16.html
PeterWood
4-Aug-2007
[719x2]
I see it from a different point of view:

A word is a value; all values have a datatype.

All values are evaluated by Rebol.

Some values evaluate directly (ie 1, 1.999)

Some values evaluate indirectly  (ie a, b c)
ie should be eg
Gabriele
5-Aug-2007
[721x2]
i'd say that differently. some values evaluate to themselves; other 
values evaluate to some other value. a paren evaluates to the result 
of DOing it. a word evaluates to the value it's bound to. a lit-word 
evaluates to the respective word. and so on.
directly
 and "indirectly" is quite vague.
Geomol
5-Aug-2007
[723]
Gabriele, what is the correct way to specify, what's happening with 
a simple block assignment, like:
blk: [a-word 123]

It's kind of partly being reduced, so 123 ends up as a number! instead 
of a word!.
PeterWood
5-Aug-2007
[724]
Why do you say that 123 ends up as a number! instead of a word! ?

>> type? 123
== integer!
Gabriele
5-Aug-2007
[725]
123 is always a number. no evaluation needed. words cannot start 
with a digit so 123 never gets loaded as a word value.
Geomol
5-Aug-2007
[726]
From the previous discussion I got the impression, that everything 
is words, when they're typed in, or viewed as output. My reasoning 
goes as: if NONE is a word when inside a block (initally without 
specifying, what we do with that block), then everything inside a 
block must be words (initially). Then the input parser take that 
block and figure out, what's inside. Some of the stuff inside ende 
up as other datatypes (in this case integer!), others are left as 
words. Or?

What I find a bit peculiar is, that things like [integer! none +] 
are left as words and not being parsed to the expected datatypes.
Gabriele
5-Aug-2007
[727x6]
no, you're wrong
when you LOAD, text is converted to rebol values. type is determined 
by syntax.
only things that have a syntax that matches a word! are parsed as 
words
123 is parsed as an integer. 123.0 as decimal. 123.1.1 as tuple. 
and so on.
values like none, true, false, etc. do not have such syntax (actually, 
it has been introduced later, and it is #[none], #[true], etc.)
a b c d ... all match the syntax for word! values and are loaded 
as such. the spelling does not matter at all. from the point of view 
of load, there is absolutely no special meaning to the word none 
or the word false. they are just word values like any other word 
value.
Geomol
5-Aug-2007
[733x2]
Ah, I'm beginning to see the light! If integer! shoud be seen as 
a datatype!, then it has to 'read' the on the word somehow, and if 
"!" was used to distinguish it, then I couldn't use "!" in my own 
words. And none is just a word, nothing special about it's presense. 
And I could have my own none values, like: my-none: :none

But but but ... why doesn't it look it up and see, if that word has 
a value? Will that give problems? *thinking*
then it has to 'read' *that* on the word somehow
Gabriele
5-Aug-2007
[735]
looking up the values of words is something that is not what LOAD 
is supposed to do. you could load a dialect block or just some data. 
words can be used just as symbols, not to reference values.
Geomol
5-Aug-2007
[736]
So to sum it all up. To attack the problem, Brian original posted 
about none being a word! sometimes and being none! sometimes, programmers 
should learn the rules about, how REBOL distinguish values. The special 
char rules, Gabriele pointed out up there. And then, if none of those 
special chars are encountered, the sequence of characters are just 
seen as a word.
Is this correct? :-)
RobertS
5-Aug-2007
[737]
I will likely put this in any tutorial that I prepare:
	reduce [ does  [ join "R" "3" ] ]
Gabriele
5-Aug-2007
[738]
Geomol, i think that's correct, but i may have missed a few chars 
or rules, so please check the core guide.
RobertS
5-Aug-2007
[739x5]
re: comments in 'core' on the plague of MI ...

multiple inheritance works rather nicely in Curl since you are required 
to provide 'secondary'  constructors - I prefer prototype-based with 
an option for class hierarchies, personally ( try experimenting with 
Logtalk if you can find time ).  I am watching Io, the language, 
evolve as Rebol3 emerges: what is interesting to me is that I ask 
'But is that Oz ?' in Oz. ( which is multi-paradigm )  I used to 
hear a lot of 'getting it' about Prolog and Smalltalk.  After almost 
2 decades in both, I think many of them "didn't get it" ( class hierarchy 
obsessed, as ST purists are/were ).  Ruby is so much like Smalltalk 
that I am quite enjoying watching Groovy play catch-up with Ruby 

Most issues in Rebol have a parallel in Javascript; where ( for the 
neophyte) experiments with 
	typeof

in a console is about the only way for the average developer  to 
'get  it' given
	d1 = Date  // now you use d1 as a function d1()
	d2 = Date()   // d2 is a string that looks like a number   

 d3 = new Date() // d3 is an object but it is UTC but it is presented 
 local time but it is compared UTC .... 
or
	s1 = "string"
	s2 = String("string")
	s3 = new String('string')

 s3[1] = 6   // s3 is an object, as typeof of reveals; String 'equality' 
 in JavaScript even with === is no end of grief  and  for what convenience 
 ?
	s3["size"] = 6
or
	a1 = Array(42)
	a2 = new Array(42)

I think the latter 2 show just how rushed LiveScript was pushed/forced 
out to market as "LavaScript" before the Sun "StrongTalk" folks had 
much influence on the Netscape folks ....  Rebol3 is in better hands 
than 'ActionScrtpt'  as it drifts into classes - because it is being 
kept 'in hand''

The changes in Groovy as it complied with the JSR for Java scripting 
are interesting ( Groovy is almost neat as Rebol would be if it were 
confined to, say, living on  top of VisualBasic ;-)  Now to avoid 
'Rebol on Rails' ...

I think some people who adopted Spring to cope with Java would appreciate 
Rebol ( there, too, you have to 'get it ' )

 MySubClassObject.prototype = new MyParentClassObject()   // now go 
 mess with THAT object before it is useful ...
	// ...

 MySubClassObject.prototype.superclass = MyParentClass  // to fake 
 having a superclass other than Object
cannot be much easier to "get" than anything about Rebol
	use    ; now mostly use /local
and

 bind   ; modifies the block it is passed; use COPY refinement to 
 preclude this side-effect

Smalltalk80 was like "Rebol4" as compared to the first passes at 
an O-O language ...  someone who actually understands Smalltalk contexts/blocks 
and JavaScript should 'get it' with Rebol ( some of those people 
are using Seaside with Squeak, Dolphin and/or VisualWorks ST )

  my 2 cents:  a1 should have been an array of fixed size and only 
  a2 should be a Vector object
I meant that I don't much ask ''But is that Oz?" the way we ask "but 
is that "Rebol?" or "But would that be Rebol?"  It comes from my 
aversion to the questions/attacks of  purists who insisted that Turbo 
Prolog was not really a PROLOG.  Neither is what Prolog became (Prologia 
IV)

The Slate team for Smalltalk3 ( if you think of JavaScript as Smalltalk2 
 [heresy] ) now have Self and Strongtalk to look over with 15+ years 
of hindsight.
It appears to have slowed them down a lot.

I can't wait to get my hands on that Rebol3 beta ...

PS  if you don't think JavaScript was Smalltalk2, just look at Io, 
the language ;-)

PPS  the author of CTM was probably asking himself "But will they 
see that this is not Oz? " with every chapter (Peter Van Roy,  'Concepts, 
Techniques and Models of CP', MIT Press) - the O-O chapter is arguably 
the worst flaw in a fine MIT intro book - unless it is the flaw of 
totally ignoring JavaScript as a functional prototype-based lang. 
( and I don't recall mention of Curl or Rebol )

Another language evolving: Cecil into Diesel
ah, c'mon
	mold/all reduce [ does [ join "Rebol" "3"]]
is cute ...

 ( as I wait to be reduced to a puddle one atom thick for failing 
 to fit the mold )
I'll keep my posts, well, shorter.  Promise. sorta
it's my 'Liquid Rebol' joke; it belongs in chat.  New people always 
post in the wrong threads.  Better "I'm new" than "They're new" or 
"We're new"
	joke = new Rebol(2)  // javascript

 funnier: make classInstance! RebolObject [prototype! classObject! 
 object! ]
;; this is neat

 mold make object! ["test"]   ;; warning: to preserve a spec block 
 be sure to use    obj: make object! copy/deep specBlk

;; copy/deep issues are rampant in Smalltalk ( if you get the impression 
that I think Smalltalkers neglect Rebol, yer rite )
Geomol
5-Aug-2007
[744]
In relation to Roberts post:

>> load mold reduce [ does [ join "Rebol" "3"]]
== [func [] [join "Rebol" "3"]]
>> load mold/all reduce [ does [ join "Rebol" "3"]]
** Syntax Error: Invalid construct -- #[
** Near: (line 1) [#[function! [][join "Rebol" "3"]]]

What!? :-)
Gabriele
5-Aug-2007
[745]
geomol, that's a bug. i think it's in rambo too.
RobertS
5-Aug-2007
[746x4]
load mold/all reduce [does [join [ Rebol" "3" ]] ;; thanks. In STSC 
APL we could use 'load' or 'laod' ...
laod: :load  ;; Rebol3 is free of wordspace worry size anxiety
;; my Rebol tutorial would include something on quotes , such as
	>>'test'
	== test'
	>>mold 'test'
	== "test''"

 >>mold join 'test' "tested"  ; note use of {} to avoid double double-quotes
	>> ""test""  ;; error - but which error and why?

 >> "'test''"  ;; be-aware that PDF files may use left-single-quote, 
 right-single-quote, left-double-quote  and single-quote != apostrophe 
 != backtick ...
;; and definitely something to include 
	>> help rejoin
	>> source rejoin

( I am now talking with a publisher. Hurray!  The hard part is behind 
me!   Now to have some fun ...   Dead-line?  What dead-line was that? 
 When!?  )
>>system/console/prompt: [ reform [ now/time ">> "]]  ;; good tutorial 
candidate from 'Rebol for Dummies' by Ralph Roberts
>>to-integer #2A  ;; Hex. But what was the question?

>>big-Q: does [ rejoin [ none ". But the answer is: " to integer! 
#2A]]
>>big-Q

>>little-Q: [ rejoin [ none ". But the answer is: " to integer! #2A]]
>> do little-Q

>> do big-Q ;; now you get an error because none is the has-no-value 
word
>> type? none 
>> path? 'none/first
;; 24Arghhh!{]}['   there was a typo 2 posts back ... cannot go back 
4 2 posts ...
;;

load mold/all reduce [does [join [ "Rebol" "3" ]]] ;;  typo. Arggh!!! 
 in code ending:  " thanks.  In STSC APL blah-blah "
laod: :load
laod mold/all reduce [does [rejoin [ Rebol" "3" ]]] ;; better
laod mold/all reduce does [join [ Rebol" "3" ]]  ;; huh?
mold/all reduce does [join [ Rebol" "3" ]]  ;; oh ...

comment {
	[func [][rejoin ["Rebol" 3]]]
versus
	{#[function! [][rejoin ["Rebol" "3"]]]}
}
pg 329 ff of the old 'Official Guide' book is a treatment of 
	reduce [none]

that is so very fine, I suppose, because so well-motivated by its 
context.


>> type? first reduce [none]    ;; compare this to:   type? first 
[none]

>> type? first reduce [yes]	;; compare this to:   type? first [yes]
RobertS
25-Aug-2007
[750]
set  get 
this might not be obvious if you are new ( like me )
beBoundToWord: 'aWord
set :beBoundToWord 42
print aWord 
get :beBoundToWord
word? :beBoundToWord
Henrik
25-Aug-2007
[751]
you mean the last line?
RobertS
25-Aug-2007
[752]
; this also not so obvious  about index versus path
  blk: [ t' t'' t''' ]
  blk/t'
  blk/1
  blk/t': 42
  blk
  set blk/1 21
  blk
  blk/1
  :blk/1
  get blk/1
blk2:  [ a' b' c' ]  
  set blk2/a' 42
  blk2
  blk2/2
  blk2/a'
  get blk2/a'
Henrik
25-Aug-2007
[753x2]
actually what you are finding confusing, I think, is a simple rule 
that paths point to the next element in the block, where index does 
not.
so it works like it should :-) but this is the rule. this way you 
can quickly access words in a block through a path.
RobertS
25-Aug-2007
[755x4]
; one thing I failed to note with the  set  and  get 
>> aWord
** Script Error: aWord has no value
** Near: aWord
>> 'aWord
== aWord
>> aWord
** Script Error: aWord has no value
** Near: aWord
>> word? aWord
** Script Error: aWord has no value
** Near: word? aWord
>> word? 'aWord
== true
>> a: 'aWord
== aWord
>> aWord
** Script Error: aWord has no value
** Near: aWord
>> word? :a
== true
>> :aWord
** Script Error: aWord has no value
** Near: :aWord
>> :a
== aWord

; this seems worth getting clear:  that a word can be a value and 
still not be used until it has a value
oh, I am not confused -.. I put this for anyone who is new to explore 
-- but thanks
More and more I think that was is not obvious is no longer obvious 
once it is obvious

There is an 'active' LISP tutorial that would be a good model for 
a 'Rebol for newbies'

I would like to use the approach taken in the 2.3 "Official Guide" 
book to introduce unit testing in Rebol for TDD "from-the-get-go"

In Smaltlalk we used to count on newbies exploring in a workspace: 
we reaped a culture where people thoght the point of O-O was to write 
subclasses and create deep hierarchies like, say, Collection.  What 
was obvious was just wrong.  Messages were the point, not classes, 
let alone sub-classing.  Am I wrong to suggest to anyone new: "buy 
as used copy of "The Official Guide" " ?  For Oz, which is so much 
like Rebol, I do not hesitate to recommend Peter Van Roy's CTM from 
MIT Press.  Scheme has 'Little Schemer' and 'Simply Scheme'   The 
latter would be my model for an interactive tutorial in which you 
LEARN.  Smalltalk was supposed to be about how we model things ( 
how we learn how things interact )

I think it fair to say that it failed.  Classes were not the point. 
 Objects were not the point.  Things went wrong early on in abandoning 
the Actor Model in early 70's     I am hoping Rebol3  is getting 
it right ;-)   ( Io, the language, is quite inspiring ( www.iolanguage.com 
) but I still think Oz is a great intro to Rebol (they, too, lack 
an effective learning tool to "think in Oz " )
;One tip if you are new like me
  save %hist_001.r system/console/history
; then in user.r
  system/console/history: load %hist_001.r
: when you have materials worth reviewing as you learn ....


; PS  I meant 'former' as model, i.e, "Little Schemer"  "Seasoned 
Schemer" "Reasoned Schemer"

Prolog has the 'Art of .. ' 'Craft of ' and 'Practice of Prolog' 
series
Henrik
25-Aug-2007
[759]
robert, we are building a Wiki for R3. would you be interested in 
doing smalltalk vs. prolog vs. other-languages-you-know vs. Rebol?
RobertS
25-Aug-2007
[760]
would love to
Henrik
25-Aug-2007
[761]
excellent. I will try to make arrangements.
btiffin
25-Aug-2007
[762]
Robert;  I struggled trying to explain 'word'  in the new Glossary. 
 Yes, it needs to be well documented for those of us that can't tie 
our REBOL shoelaces with one-hand yet.  Once you can tie shoelaces 
it's almost impossible to forget how, but until then the obvious 
is obviously non-obvious.
Gabriele
25-Aug-2007
[763]
messages: agreed, that's the interesting part. too bad the C++ and 
Java guys have no idea :) I think that rebol/services could cover 
that part well. you can even compare that to an erlang-style collection 
of nodes communicating thru messages.
RobertS
25-Aug-2007
[764]
It is nice to see Joe Armstrong's 'Erlang' book in print with Pragmatic. 
 Does someone here know Dave Thomas at Prag Prog I wonder?
RobertS
26-Aug-2007
[765x2]
Can u tell me why we use datetype  unset!  in the func  list-dir 
 but not in the func  to-logic 
I.e.  why do we not have
   to logic!
return false when I pass in it an unset!
?

Or am I missing something here ?  Maybe I miss what is the diff between 
 'qwetr  being type set-word! and it not having a binding yet or 
my having sent
    unset 'qwetr

Is this like the  diff in other lang's between  nil_or_null and undefined_or_undeclared 
?
oh I see

   listdir   ; the param is not there, i.e., we have something unset!

    listdir qwetr  ; errror


But could the latter not return false a la negation-as-failure meaning 
I cannot browse your putative directory ?


I guess I am asking " What is the Rebolesque way of seeing this? 
"