exercism / 8th

Exercism exercises in 8th.
https://exercism.org/tracks/8th
MIT License
4 stars 12 forks source link

Add `phone-number` exercise #185

Closed ErikSchierboom closed 5 months ago

ErikSchierboom commented 5 months ago

@glennj Another interesting one. Could you try running this on your machine:

ok> "example.8th" f:include G:reset

ok> "223.456.7890" clean .s
 0 s: 000000010b01c970 1  2234567890

ok> "223.456.7890" clean .s
 0 G: 000000010adf11c0 1  null
 1 s: 000000010b01c970 1  2234567890

Seems odd that the same code returns different results. I must be making some very silly mistake.

glennj commented 5 months ago

There's something going on in digits:

$ 8th
8th 24.02 LIN64 Free (98b29c8c/2024-03-11) custid: 44e5dc98

ok> "example.8th" f:include

ok> "1234567890" digits .s
 0 a: 00007f04d0e91ec0 2   [1,2,3,4,5,6,7,8,9,0]

ok> drop

ok> "1234567890" digits .s
 0 a: 00007f04d0e91ec0 2   [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]

ok> drop

ok> "1234567890" digits .s
 0 a: 00007f04d0e91ec0 2   [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]