guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Re: Patch file for colorize module


From: Ricardo Wurmus
Subject: Re: Fwd: Re: Patch file for colorize module
Date: Sun, 03 Jun 2018 21:30:27 +0200
User-agent: mu4e 1.0; emacs 26.1

Hi Sahithi,

> Hi Ricardo,
>
> I have worked with different possibilities
>> Now all you need to do is work on the “handle-string” procedure.
>>
>> I suggest using simpler matching procedures at first.  To get started
>> try “string-prefix?” and use it with the string “starting phase”.  This
>> won’t work with regular expressions, though.
> String-prefix resulted a boolean output so, I thought of using conditionals.
> Following is the line I added to “handle-string” procedure
>
> /(if (string-prefix? "starting phase" str) (colorized-display str
> '(GREEN)) (display str target-port) ))

Right, this is one way.  But as you have seen,  “string-prefix?” isn’t
all that useful for our purposes.

You also see that “if” alone is not sufficient here, because you have
more than one expression.  You could nest “if” expressions, but that’s
ugly.  You can use “cond” instead.

> Do I need to write multiple definitions for each expression?
>
> '("^starting phase.*"
>     "^phase .* succeeded.*"
>     "^phase .* failed.*")

That’s up to you.  You could iterate over a list of expressions or you
can explicitly write a case for each expression.

>> If you don’t understand this example please look up the procedures in
>> the Guile manual.
>
> I dint find this example in procedures, may I overlooked somewhere I
> recheck it.

Please look at the examples in my previous email again.  I used
“string-match”, “match:substring”, and “and=>”, which you may not be
familiar with yet.

I think these are enough hints.  I’d be happy if you could try to
implement a bit more than a single “if” expression and send us your
draft implementation within the next few days.  If you have questions
please feel free to ask for help on #guile or #guix.  I’d like us to
increase the speed a little, because we seem to be spending too much
time on introductory work.

--
Ricardo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]