Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8731637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:17:01+00:00 2026-06-13T09:17:01+00:00

I’m tinkering with an interface to Redis pub/sub that can do patterns like: PSUBSCRIBE

  • 0

I’m tinkering with an interface to Redis pub/sub that can do patterns like:

 PSUBSCRIBE news.jazz.figurative
 PSUBSCRIBE news.*
 PSUBSCRIBE n*

Despite the absence of delimiters, Redis accepts these as strings (implicit by spaces). Of course in Rebol, these would be WORD! tokens.

First thought in mapping the ideas was that it would be cool to use a PATH! since they have structure and can be built and introspected programmatically (count how many elements in the path, take the last one off, etc.) with no searching for dots. It’s also no more characters:

 PSUBSCRIBE news/jazz/figurative
 PSUBSCRIBE news/*
 PSUBSCRIBE n*

The last one is the trick, though. Although you can build a single-element PATH! in a programmatic fashion (e.g. from BLOCK! like to-path [n*]), the default tokenizer would classify that last one to be a WORD! when you enter it directly. So you’d have to make PSUBSCRIBE accept a parameter of either [word! path!]

PSUBSCRIBE: func ['pattern [word! path!]] [
    pattern: to-path pattern
    print [{The pattern you passed in was} mold pattern]

    insert pattern 'alt
    print [{Inserting at head of path yields} mold pattern]

    print [{The number of path elements is now} length? pattern]
]

In a sense it “works”:

>> psubscribe news/*
The pattern you passed in was news/*
Inserting at head of path yields alt/news/*
The number of path elements is now 3

…but notice that I had to make pattern a quoted parameter (['pattern]). If you wanted to pass a pattern which was stored in a variable, the quoting means it would think the name of the variable is the actual pattern:

>> mypattern: 'news.*

>> PSUBSCRIBE mypattern
The pattern you passed in was mypattern
Inserting at head of path yields alt/mypattern
The number of path elements is now 2

Basically, my idea wouldn’t have been a bad one if I were creating a REDIS dialect. Which I might take a shot at. But right now I’m trying to get these things working inside of the DO dialect, and I can’t change the evaluator’s rules to give paths new behavior without quoting them.

So that’s the part I know but am just documenting. 🙂 Now the question: if I’m stuck with the DO dialect, do I just use STRING! as a cop-out? Calls would have to involve either of the two kinds of string delimiters:

 PSUBSCRIBE "news.jazz.figurative"
 PSUBSCRIBE {news.*}
 PSUBSCRIBE "n*"

Then again, there is BLOCK!

 PSUBSCRIBE [news jazz figurative]
 PSUBSCRIBE [news *]
 PSUBSCRIBE [n*]

This gives a structural layer so that it’s broken into parts and one doesn’t have to parse out the dots. Yet the stars seem to be able to happen anywhere, not just in a slot in the hierarchy.

Maybe I’m trying to put structure on something that’s really just a string and can’t reasonably be modeled as anything else. Is that the case? If so I’m linking to this question in the source as justification for the decision. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:17:03+00:00Added an answer on June 13, 2026 at 9:17 am

    You can pass a reference through a literal parameter:

    mypattern: 'news/*
    PSUBSCRIBE :mypattern
    

    On the modeling question, are your tokens always compatible with REBOL’s word composition rules? Also, there is no way to check if a star is present without forming the word, so perhaps it should be strings in the first place. And stars do have meaning within strings when used with find/any.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.