Re: [Factor-talk] Bug in string ?

2011-07-20 Thread Joe Groff
On Jul 19, 2011, at 2:44 PM, Bjarke Dahl Ebert wrote:

 Hi Factor-talk,
 
 I'm new to Factor.
 
 When I do
 { -1 } string
 my listener hangs (version 0.94).
 I would expect a runtime error instead.
 Is this a bug?

Definitely. It appears to be a bug in the set-string-nth primitive operation. 
I'll fix it.

Just to be clear, string does an element-wise conversion of a sequence of 
integers into a string, so for example, { CHAR: a CHAR: b CHAR: c } string 
(or equivalently { 65 66 67 } string) gives the string abc. If you're 
expecting to get a string representation of an object, you need to use 
unparse or numberstring. Some new users get confused by that.

-Joe
--
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks  Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Bug in string ?

2011-07-20 Thread Bjarke Dahl Ebert
Thanks, Joe!

I discovered this when I by mistake did something to the effect of
1234 [ 96 - ] map
when I meant to do
1234 array [ 96 - ] map

and actually, 96 was meant to be 48 too, but then it wouldn't have triggered
the bug :-)

Kind regards,
Bjarke

On Wed, Jul 20, 2011 at 19:15, Joe Groff arc...@gmail.com wrote:

 On Jul 19, 2011, at 2:44 PM, Bjarke Dahl Ebert wrote:

  Hi Factor-talk,
 
  I'm new to Factor.
 
  When I do
  { -1 } string
  my listener hangs (version 0.94).
  I would expect a runtime error instead.
  Is this a bug?

 Definitely. It appears to be a bug in the set-string-nth primitive
 operation. I'll fix it.

 Just to be clear, string does an element-wise conversion of a sequence of
 integers into a string, so for example, { CHAR: a CHAR: b CHAR: c }
 string (or equivalently { 65 66 67 } string) gives the string abc. If
 you're expecting to get a string representation of an object, you need to
 use unparse or numberstring. Some new users get confused by that.

 -Joe

 --
 10 Tips for Better Web Security
 Learn 10 ways to better secure your business today. Topics covered include:
 Web security, SSL, hacker attacks  Denial of Service (DoS), private keys,
 security Microsoft Exchange, secure Instant Messaging, and much more.
 http://www.accelacomm.com/jaw/sfnl/114/51426210/
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk

--
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks  Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Bug in string ?

2011-07-20 Thread Joe Groff
On Jul 20, 2011, at 10:46 AM, Bjarke Dahl Ebert wrote:

 Thanks, Joe!
 
 I discovered this when I by mistake did something to the effect of
 1234 [ 96 - ] map
 when I meant to do
 1234 array [ 96 - ] map

Just FYI, you can map into a different sequence type in a single step using 
map-as:

1234 [ CHAR: 0 - ] { } map-as

The syntax CHAR: c parses as the code point index for the following character 
or escape sequence, which is probably more readable than hardcoding 48. 
Nonetheless, it's always good to catch and fix new bugs. Thanks for the report. 
I've pushed a fix.

-Joe


--
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks  Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Bug in string ?

2011-07-19 Thread Bjarke Dahl Ebert
Hi Factor-talk,

I'm new to Factor.

When I do
{ -1 } string
my listener hangs (version 0.94).
I would expect a runtime error instead.
Is this a bug?


Kind regards,
Bjarke
--
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk