[Core] Discuss core issues
difference in recent versions will subtract dates and times
hmm, not sure .... is difference any different from date1 - date2
I mean - when substracting two 'now values, the time is not being taken into account ..
>> a: now - 125:00:00 == 19-Mar-2006/9:08:07 >> a - now == -5 ;; five days >> difference a now == -125:00:16 ;;; 125 hours That's the difference! >>
There must be no timezone present
why should be difference call different to simple usage of minus op?
it's a strange hack -- difference was originally for sets. So making it work for time is seriously non-orthogonal.
I hate those hacks
Maybe we need three types instead of two. date! time! and idate! or stamp!
difference hadles timezones too.
I don't like hacks, but the minus op is a very practical shortcut. Should it try to be smart and return days if no time exists for either arg; otherwise do the same thing DIFFERENCE does (and what time do you assume if only given for one arg; midnight UTC?)?
Can rebol do hashes of hashes, arrays of hashes, hashes of arrays, data structures within data structures, similar to the way Perl does it with references?
I haven't actually seen documentation which explains concisely how to accomplish this with Rebol
it would be interesting if it could also do arrays of objects, and hashes of objects
but let's say I set some words to some blocks, and I put those words into another block, do I always have to reduce to actually see the stuff pointed to by the words in the blocks, or is there a way to actually insert the content of the words themselves into the blocks
You can reduce or not; that is, the choice of when to evaluate is up to you; and, yes, any type of block can contain any type of data nested to any level.
You need to be aware that the behavior of lists is *slightly* different than for blocks and hashes, WRT what INSERT does, etc. The Core manual covers it correctly I think.
but I mean, I don't want to have to reduce, I want to insert the actual values of the words into the list, not the word itself
when I insert the word, I have to reduce to show what the contents of the word actually are
let's say a: [value1 value2 value3]
and I want b to have a in it
b: [a] will have the word a, not value1 value2 value3
what I do b: [a] and have it put value1 value2 value3 in b instead of a itself
you can do B: REDUCE[A], but if don't want to reduce you can also do sth. like B: [ ] APPEND B A But I think what your looking for is sth. like >> a: [1 2 3] b: [ ] >> append/only b a >> probe b >> [ [ 1 2 3 ] ] >> clear a == [ ] >> probe b == [ [ ] ] >> append a 4 probe b == [ [ 4 ] ]
why exactly is it called reduce also?
Because it reduce the words to their values?
It reduces the expressions found within the block (and it returns the results in a new block).
I am also perplexed why rebol doesn't have a substring function, sure even if you can create one with a few extra commands, it seems to me like most people don't want to have to invent a language, just to use the functionality that exists.
or I should rephrase that, to use functionality that exists in other languages
I hope rebol 3.0 has a substring function built in
even if source substring shows me the copy/part at stuff
A line in the sand has to be drawn somewhere.
substring is far more intuitive for someone who hasn't used rebol before than copy/part at
Gregg has posted a dialected substring function.
rebol's help also should have a see also at the bottom of commands, to direct attention to other rebol commands and functions of interest
the language as a whole feels very fragmented, I recognize the power of Rebol only because of its lispy nature, but I feel limited compared to a language like perl, because examples are far too scattered about, and the names for functions are often oddly named or sometimes the functionality exists but is so obscured that I never knew it was there at all in the first place
I hope more is done to actually document the language when 3.0 rolls out
and sure perl ain't the prettiest languages on earth, but it is well documented
for example, how could I take a date, and add 3 months or 3 weeks to the date?
a CPAN for Rebol?
hmm, that is one idea, hehe
But I am actually talking thorough discussion and documentation of every nook and cranny and how to do basic things people want and need to do with the language
something along the lines of the rebol core manual, but more in depth
having to re-invent the functionality that other languages just give you is a serious pitfall if you ask me
that was one of the things that drove me crazy about lisp, yeah it is a powerful language, and yeah it is a programmable language, but to some degree the only way to do anything really useful in the langauge was to in essence program lisp to function similar to other languages you were already familiar with, or to in essence extend lisp with functionality it should have already had before you even started programming in it it
in some ways this might be considered an elitist atttitude on the part of the language writers.
If it's not there, write it yourself.
Better to have a way to point to mezzanines that implement the common functionality that people want.
I dunno, I think that languages like java or .NET would be far less successful if people had to implement a majority of the class library by hand, anytime they wanted to take advantage of advanced functionality. There is just some functionality that people come to expect regardless of what higher level language they are coding in. And for a language that supposedly can be used to parse and manipulate text and data, not having a built in substring function is pretty crazy