World: r3wp
[I'm new] Ask any question, and a helpful person will try to answer.
older newer | first last |
BrianH 15-May-2009 [2480x2] | First, which version of REBOL are you using? If not 2.7.6, it won't work. |
Oh wait, it's the contents of the does. Try this: does [make port-proto []] | |
mhinson 15-May-2009 [2482x2] | 2.7.6.3.1 it is new like me |
That works, thank you. | |
BrianH 15-May-2009 [2484] | Even the old guard makes newbie mistakes sometimes :) |
Steeve 15-May-2009 [2485] | 10 push-ups for Brian |
mhinson 15-May-2009 [2486] | I nearly guessed it, but as a noob there are so many options that I could be a while wondering if it is my typing or something too basic to notice. |
BrianH 15-May-2009 [2487] | Clearly the latter :) |
mhinson 15-May-2009 [2488] | These hordes of newbies, always asking foolish questions & never looking at the documentation. ;-) |
Steeve 15-May-2009 [2489] | they are not so much (newbies) there, they faint after some days usually |
BrianH 15-May-2009 [2490] | I'm not sure how well-documented the change to ARRAY is. I didn't handle the documentation of the 2.7.6 release. |
Maxim 15-May-2009 [2491] | someone did? ;-) |
mhinson 15-May-2009 [2492] | if I have this mike: array/initial 3 array/initial 3 array/initial 3 none modAndPort: "2/2" UpState: 2 data: "disabled" How do I use the variables to create this logic please mike/2/2/:UpState: data mike/ModAndPort/:UpState: data Something like this I was hoping mike/(ModAndPort)/:UpState: data ** Script Error: Invalid path value: 2/2 |
BrianH 15-May-2009 [2493x2] | I don't know, Maxim. We have to do better about that in future R2 releases. |
Mhinson, your first line can be this: ARRAY [3 3 3] The none value is the default, and the multiple calls can be replaced by the [3 3 3]. | |
mhinson 15-May-2009 [2495] | More typing saved, thats good. |
BrianH 15-May-2009 [2496] | As for the path stuff, you may be out of luck. Try this: m: 2 p: 2 u: 2 mike/:m/:p/:u: "disabled" |
mhinson 15-May-2009 [2497] | ok, so I have to split it into integers.. Nice to hear it from the developer of the ARRAY :-) |
BrianH 15-May-2009 [2498x2] | It's not just more typing saved. The value passed to array/initial is not copied, it is referenced. Your version would have aliasing issues. |
If you specify multiple dimensions instead it creates unique nested blocks instead of multiple references. | |
mhinson 15-May-2009 [2500] | Thanks for point this out, I see it is very important. I will try to use your new function passing once I get it working in a basic form. Thanks. |
BrianH 15-May-2009 [2501x2] | Learn to love the SOURCE function :) |
>> source array array: func [ "Makes and initializes a series of a given size." size [integer! block!] "Size or block of sizes for each dimension" /initial "Specify an initial value for all elements" value "Initial value" /local block rest ][ if block? size [ rest: next size if tail? rest [rest: none] size: first size if not integer? size [make error! "Integer size required"] ] block: make block! size case [ block? rest [ loop size [block: insert/only block array/initial rest :value] ] series? :value [ loop size [block: insert/only block copy/deep value] ] any-function? :value [ loop size [block: insert/only block value] ] insert/dup block value size ] head block ] | |
mhinson 15-May-2009 [2503] | I often look at it but lak the skill to interpret it very well. |
Maxim 15-May-2009 [2504] | help & source are so powerfull a feature in rebol |
BrianH 15-May-2009 [2505] | They're how I learned this stuff :) |
Maxim 15-May-2009 [2506] | people don't realise that the console provides many features visual IDEs dont provide |
Steeve 15-May-2009 [2507] | oh was that a RTFD coming from Brian ? so mean... |
BrianH 15-May-2009 [2508] | Wait, it does copy/deep the initial value. It's been a while since I looked at that function :( |
mhinson 15-May-2009 [2509] | array [x x x] is much neater though |
BrianH 15-May-2009 [2510x3] | So it really does just save typing. |
:) | |
Note it only only does copy/deep of series. Objects are still referenced, so you still need the does [make proto []]. | |
mhinson 15-May-2009 [2513] | Some say that developers are born with a finite number of key strokes... once they are used up, that is the end. |
Steeve 15-May-2009 [2514x2] | hmm, it's a bug no ? |
or a missing feature, as you wish | |
BrianH 15-May-2009 [2516] | No, I can see the value of only copying series. You don't usually want to copy objects - it's not as safe. |
Steeve 15-May-2009 [2517] | ok i do 10 push-ups |
BrianH 15-May-2009 [2518x2] | I need more excercise anyways :) |
Spelling doesn't count if it's not code though :) | |
Maxim 15-May-2009 [2520] | every single day (and often a few times that day): - I open up a rebol console from quick-launch bar in windows (taking about 0.1 sec to appear) - type help 'some-func - test the 'some-func with some-data I'm using. - close the console. overall it takes about a few seconds, to do a unit test of something I'm adding. no bloat, no dangling window. python offers something similar... but: - python takes anywhere from 3-10 secs on load. - then you have to know in what lib the most basic function is (alread half as usefull) - the console itself is really bad, - previous commands browsing is really stupid - having to type so much more code to get the simplest function test going is a pain - in the end, its a non-feature. |
BrianH 15-May-2009 [2521] | I leave a R2 and R3 console open full-time while I'm working. It helps to have R3 open too since I don't always remember how much of R3 I've backported to R2, so sometimes I remember a function that doesn't exist in R2. |
mhinson 15-May-2009 [2522] | I found a cosmetic bug in the console |
Maxim 15-May-2009 [2523x2] | I was just pointing out that rebol is sooo fast to launch that you can close it and its not a pain... I easily get up to 10-15 windows open at a time, and when you've got half of them as rebol consoles, its easier not to guess which one is the help window :-) |
impossible... the console is *perfect* ;-) | |
Steeve 15-May-2009 [2525] | i have 3 R3 consoles (one for the chat, on for test, one for... i don't remember) I have 1 R2 console for testing |
Henrik 15-May-2009 [2526] | maxim, it's amazing that R3 is even faster at launching. |
BrianH 15-May-2009 [2527] | Text mode :) |
Maxim 15-May-2009 [2528] | well.. Obviously, Carl keeps removing stuff from REBOL... just ask steeve ;-) |
Henrik 15-May-2009 [2529] | nah, it's just that Carl has secretly figured out how to do random compression. |
older newer | first last |