Given that dis.csv
looks like this
Name|Age|DOB|Favourite Color
John|17|12/12/1998|Blue
David|31|15/07/1985|Orange
Michael|11|02/08/2005|Red
Open the file called dis.csv
and assign the filehandle to the variable csvfile
SetKeyDelay -1 ; Makes SendRaw faster | |
F7:: | |
ClipStore = %Clipboard% ; Save the current Clipboard | |
SendInput ^a^c ; Copy all text in current field | |
Output := StrReplace(Clipboard, "\", "\\") ; Replace "\" with "\\" | |
SendRaw %Output% ; Send the output | |
Clipboard = %ClipStore% : Restore original Clipboard | |
Return |
#!/usr/bin/env sh | |
set -e | |
INSTALL_DIR=$HOME/rakudo | |
LATEST_TAR="rakudo-star-latest.tar.gz" | |
URL="http://rakudo.org/downloads/star" | |
echo "\033[1;33m | |
This script will install Rakudo Star |
Given that dis.csv
looks like this
Name|Age|DOB|Favourite Color
John|17|12/12/1998|Blue
David|31|15/07/1985|Orange
Michael|11|02/08/2005|Red
Open the file called dis.csv
and assign the filehandle to the variable csvfile
use Inline::Python; | |
my $py = Inline::Python.new(); | |
$py.run('import matplotlib.pyplot'); | |
class Matplotlib::Mlab { | |
method FALLBACK($name, |c) { | |
$py.call('matplotlib.mlab', $name, |c) | |
} | |
} |
> <matthew mark luke john>.unique(as => *.chars).sort(by => *.chars)
(mark matthew)
Ahh good, my code works... except it's not really sorting by chars here because unlike unique
, sort
takes a code block not a named parameter. However there is no error to indicate this is not DWIM. It just silently sorts Naturally.
If your data happens to sort Naturally in the same order your by
option would have sorted it - and you don't notice - you now have a bug laying dormant in your code that could go unnoticed indefinitely.
Sort should either handle this syntax, or otherwise throw up a warning;
my %m; | |
my token foo { 'foo' { %m<foo> = $/ } }; | |
my token bar { 'bar' { %m<bar> = $/ } }; | |
my token baz { 'baz' { %m<baz> = $/ } }; | |
my token qux { 'qux' { %m<qux> = $/ } }; | |
my @tokens = /<foo>/, /<bar>/, /<baz>/, /<qux>/; | |
say 'foo bar baz qux' ~~ / ^ <{ @tokens[$++] }> ** { +@tokens } % <.ws> $ /; |
I've used this in some personal code... Seems to work fine mostly provided you don't try to get it to parse timezones.
I'm no C programmer. I'm not sure if I've done anything wrong with the NativeCall.
If someone wants steal this and release to the ecosystem, it should probably be added to the already existing POSIX module rather than it's own thing.
> (1..10).rotor(3) | |
((1 2 3) (4 5 6) (7 8 9)) | |
> (1..10).rotor(3, :partial) | |
((1 2 3) (4 5 6) (7 8 9) (10)) | |
> (1..10).rotor(3,2,1) | |
((1 2 3) (4 5) (6) (7 8 9)) | |
> (1..10).rotor(3,2,1, :partial) |
sub hanoi(\n, \a = 1, \b = 2, \c = 3) { | |
return unless n; | |
hanoi n - 1, a, c, b; | |
#say "Move disk {n} from peg {a} to peg {c}"; | |
hanoi n - 1, c, b, a; | |
} | |
hanoi(20); | |
say now - INIT now |