Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A competition to solve a particular problem through the usage and manipulation of strings.
3
votes
Love Tester Code Golf
Dyalog APL, 94 91-30= 61 bytes
Usually APL golfing results in code that is more compact – but not more complex – than normal, but in this case I save chars in ugly ways:
{1↓(∊' ',¨⍵,⍪'and' 'have'),' l …
2
votes
Orthogonal Orientation
Dyalog APL, 15 bytes
⌽∘⍉⍣(11|⎕UCS⍞)⍪
⍪ make string into 1-column table
⍣(…) repeat (n) times
⍞ get string input
⎕UCS convert to UCS code point
11| division rest when divided by 11
⌽∘⍉ rotate -90° (flip-transpose … )
Alternate method (same length):
⌽∘⍉⍣('<^>v'⍳⎕)⍪
⎕ get evaluated input (so one must input, e.g. '^' or the name of a program/variable that returns the desired character)
'<^>v'⍳ index into the string …
2
votes
Is this a valid variable name?
Dyalog APL, 19 bytes - 10% = 17.1
{(0≤⎕NC⍵)÷1+'_'=⊃⍵}
{…⍵…} anonymous function where the right argument is represented by ⍵
⊃⍵ first character (gives space if empty)
'_'= 1 if equal to 'underbar, 0 o …
1
vote
Simple cat program
APL, 6 bytes
⎕←⍞
→1
This has worked in all APLs since the beginning of time.
⍞ wait for input
⎕← Output that
→1 go to line 1
0
votes
Count how many characters are in the program's source
Dyalog APL, 8 bytes
The niladic function f:
≢∊⎕NR'f'
Notice that this prints 10 because APL counts (and stores) the function header (name + newline). However, PPCG practice is not to count this heade …
2
votes
Reverse the consonants
as c
t/⍨ extract (consonants) from t
⌽ reverse
(c/t)← replace consonants with (the reversed ones)
t return the modified string …
2
votes
Reverse a string while maintaining the capitalization in the same places
Dyalog APL, 12 bytes
⌽f¨⍨⊢≠f←819⌶
819⌶ is the case folding function
f← because its name is long, we assign it to f
⊢≠f Boolean where text differs from lower-cased text
f¨⍨ use that (1 means uppercase …
2
votes
Convert n strings of m length to m strings of n length
K, 1 byte
+
Try it here!
Transpose
0
votes
Truncate consecutive character runs to n length
Dyalog APL, 22 20 bytes
(∊⊢↑¨⍨⎕⌊⍴¨)⊢⊂⍨1,2≠/⊢
Prompts for n and takes input string as argument.
( the tacit function ... …
3
votes
Reduce and generalize a list of string
Dyalog APL, 21 bytes
∪'/\d' '\d'⎕R'/Y' 'X'
⎕R regex replaces the left-side strings with the right-side ones
∪ returns the unique elements
TryAPL online!
2
votes
Slowly turn a string into another
Dyalog APL, 20 13 bytes
↑(⌽,\⍞),1↓,\⍞
↑ matrify
(⌽,\⍞) reversed (⌽) cumulative concatenation (,\) of character input (⍞)
, prepended to
1↓ one element dropped from
,\⍞ cumulative concatenation of ch …
2
votes
Dimensional countdown
Dyalog APL, 18 bytes
Prompts for n, then for k.
~∘'0'⍤1⍕(⌽⍳)⍤0⍣⎕⊢⎕
~∘'0'⍤1 remove (~) the (∘) zeros ('0') from the rows (⍤1) (padding with spaces as needed) of
⍕ the character representation of
(⌽⍳) …
4
votes
The Squiggly Sequence
.
⊢⍴'\/'⊃⍨2|⊢
⊢ the argument
⍴ reshapes (repeats)
'\/'⊃⍨ the string "/" selected by
2|⊢ the division remainder when the argument is divided by two
TryAPL online! …
1
vote
Substring Chainification
Dyalog APL 16.0, 15 characters (non-competing); 15.0, 17 bytes
16.0 solution
{⍵⊆⍨(⍴⍵)↑⍺/+\⍺}
Dyalog APL 16.0 adds APL2's partition primitive, ⊂, with the glyph ⊆.
15.0 solution:
{(-⍺)↑¨(+\⍺)↑¨⊂⍵}
…
3
votes
Exploded view of a string
Dyalog APL, 11 bytes
Function returning list of strings.
(⊂∩¨∪)~∘' '
(⊂∩¨∪) the intersection of the entirety and its unique characters
~∘' ' except spaces
TryAPL online!