-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
moar examples needed #4
Comments
This is similar to the plist discussion going on over on the dash.el repository. I would probably do something like
You can generalize this into a custom plist matcher using
Of course this is not so performant for large plists. You could coerce the plist into a hash table and do the same thing using hash lookup if you were so concerned. |
So pretty much do the matching elsewhere? I really like dash's end of list mechanism by the way:
So now I'm wondering whether it might be good to take both approaches and combine them. |
The more idiomatic match for the tail of a list is One could forbid the use of symbols denoting patterns in match expressions and correctly interpret (list a b and stringp s) but this doesn't seem like a good solution. With the plist defpattern defined above, you can match against a plist pretty idiomatically: (match '(:a 'a :b 'b) The point of extensibility in Shadchen is that any match semantics you might want for custom objects can be given a concise form which hides the details of the pattern match. |
Ah, right. Gotcha. But it would be nice if those things were all there. plist and alist matching out of the box would be fantastic. Ah well, perhaps I'll have a play and send you some PRs. |
By the way, I am an enormous fan of you emacs work. I definitely recognize a kindred spirit re making emacs do insane things. You are inspiring me to brush off some of my old projects! |
Awww. Shucks. I just wish I understood your code. I can't possibly hope to keep up with you. |
If you can't understand my code, it is definitely my problem, not yours. I would welcome pull requests and I am in particular interested in modernizing shadchen el a bit. I sort of delayed moving to Emacs 24 for quite a long time, for various reasons, and as such it is kind of ugly or at least old looking, I would guess. Plus, I am a bit embarrassed, as I've said before, about the quality of the code here, so I kind of stopped promoting Shadchen when I realized there was a lot for me to learn about software engineering. I would be nice to go back and clean it up. Thanks for giving me the reminder to do so. |
I don't think you need to clear it up. If I could give you any advice it would be "if it works, ship it". I am torn between this and -let. -let is really nice but this is more powerful in the end. I'll get this added to marmalade and then I'll try and send you PRs. |
So:
what am I doing wrong? |
Aha. The definition of extract/c was wrong:
|
... and alists too:
I wonder how many other types could be provided for. Windows? Frames? One other thing about this lib is that it seems like it's a straight port from your CL version. I found a few doc nits but the doc looks the same between the two. Can I submit PRs to this? or do you generate one from the other? |
Nice work! But I think we also need a by #'cddr on the loop in the pattern I wish I generated one from the other, but they are divergent enough that What advice can you give me about how people are doing testing in Emacs
|
Now that I am at a real computer, I can test these things out. We want something that looks like this:
|
Great! I'll send a pr on that. Personally for testing I use ert which is built in, it works pretty well, I see no reason to use anything else. I have built my own continuous integration stuff for that using a tool I call elpakit. Other people use cask for the same task. |
obvious stuff to add as discussed in #4
I'll take a look at this myself I guess... but to what extent could |
You were asking about tests. A complex set of tests is here: https://github.com/joddie/macrostep/blob/master/macrostep-test.el |
Is the inspiration for shadchen the matcher in racket? It seems so. If so I'll try to use that as inspiration for any extra patterns I define? I'd like to add the ___ to the list matcher for example. |
It is definitely based on Racket's pattern matcher. I will have to refresh my memory on the ___ pattern. |
It's something that let's you match many things:
|
That should probably be (6) rather than 6. Tail performs a pattern match The append pattern does something like this already. (append ... ) produces the first match (append (list 1) And I would expect this pattern to match last to 6 if used against the If you want to take a crack at making append better behaved, that might be On Mon, Oct 13, 2014 at 11:06 PM, Nic Ferrier notifications@github.com
|
Hum. Ok. I'll look. Slightly related - how about declaring a specific index for the macros?
eg:
|
Yeah, so further to your comment, this works:
|
I think its worth looking into the implementation, because it might be sort I don't object to putting in a (___) pattern which is active just inside of |
I definitely will look into the implementation. Particularly if I can notifications@github.com writes:
|
Bizarrely when I come to use it again it doesn't work! weird! |
What doesn't? On Wed, Oct 29, 2014 at 8:56 PM, Nic Ferrier notifications@github.com
|
The append. I need to add a test I guess. |
It is a kind of tricky thing, concat and append. I have often thought I think making concat and append efficient (or just one, as concat can be -V On Wed, Oct 29, 2014 at 10:40 PM, Nic Ferrier notifications@github.com
|
I had fun using this for a matcher for the stuff produced by org-elements... it's pretty tricky because there aren't enough examples.
One particular problem I had was how I could match against something deep in a list, org-elements has stuff like this:
How to match just
:contents-begin
for example?The text was updated successfully, but these errors were encountered: