Re: core.match -- adding extractors?

2013-06-04 Thread David Pollak
On Tue, Jun 4, 2013 at 2:12 PM, David Nolen  wrote:

> I've looked at extractors a little bit, but I would need to investigate
> further. Does this offer any more power than supporting arbitrary function
> application in patterns?
>

The only advantage to function application is that you could conceivably
memoize the results of the unapply because they are "not supposed" to be
side-effecting.


>
> Also, I'm unlikely to dive into any feature addition related issues until
> all these pressing bugs in JIRA are squashed.
>

No worries.

I will not open a ticket at this time. I just want to put the idea out
there.


>
>
> On Tue, Jun 4, 2013 at 4:17 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> Howdy David & Co.,
>>
>> One of the *really* nice things about Scala's pattern matching is the
>> ability to extend pattern matching using extractors. The research is
>> presented in
>> http://lampwww.epfl.ch/~emir/written/MatchingObjectsWithPatterns-TR.pdf
>>
>> The practical aspects allow testing and transforming at pattern matching
>> time. For example:
>>
>> object AsInt {
>>   def unapply(in: String): Option[Int] = try {Some(in.toInt)} catch {case
>> e: Exception => None}
>> }
>>
>> foo match {
>>   case AsInt(number) => number + 1
>>   case _ => 0
>> }
>>
>> More importantly, one can use extractors to test external things:
>>
>> object AsJsonFile {
>>   def unapply(fileName: String): Option[JSON] = ... // find the file,
>> load it and parse it as JSON
>> }
>>
>> What are your thoughts on adding extractors to the pattern matcher?
>>
>> Thanks,
>>
>> David
>>
>> --
>> Telegram, Simply Beautiful CMS https://telegr.am
>> Lift, the simply functional web framework http://liftweb.net
>> Follow me: http://twitter.com/dpp
>> Blog: http://goodstuff.im
>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.match -- adding extractors?

2013-06-04 Thread David Nolen
That said feel free to add an enhancement ticket.


On Tue, Jun 4, 2013 at 5:12 PM, David Nolen  wrote:

> I've looked at extractors a little bit, but I would need to investigate
> further. Does this offer any more power than supporting arbitrary function
> application in patterns?
>
> Also, I'm unlikely to dive into any feature addition related issues until
> all these pressing bugs in JIRA are squashed.
>
>
> On Tue, Jun 4, 2013 at 4:17 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> Howdy David & Co.,
>>
>> One of the *really* nice things about Scala's pattern matching is the
>> ability to extend pattern matching using extractors. The research is
>> presented in
>> http://lampwww.epfl.ch/~emir/written/MatchingObjectsWithPatterns-TR.pdf
>>
>> The practical aspects allow testing and transforming at pattern matching
>> time. For example:
>>
>> object AsInt {
>>   def unapply(in: String): Option[Int] = try {Some(in.toInt)} catch {case
>> e: Exception => None}
>> }
>>
>> foo match {
>>   case AsInt(number) => number + 1
>>   case _ => 0
>> }
>>
>> More importantly, one can use extractors to test external things:
>>
>> object AsJsonFile {
>>   def unapply(fileName: String): Option[JSON] = ... // find the file,
>> load it and parse it as JSON
>> }
>>
>> What are your thoughts on adding extractors to the pattern matcher?
>>
>> Thanks,
>>
>> David
>>
>> --
>> Telegram, Simply Beautiful CMS https://telegr.am
>> Lift, the simply functional web framework http://liftweb.net
>> Follow me: http://twitter.com/dpp
>> Blog: http://goodstuff.im
>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.match -- adding extractors?

2013-06-04 Thread David Nolen
I've looked at extractors a little bit, but I would need to investigate
further. Does this offer any more power than supporting arbitrary function
application in patterns?

Also, I'm unlikely to dive into any feature addition related issues until
all these pressing bugs in JIRA are squashed.


On Tue, Jun 4, 2013 at 4:17 PM, David Pollak
wrote:

> Howdy David & Co.,
>
> One of the *really* nice things about Scala's pattern matching is the
> ability to extend pattern matching using extractors. The research is
> presented in
> http://lampwww.epfl.ch/~emir/written/MatchingObjectsWithPatterns-TR.pdf
>
> The practical aspects allow testing and transforming at pattern matching
> time. For example:
>
> object AsInt {
>   def unapply(in: String): Option[Int] = try {Some(in.toInt)} catch {case
> e: Exception => None}
> }
>
> foo match {
>   case AsInt(number) => number + 1
>   case _ => 0
> }
>
> More importantly, one can use extractors to test external things:
>
> object AsJsonFile {
>   def unapply(fileName: String): Option[JSON] = ... // find the file, load
> it and parse it as JSON
> }
>
> What are your thoughts on adding extractors to the pattern matcher?
>
> Thanks,
>
> David
>
> --
> Telegram, Simply Beautiful CMS https://telegr.am
> Lift, the simply functional web framework http://liftweb.net
> Follow me: http://twitter.com/dpp
> Blog: http://goodstuff.im
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




core.match -- adding extractors?

2013-06-04 Thread David Pollak
Howdy David & Co.,

One of the *really* nice things about Scala's pattern matching is the
ability to extend pattern matching using extractors. The research is
presented in
http://lampwww.epfl.ch/~emir/written/MatchingObjectsWithPatterns-TR.pdf

The practical aspects allow testing and transforming at pattern matching
time. For example:

object AsInt {
  def unapply(in: String): Option[Int] = try {Some(in.toInt)} catch {case
e: Exception => None}
}

foo match {
  case AsInt(number) => number + 1
  case _ => 0
}

More importantly, one can use extractors to test external things:

object AsJsonFile {
  def unapply(fileName: String): Option[JSON] = ... // find the file, load
it and parse it as JSON
}

What are your thoughts on adding extractors to the pattern matcher?

Thanks,

David

-- 
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.