On 5/18/2024 1:28 AM, HenHanna wrote:
How can i write this function simply? (in Scheme (Gauche))(a0bc0 a0bc1 a1bc0
-- Given a string 'a.bc.' -- each dot(.) is to be replaced with 0
or 1.
-- So the value is a list of 4 strings:
a1bc1)
-- The order is not important.
If the string has 3 dots, the value is a list of length 8.
If the program is going to be simpler,
pls use, say, (a $ b c $) rather than 'a.bc.'
___________________________________________________
From the Gauche (Scheme) manual:
(cartesian-product ’((a b c) (0 1)))
⇒ ((a 0) (a 1) (b 0) (b 1) (c 0) (c 1))
________________________________________
The Gauche (Scheme) manual describes
string-count and cartesian-product
as built-in functions, but I couldn't use them and ended up defining
them myself -- Why is that?
Do i have to import libraries, as in Python?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 00:01:29 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,057 |
Messages: | 6,416,566 |