Skip to content
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

Change from ppcre:scan to ppcre:scan-to-strings #12

Merged
merged 4 commits into from
Jul 28, 2015
Merged

Change from ppcre:scan to ppcre:scan-to-strings #12

merged 4 commits into from
Jul 28, 2015

Conversation

EuAndreh
Copy link
Contributor

ppcre:scan-to-strings gives a more practical usage to the #~m macro, as far as pilfering Perl's syntax goes.

@EuAndreh
Copy link
Contributor Author

I've also changed the if-match macro: now it works nested:

* (when-match (#~m_a(b)c_ "abc")
      (when-match (#~m_(f)(g)h_ "fgh") 
          (print $1)
          (print $2))
      (print $1)
      t)
; "f"
; "g"
; "b"
; => T

* (when-match (#~m_a(b)c_ "abc")
      (when-match (#~m_(f)(g)h_ "fgh") 
          (print $1)
          (print $2))
      (print $1)
      (print $2)
      t)
; "f"
; "g"
; "b"
; => ERROR: Too few matchs: $2 unbound.

@EuAndreh
Copy link
Contributor Author

Instead of an error, uncaptured variables could also return nil.

thephoeron added a commit that referenced this pull request Jul 28, 2015
Change from ppcre:scan to ppcre:scan-to-strings
@thephoeron thephoeron merged commit 4fe7548 into thephoeron:master Jul 28, 2015
@thephoeron
Copy link
Owner

Neat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants