diff options
| author | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2025-11-23 22:43:45 +0100 |
|---|---|---|
| committer | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2025-11-23 22:48:54 +0100 |
| commit | 83c73c8a9c53d892a98feefce6a683f63e76e6cb (patch) | |
| tree | a119fb714b9335def164b7c88a638779e98b0a2d | |
| parent | 8779b1b3d01abcfa937fc6474ff3b8fb86d19b32 (diff) | |
| download | perlweeklychallenge-club-83c73c8a9c53d892a98feefce6a683f63e76e6cb.tar.gz perlweeklychallenge-club-83c73c8a9c53d892a98feefce6a683f63e76e6cb.tar.bz2 perlweeklychallenge-club-83c73c8a9c53d892a98feefce6a683f63e76e6cb.zip | |
Solution to task 2 in J
| -rwxr-xr-x | challenge-348/jo-37/j/ch-1.ijs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/challenge-348/jo-37/j/ch-1.ijs b/challenge-348/jo-37/j/ch-1.ijs new file mode 100755 index 0000000000..6a1a95daa5 --- /dev/null +++ b/challenge-348/jo-37/j/ch-1.ijs @@ -0,0 +1,36 @@ +#!/usr/local/bin/jconsole + +Vows =: 'aeiouAEIOU' +halve =: {{((-.(2|#y))*(<. -: #y))({. ; }.)y}} +countvows =: {{+/ (#Vows) > Vows i. y}} +stringalike =: {{-. 0 = (=/ * */) countvows "1 > halve >y}} + +Ex =: cutopen 0 : 0 +textbook +book +AbCdEfGh +rhythmmyth +UmpireeAudio +) + +3 : 0 > 2}. ARGV +if. + 1 = # y +do. + echo stringalike 0 { y +elseif. + 0 = # y +do. + try. + assert (0 1 1 0 0) = stringalike "0 Ex + echo 'tests succeeded' + catch. + echo 'tests failed ' + end. +else. + echo 'Call "./ch-1.ijs STR" to process string' + echo 'or "./ch-1.ijs" to run the examples' +end. +) + +exit '' |
