Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

start with the answers

  • Loading branch information...
commit 80fcd53c3ba90fe18230e02511d26c3789da1ba9 1 parent a531262
Moritz Lenz moritz authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 answers.md
32 answers.md
View
@@ -0,0 +1,32 @@
+# Perl 6 FAQ
+
+## What is `so`?
+
+`so` is loose precedence operator that coerces to `Bool`.
+
+It has the same semantics as the `?` prefix operator, just like
+`and` is the low-precedence version of `&&`.
+
+Example usage:
+
+ say so 1|2 == 2; # Bool::True
+
+In this example, the result of the comparison (which is a `Junction`), is
+converted to Bool before being printed.
+
+## How can I extract the eigenstates from a `Junction`?
+
+If you want to extract the eigenstates from a junction, you are doing
+something wrong. Junctions are meant as matchers, not for doing algebra
+with them.
+
+If you want to do it anyway, you can abuse autothreading for that:
+
+ sub eigenstates(Mu $j) {
+ my @states;
+ -> Any $s { @states.push: $s }.($j);
+ @states;
+ }
+
+ say eigenstates(1|2|3).join(', ');
+ # prints 1, 2, 3 or a permutation thereof
Please sign in to comment.
Something went wrong with that request. Please try again.