How can i write this function simply?-a-a (in Scheme (Gauche))-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a (a0bc0 a0bc1 a1bc0
-- Given a string-a 'a.bc.' -- each dot(.) is to be replaced with 0 or 1.
-a-a-a-a-a-a -- So the value is a list of 4 strings:
-- The order is not important.
-a-a-a-a-a-a-a-a-a-a-a If the string has 3 dots, the value is a list of length 8.
If the program is going to be simpler,
-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a pls use, say,-a-a (a $ b c $)-a rather than-a 'a.bc.'
On 5/18/2024 1:28 AM, HenHanna wrote:
How can i write this function simply?-a-a (in Scheme (Gauche))-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a (a0bc0 a0bc1 a1bc0
-- Given a string-a 'a.bc.' -- each dot(.) is to be replaced with 0
or 1.
-a-a-a-a-a-a -- So the value is a list of 4 strings:
a1bc1)
-- The order is not important.
-a-a-a-a-a-a-a-a-a-a-a If the string has 3 dots, the value is a list of length 8.
If the program is going to be simpler,
-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a pls use, say,-a-a (a $ b c $)-a rather than-a 'a.bc.'
___________________________________________________
From the Gauche (Scheme) manual:
(cartesian-product rCO((a b c) (0 1)))
rcA ((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: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 54:54:09 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,585 |