jclaggett / seqex Goto Github PK
View Code? Open in Web Editor NEWSequence Expressions
Sequence Expressions
@jclaggett @Chouser
I really enjoyed your talk at ClojureConj 2013!
But I have a question: now that we have clojure.spec
, do we still need seqex
?
The only thing I don't see in clojure.spec
is syndoc
. But maybe there is more.
I started a new project, added the dependency [n01se/seqex "2.0.1"] and wrote the following code:
(ns foo.core
(:require [n01se.seqex :refer all]))
(defn -main [& args] )
I get the following crash when attempting "lein run":
Exception in thread "main" java.lang.UnsupportedOperationException: Unknown Collection type, compiling:(n01se/seqex.clj:154)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)
at clojure.lang.Compiler.analyze(Compiler.java:6262)
at clojure.lang.Compiler.eval(Compiler.java:6508)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at foo.core$eval20$loading__4784__auto____21.invoke(core.clj:1)
...
I extracted the seqex.clj file from the jar, and the line it crashes on is
(defprotocol LitEx)
Now I'm stuck :(
Hey Jonathan,
I saw your presentation on iluminated macros and followed the links to this repository. I was trying to replicate the code that you put on your slides but after some digging I found out that there is already something in your repository. I am not fully aware if it is the code itself that you showed, but it does looks like it.
The case is that by looking at the code I almost inmediately got lost among the functions and their expected behavior. Is there any specific reason to redefine functions such as 'cat' 'opt' 'alt' and so on on n01se/syntax and n01se/seqx?
Also would it be possible to have an example of the use of the functions on the macros and the error messages? So far I have only gotten to the point where after executing the syntax just gives me "Bad value ..." not the much prettier version shown on your presentation.
This is what I have got so far
(def docstring string?)
(def namex symbol?)
(def meta-map map?)
(def args vector?)
(def body (seqx/and list? (seqx/subex args)))
(def defn-syntax
(seqx/cat namex
(seqx/opt docstring)
(seqx/opt meta-map)
(seqx/alt body)))
(def foo '(fn-name "some-doc" {:meta :data} (1 [b])) )
(seqx/valid? defn-syntax foo)
(seqx/exec defn-syntax foo)
However I don't think I am even close to the code that I see on repl
PS: great work :D I enjoyed watching my code being 'understood' by another code
You might already be aware of this, but there is a pretty good example of a solution to this, at
http://reference.wolfram.com/mathematica/guide/Patterns.html
(this is within the context of a broader expression pattern matching language that can deal with trees, but also deals with various form of the sequence case)
syndoc
only seems to work with *nix systems. Are there plans to support this for Windows?
Empty protocol definitions do not compile in clojure 1.4
https://github.com/jclaggett/seqex/blob/master/src/n01se/seqex.clj#L154
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.