World: r3wp
[Rebol School] Rebol School
older newer | first last |
PeterWood 28-Apr-2009 [2812] | I asked on R3 chat and got this answer: Re #3821: T won't make it to the final distribution - it's for the test phase. It's not even documented. I expect that the function will go away inn the code reorganization. |
RobertS 22-May-2009 [2813] | . |
Janko 12-Jun-2009 [2814x3] | I have one question ... I have parse blocks stored in some external block: parsers: [ aaa [ ( variable + 1 ) to abc ] ] so I do select parsers 'aaaa to get that block .. and then I >>parse string get-parse-bock<< The problem is that "variable" in that block is defined in the function where parse happens ... and it's undefined inside parse block in this case ... any ideas how to bind it to it's outer variable... I haven't used bind or use before but I thought I can do something like this with bind .. but I can't make it work and I also don't "get" the bind example in docs |
hm.. it seems I was using the parameters reverse and bind is exactly for this :) | |
... I don't get this example: >> words: [a b c] >> fun: func [a b c][print bind words 'a] >> fun 1 2 3 1 2 3 You give it just 'a to bind but is seems to bind b and c too?? | |
Henrik 12-Jun-2009 [2817] | yes, because they exist in the same context. |
Janko 12-Jun-2009 [2818] | so it binds all the words from the context of the word you give it to? |
Henrik 12-Jun-2009 [2819] | I think it's more correctly to say, it binds the context in which the words happen to exist. |
Janko 12-Jun-2009 [2820x3] | yes, that is more clear way to put it |
now that I know and read the docs I get that this is written , but I haven't before | |
thanks Henrik! | |
Henrik 12-Jun-2009 [2823] | no problem |
PatrickP61 15-Jul-2009 [2824] | Asking for help on a formatting problem I have the following block that cotains some rebol code which I wish to print on the console and then execute the code: >> code-blk: [print "ok"] == [print "ok"] <-- assigned a code block just fine >> do code-blk == ok <-- looks good so far >> print code-blk == ok <-- Nope that isn't what I was looking for, but I understand why since it is like print the results of print "ok" >> print form code-blk == print ok <-- getting closer to what I desire, but the quotes are missing >> print mold form code-blk == "print ok" <-- not what I desired -- I want the original code block to be printed as print "ok" with the quotes Any ideas on how to fix this? |
Graham 15-Jul-2009 [2825] | source code-blk |
PatrickP61 15-Jul-2009 [2826] | >> source code-blk code-blk: [print "ok"] <-- My goal is to just get print "ok" Another way to pose the question is How can I convert the entire contents of a block, including spaces, into a string? |
Graham 15-Jul-2009 [2827] | have a look at source source |
PatrickP61 15-Jul-2009 [2828] | Ahhh, you are right Graham, since SOURCE did print the correct string somehow! Will dig into it |
ChristianE 15-Jul-2009 [2829] | >> print mold code-blk [print "ok"] >> print head remove back tail remove mold code-blk print "ok" |
PatrickP61 15-Jul-2009 [2830] | Thank you ChristianE -- I found similar code in SOURCE SOURCE |
BrianH 15-Jul-2009 [2831] | >> print mold/only [print "ok"] print "ok" |
PatrickP61 15-Jul-2009 [2832] | That is even better! |
ChristianE 15-Jul-2009 [2833] | MOLD/ONLY, ha! As always, there's a refinement you don't think of ... |
BrianH 15-Jul-2009 [2834] | As always, there's a refinement you don't think of - that's the best thing to remember about REBOL :) |
WuJian 5-Aug-2009 [2835] | Excuse me. How can I get zero padded with numeric values? for example I want the numeric strings from "0001" to "9999" |
Sunanda 5-Aug-2009 [2836] | Several people have written such a function. Here's one of them: http://www.rebol.org/ml-display-message.r?m=rmlQGBC |
WuJian 5-Aug-2009 [2837] | Thank you. |
Ashley 6-Aug-2009 [2838] | Here's a QAD I use: >> i: 1 == 1 >> join skip "0000" length? form i i == "0001" |
Graham 6-Aug-2009 [2839x4] | next form 10000 + now/month == "0008" |
and for that mailing list question ... on how to format yyyymmdd rejoin [ now/year next form 100 + now/month next form 100 + now/day ] == "20090806" | |
now/year * 100 + now/month * 100 + now/day == 20090806 guess have to benchmark to see which is fastest | |
last version is 5x faster | |
Anton 6-Aug-2009 [2843] | Nice one. |
WuJian 7-Aug-2009 [2844] | NIce |
Gregg 7-Aug-2009 [2845] | Doesn't measure that much faster here, and you have to add the FORM call as well. Still nice. :-) If performance is important, you can do two things: 1) cache NOW, 2) cache the whole result once a day. |
Graham 7-Aug-2009 [2846x3] | I ran 10,000 iterations with 'form and found it was 5x faster :) |
It's something I learned from Forth .. math is always faster than logic. | |
BTW, you can use the same trick for those pesky apis that want leading zeros for time >> time: now/time - 5:00 == 6:29:02 >> next form 100:00 + time == "06:29:02" | |
Maxim 7-Aug-2009 [2849] | wow a bug with experience :-) |
CharlesW 20-Oct-2009 [2850] | I am trying to retrieve email from a godaddy account. Their server however uses a username with the @ sign. I am not sure but I think this is messing up the pop protocol. The error I receive is: connecting to: companyname.com ** Access Error: Cannot connect to companyname.com ** Where: open-proto Notice that my pop statment has two @ signs in it but is needed to login to goDaddy's multi-tenent pop server. foreach message read pop://[user-:-companyname-:-com]:[password-:-pop-:-secureserver-:-net] [ print message ] Any Suggestions? |
Henrik 20-Oct-2009 [2851x2] | I think there is a fix for that, but I can't remember what it is. |
found it | |
Pekr 20-Oct-2009 [2853x2] | you can use block specification, instead of URL scheme ... or fix url-chars ... |
net-utils/url-parser/user-char: union net-utils/url-parser/user-char make bitset! #"@" | |
Henrik 20-Oct-2009 [2855x2] | This is for the backslash: net-utils/url-parser/user-char: union net-utils/url-parser/user-char make bitset! #"\" |
use Pekr's code | |
Pekr 20-Oct-2009 [2857x2] | :-) now I was first :-) |
I have it in my user.r, so I almost forgot about it ... | |
Henrik 20-Oct-2009 [2859] | you were first, because it took 3 minutes to swap into textmate. :-) have too many things running here. |
CharlesW 20-Oct-2009 [2860] | Thank guys. |
Graham 1-Jan-2010 [2861] | The Rebol School site is now working again after 4 years of malfunctions. |
older newer | first last |