k-user AT lists.siebelschool.illinois.edu
Subject: K-user mailing list
List archive
- From: "Saha, Shambwaditya" <ssaha6 AT illinois.edu>
- To: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
- Subject: [K-user] Recursive functions
- Date: Fri, 3 Jan 2014 16:46:59 -0600
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
Hi,
I was trying to implement, List concatenation in K as
syntax IList ::= List{Int,","}
syntax IList ::= "(" IList ")" [bracket,strict]
syntax IList ::= "concat" IList IList [strict]
rule concat L1:IList .IList => L1
rule concat .IList L1:IList => L1
rule concat (I:Int , L1:IList):IList L2:IList => ( I , ( concat L1 L2 ) ):IList
But for an input : "concat (1,2,3) (4,5,6)", I am getting an output : " 1, (concat (2, 3) (4, (5, 6)))" . Clearly the function is not unfolding.
Also I was wondering if any List manipulation functions (like concatenation, reversal) are available in the builtins of K.
Thanks in Advance!
Regards,
Shambwaditya
- [K-user] Recursive functions, Saha, Shambwaditya, 01/03/2014
Archive powered by MHonArc 2.6.16.