Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] String build and print

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] String build and print


Chronological Thread 
  • From: t x <txrev319 AT gmail.com>
  • To: Marcus Ramos <mvmramos AT gmail.com>
  • Cc: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] String build and print
  • Date: Fri, 5 Jul 2013 17:19:39 -0700

Why do you have "sym" ?

Are (sym "a") and (cat "a" epsilon) supposed to be different strings?



On Fri, Jul 5, 2013 at 7:59 AM, Marcus Ramos <mvmramos AT gmail.com> wrote:
Hello all,

I am trying to further develop the library String, and thus have the following
piece of code:

Inductive string: Set :=
   | epsilon: string
   | sym: ascii->string
   | cat: ascii->string->string.

Fixpoint append (s1 s2: string): string :=
   match s1 with
   | epsilon => s2
   | sym c => cat c s2
   | cat c s => cat c (append s s2)
   end.

I would like to write a fixpoint stringdenote that parses, for example:

(cat "a" (sym "b"))(sym "c")

and returns "abc" in the screen. Does any one know I can achieve this? In
other words, how can I build a string of characters as a return value of this
fixpoint and print the value on the screen? Sorry if this is too basic, but I
really haven´t found my way through.

Thanks in advance,
Marcus.




Archive powered by MHonArc 2.6.18.

Top of Page