Giter VIP home page Giter VIP logo

mixfix-clj's People

Contributors

awto 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  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  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hkrishnan

mixfix-clj's Issues

Syntax hole definition vector question

Hi Vitaliy!

First of all, thank you for a great library! For a great majority of my use cases, the examples provided by you in README.md are quite sufficient. However, i am struggling when writing some operators of my own. Can you please clarify a bit the following lines from README:

empty - means same precedence level as its operator
number - specifies any precedence explicitly
+ - precedence is the same as the operator's one
assoc - will unwrap sub-form if it has same head symbol as the operator
id <value> - for assoc operators will treat as identity for the operation, by default nil.

By this description, what is the difference between empty and +? I've noticed that if i modify the definition of + in one of your examples to (m/op 400 + [[] + []]), ambiguity errors appear. So there must be some difference. And another question is: what is the identity of the operation referred to in id description?

Thanks again,
Vitaliy.

Allow for literals in mixfix expression

Hi!

Do you think it is feasible to extend the definition of % macro somewhat, in order to allow for literal expressions in expression body? For instance, this expression throws CompilerException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn:

(m/% 5)

By changing the definition of the % macro to

(defmacro % [& args] 
  (if (next args) 
    `(%/% ~@args)
    (first args)))

this issue seems to be solved. What do you think?

Quoting body of `op` macro

Hi Vitaliy,

last week i ran into a weird issue when trying to deploy the jar using mixfix via lein uberjar. This StackOverflow issue summarises the essence of it.

Basically, it seems that op macro modifies a global *lang* and therefore fails when run from an uberjar, as in that case contents of the global remain unchanged. As per Leonid Beschastny's comment, do you think it is possible to modify the definition of the op macro by prepending syntax-quote to its body? It would then transform to:

(defmacro op
  "Defines mixfix operator. First optional argument is a name for the
   operator's scope. The second is precedence level of the operator. The bigger
   the number the tightly the operator binds. The third is resulting form head
   symbol. And the last one is a mixfix picture of the operator."
  ([lang prec symbol picture]
    `(binding [*lang* @(resolve &env lang)] (add-op prec symbol picture) nil))
  ([prec symbol picture] `(add-op prec symbol picture) nil))

My knowledge of macros is quite limited, so I apologise if this modification seems like nonsense to you.

Thanks,
Vitaliy.

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.