Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
Boleslav Březovský
@rebolek
Wow @greggirwin. You can talk to that Google fellow directly? :smirk: Tell them to revert Gmail back also, this insanity is terrible.
rebred
@rebred
str: "name=joe&lastname=smo&address=bighouse&phone=1234"
what is the fastest way (cpu cycles) to extract these values from str
Boleslav Březovský
@rebolek
That's an interesting question. Red is very high level, there are many ways to split the string.
dsunanda
@dsunanda
Don't know about CPU cycles, but Rebol 2 has a function for this: decode-cgi. You can take the source straight from R2 and it schould work, though you may need to change the PARSE/ALL to just PARSE.
probe decode-cgi str
=== [name: "joe" lastname: "smo" address: "bighouse" phone: "1234"]
rebred
@rebred
parse decode-cgi = big and slow = many cpu cycles
dsunanda
@dsunanda

That is not necessarily the case - certainly not with R2's implementation of PARSE.

In the hands of experts (such as Maxim) it was often much faster than procedural code. There were many speed challenges over on the Mailing list and Altme. PARSE usually won.

Dunno if Red's PARSE is yet optimized internally - but you may be surprised by how nifty it can be.

rebred
@rebred
this removes the first 4 char of a string
how do I remove the last 4
ne1uno
@ne1uno
@rebred /tail see ? trim
Vladimir Vasilyev
@9214
@rebred perhaps you should learn about series' indexes first.
rebred
@rebred
@ne1uno remove modifies the string
how do I use trim ?
Vladimir Vasilyev
@9214
You don't need trim in your case, @ne1uno is mistaken.
amreus
@amreus
take/last/part string 4?
nedzadarek
@nedzadarek
@ne1uno trim deletes spaces or list of characters. I am not sure how you can delete N elements from tail using this.
Vladimir Vasilyev
@9214
@rebred read this and figure out how to position your string index 4 characters before the tail. The rest is trivial.
Or use take instead, if you care about removed values.
rebred
@rebred
test: "this is a simple test"
remove/part test 3
== "s is a simple test"
nedzadarek
@nedzadarek
:clap:
amreus
@amreus
using take doesn't express quite clearly the intent I guess since you probably aren't interested in the removed values.
rebred
@rebred
I guess remove only works for trimming the beginning of the string not the end
Vladimir Vasilyev
@9214

Sigh...

>> string: "a string"
== "a string"
>> at tail string -4
== "ring"
>> clear at tail string -4
== ""
>> string
== "a st"

You can use remove/part ... 4 instead of clear if you really want.

amreus
@amreus
@rebred - @9214 is trying to tell you to look at series index...
This message was deleted
rebred
@rebred
@amreus yes I was trying to avoid doing all these steps to remove 4 chars at the tail of a string !
nedzadarek
@nedzadarek
@rebred to be precise, remove and some other functions works from the current position, e.g. s: "abcdef" (s2: at s 2) (remove/part s2 3) probe s ; "aef"... but Vladimir already posted you link about this.
rebred
@rebred
str: "this is $ simple test"
find/tail str "$"
== " simple test"
is there a way instead of getting the string on the right of the $ I can get the string on the left ?
Vladimir Vasilyev
@9214
You're already getting the string on the right.
rebred
@rebred
yes sorry @9214
Vladimir Vasilyev
@9214
Why then do you use /tail refinement?
rebred
@rebred
str: "this is $ simple test"
find str "$"
== "$ simple test"
rebred
@rebred
I see there is a SQLite binding
is there an example on how to use and configure it ?
Vladimir Vasilyev
@9214
@rebred if you'd look at this repository more closely, you'd notice that it contains 3 testing examples.
rebred
@rebred
@9214 thank you
GiuseppeChillemi
@GiuseppeChillemi
@rebred also you could use Munge.
But only on Windows Platform.
Sunnypt
@Sunnypt
how can I see what is new in each latest build of Red - I download every new build but struggle to know what's new.
Gregg Irwin
@greggirwin
We have https://progress.red-lang.org/, to summarize changes, but it's not the same as a changelog, which we hope to do more consistently in the future.
And, again, a huge thanks to @x8x for making that progress page. It's fantastic.
Sunnypt
@Sunnypt
ok, sorry - just wanted to know about new things as they are introduced
Sunnypt
@Sunnypt
i meant new functions, actions etc.
Gregg Irwin
@greggirwin
Yes, that's what a changelog will help with.
Sunnypt
@Sunnypt
thanks - so at the moment new builds appear, but who knows what new features they hold ?
Sunnypt
@Sunnypt
yes , sorry - just keen to know what's new
nedzadarek
@nedzadarek

If I have a block! I can retrieve value by:

  • integer! -> arr: [11 22 33] arr/1; 11
  • word! -> arr: [a 1 b 2] arr/b; 2
  • paren! -> result of the paren! can be: any-word (same as word!), integer (see above), other value (select arr 'a)

Do I miss something?

Gregg Irwin
@greggirwin
@Sunnypt you need to monitor the progress page or commits. We include big notes with big releases and blog announcements, which we hope to do much more frequently. New docs efforts ramping up as well.