World: r3wp
[!REBOL3-OLD1]
older newer | first last |
Henrik 11-Apr-2006 [359] | isn't this the issue of using an ordinal on a block with NONE as an element? |
Graham 11-Apr-2006 [360x3] | perhaps it should return an error. |
in all cases. | |
which is inconvenient ... | |
Henrik 11-Apr-2006 [363] | very |
Graham 11-Apr-2006 [364] | whatever result is returned by an operation on the block can also be an element in that block. |
Henrik 11-Apr-2006 [365] | yeah, what if your block contains an error! object? |
Graham 11-Apr-2006 [366] | exactly. |
Henrik 11-Apr-2006 [367x3] | but then the problem exists in FIND to for example |
which returns none on not found, but there we have the FOUND? to help us. perhaps the ordinals should use FOUND? as an indicator? | |
found? second [true none] | |
Graham 11-Apr-2006 [370] | found? is just not none |
Henrik 11-Apr-2006 [371] | I thought it was smarter than that, but maybe it could be smarter in 3.0 |
Graham 11-Apr-2006 [372] | >> source found? found?: func [ "Returns TRUE if value is not NONE." value ][ not none? :value ] |
Henrik 11-Apr-2006 [373] | oh :-) |
Pekr 11-Apr-2006 [374] | :-) |
Graham 11-Apr-2006 [375] | I use it as a shortcut for not none? |
Henrik 11-Apr-2006 [376] | well, it would also eliminate the performance advantage that ordinals apparently give |
Pekr 11-Apr-2006 [377] | then we need some flag to be settable for none? strict? none? blk/3 |
Graham 11-Apr-2006 [378x2] | Perhaps we need a way to configure the behaviour we want? |
if your data doesn't have none, then you can accept none for a range error. | |
Pekr 11-Apr-2006 [380] | I thought about it too :-) e.g. copy-by-default: true, etc. :-) |
Graham 11-Apr-2006 [381x2] | I suspect it was a mistake to allow an out of range to return none. |
Too late now though .. | |
Geomol 11-Apr-2006 [383x5] | Regarding pair and decimals; would it make sense to generalize pair further into a new vector datatype, that can be any dimension more than one? Examples: 2.4x8.0x5.5 would be a 3D vector with coords (2.4; 8.0; 5.5). Like the same idea with tuples, which can be 3 or more bytes separated by dots: 255.255.255, 255.255.255.255,... etc. |
Or should that be handles with user-defined datatypes? | |
*handled* | |
And going further, if we take the vector road, what about matrices? | |
Support for multi-dimensional vectors and matrices in rebcode might lead to something really interesting. ;-) | |
Graham 11-Apr-2006 [388x2] | I think it should be handled natively |
but it could get ugly quickly. | |
Geomol 11-Apr-2006 [390x3] | The alternative, doing vector- and matrix-math just using decimals, can easily be ever uglier. |
Imagine having a matrix! datatype: m: make matrix! 4x4 Then you could find the determinant like for example: m/determinant That would be a miracle! :-) | |
Suddently complicated math can be made very simple. | |
Henrik 11-Apr-2006 [393] | it would also be a miracle to be able to have a complex! datatype. I think electronic engineers would appreciate that |
Graham 11-Apr-2006 [394] | How to submit a suggestion to Carl? |
Pekr 11-Apr-2006 [395] | feedback or comment on blog? |
Henrik 11-Apr-2006 [396x3] | or rambo? |
geomol, I once had the idea that you could define ISO units as kind of datatypes and do scientific calculations on them | |
my calculator can do that, so why not have it in rebol? | |
Geomol 11-Apr-2006 [399] | Henrik, give an example! |
Graham 11-Apr-2006 [400] | Geomol, Rambo the suggestion for a vector datatype. |
Rebolek 11-Apr-2006 [401] | and what about interval computations? :) |
Graham 11-Apr-2006 [402] | Let's stick with 3 dimensions. |
Henrik 11-Apr-2006 [403x2] | well, I'm really not sure about the notation as I haven't given it too much thought, so I can't give a valid example, but if you could say: >> 6 / 2 == 3 >> 6 [m] / 2 [cm] == 300 [cm] |
this is no good, but some method to attach units to numbers and variables and make REBOL aware of them during calculations | |
Graham 11-Apr-2006 [405] | >> $5.00 / 20 == $0.25 |
Geomol 11-Apr-2006 [406] | Henrik, ah ok. Yes, good idea! |
Graham 11-Apr-2006 [407] | so we can do mixed imperial and si calculations ?? |
Geomol 11-Apr-2006 [408] | Something like: ISOm6 / ISOcm2 |
older newer | first last |