World: r3wp
[All] except covered in other channels
older newer | first last |
[unknown: 5] 13-Jun-2005 [1705x2] | Anyone know how to do simple arithmetic operations on tuples such as ip addresses? |
Ahh never mind looks like I have to add a complete tuple - actually that is rather a good idea instead | |
Vincent 13-Jun-2005 [1707] | Paul: you can + - * / // an integer!/decimal!/tuple! to any tuple, but for most operations the tuple! must be the first operand.. |
[unknown: 5] 13-Jun-2005 [1708x5] | Yeah I found that out |
I went ahead and made a quick increment function for it | |
Doesn't look very concise but works | |
increment: func [ip-addr][ either ip-addr/4 < 255 [ return ip-addr + 0.0.0.1 ][ either ip-addr/3 < 255 [ return ip-addr + 0.0.1.0 ][ either ip-addr/2 < 255 [ return ip-addr + 0.1.0.0 ][ either ip-addr/1 < 255 [ return ip-addr + 1.0.0.0 ][ ] ] ] ] ] | |
I'm curious about how try errors in tuple conversions - For example if I do a try [error? error: to-tuple "abcd"] it doesn't evaluate correctly | |
Vincent 13-Jun-2005 [1713] | and with error? error: try [to-tuple "abcd"] ? |
[unknown: 5] 13-Jun-2005 [1714x2] | I would assume that would work - let me try that |
Yes that works - thought I tried that already though. | |
JaimeVargas 13-Jun-2005 [1716x2] | next-ip: func [ip][to-tuple debase/base to-hex (to-integer to-binary ip) + 1 16] |
A one-liner. A bit more rebolish... ;-) | |
[unknown: 5] 13-Jun-2005 [1718x2] | yeah works Jaime - I knew there was a more elegant way - I was whipping up something fast |
Of course will REBOL it seems there always is | |
Pekr 13-Jun-2005 [1720] | more rebolish? :-) |
JaimeVargas 13-Jun-2005 [1721] | May be not? But definetely shorter... |
Pekr 13-Jun-2005 [1722] | kind of guru-level code, which even medium level reboller can't follow, what does it do in particular :-) |
[unknown: 5] 13-Jun-2005 [1723x4] | Yeah but carries a bit more overhead in a trace |
Pekr: I don't quite follow it myself | |
:) | |
But looks darn spiffy | |
JaimeVargas 13-Jun-2005 [1727x4] | IP addresses are just integers represented as tuples, where each section represents a byte value (0..255) |
So if you want if you want to increase a tuple but one, don't do the math in tuples. Do in integer space that is this line. (to-integer to-binary ip) + 1. | |
The parentheses statement gets the integer. The reas of the code transform the resulting integer to a tuple again. | |
Hope this helps you grok it. | |
Vincent 13-Jun-2005 [1731] | the parentheses improves readability, but are optional if you swap the operands : next-ip: func [ip][to-tuple debase/base to-hex 1 + to-integer to-binary ip 16] |
[unknown: 5] 13-Jun-2005 [1732x2] | Thanks guys for your help |
How do you make text blink? | |
BrianW 13-Jun-2005 [1734] | open and close your eyes really fast. |
[unknown: 5] 13-Jun-2005 [1735] | LOL Brian. |
yeksoon 13-Jun-2005 [1736] | flip-flop the font size between 0 and whatever other size ? |
ChristianE 13-Jun-2005 [1737x3] | view layout [t: text "Blink, please!" black rate 2 feel [engage: func [f a e] [if 'time = e/type [t/font/color: either t/font/color = white [black] [white] show t]]]] |
Sorry, T: of course wasn't necessary, in ENGAGE T should have read F (F/FONT/...) | |
view layout [style blink-text text white red rate 2 feel [engage: func [f a e] [if 'time = e/type [c: f/font/color f/font/color: f/color f/color: c show f]]] blink-text "Blink, please" red white blink-text "Yellow & Blue" yellow black] | |
[unknown: 5] 13-Jun-2005 [1740] | Thanks ChristianE. |
BrianW 15-Jun-2005 [1741] | Another curiosity question: Does Rebol ever get used in the embedded market? You know: cell phones, set-top boxes, high tech microwaves, etc. |
yeksoon 15-Jun-2005 [1742] | whywire.net? the wireless stuffs?... is that considered embedded? |
BrianW 15-Jun-2005 [1743x2] | Sure, I'd consider it embedded. Thanks |
oh yeah, I'd already forgotten about that. Silly me. | |
yeksoon 15-Jun-2005 [1745x2] | set top box-->ask Steve (or eFish)<--- |
if I put rebol onto a small chip and sew it into my wallet...I got a rebol-embedded wallet :) | |
[unknown: 9] 13-Jul-2005 [1747] | If anyone would like more people invited to this world, please speak up. |
Sunanda 13-Jul-2005 [1748x2] | I'd like there to be a clear path by which new people could request membership....With the loss of the guest account the path is no longer obvious. We need something better than having to know an existing member. |
I'd like to be invited a 2nd time so I have an alternate account I can use to work around the resync bug (see !Atlme forum messages on Monday) | |
[unknown: 9] 14-Jul-2005 [1750] | What would you suggest fr a better path? |
Tomc 14-Jul-2005 [1751x3] | an altme with a restricted guest account |
an altme that has overcome the sync bug | |
(realizing it may not be in your court) | |
Allen 14-Jul-2005 [1754] | A form to email signup request on http://www.rebol.com/support.html .. low barrier of entry. Then just need a Hat to process any requests at least once a day (unless you want to automate the process more) |
older newer | first last |