Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for south‭

Type On... Excerpt Status Date
Answer A: "Hello, {name}!"
[Factor], 30 29 bytes [ readln "Hello, %s!"printf ] Try it online! Uses `io` and `formatting`.
(more)
over 1 year ago
Answer A: Lowercase, but not just the letters
J, 15 bytes ``` 7 u:32 OR 3 u:] ``` Port of Shaggy's answers. Evaluates as 3 forks `7 u: (32 OR (3 u:]))` Attempt This Online! ``` 7 u:32 OR 3 u:] ] : right argument 3 u: : 3&u: converts a string to a list of char codes 32 OR : bitwise OR the result...
(more)
over 1 year ago
Answer A: Just the vowels please
Fig, 3 bytes Actual score is: \$3\log{256}(96)\approx\$ 2.469 bytes. Filters consonants from the input string using implicit input. ``` Fcb ``` Try it online! ``` Fcb F : Filter with two string args filters a from b cb : constant for upper/lowercase consonants ```
(more)
over 1 year ago
Answer A: Just the vowels please
[Raku], 18 bytes {m:g:i//} Implicitly matches the topic variable with the regex Try it online! ``` {m:g:i//} { } : anonymous code block m : match operator :g:i : regex adverbs, global and ignorecase // : the regex usi...
(more)
over 1 year ago
Answer A: 8 coexisting queens
J, 20 bytes ``` '01'{#:2^2842 A.i.8 ``` Attempt This Online! Non-tacit program that outputs implicitly in a REPL. Shoutout to Raul (Miller)#5220 in the APL farm discord for thinking of this cool idea. ``` 2842 A.i.8 : Anagram 2842 of 0..8 -> 0 4 7 5 2 6 1 3 2^ ...
(more)
over 1 year ago
Answer A: Can you give me half?
Fig, 2 unique, 2 total ``` H! ``` Try it online! Halves the negation of the empty string when no input is given.
(more)
over 1 year ago
Answer A: Looping counter
Fig, 5 bytes The actual score is \$5\log{256}(96)\approx\$ 4.116 bytes. The leaderboard only likes ints in the header. ``` (J,Q0 ``` -1 char thanks to Seggan Try it online! Fractional byte lang created by Seggan. Is this even allowed here? ``` (J,Q0 ,Q : Print and return last ret...
(more)
over 1 year ago
Answer A: Multiply complex numbers.
Sidef, 25 bytes ``` {eval .split.join(" ")} ``` ``` {eval .split.join(" ")} { } # Create anonymous code block .split.join(" ") # splits on whitespace and joins with " " . # equivalent to .split.join, where is the topic ...
(more)
over 1 year ago
Answer A: Find n Niven Numbers
Ruby, 56 bytes p (1..).lazy.filter{1%1.digits.sum&lt;1}.take(gets.toi) Attempt This Online!
(more)
over 1 year ago
Answer A: Partial Sums of Harmonic Series
Goruby, 38 bytes ``` ->n{dw{$.+=1;$..mp{1.0/-1}.su<n};$.} ``` This was not as much fun as I thought it would be, but it was fun enough to use once.
(more)
over 1 year ago
Answer A: Make a frequency table (histogram)
Ruby, 12 bytes ``` ->{1.tally} ``` Attempt it online!
(more)
almost 2 years ago
Answer A: Determine whether an integer is square-free
Myby, 12 5 bytes ``` primf=primfd ``` ``` primf : prime factors = : equals primfd : unique prime factors ``` Evaluated as a monadic fork in J `(f y) g (h y)`. The test cases (retested) can be viewed here and were generated using this ruby script.
(more)
almost 2 years ago
Answer A: Evens or Odds - you know this one
Myby, 2 bytes ``` %2 ``` Input is taken from the command line implicitly. `0` for even, `1` for odd. Since Myby is still in its early stages, there is no online sandbox. Some test cases can be seen here.
(more)
almost 2 years ago
Answer A: Cumulative Counts
J, 9 bytes ```J 1#.]=&><\ ``` This is the 7 byte APL solve but makes use of `#.` in place of `+/"1`. I came up with `1#.]=\` first, but [bubbler pointed out it breaks when non zeros are present. Attempt it online!
(more)
almost 2 years ago
Answer A: Make a frequency table (histogram)
J, 8 bytes ```J .,:#/. ``` Tacit function, this is the de facto method for this problem in J. Attempt it online!
(more)
almost 2 years ago
Answer A: Make a frequency table (histogram)
Python 3, 38 36 33 bytes ```python lambda x:{n:x.count(n)for n in x} ``` -2 bytes thanks to @Razetime Another -3 bytes thanks to @orthoplex Attempt it online!
(more)
almost 2 years ago
Answer A: Create a range grid
MATL, 8 bytes ``` tp:qwPe! ``` Try it online! ``` tp:qwPe! t : duplicate with implicit input (function args as array) p : product [2 3]p -> 6 : : range 1..n q : decrement w : swap top of stack P : flip [2 3]P -> [3 2] e : reshape 1 2 3...
(more)
about 2 years ago
Answer A: Create a range grid
Ruby, 33 bytes ``` ->n,m{[(0...nm).eachslice(m)]} ``` Try it online!
(more)
about 2 years ago
Answer A: The Pell Numbers
J, 28 bytes ``` :}.@{.m&(+/ .)&m=.2 1,:1 0 ``` [Try it online! Tacit matmul solve. `x&u&y` applies `x` to `y` `n` times.
(more)
about 2 years ago
Answer A: Looping counter
MATL, 16 bytes ``` 1`1yh1$lZctDwQt] ``` Try it online! The TIO output fetch will likely fail, so make sure to click the run button to stop the execution. ``` 1`1yh1$lZctDwQt] 1` ] - Push 1 onto stack, enter do-while 1 - Push 1 onto stack y - d...
(more)
about 2 years ago
Answer A: Determine whether an integer is square-free
MATL, 6 bytes ``` YftuX= ``` Try it online! Same method as Moshi. ``` YftuX= Yf - factor with implicit input t - duplicate u - unique X= - isequal ```
(more)
about 2 years ago
Answer A: Solve Goldbach's Conjecture
MATL, 19 bytes ``` XH:YqtZ!tsH=f1Z)Z) ``` Try it online! I'm still a novice at MATL, so I am all ears to any improvements. ``` XH:YqtZ!tsH=f1Z)Z) XH - copy implicit input to H clipboard : - range 1..n Yq - vectorized n-th prime t ...
(more)
about 2 years ago
Answer A: Are All Elements Equal?
MATL, 4 bytes ``` tPX= ``` Try it online! ``` tPX= t - duplicate with implicit input P - fliplr in MATLAB, reverses top of stack X= - isequal ```
(more)
about 2 years ago
Answer A: Can you give me half?
MATL, 3 distinct, 3 total ``` lH/ ``` Try it online! Computes `1/2`. Reserved labels for constants can be found here
(more)
about 2 years ago
Answer A: Solve Goldbach's Conjecture
Ruby, 69 bytes ```RUBY require'prime';->n{Prime.first(n).then{1.product 1}.find{1+2==n}} ``` Try it online!
(more)
about 2 years ago
Answer A: Solve Goldbach's Conjecture
J, 50 bytes ```J {{({[:y&(i.&1@:=)[:>+/&.>),{@(,&+/&.>),{@(,&+/&.>) NB. monadic hook [:>+/&.> NB. sum each pair and unbox [:y&(i.&1@:=) NB. first occurrence of y in list of sums { ...
(more)
about 2 years ago
Answer A: Keyword golfing
Ruby 3.1.0, 274 259 249 bytes -10 bytes thanks to Paradox in the Ruby discord ```ruby BEGIN{END{alias module class begin rescue retry ensure end if self elsif defined? for$.in true do super while false until 0unless not ENCODING and LINE or nil undef redo next end return def break =yiel...
(more)
about 2 years ago
Answer A: Small integer swapping
J, 3 bytes ```J ,|. ``` Try it online! This hook `y f (g y)` appends `y` with its reverse.
(more)
about 2 years ago
Answer A: Determine whether an integer is square-free
J, 17 bytes ```J {{./y|:2+i.y}} ``` Try it online! A direct definition closest to Razetime's infuriatingly good train solution. Outputs a non-zero number for true and 0 for false.
(more)
over 2 years ago
Answer A: A number adder, not a death adder
J, 21 bytes ```J ,&'+".1!:1(3)'1!:1(3) ``` Try it online! STDIN is ugly in J because you have to use foreigns.
(more)
over 2 years ago
Answer A: Make my value binary
J, 2 bytes ```J #: ``` Try it online! Antibase two
(more)
over 2 years ago
Answer A: Shape of an array
J, 1 byte ```J $ ``` This is shape of. Pretty low-hanging fruit tbh.
(more)
over 2 years ago
Answer A: Can you give me half?
J, 4 3 distinct, 6 bytes ```J -:-: ``` Half of ` -: ` which is asks if infinity matches infinity. Thanks to @xash in the APL farm discord for saving the 3 unique bytes and orthoplex for catching my blunder.
(more)
over 2 years ago
Answer A: It's Hip to be Square
J, 6 bytes ```J 0=1|%: ``` Try it online!
(more)
over 2 years ago
Answer A: Evaluate a single variable polynomial equation
J, 2 bytes ```J p. ``` Try it online! J likes inflections so it won't beat APL, but J is still a contender :).
(more)
over 2 years ago
Answer A: Reverse an ASCII string
J, 2 bytes ```J |. ``` Try it online!
(more)
over 2 years ago
Answer A: Roll n fair dice
J, 10 7 bytes ```J +/>:?#/ ``` Try it online! ``` +/>:?#/ #/ : Inserts dyadic # into an array n m Creates n copies of m ? : Roll from 0..y >: : Increment +/ : Sum reduce ``` -3 bytes thanks to torres.
(more)
over 2 years ago
Answer A: Make $2 + 2 = 5$
J, 7 9 bytes ```J ++2&=@+. ``` Try it online! Dyadic fork that executes with the form `(x + y) + (2 = x +. y)`. Thanks to torres for pointing out the obvious flaw.
(more)
over 2 years ago
Answer A: Compute the determinant
J, 5 bytes ``` -/ . ``` Try it online! For the determinant conjunction, the space before `u` is necessary, so there is no shaving a byte here. If you want to read more about this conjunction, check out NuVoc
(more)
over 2 years ago
Answer A: Reduce over the range [1..n]
J, 11 9 bytes ``` /@(>:@i.) ``` Attempt it online!
(more)
over 2 years ago
Answer A: "Hello, World!"
J, 15 bytes ``` 'Hello, World!' ``` Or if you prefer to beat around the bush...76 bytes. ``` {:a.{-:^:1@:|.&2 S:0<@:<\50 16.5 36 50.5 54 54 55.5 22 16 43.5 55.5 57 54 ``` Try it online!
(more)
over 2 years ago
Answer A: Repeat the characters
J, 1 byte ``` # ``` Try it online! The copy verb. It works the exact same as APL and Jelly's replicate.
(more)
over 2 years ago
Answer A: Are All Elements Equal?
J, 4 bytes ``` -:|. ``` Try it online! Checks if the input array matches itself reversed. This is a tacit form and is executed monadically as `x f (g x)`.
(more)
over 2 years ago
Answer A: Multiply complex numbers.
J, 2 bytes ``` / ``` Try it online! For complex numbers with `0` as the second part, J will represent them as ints, but they are treated the same.
(more)
over 2 years ago