[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#32121] [PATCH 3/5] database: Add support for database upgrades.
From: |
Clément Lassieur |
Subject: |
[bug#32121] [PATCH 3/5] database: Add support for database upgrades. |
Date: |
Sat, 14 Jul 2018 17:00:58 +0200 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Ludovic Courtès <address@hidden> writes:
>> + (apply max
>> + (map string->number
>> + (map (cut match:substring <> 1)
>> + (filter regexp-match?
>> + (map (cut string-match
>> + "^upgrade-([0-9]+)\\.sql$" <>)
>> + (scandir (%package-sql-dir))))))))
>
> I think you can write it along these lines:
>
> (reduce max 0
> (map (compose string->number (cut match:substring <> 1))
> (filter-map (cut string-match …) (scandir …))))
Very nice! Now it returns 0 if the list is empty (which shouldn't
happen) but it makes more sense.
> I would rather avoid SRFI-42, not just because I can’t parse it ;-), but
> also to maintain consistency and make the code possibly more accessible.
>
> In this case I think we could use a simple loop or (for-each … (iota n))
> and that wouldn’t be bad.
iota... Exactly what I was looking for! But for some reason I thought
it would be named something like "range" :-)
Thank you so much!
Clément
[bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/10
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Ludovic Courtès, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Ludovic Courtès, 2018/07/13
- [bug#32121] [PATCH 4/5] database: Call a specification 'jobset' instead of 'project'., Clément Lassieur, 2018/07/14
[bug#32121] [PATCH 5/5] Add support for multiple inputs., Clément Lassieur, 2018/07/10