• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp4382
r3wp44224
total:48606

results window for this page: [start: 14701 end: 14800]

world-name: r3wp

Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public]
Anton:
19-Jul-2007
In short, Rebol's molding of strings can be in two different formats 
depending on the input string, and depending on where you get your 
input string from, it can be hard to guess which one it is.

I would suggest to make your own Excel/CSV-string-molding function 
to ensure you have double-quotes as expected.

Other people have come to this exact same problem before, by the 
way.
Anton:
19-Jul-2007
I don't understand the exact logic of the CSV file quote formatting, 
but you could use a function similar to this:
	enquote: func [string][rejoin [{"} string {"}]]
>> print enquote "hel^"lo"
hel
lo"

and you could take it further by replacing single instances of " 
in the string with two instances, etc.
PatrickP61:
19-Jul-2007
Anton,  What do you think of this approach -- I'm just thinking it 
through and am not sure if I have covered all the bases.

Since my input can contain any number of symbols, commas, single 
and double quotes, and rarely, but possibly braces, what if I attack 
the problem a different way.  Whenever an embedded comma, or double 
quote or something like that occurs within an spreadsheet cell, it 
will require some kind of "extra" formatting like two quotes or the 
like.  It may even be that there are unique combinations of such 
symbols, rare as that would be, to have complex formatting of an 
input block for rebol to convert it properly for CSV.


What if I shift gears and look at a TAB delimited file instead.  
I know that I will never have TAB embedded in my cells, and that 
I deal with the entire block as a series instead.  I could embed 
TAB wherever needed to separate the columns and leave the remaining 
string the way it is.  Would that work, or would I still need to 
do some formatting to handle it.  I think I'll open an excel spreadsheet, 
and work in reverse to see what it needs for TAB delimited file. 
 Any comments?
PatrickP61:
20-Jul-2007
Anton,  I tried the mold-csv-string and got the following:
[
    [
Col A1
 
Col B1
] 
    [2 3] 
    [
'3
 
'4
] 
    [
4a
 
4b
] 
    [{
5a



} {



5b
}] 
    [{

6a x

} 
6b y
] 
    [
7a, x
 {7b,

 y

}] 
    [{
8a 

,x} {
8b 



y
}] 
    [{


9a

 x
} {
9b 

y


}]
]

Which is not usable for excel  -- Maybe I mis-understood how to use 
it...
PatrickP61:
20-Jul-2007
I also checked out tab delimited and the rules for that is much much 
simpler.

If a quote or comma is embedded in the string and does not start 
with a quote, then I can leave the value as it is.

The only thing I need to handle is if a value starts with a quote, 
then I need to add additional " around it, which I should be able 
to do!
PatrickP61:
20-Jul-2007
For those of you monitoring and want to see what I mean:

Out-string:	[		; (want in tab file)		; (want in excel)
	{Col A1^-Col B1^/}	; Col A1	Col B1		; Col A1	Col B1 
	{2^(tab)3^(line)}	; 2		3		;      2		     3
	{'3^-'4^/}		; '3		'4		; '3		'4
	{4a^-4b^/}		; 4a		4b		; 4a		4b
	{5a""^-"""""5b"^/}	; 5a""		"""""5b"		; 5a""		""5b
	{"""6a x"""^-6b y^/}	; """6a x"""	6b y		; "6a x"		6b y
	{7a, x^-7b," y"^/}	; 7a, x		7b," y"		; 7a, x		7b," y"
	{8a ",x^-8b "" y^/}	; 8a ",x		8b "" y		; 8a ",x		8b "" y
	{"""9a"" x"^-9b "y"^/}	; """9a"" x"	9b "y"		; "9a" x		9b "y"	
]

 write %Book2.txt Out-string 


Aside from just need to insert a ^(tab) or ^- at the appropriate 
places to separate a cell from each other, and a ^(line) or ^/ in 
a string, I will also need to check the first character of each "cell". 
 If it starts with a ", then I need to add another set around it. 
 See 5b and 9a above to see what I mean.
Gregg:
20-Jul-2007
Just skimmed here, so no new advice to add, except to say that this 
is one of those cases where it's impossible for REBOL to get it "right", 
because everybody has different rules about how it should work. I 
agree that the Excel model is a good one, and I would like to see 
it support that. REBOL also treats things differently based on whether 
there are spaces adjacent to the quotes or not, making it even more 
fun.

	http://www.rebol.net/cookbook/recipes/0018.html
PatrickP61:
20-Jul-2007
My end goal is to be able to take some formatted text of some kind, 
something that is generated by a utility of some kind, and generate 
a spreadsheet from it.  The formatted text can be of any type including 
" and the like.


I'm working in reverse, by creating a spreadsheet in MS excel with 
various kinds of data that I've shown above.  Some data with just 
alpha, just numbers, combinatins, leading quotes, trailing quotes, 
embedded quotes, embedded commas, spaces etc.  Then I saved the spreadsheet 
as CSV and another version as Tab delimited.


Then by looking at those files via notepad or other editor, I can 
see how the data must be in order for MS excel to accept it.  I initially 
had problems with the CSV model because embedded qutoes needs other 
qutoes added to that "cell" if you will.  The Tab delimited model 
has less restrictions on it.  The only thing that needs attention 
is when a "cell" starts with a quote, which needs additional quotes 
added to it.  Embedded qutoes or trailing qutoes don't need any modification.


Long story short -- I'm going with Tab delimited model and figuring 
out a rebol script to take data from an IBM utility dump (with rules 
on what data to capture), and model that info into an excel spreadsheet 
via Tab delimited file.
PatrickP61:
20-Jul-2007
Hi Gregg -- The cookbook recipe is a good one for reading and processing 
CSV's as input.  My main issue is NOT the CSV part itself.  It is 
pretty simple really.  But as usual MS has some additional formatting 
rules whenever certain characters are embedded, and that is the part 
I'm having trouble with in order for a CSV file to be loaded as a 
spreadsheet. 


You don't happen to have one that lets you write CSV files as output 
for excel (with all the special rules etc)???   :-)
Gregg:
21-Jul-2007
delimit: func [
        "Insert a delimiter between series values."
        series [series!] "Series to delimit. Will be modified."
        value            "The delimiter to insert between items."

        /skip   ;<-- be sure to use system/words/skip in this func

            size [integer!] "The number of items between delimiters. Default 
            is 1."
    ][
        ; By default, delimiters go between each item.
        ; MAX catches zero and negative sizes.
        size: max 1 any [size 1]

        ; If we aren't going to insert any delimiters, just return the series.

        ; This check means FORSKIP should always give us a series result,
        ; rather than NONE, so we can safely inline HEAD with it.
        if size + 1 > length? series [return series]
        ; We don't want a delimiter at the beginning.
        series: system/words/skip series size

        ; Use size+n because we're inserting a delimiter on each pass,

        ; and need to skip over that as well. If we're inserting a

        ; series into a string, we have to skip the length of that

        ; series. i.e. the delimiter value is more than a single item
        ; we need to skip.
        size: size + any [

            all [list? series  0] ; lists behave differently; no need to skip 
            dlm.

            all [any-string? series  series? value  length? value]
            all [any-string? series  length? form value]
            1
        ]
        head forskip series size [insert/only series value]
    ]
PatrickP61:
23-Jul-2007
Hey Gregg,  Thanks for the code.  I tried it out and while there 
is a few hicups, I am planning on using that code when I create an 
Excel CSV version in addition to the Tab delimited version.   Thank 
you!
RobertS:
1-Aug-2007
Put another way, what is the rule for when a word must explicitly 
bear the sigil prefix of  :  ? I.e., when is a get-word! required 
and when does any word suffice?  ::word is an error but   to file! 
:myString  in a func is no different from  to file! myString   and 
how do you pur carriage-returns into this message-post box!  ;-)
btiffin:
1-Aug-2007
I'm not completely clued in, but I think get-words can be faster 
as well, as the lexical scanner can skip the evaluation,  In your 
case; evaluating a filename, returns a filename, (and I only assume) 
is an extra (nearly empty?)step than just getting the filename.
btiffin:
1-Aug-2007
For instance.  a: now  gives you a date time field that won't change 
whenever you reference a or get a and it's type is date!   a: :now 
gives you an a that will be the current time whenever it is evaluated., 
but if you get-word a with :a or get 'a you get back the native, 
not the datetime, so a's type reports as native!  It's funky and 
fun.
btiffin:
1-Aug-2007
REBOL is both and more.  :)   But in that last example, although 
you may have passed the "unevaluated" logname, the function by using 
 the  value  reference, evaluates it.  :)
btiffin:
1-Aug-2007
Try func [:val]  and func ['val]  for even more fun
btiffin:
1-Aug-2007
The lexical scanner will pass the "uneval" value in the first case 
and the literal value in the second.  It is tricky, but it slowly 
starts to make sense.
btiffin:
1-Aug-2007
But I recommend practise, and let yourself be confused.  :)
btiffin:
1-Aug-2007
It's a weird time in Altme as well.  The gurus that are usually around 
to give very detailed and exact wording to these issues are all busy 
with R3, so show up here on a less regular basis.  You may have to 
filter through some tier B rebol explanations for the next few days. 
 :)
btiffin:
1-Aug-2007
Now having said that...Gregg, Geomol, many many others dish out good 
help...but watch for Gabriele, Ladislav and some others as they seem 
to have a gift for explaining things so a computer would understand 
without ambiguity.
btiffin:
1-Aug-2007
I'm in a catch-22 now...Gregg and John are gurus, they speak human 
and computer...Gabriele and Ladislav are gurus, they speak computer 
and human...Gregg and John are gurus, they speak computer and human...Gabriele 
and Ladislav are gurus, they speak human and computer...  Just like 
REBOL, I know what I want to say but it's deeper than I can express. 
 :)
btiffin:
1-Aug-2007
:)  I've never actually read the books...everything I know is from 
the Core manual, experiments and the guys here.
btiffin:
2-Aug-2007
Robert and all;  I just bumped into this one again...so I thought 
I'd mention it.


none is a weird value, in that it usually looks like none, but a 
lot of time is  'none  the word!, not the value none of type none!

My suggestion...when starting out, get used to typing  #[none]


a: [none none]   type? first a  is word!  and none? will test false.

a: [#[none] #[none]]  nice and safe...  type? first a  is none!  
and none? will test true.
Geomol:
2-Aug-2007
Is there a list anywhere of what values are actually their expected 
values, and what values are seen as words, when inside a block? As 
in:


blk: [none 1 1.2 integer! [email-:-somewhere-:-net] #an-issue 127.0.0.1]
etc. etc.

If not, someone should make one such list!
Geomol:
3-Aug-2007
Ok, why not? I was thinking about something like Gregg just did, 
but with all the datatypes. Putting the different datatypes in a 
block with a simple assignment and then check, how they're seen by 
REBOL.
btiffin:
3-Aug-2007
Carl wants such a list for   form, mold, to string!,  format (but 
that's R3), add the serial form, score some points and help the beginners 
in one grand pdf-maker datatype file.  Not much to ask, is it John? 
 :)
btiffin:
3-Aug-2007
I think it'll be a very useful and worthy entry for DocBase, but 
it would also be nice to use Gabriele's PDF-MAKER or other page layout 
for a nice reference sheet printout.
btiffin:
3-Aug-2007
So...get RT to open DocBase and I'll start right now, oh yeah and 
R3 beta for access to format  :)  Kidding... I was going to be playing 
with PDF-MAKER today, to see if I can add print functionality to 
the Desktop Librarian...maybe I'll use this as a good way learn the 
dialect.  So unless someone else steps up...I'll take a kick at it, 
for R2 datatypes anyway.
Gabriele:
4-Aug-2007
ah, a table with all datatypes and how they convert to string? that 
didn't seem to be what John was talking about :) anyway... we have 
something like that ;)
btiffin:
4-Aug-2007
True.  John is (I think) talking about a little more, the unevaluated, 
evaluated, versus serialized issue.

Like when is false false, versus (non-obviously) 'false and true.
Gabriele:
4-Aug-2007
they should all have a mold/all representation though (well, of course 
there are exceptions, like native! and so on.)
Gabriele:
4-Aug-2007
like @ and :
Geomol:
4-Aug-2007
I still think, it will be good to have a list of examples, so it 
can be actual seen, what all this means. You and I understand it, 
but does everyone else?
Gabriele:
4-Aug-2007
hmm. examples of valid and invalid words? agreed. but it's a different 
thing from a table with all datatypes and saying that some of them 
are words - that's confusing; only values of the word! type are words.
Gabriele:
4-Aug-2007
what you say instead is that some values do not have a mold representation, 
so that they mold to something that once evaluated, returns the value 
(eg make object! ... and so on).
Geomol:
4-Aug-2007
We might move to beyond "I'm new" here, but we have a slighty different 
understanding, I think.

none is always a word

There is a possible trap here for the new one. This is output from 
my terminal:

>> blk
== [none]


Is that "none"-word a word in the REBOL understanding of a word? 
It depends on, how I made it. Did I write:

>> blk: [none]
== [none]

or did I write:

>> blk: []
== []
>> append blk none
== [none]


For the programmer being new to REBOL, it may be hard to see the 
difference. And the sentence "none is always a word" may only apply 
to the situation, where values are being fed into REBOL, not when 
I write:

>> blk
== [none]

Or what?
Gabriele:
4-Aug-2007
that's the difference between not having a mold representation and 
having it.
btiffin:
4-Aug-2007
Gabriele; "there is no mystery, words are just words".


I'll reiterate what John said.  It may not be obvious to everyone. 
 It's like tying your shoelaces.  Once you know, you just "know" 
and it becomes impossible to "not know".  But until then it's a mystery 
and you trip over your shoelaces.


none always looks like none.  There is nothing obvious in a: none 
 a: [none] until you trip.  Then you know, kinda.  It is very very 
easy to trip over   if first [false] ["I trip"].  The fact that false 
and #[false] are two completely different things needs to be disseminated 
to the new user, explicitly.  Mainly because in trheory it is obvious, 
in reality it is mysterious.
btiffin:
4-Aug-2007
And as you are pointing out now...the issue is goes deep enough to 
warrant discussion among high level REBOL programmers, although perhaps 
not at the 'tieing shoelaces' level.  :)
Gabriele:
4-Aug-2007
but if you tell newbies that sometimes none is none and sometimes 
not, you're just confusing them.
btiffin:
4-Aug-2007
Yeah, I explained to Robert that the group here may have to suffer 
through some 'Tier B' advice  :)  There is a knack to explaining 
the deeper issues that can only come with enlightenment.   I have 
been trying to explain that the visible none is not the value none, 
but lack the vocabulary, based on the lack of deep understanding 
and experience.  It will come.
Geomol:
4-Aug-2007
:-) 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.
Gabriele:
5-Aug-2007
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.
Gabriele:
5-Aug-2007
directly
 and "indirectly" is quite vague.
Geomol:
5-Aug-2007
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
123 is parsed as an integer. 123.0 as decimal. 123.1.1 as tuple. 
and so on.
Gabriele:
5-Aug-2007
values like none, true, false, etc. do not have such syntax (actually, 
it has been introduced later, and it is #[none], #[true], etc.)
Gabriele:
5-Aug-2007
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
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*
Geomol:
5-Aug-2007
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
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
RobertS:
5-Aug-2007
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
RobertS:
5-Aug-2007
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!?  )
RobertS:
25-Aug-2007
; 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
RobertS:
25-Aug-2007
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 " )
RobertS:
25-Aug-2007
;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
Gabriele:
25-Aug-2007
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:
26-Aug-2007
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 
?
btiffin:
26-Aug-2007
Robert;  By definition in REBOL the only logical false values are 
#[false] and #[none]  So for instance, integer! 0 is logcally true, 
which took me by surprise at first, but that is the way of REBOL. 
 Surprise! Usually pleasant. :)


Aside: The other words that evaluate as false; no, off (others?) 
do not have a pure lexical form so, #[off] is not a loadable value 
but the word off still evaluates to #[false].


And  to logic! get/any 'an-unset-word  will evaluate as #[true], 
as back to the defintion, only #[false] and #[none] are false.  As 
far as I understand it anyway.
btiffin:
27-Aug-2007
It is kinda  Born and raised with 0 false 1 true (actually being 
a polyFORTH coder) 0 false 1 true -1 really true.  The whole all 
bits on argument.  :)
RobertS:
27-Aug-2007
I have written an alternate form of the func WHAT  that dumps to 
a file ( I have only 481 global functions at startup )

I will try to find time to build a page that gives clicks for SOURCE 
and HELP for each func in a given file dump (and maybe group them)
I tried messing with PRINT but that broke HELP and SOURCE ;-)
Gabriele:
30-Aug-2007
fold: func [

 "Applies F to the accumulator value and, successively, each value 
 in the block."
	block [any-block!] "Block of values"
	accum "Accumulator value" 
	f [any-function!] "Function to apply"
][
    foreach val block [accum: f :accum :val]
]
RobertS:
31-Aug-2007
; tutorials  on series and find/part

; I may be alone in thinking that without experimenting, a newbie 
will miss this ...  here is my experiment

; the docs say part will accept a 'range' but give no clear indication 
what a 'range' is in 2.x
text: {
    Tested this before.
    Then test these.
}

start: find text "this"
end: find start newline
item: find/part start "this" end
print item

index? find text "this"
index? start
length? start
index? end
length? end
head start
head end
index? item
head item

; by now you get that Ah-Hah experience or Eureka! or 'hot-damn!' 
as the case may be ...
RobertS:
31-Aug-2007
I would have my tutorial read:
	some series S at some position
	that same series S at some further position

And: think of 'find' as 'try to reposition current index in the series'

Without seeing the source for FIND, I have no idea yet how to explain 
that 'range' must be that very same series.  Chalk it up to lack 
of imagination...
RobertS:
31-Aug-2007
; I did a dif between the functions in VIEW and those in CORE for 
a default install.  What I get is this ( I hope it is useful to have 
al 106  in one place )

 alert  brightness?  caret-to-offset  center-face  choose  clear-face 
  clear-fields  confine  crypt-strength?

 dbug  deflag-face  desktop  dh-compute-key  dh-generate-key  dh-make-key 
  do-events  do-face  do-face-alt  do-thru  

 draw  dsa-generate-key  dsa-make-key  dsa-make-signature  dsa-verify-signature 
  dump-face  dump-pane  edge-size?  

 editor  emailer  exists-thru?  find-key-face  find-window  flag-face 
  flag-face?  flash  focus  get-face  

 get-net-info  get-style  hide  hide-popup  hilight-all  hilight-text 
  hsv-to-rgb  in-window?  inform  

 insert-event-func  inside?  install  launch-thru  layout  link-relative-path 
  load-image  load-stock  

 load-stock-block  load-thru  local-request-file  make-face  notify 
  offset-to-caret  open-events  outside?  

 overlap?  path-thru  read-net  read-thru  remove-event-func  request 
  request-color  request-date  request-dir  

 request-download  request-file  request-list  request-pass  request-text 
  reset-face  resize-face  rgb-to-hsv  

 rsa-encrypt  rsa-generate-key  rsa-make-key  screen-offset?  scroll-drag 
  scroll-face  scroll-para  set-face  

 set-font  set-para  set-style  set-user  show  show-popup  size-text 
  span?  stylize  textinfo  unfocus  

 uninstall  unlight-text  unview  vbug  view  viewed?  win-offset? 
  within?
RobertS:
3-Sep-2007
SYMBOL! is internal houskeeping for names of words (?) and a routine! 
is for working with a call to a DLL  ( of my 54 datatypes in a 2.6.3 
VIEW exec )
RobertS:
4-Sep-2007
Thanks.  And is that colours or colors?  ;-)
btiffin:
4-Sep-2007
Robert;  Make sure you check out  http://www.rebol.it/romano/and 
in particular http://www.rebol.it/romano/#sect1.1.anamonitor 3.0 
and 2.0.  Not something for your average I'm new resident but I have 
a feeling you'll appreciate Romano's utilities.
RobertS:
8-Sep-2007
the answer is interesting for  me as a newbie and lies in
>> source probe
RobertS:
8-Sep-2007
; the error from trying
>>  n: print mold m
; natually leads to
help print
; and since this fails
p: write %tmp.txt :anything"
; with
help write

; we get to clarify binding words to values, functions, procedures 
 evaluation and returned values

; I hope to get tutorials prepared for OCaml and Scheme as well as 
Haskell and Curl, Perl, Python, Ruby and Smalltalk based on my experience 
as a newbie while I am still a newbie ...
RobertS:
8-Sep-2007
both English Rebol books call print and prin 'functions'

The Rebol docs dictionary lumps all the words together as 'functions'

The challenge I have in introducing Rebol in a tutorial is to explain 
why the second expression fails:
>> c: open %temp.txt
>> d: close %temp.txt
; when explaining that the last line seen in
>> source send

; is not an indication that the function named send returns a value. 
 In many languages procedures can be called functions. Is Rebol one 
of them?

; not all mathematicians can add and many cannot teach mathematics 
but can teach naval history. and such.
Gabriele:
8-Sep-2007
they are all functions, as the all return a value. some return the 
value "unset!" which is treated somewhat specially by the interpreter. 
you cannot set a word to this value unless you use set/any, and you 
cannot get a word that refers to this value unless you use get/any.
Gabriele:
8-Sep-2007
unset! is mainly used to catch typos (eg. if you write pint instead 
of print you get an error), and it's used as a return value by functions 
that don't have anything useful to return.
RobertS:
9-Sep-2007
I wil be sure to cover  get/any  and  set/any 
thanks
RobertS:
12-Sep-2007
; I only have the issue if I build t2 to hold some functor and a 
word bound to a block rather than the block, i.e., not
>> t1: [a "one" b "two" c "three" x [f "for"]]
== [a "one" b "two" c "three" x [f "for"]]
>> t2: reduce['functor t1]
== [functor [a "one" b "two" c "three" x [f "for"]]]
>> t2/functor/c
== "three"
Chris:
13-Sep-2007
; or b) step through the path and resolve each value in turn:

resolve: func [:path [path!] /local wd val][
    wd: first path: copy path remove path val: get wd
    while [all [block? val not tail? path]]
        wd: first path remove path
        val: val/:wd
        if word? val [val: get val]
    ]
    val
]
RobertS:
13-Sep-2007
bind to two valid paths
compose with one word nested in a block
you can append all you want
type? is path
and the path will not be valid
RobertS:
13-Sep-2007
the path is just word1/word2 and then is just word1/word/word3

Only word1 ever binds to a value
RobertS:
13-Sep-2007
What should the behavior of 'join and 'append' and 'insert be when 
passed a path and a word?
Chris:
13-Sep-2007
What I'm getting at is there are limitations in the default handling 
of paths.  But paths are series and you can evaluate them however 
you want to.
RobertS:
13-Sep-2007
Here is what Carl has said:

Of course, not to discourage anyone, but we're going to be careful 
and choosy about what becomes part of R3. We've got our standards. 
We still value small, fast, and smart. REBOL is about getting great 
advantage and leverage from a well-designed tool, not about becoming 
yet another bloated and hard-to-manage computer language.
Chris:
13-Sep-2007
join foo/bar 'ton -- will try and evaluate foo/bar then append 'ton
join 'foo/bar 'ton -- will give you 'foo/bar/ton
RobertS:
13-Sep-2007
'f has no value so it is just like a functor
I am not askeing to be able to just use
   t2/f/a
with no further ado
I must build the path
   newPath: to-path reduce [ t2/f  'a]

is a pain ( and only because of how to-path is implemented;  to-lit-path 
is no more help as far as I can see at this hour
Group: rebcode ... Rebcode discussion [web-public]
BrianH:
25-Oct-2005
Something non-vote-related, would it be possible to have to-dec just 
assign the source to the destination when the source value is already 
a decimal? And the same for to-int, types adjusted?
BrianH:
25-Oct-2005
And to-int works the equivalent way.
BrianH:
25-Oct-2005
By the way, I would prefer that randz and the trigonometric opcodes 
not be renamed unless you are planning to make versions of them for 
each type. They are already documented as being type-specific and 
there's only one of each, so it shouldn't be a problem.
BrianH:
25-Oct-2005
And to-int assigns 1 when the source is an integer. They're not even 
consistent with each other.
BrianH:
26-Oct-2005
I've written a patch to the assembler that implements a working OFFSET 
directive and label value fixups. I will submit it to RAMBO as an 
enhancement request.
BrianH:
26-Oct-2005
Note that label, offset and the branches all calculate relative to 
the end of their statements.
BrianH:
26-Oct-2005
REBOL []


use [fixup-rule label-rule label-fixup-rule label-error-rule here] 
[
    ; Initialize the intermediate rules
    label-rule: make block! 0
    label-fixup-rule: make block! 0
    label-error-rule: make block! 0
    ; Build the fixup-rule based on the opcode-rule
    fixup-rule: copy/deep rebcode*/opcode-rule
    parse fixup-rule [
        some [
            here: 
            lit-word! block! '| (

                unless find ['bra 'brat 'braf] here/1 [insert here/2 [label-error-rule 
                |]]
            ) |
            lit-word! 'word! '| (

                unless 'label = here/1 [here/2: [label-error-rule | word!]]
            ) |
            lit-word! | '| | 'block! | 'series! |
            'word! (here/1: [label-error-rule | word!]) |
            'any-type! (here/1: [label-fixup-rule | any-type!]) |
            into ['integer! '| 'word! | 'word! '| 'integer!] (
                insert here/1 [label-fixup-rule |]
            ) |
            block! (insert here/1 [label-error-rule |])
        ]
    ]
    ; Replace the fix-bl function

    rebcode*/fix-bl: func [block /local labels here there label rule] 
    bind [
        labels: make block! 16
        block-action: :fix-bl
        if debug? [print "=== Fixing binding and labels... ==="]
        parse block [
            some [
                here:
                subblock-rule (here/1: bind here/1 words)
                |

                'label word! (here/1: bind here/1 words insert insert tail labels 
                here/2 index? here)
                |
                'offset word! integer! (
                    here/1: bind 'set words
                    here/3: 3 + here/3 + index? here

                    if (here/3 < 1) or (here/3 > 1 + length? block) [
                        error/with here "Offset out of bounds:"
                    ]
                )
                |
                opcode-rule (here/1: bind here/1 words)
                |
                skip (error here)
            ]
        ]
        either 0 < length? labels [
            label-rule: make block! length? labels

            foreach [key val] labels [insert insert tail label-rule to-lit-word 
            key '|]
            clear back tail label-rule

            label-fixup-rule: [there: label-rule (there/1: 2 + select labels 
            there/1)]

            label-error-rule: [label-rule (error/with here "Cannot use label 
            here:")]
            rule: fixup-rule
        ] [
            rule: opcode-rule
        ]
        parse block [
            some [
                here:
                ['bra word! | 'brat word! | 'braf word!] (

                    if not label: select labels here/2 [error/with here "Missing label:"]
                    here/2: label - index? here
                )
                |
                rule
                |
                skip (error here)
            ]
        ]
    ] rebcode*
]
Volker:
27-Oct-2005
because its assembler and 68k did it that way. dont like it too.
BrianH:
27-Oct-2005
The only advantages I can see to the dot (as opposed to the - ) is 
that it is less visually imposing and that it is easier for me to 
reach on my keyboard. These advantages are not insignificant, though.
BrianH:
28-Oct-2005
Are the labels statically replaced with offsets like they are with 
bra, done with runtime lookups of the label declaration, done with 
label offsets assigned to the words, or done some way that hasn't 
occured to me? Can numeric offsets be used, and if so are they absolute 
(within the block) or relative?
BrianH:
28-Oct-2005
Last question, can the block be passed in a word? Keep in mind that 
I am not requesting this, as there would be some negatives:

- You couldn't replace the labels statically with offsets in the 
assembler
- It would likely be slower and harder to JIT
- Copy/paste or compose can accomplish the same thing
BrianH:
28-Oct-2005
Common usage scenarios for BRAB would be C-style switch statements, 
state machines and token-threaded interpreters. Direct-threaded interpreters 
would still need BRAW, though are only practical when branching to 
an absolute offset so the current BRAW wouldn't work for them either.
BrianH:
28-Oct-2005
So you can specify numeric offsets, but they are only practical for 
a literally specified block. And you can still specify label words 
in an indirect block, so those are still useful too. Cool!
BrianH:
28-Oct-2005
-1 could be treated as a default value, and you would put its associated 
code right after the branch. But I get your point.
BrianH:
28-Oct-2005
Then you would add an extra step to the common cases of 0 and 1, 
internally?
BrianH:
28-Oct-2005
No immediate number has to be added for 0-based, and 1-based can 
be hardcoded.
Volker:
28-Oct-2005
And i guess when switching adding something is quite common.
14701 / 4860612345...146147[148] 149150...483484485486487