RfD: String comparison words version 1 (was version 0)

forth

    Sponsored Links

    Next

  • 1. New to networking Q1
    Hi All, I have recently bitten the bullet and bought a netgear wired/wireless router (MR814)and wireless pc card (MA401) to network my desktop and laptop and share my bb internet connection from my st box. Before buying this stuff my desktop was connected to the stb through a USB/Ethernet adaptor and cable. For a number of reasons I wanted to site the router at the stb side of the room rather than by the desktop pc. So I went through the cabling (ignoring the laptop and wireless side of things) and set up procedure... and...the desktop could not connect to the router (using the web browser to try and access the router configuration settings). The arrangement was (1) pc>my cable>router>netgear supplied cable>stb. I then shifted the router to the pc side of the room. The new arrangement being (2) pc>netgear supplied cable>router>my cable>stb. This worked!! Changed it back to (1). It didn't work! Changed it back to (2). It works again. Left it alone and got on with seting up the laptop with the wireless card. That brings me to Q2! (in another post) Any ideas as to what is causing the above difference? I'd still like to put the router near the stb Regards keith
  • 2. A Chat room for Forth
    I have learned how IRC is used in the Forth community. I would like to use it as a model and update the software. We have Yahoo Instant Messaging. It works and is much easier to setup than IRC. I like it. It can be left on in the back ground. It does not have to be an interruption. The IRC users seem to leave a window open and they check the screen every once in a while to see what is going on. If I can find some others who have an Yahoo Screen name, I would like to pioneer the opening of a Chat room on weekends at around 10 am. If you have a Yahoo account, please send me your account name to I can make a list. Alternatively you could invite me to IM most any time by sending an invitation to japeters1939 from the Yahoo Chat Window. John A. Peters Win32Forth Librarian/Promoter XXXX@XXXXX.COM 415 509-3599 Cell

Re: RfD: String comparison words version 1 (was version 0)

Postby Andrew Haley » Thu, 25 Nov 2010 01:30:32 GMT




Okay, but does the standard Forth language really need a string
comparison operator that optimizes this particular case?  Really? ...

Andrew.

Re: RfD: String comparison words version 1 (was version 0)

Postby Bernd Paysan » Thu, 25 Nov 2010 02:07:43 GMT




Hashing the strings first should solve that problem - the hash is different 
even when the prefix is the same.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself!"
 http://www.**--****.com/ ~paysan/

Re: RfD: String comparison words version 1 (was version 0)

Postby Bernd Paysan » Thu, 25 Nov 2010 02:07:43 GMT




Hashing the strings first should solve that problem - the hash is different 
even when the prefix is the same.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself!"
 http://www.**--****.com/ ~paysan/

Re: RfD: String comparison words version 1 (was version 0)

Postby anton » Thu, 25 Nov 2010 02:32:17 GMT

Andrew Haley < XXXX@XXXXX.COM > writes:



I did not introduce STR= in Gforth because of performance
considerations.  Indeed, the implementation of STR= in Gforth is:

: str=  
  compare 0= ;

The value in STR= and STR< is in the better interface.  It is the
analogue of = and <.

If the combination of COMPARE and 0=/0< was the right interface, why
does Forth have =, <, U<, D=, D< etc.?  They could all be replaced
with, say, CMP, UCMP, DCMP combined with 0= and 0<, where CMP compares
two signed cells and returns -1, 0, or 1 depending on the result of
the comparison.

- anton
-- 
M. Anton Ertl   http://www.**--****.com/ 
comp.lang.forth FAQs:  http://www.**--****.com/ 
     New standard:  http://www.**--****.com/ 
   EuroForth 2010:  http://www.**--****.com/ 

Re: RfD: String comparison words version 1 (was version 0)

Postby BruceMcF » Thu, 25 Nov 2010 03:39:02 GMT



Doesn't much of the juggling go away if the underlying factor is
\ S= ( ca1 ca2 u -- flag )
\ * test whether the ( ca1 u ) and ( ca2 u ) are equal

: STR= ( ca1 u1 ca2 u2 -- flag )
   ROT OVER = IF S= ELSE DROP 2DROP FALSE THEN ;

It also gives symmetric substring equality, with even less overhead:

: SS= ( ca1 u1 ca2 u2 -- flag ) ROT MIN S= ;

Assymetric substring testing is also easier with S= as the (possibly
optimized) primitive factor. So I'd rather S= standard and STR= and
SS= (or whatever you want to call it) Comus than STR= standard and S=
and SS= Comus.

Re: RfD: String comparison words version 1 (was version 0)

Postby Andrew Haley » Thu, 25 Nov 2010 04:44:51 GMT





Indeed they could, and on very small systems it might be a good idea.
COMPARE is a compromise to keep the size of the wordset small, and
quite a good one.  This is much the same as the reasoning for
strcmp(), I suppose: C used to be a small language like Forth.

Andrew.


Return to forth

 

Who is online

Users browsing this forum: No registered users and 58 guest