Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
expressions in patterns
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stacy  
View profile  
 More options Dec 14 2011, 9:45 pm
From: Stacy <stacymarse...@gmail.com>
Date: Wed, 14 Dec 2011 18:45:24 -0800 (PST)
Local: Wed, Dec 14 2011 9:45 pm
Subject: expressions in patterns
Has anyone tried modifying Pyke to allow expressions in assertions
e.g., assuming $num is bound to a number, I am thinking of something
like the following
assert
  relation($num+1)

of course there is a way around this by using a python premise in the
assert clause but the rules i am creating have numerous cases like
this and it would be simpler not to have to bind numerous additional
variables in the assert clause


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dante_Zaupa  
View profile  
 More options Dec 15 2011, 9:16 am
From: Dante_Zaupa <dante...@gmail.com>
Date: Thu, 15 Dec 2011 12:16:54 -0200
Local: Thurs, Dec 15 2011 9:16 am
Subject: Re: expressions in patterns
Can't you do it in the python code outside the call for rule matching?
For instance:

prove(num)
num += 1

Seems like something you ought to do in python itself, not on the rules.

--
Dante

http://dzaupa.notapipe.org/

"IMPUNIDADE, subst.: Riqueza."
                -- Ambrose Bierce, "The Devil's Dictionary"

Usuário Linux #459228 -- Linux Mint 11 ("Katya")


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce Frederiksen  
View profile  
 More options Dec 15 2011, 12:02 pm
From: Bruce Frederiksen <dangy...@gmail.com>
Date: Thu, 15 Dec 2011 12:02:43 -0500
Local: Thurs, Dec 15 2011 12:02 pm
Subject: Re: expressions in patterns

I'm a little leary of this.

Right now, Pyke does not parse the python code snippets in the .krb files.
 It knows which lines are python code, and just does a simple scan on these
strings looking for pattern variables (indicated by dollar signs, e.g.,
$num).  I would like to avoid having Pyke having to fully parse python
code.  This would mean staying in sync with changes in the python grammar
and probably would require mechanisms to support multiple grammars somehow
so that Pyke would continue to run on multiple versions of python.

I suppose that the .krb parser could just take all the text up to the next
comma (ignoring commas nested in parens, brackets or within string
literals) as python code and do the same substitution as described above on
it.  But then a question arises about single values within parenthesis.
 What would ($num + 1) * 3 be when $num is 4?  If the parenthesis have
python meaning, it would be 15.  But if the parenthesis have Pyke meaning,
they would indicate a singleton tuple that would then be repeated 3 times
giving (5, 5, 5), the same as doing (4 + 1,) * 3 in python.

Any ideas how to deal with this unambiguously?

-Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stacy  
View profile  
 More options Dec 15 2011, 8:31 pm
From: Stacy <stacymarse...@gmail.com>
Date: Thu, 15 Dec 2011 17:31:52 -0800 (PST)
Local: Thurs, Dec 15 2011 8:31 pm
Subject: Re: expressions in patterns
 I was wondering about the parentheses myself. Forget I asked.
It adds complications and frankly it is not a critical problem since
there are straightforward alternatives.

On Dec 15, 9:02 am, Bruce Frederiksen <dangy...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »