Re: [Chicken-users] Anyone know why I can't split with an empty string in (chicken irregex)?

2019-05-03 Thread joshua
On Thu, May 02, 2019 at 02:17:25PM +0200, Peter Bex wrote:
> 
> Hm, that is somewhat surprising.  I checked irregex upstream,
> but as far as I can tell, this has never worked.  In extremely
> old versions this would raise an internal error and in newer
> versions it returns the empty list.
> 
> I can take a look but I'm not even sure what the correct behaviour is
> supposed to be.
> 

I guess I expected something like this (from Ruby):

home> rlwrap irb
irb(main):001:0> "foobar".split(//)
=> ["f", "o", "o", "b", "a", "r"]
irb(main):002:0> "foobar".split(/\s*/)
=> ["f", "o", "o", "b", "a", "r"]

Even if "" didn't work, I would expect "\\s*" to tokenize a string, eliminating 
whitespace.


joshua


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Anyone know why I can't split with an empty string in (chicken irregex)?

2019-05-02 Thread Peter Bex
On Wed, May 01, 2019 at 11:18:31PM -0500, joshua wrote:
> I can't seem to figure out how to split a string into individual characters.

Hi Joshua,

The canonical way to do that would be string->list.

> I could swear this worked before, in Chicken 4.
> I'm now using Chicken 5.0.0 running on Void Linux.
> 
> #;1> (import (chicken irregex))
> ; loading /usr/lib/chicken/9/chicken.irregex.import.so ...
> #;2> (irregex-split (irregex ",") "foo,bar,baz")
> ("foo" "bar" "baz")
> #;3> (irregex-split (irregex " ") "foo bar baz")
> ("foo" "bar" "baz")
> #;4> (irregex-split (irregex "") "foobarbaz")
> () ; wat

Hm, that is somewhat surprising.  I checked irregex upstream,
but as far as I can tell, this has never worked.  In extremely
old versions this would raise an internal error and in newer
versions it returns the empty list.

I can take a look but I'm not even sure what the correct behaviour is
supposed to be.

Cheers,
Peter


signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Anyone know why I can't split with an empty string in (chicken irregex)?

2019-05-02 Thread joshua


I can't seem to figure out how to split a string into individual characters.
I could swear this worked before, in Chicken 4.
I'm now using Chicken 5.0.0 running on Void Linux.

#;1> (import (chicken irregex))
; loading /usr/lib/chicken/9/chicken.irregex.import.so ...
#;2> (irregex-split (irregex ",") "foo,bar,baz")
("foo" "bar" "baz")
#;3> (irregex-split (irregex " ") "foo bar baz")
("foo" "bar" "baz")
#;4> (irregex-split (irregex "") "foobarbaz")
() ; wat
#;5> (irregex-split (irregex "\\s*") "foobarbaz")
()

Any ideas?


Thanks,
joshua


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users