Where is (re? x)

2010-08-23 Thread Jeff Rose
It looks like regular expressions are the only type with built-in
syntax that don't have a predicate function.  How about:

(def
 ^{:arglists '([x])
   :doc Return true if x is a regular expression
(java.util.regex.Pattern)
   :added 1.3}
 re? (fn re? [x] (instance? java.util.regex.Pattern x)))

Or maybe call it regexp? if re? isn't clear enough...

-Jeff

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


Re: Where is (re? x)

2010-08-23 Thread James Reeves
Why use def? You could just place re? after the definition of defn,
and write it:

(defn re?
  Return true if x is a regular expression
  {:added 1.3}
  [x]
  (instance? java.util.regex.Pattern x))

- James

On 23 August 2010 16:17, Jeff Rose ros...@gmail.com wrote:
 It looks like regular expressions are the only type with built-in
 syntax that don't have a predicate function.  How about:

 (def
  ^{:arglists '([x])
   :doc Return true if x is a regular expression
 (java.util.regex.Pattern)
   :added 1.3}
  re? (fn re? [x] (instance? java.util.regex.Pattern x)))

 Or maybe call it regexp? if re? isn't clear enough...

 -Jeff

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


Re: Where is (re? x)

2010-08-23 Thread Jeff Rose
Sure, I was just copying the style of the existing predicate functions
in core.clj to keep it consistent.

-Jeff

On Aug 23, 5:25 pm, James Reeves jree...@weavejester.com wrote:
 Why use def? You could just place re? after the definition of defn,
 and write it:

 (defn re?
   Return true if x is a regular expression
   {:added 1.3}
   [x]
   (instance? java.util.regex.Pattern x))

 - James

 On 23 August 2010 16:17, Jeff Rose ros...@gmail.com wrote:



  It looks like regular expressions are the only type with built-in
  syntax that don't have a predicate function.  How about:

  (def
   ^{:arglists '([x])
    :doc Return true if x is a regular expression
  (java.util.regex.Pattern)
    :added 1.3}
   re? (fn re? [x] (instance? java.util.regex.Pattern x)))

  Or maybe call it regexp? if re? isn't clear enough...

  -Jeff

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


Re: Where is (re? x)

2010-08-23 Thread Sean Devlin
Be very careful when copying the style of clojure.core.  There are a
lot of non-standard practices in there, because Rich is bootstrapping
the language.  For example, defn doesn't work like we're all used to
in core until about 80% of the way through.

Follow these style guidelines instead:

https://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards

On Aug 23, 12:30 pm, Jeff Rose ros...@gmail.com wrote:
 Sure, I was just copying the style of the existing predicate functions
 in core.clj to keep it consistent.

 -Jeff

 On Aug 23, 5:25 pm, James Reeves jree...@weavejester.com wrote:

  Why use def? You could just place re? after the definition of defn,
  and write it:

  (defn re?
    Return true if x is a regular expression
    {:added 1.3}
    [x]
    (instance? java.util.regex.Pattern x))

  - James

  On 23 August 2010 16:17, Jeff Rose ros...@gmail.com wrote:

   It looks like regular expressions are the only type with built-in
   syntax that don't have a predicate function.  How about:

   (def
    ^{:arglists '([x])
     :doc Return true if x is a regular expression
   (java.util.regex.Pattern)
     :added 1.3}
    re? (fn re? [x] (instance? java.util.regex.Pattern x)))

   Or maybe call it regexp? if re? isn't clear enough...

   -Jeff

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


Re: Where is (re? x)

2010-08-23 Thread Robert McIntyre
I think the re? definition might belong around line 447 of core with
the rest of the more normal looking
instance? functions.

On Mon, Aug 23, 2010 at 1:27 PM, Sean Devlin francoisdev...@gmail.com wrote:
 Be very careful when copying the style of clojure.core.  There are a
 lot of non-standard practices in there, because Rich is bootstrapping
 the language.  For example, defn doesn't work like we're all used to
 in core until about 80% of the way through.

 Follow these style guidelines instead:

 https://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards

 On Aug 23, 12:30 pm, Jeff Rose ros...@gmail.com wrote:
 Sure, I was just copying the style of the existing predicate functions
 in core.clj to keep it consistent.

 -Jeff

 On Aug 23, 5:25 pm, James Reeves jree...@weavejester.com wrote:

  Why use def? You could just place re? after the definition of defn,
  and write it:

  (defn re?
    Return true if x is a regular expression
    {:added 1.3}
    [x]
    (instance? java.util.regex.Pattern x))

  - James

  On 23 August 2010 16:17, Jeff Rose ros...@gmail.com wrote:

   It looks like regular expressions are the only type with built-in
   syntax that don't have a predicate function.  How about:

   (def
    ^{:arglists '([x])
     :doc Return true if x is a regular expression
   (java.util.regex.Pattern)
     :added 1.3}
    re? (fn re? [x] (instance? java.util.regex.Pattern x)))

   Or maybe call it regexp? if re? isn't clear enough...

   -Jeff

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