Giter VIP home page Giter VIP logo

stratege's People

Contributors

mschuene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

alexgian

stratege's Issues

Undeclared dependency to criterium

When I add the dependency [stratege "0.1.0"] I also need to add the dependency to [criterium "0.4.3"], else I cannot require [stratege.core :as s :refer [rules]] due to missing criterium.core.
Maybe criterium could be a development-dependency, and not required at all in production code?

How to write recursive strategies for arbitrary length predicates?

Hi Maik,

Thank you for publishing this library. I'm trying to use it to create a generic dnf term rewriter. I'm not yet able to create recursive rules that match predicates of arbitrary lengths.

Simple predicates work:

[:not [:or a b]] ;=> [:and [:not a] [:not b]]

But how do I write rules that are recursive and will match predicates of arbitrary lengths, like:

[:not [:or a b c]] ;=> [:and [:not :a] [:not :b] [:not c]]
[:not [:or a b c d]] ;=> [:and [:not :a] [:not :b] [:not c] [:not d]]
[:not [:or a b c d e]] ;=> [:and [:not :a] [:not :b] [:not c] [:not d] [:not e]]
;; etc

Thanks,
Jeroen

Problem with "propagate-constants" from given example.

Hi, some nice work here, potentially!
Excuse any ridiculously dumb questions, I'm new to this system.
However, this - following your example - does not give the right result. Any ideas?

(ns stratego.core)
(require '[stratege.core :as s :refer [defrule rules]])

;; Second examples from github/mschuene/stratege main page

(def propagate-constants-rules
  (s/match-replace
   [:and true x] x
   [:and x true] x
   [:and false x] false
   [:and x false] false
   [:or true x] true
   [:or x true] true
   [:or false x] x
   [:or x false] x
   [:not false] true
   [:not true] false))
(def propagate-constants (s/downup propagate-constants-rules))

then

stratego.core=> (clojure.test/is (= true (propagate-constants [:and true [:or true false]])))

FAIL in () (form-init2163883587934145703.clj:1)
expected: (= true (propagate-constants [:and true [:or true false]]))
  actual: (not (= true nil))
false

Why does propagate-constants return nil?
Surely it should propagate to true.
Once again, apologies if I'm missing something too obvious.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.