From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: [PATCH] gnu: Add Mlucas. Date: Tue, 06 Oct 2015 17:40:22 +0300 Message-ID: <87h9m4f4bt.fsf@gmail.com> References: <20151005130123.2091f6e4@debian> <87zizx5kte.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjTWk-0004zf-GM for guix-devel@gnu.org; Tue, 06 Oct 2015 10:47:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjTWe-0006FX-Qo for guix-devel@gnu.org; Tue, 06 Oct 2015 10:47:38 -0400 Received: from mail-lb0-x241.google.com ([2a00:1450:4010:c04::241]:34508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjTWe-0006FQ-KB for guix-devel@gnu.org; Tue, 06 Oct 2015 10:47:32 -0400 Received: by lbnt2 with SMTP id t2so7912426lbn.1 for ; Tue, 06 Oct 2015 07:47:32 -0700 (PDT) In-Reply-To: (Alex Vong's message of "Tue, 6 Oct 2015 21:43:14 +0800") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Vong Cc: guix-devel@gnu.org Alex Vong (2015-10-06 16:43 +0300) wrote: > Hi Alex, > > On 06/10/2015, Alex Kost wrote: [...] >>> +;;; selectors of flag-sublist >>> +(define (flag-type flag-sublist) >>> + (car flag-sublist)) >>> +(define (flag-string-list flag-sublist) >>> + (cdr flag-sublist)) >> >> IMO it is clearer to write it like this: >> >> (define flag-type first) >> (define flag-string-list second) >> >> Although I think it is better to use records for such things. We also >> have 'define-record-type*' in (guix records) module. >> >> (also some people don't like car/cdr with passion) >> > I think SECOND is CADR instead of CDR. Am I right? I will read about > DEFINE-RECORD-TYPE, it sounds fun to define new types. Ouch, yes, 'second' is 'cadr', my bad. Actually I think 'first', 'second', etc. are not much better then 'car', 'cadr', etc. It is usually possible and desirable to avoid such things, although I confess I use 'car'-s sometimes (when Ludovic doesn't see :-)). >>> +;;; constructor of flag-list >>> +(define (flag-list . flag-lst) >>> + ;; Trim leading and trailing whitespaces of all flag-string >>> + ;; in flag-list. >>> + (define (trim-flag-string flag-lst) >>> + (map (=CE=BB(flag-sublist) >> >> We use 'lambda'. I'm personally not against '=CE=BB', but maybe others >> wouldn't like it. Anyway a common convention is to have a space before >> "(", i.e.: >> >> (map (=CE=BB (flag-sublist) ...)) >> > I used to use LAMBDA, but one day I discovered Guile supports =CE=BB, so I > have used it since then. I will follow the space convention anyway. I like "=CE=BB" and I will use it too, if it is (will be) allowed. Thanks for raising this. [...] >> And absolutely all people don't like 'cadadr'!! Please use 'match' for >> such things: >> . >> > Yes, (second (second ...) is probably better than cadadr. I should > really try pattern matcher. Do you know any tutorial on it? However, I > think I am not making a new build system anymore. The reason will be > noted on the next reply. I've never searched for a tutorial. I learnt how to use 'match' from the Guile manual and the Guix source code. There is also a cool 'match-lambda' macro which can be often met in the Guix code, but it is not documented in the Guile manual. --=20 Alex