JESS: jess: (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 /a/b")) versus Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))

View: New views
3 Messages — Rating Filter:   Alert me  

JESS: jess: (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 /a/b")) versus Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))

by jo-48 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

(length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7  /a/b"))
3
Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))
2
Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b")
(679196dc49add8e88a07bd9fd34ec2f7 .a/b)
Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7  /a/b")
(679196dc49add8e88a07bd9fd34ec2f7 " b)
Jess>


I do not understand why this explode$ differently in those two cases.


Kind Regards,
Joe


     


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: jess: (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 /a/b")) versus Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"/" is a special character in Jess. In particular, two "/" characters  
delimit a regular expression, which can't actually be used the way  
you're "using" it. That symbol consisting of a single double-quote is  
the (admittedly strange) way that Jess has interpreted what you've  
asked it to do.

In any case, recent versions of the manual take some pains to mention  
that file paths must absolutely be written as quoted strings in Jess;  
i.e., this does what you want:

Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7  \"/a/b\""))
(679196dc49add8e88a07bd9fd34ec2f7  "/a/b")



On Jul 24, 2009, at 10:41 AM, jo wrote:

>
> Hi,
>
> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7  /a/b"))
> 3
> Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))
> 2
> Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b")
> (679196dc49add8e88a07bd9fd34ec2f7 .a/b)
> Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7  /a/b")
> (679196dc49add8e88a07bd9fd34ec2f7 " b)
> Jess>
>
>
> I do not understand why this explode$ differently in those two cases.
>
>
> Kind Regards,
> Joe
>
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users  
> you@...'
> in the BODY of a message to majordomo@..., NOT to the list
> (use your own address!) List problems? Notify owner-jess-users@...
> .
> --------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


Re: JESS: jess: (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 /a/b")) versus Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))

by jo-48 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok I understand more or less now.

This is what I came up with instead:

(deffunction split-md5-line (?line )
    (bind ?s (new String ?line ))
    (bind ?items (?s split  "[ ]+" ) )
    (return ?items)
)

tx
J



----- Original Message ----
From: Ernest Friedman-Hill <ejfried@...>
To: jess-users <jess-users@...>
Sent: Friday, July 24, 2009 4:58:48 PM
Subject: Re: JESS: jess: (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 /a/b")) versus Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))

"/" is a special character in Jess. In particular, two "/" characters delimit a regular expression, which can't actually be used the way you're "using" it. That symbol consisting of a single double-quote is the (admittedly strange) way that Jess has interpreted what you've asked it to do.

In any case, recent versions of the manual take some pains to mention that file paths must absolutely be written as quoted strings in Jess; i.e., this does what you want:

Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7  \"/a/b\""))
(679196dc49add8e88a07bd9fd34ec2f7  "/a/b")



On Jul 24, 2009, at 10:41 AM, jo wrote:

>
> Hi,
>
> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7  /a/b"))
> 3
> Jess> (length$ (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b"))
> 2
> Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7 .a/b")
> (679196dc49add8e88a07bd9fd34ec2f7 .a/b)
> Jess> (explode$ "679196dc49add8e88a07bd9fd34ec2f7  /a/b")
> (679196dc49add8e88a07bd9fd34ec2f7 " b)
> Jess>
>
>
> I do not understand why this explode$ differently in those two cases.
>
>
> Kind Regards,
> Joe
>
>
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users you@...'
> in the BODY of a message to majordomo@..., NOT to the list
> (use your own address!) List problems? Notify owner-jess-users@....
> --------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------


     


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------