Skip to Content.
Sympa Menu

k-user - [[K-user] ] How to return a list

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

[[K-user] ] How to return a list


Chronological Thread 
  • From: wang_feng_bro AT 163.com
  • To: k-user AT lists.cs.illinois.edu
  • Subject: [[K-user] ] How to return a list
  • Date: Tue, 24 Apr 2018 22:00:32 +0800
  • Authentication-results: illinois.edu; spf=pass smtp.mailfrom=wang_feng_bro AT 163.com; dkim=pass header.d=163.com header.s=s110527; dmarc=none

Hi all,

I want to implement a function in K, which takes a list as the input and also return a list. 
For instance, the input is : (1,2,3) and the expecting output is (int, int ,int ). However, my function returns (int, (int, (int .)).
The definitions are :

syntax Type ::= “int” | ….
syntax Types ::= List{Type, ",”}


syntax Types ::= getAllTypes(Vals)  [function]
rule getAllTypes(V:Val, Vs:Vals) => getType(V), getAllTypes(Vs)
rule getAllTypes(.Vals) => . 

where getType() is just an auxiliary function. 

Please help me… Thanks !

Jerry





Archive powered by MHonArc 2.6.19.

Top of Page