World: r3wp
[!REBOL3-OLD1]
older newer | first last |
BrianH 31-Dec-2009 [20561x2] | And it will just throw an error if the block contains anything not addable. |
That's the R3 way - throw a useful error so the programmer can fix their code, no DWIM :) | |
Paul 31-Dec-2009 [20563x2] | why the :value? |
Your already reducing the block. | |
BrianH 31-Dec-2009 [20565] | In case reducing the block makes a function or some other active value - no double eval. It's a way to trip bad errors quicker. |
Paul 31-Dec-2009 [20566] | ok. |
Steeve 31-Dec-2009 [20567x3] | uggly one-liner version. sum: func[block [block!]][ foreach [v1: v2] next head reduce/into block copy [0 0][v1/1: :v2 + v1/0] ] -_-; |
yeah !!!! i do not use any locals | |
... | |
Gregg 31-Dec-2009 [20570] | It uses a lambda local. :-) |
Steeve 31-Dec-2009 [20571] | i should have used forall, less uggly :-) |
BrianH 31-Dec-2009 [20572] | And faster. Reversing the order of arguments might not be a good idea though - some operators are more forgiving of their left value. |
Steeve 31-Dec-2009 [20573] | i was not seriously doing a proposal :-) |
BrianH 31-Dec-2009 [20574] | v1/1: v1/0 + :v2 |
Gregg 31-Dec-2009 [20575x2] | Yeah, I'm trying to remember (since I didn't comment it) why I coerced the result. Something in my brain says there was a good reason. |
Maybe I'll remember if we write a test suite for it. | |
BrianH 31-Dec-2009 [20577] | We should make a whole module of math functions, with test code. Let the REBOL optimizer at it and then see what we can include. |
Steeve 31-Dec-2009 [20578] | Who's that optimizer ? |
BrianH 31-Dec-2009 [20579] | The "REBOL optimizer" is a running joke. The best way to optimize your REBOL code is to post it publicly in AltME or R3 chat and dare people to improve it. Then the community tries to one-up each other to improve it :) |
Steeve 31-Dec-2009 [20580] | -_-; |
BrianH 31-Dec-2009 [20581] | It's the best optimizer known to man :) |
Steeve 31-Dec-2009 [20582] | sure :) |
BrianH 31-Dec-2009 [20583x2] | For certain project domains, R3 interpreted code can be faster than compiled code, once it's been through the REBOL optimizer. |
That happened with some REBOL-vs-Java code the other day here. | |
Steeve 31-Dec-2009 [20585] | but there is several criteria to optimize something. - Best Speed - Shortest code - shortest memory overhead - best ratio of above criteria |
BrianH 31-Dec-2009 [20586x2] | An interesting example of that is AJOIN. The R3 version has less memory overhead, the R2 version in 2.7.7 is faster. |
Oh, and that means that the mezzanine is faster than the native :) | |
Steeve 31-Dec-2009 [20588] | rare |
BrianH 31-Dec-2009 [20589x2] | Not really, for code that plays to REBOL's strengths. It happens quite often. |
Rare for the kind of thing you tend to do though (emulators, iirc). | |
Rebolek 1-Jan-2010 [20591] | throw/catch does not work in R3? |
Carl 7-Jan-2010 [20592] | Testing. |
BrianH 7-Jan-2010 [20593] | Bolek, THROW and CATCH work in R3 but there is a strange interaction with TRY. |
Graham 10-Jan-2010 [20594] | How about we have some more refinements to read ?? |
Pekr 11-Jan-2010 [20595] | Graham: my reply from R3 Chat: I think that we will not get much refinements for read/write functions. The planned ones were /string (text) and /as (enconding). What you want is read working in a streamed way. We might get it in future, but I doubt we get what you propose. |
Graham 11-Jan-2010 [20596] | Why not? Because refinements slow down 'read? |
Pekr 11-Jan-2010 [20597x2] | And maybe design of read/write was never actually finished ;-) |
16-Apr-2008: Prunning down read and write - http://www.rebol.net/r3blogs/0127.html 11-Nov-2009: Finalising read and write - http://www.rebol.net/r3blogs/0294.html | |
Graham 11-Jan-2010 [20599] | well, I guess we could specifiy it in the /as block |
Pekr 11-Jan-2010 [20600x2] | I don't know. Just read realated discussions - many opinions, what read/write should (not) do ... |
I am with ones proposing having read/write as simple as possible, adding just /as for codec support. Codec API should be defined, the same way as we have Device API, port API, etc. /string should be no excuse .... in the past (1.2 days), Holger posted to IOS: read http://something.com:my-callback | |
Graham 11-Jan-2010 [20602] | read/as ftp://ftp.rebol.com/matrix.avi[ file: %movies/matrix.avi ] and to resume read/ask/seek ftp://ftp.rebol.com/matrix.avi[ file: %movies/matrix.avi ] current-file-size-of-matrix.avi |
Pekr 11-Jan-2010 [20603] | hmm, but /as was proposed to specify just type of encoding IIRC, not some other functionality ... some of us wanted /as being more general, allowing you to specify a codec to decode. Codecs are so far inefficient (not streamed), because you have to read all data firts, then pass it to encode/decode. Carl never posted a resolution to read/write case .... |
Graham 11-Jan-2010 [20604x2] | Need some way to pass parameters to scheme actors. Andreas is using read/lines ! |
I think my schemes are making R3 unstable. Tried to post a message and got from chat rebol system error #1301: invalid datatype 99 ... should never happen ... | |
Steeve 11-Jan-2010 [20606] | Well, we don't need of specific refinements, cause we can pass a block to read (which is converted to a port!). >> read [scheme: 'ftp host: ... path:... other_data: ....] The block format could be used to pass other parameters in a more handy way. >> read [ftp://ftp.rebol.com/matrix.avifile: %movies/matrix.avi] And the good news, is that it's absolulty possible to have something like that now. We just have to patch the function: system/intrinsic/make-port |
Pekr 11-Jan-2010 [20607x2] | Steeve - it is good we have you here :-) |
btw - some time ago someone stated here, that current https scheme is done "old school". Was that you? Isn't now the right time to define the better way (if any) to aproach schemes and networking? :-) | |
Graham 11-Jan-2010 [20609] | Well, I am using a write spec block ... |
Steeve 11-Jan-2010 [20610] | sorry again (it's true i said this) |
older newer | first last |