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 7845383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:12:19+00:00 2026-06-02T17:12:19+00:00

I’m looking for data structure with the following features or way to emulate it

  • 0

I’m looking for data structure with the following features or way to emulate it in Clojure (via http://www.erlang.org/course/advanced.html#refs):

References are erlang objects with exactly two properties:

They can be created by a program (using make_ref/0), and,
They can be compared for equality.

Erlang references are unique, the system guarantees that no two references created by >different calls to make_ref will ever match. The guarantee is not 100% – but differs from >100% by an insignificantly small amount :-).

and particularly Name data type from Oz language (http://www.mozart-oz.org/documentation/tutorial/node3.html):

The only way to create a name is by calling the procedure {NewName X} where X is assigned >a new name that is guaranteed to be worldwide unique. Names cannot be forged or printed.

While “unforgeable” value sounds suspicious, especially in dynamic language like Clojure this is what I am looking for. Van Roy uses this feature in CTM to create so called “secure data structures” and later on, for secure token shared between trusted entities in code:

declare NewWrapper in
proc {NewWrapper ?Wrap ?Unwrap} 
    Key={NewName} 
in 
    fun {Wrap X} 
            fun {$ K} if K==Key then X end end
    end 
    fun {Unwrap C} 
            {C Key}
    end 
end

% A secure declarative unbundled Stack
declare NewStack Push Pop IsEmpty in
local Wrap Unwrap in
    {NewWrapper Wrap Unwrap}
    fun {NewStack} {Wrap nil} end
    fun {Push S E} {Wrap E|{Unwrap S}} end
    fun {Pop S E}
        case {Unwrap S} of X|S1 then E=X  {Wrap S1} end
    end
    fun {IsEmpty S} {Unwrap S}==nil end
end

Can this behavior be emulated in Clojure? This way I can assure e.g. that programmer can unwrap a data structure if and only if I have granted him a token. I am aware that it can be insecure nonetheless I would like to find the solution that is functionally equivalent to Van Roy one’s and at least hard to circumvent by programmer.

The next requirement would be to base on pure Clojure and not JVM magic – so no “token = new Object()” etc. For example, function value looks like a good candidate because AFAIK after (defn f [] nil) then (identical? f x) evaluates to true only for x=f and and f is not a subject to memory optimizations like other constructs in functional language (or is it?). However, this approach may have further consequences I am not aware of. Could {NewName} from the above example could be just replaced with new anonymous function (provided non-distributed environment)?

  • 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-02T17:12:22+00:00Added an answer on June 2, 2026 at 5:12 pm

    gensym is guaranteed to produce a unique symbol that can be used to name things.

    user> (gensym 'token)
    token3783
    user> (gensym 'token)
    token3788
    user> (gensym 'token)
    token3793
    user> (gensym 'token)
    user> (def mine (gensym 'token))
    #'user/mine
    user> (def yours (gensym 'token))
    #'user/yours
    user> (= mine yours)
    false
    user> (= mine mine)
    true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
I have some data like this: 1 2 3 4 5 9 2 6
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I would like to count the length of a string with PHP. The string
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.