Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on perl6 (a.k.a. raku). # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/perl6.e> # or at <http://angg.twu.net/e/perl6.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # (find-status "perl6") # (find-vldifile "perl6.list") # (find-udfile "perl6/") * (eepitch-raku) * (eepitch-kill) * (eepitch-raku) sub square ($x) { $x * $x } say(square(5)) exit * (eepitch-raku) * (eepitch-kill) * (eepitch-raku) sub infix:<±>($x, $y) { $x + ($y * 2).rand - $y } say 5 ± 3 for ^10; say 6.rand for ^10 say 100.rand for ^10 sub infix:<±> { ((&[+], &[-]).pick)($^a, $^b) } say 5 ± 3 for ^10; say (^10).WHAT (^10).List say (^10).List * (eepitch-raku) * (eepitch-kill) * (eepitch-raku) multi sub infix:<±>($x, $y) { $x + ( $y * 2).rand - $y } multi sub infix:<±>($x, Int $y) { $x + (^$y * 2).pick - $y } * (eepitch-raku) * (eepitch-kill) * (eepitch-raku) multi sub infix:<±>($x, $y) { $x + ($y * 2).rand - $y } multi sub infix:<±>($x, Int $y) { $x + (0 .. $y * 2).pick - $y } say 5 ± 3.0 for ^10; say 5 ± 3 for ^10; multi sub infix:<±>($x, $y) { $x + (-$y .. $y).rand } multi sub infix:<±>($x, Int $y) { $x + (-$y .. $y).pick } say 5 ± 3.0 xx 5; say 5 ± 3 xx 5; * (eepitch-raku) * (eepitch-kill) * (eepitch-raku) say 10.base(2); say 10.base("camel"); say 3.base("camel"); say 4.base("camel"); say 10.base("beer"); • (eepitch-shell) • (eepitch-kill) • (eepitch-shell) cd /tmp cat >all.txt<<EOF one two three four EOF cat >rejected.txt<<EOF two four EOF raku -e 'say "all.txt".IO.slurp.lines (-) "rejected.txt".IO.slurp.lines' nim --hints:off --eval:'import std/[sets, strutils]; echo "all.txt".readFile.strip.splitLines.toHashSet - "rejected.txt".readFile.strip.splitLines.toHashSet' nim --eval:'echo 1' # (find-status "nim") # (find-vldifile "nim.list") # (find-udfile "nim/") nim -v * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) zef install GTK::Simple raku -v sleep 2.5 ** ($attempts - 1) ± 5.rand; # exponential backoff ± jitter # (find-angg ".emacs" "ee-insert-test-raku-mode") # (find-telegachat "1487862914#211626") # https://stackoverflow.com/questions/68903534/class-symbol-introduction-due-to-evalfile/ https://docs.raku.org/language/operators#infix_but http://docs.groovy-lang.org/docs/groovy-2.3.0/html/documentation/core-traits.html#_runtime_implementation_of_traits 2023may12 # Local Variables: # coding: utf-8-unix # End: