Hello,

I'm wondering how to write anonymous value literals of some Perl 6 basic types, and I didn't see mention of this in synopsis 2.


Now, with some basic types, I know how to do it, examples:

  Bool     # Bool::True
  Int      # 42 or 0x17 or :12<AB9>
  Rat|Num  # 18.2 or :8<53.07> or 4/3
  Str      # 'Hello world'
  Pair     # :key<val> or key=>val
  Range    # 1..10
  Junction # 'a'|'b'|'c' or 'e'&'f' or any(5,20) or none(60,87)
  Seq      # (5,6,7)
  Array    # [8,9,10]
  Hash     # { :a<b>, :c<d> } or { a => 'b', c => 'd' }

Correct me if I'm wrong with the above.

But some significant ones I don't know and really want to know:

  Bit
  Blob
  Set
  Bag
  Mapping

How does one write anonymous value literals of those types? And I mean directly, not by writing a literal of some other type and using a conversion function to derive the above?

The above is my main question, but also I wonder about how to make an anonymous literal of a KeyHash|KeySet|KeyBag. And also how does one specify a Rat vs a Num or what does "18.2" or "4/3" actually get you? And also is there such a thing as a Buf literal and if so how do you write one?

Thank you. -- Darren Duncan

Reply via email to