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 |
12
votes
Vanilla Natural Logarithm Challenge
Brachylog, 2 bytes
*₁
Try it online!
C (gcc) / PARI/GP / Julia polyglot, 3 bytes
log
Try it online in C (gcc)!
Attempt this online in PARI/GP!
Try it online in Julia! … Pascal, ≥ 5 bytes
The built‑in function ln fulfills the task.
Its only parameter needs to be positive. …
9
votes
Recognize a counting tree
This is a non-deterministic language inspired by Curry, Brachylog and other language. …
7
votes
Don't repeat yourself
Brachylog (v2), 4 bytes
√ℕl|
Try it online! … (The header in the TIO link calls the function with all indexes from 1 to 1000, printing the results, and therefore displays the first 1000 elements of the sequence.) …
4
votes
Backronymiser឵឵
Brachylog (v2), 10 bytes
↔{|ụ}ᵐ↔w₆⊇
Try it online!
Function submission, using both its arguments (input string on the left, uppercase acronym on the right) and outputting to standard output. … ) is by far the most useful of Brachylog's nine write instructions, so could probably do with a 1-byte representation (I would likely make this the default behaviour for a write if I were designing a Brachylog-alike …
6
votes
Pairs of integers ordered by their exponentiation
Brachylog (v2), 12 bytes
⟦+₂ᵐgj∋ᵐ.^?∧
Try it online!
Function submission, a generator that generates all solutions. The TIO link uses a header + a command-line argument to print the first ten. … So the Jelly-ish algorithm written here is probably the best available option in the current version of Brachylog. …
2
votes
Output integers in negative order, increase the maximum integer everytime
Brachylog (v2), 7 bytes
⟦₁⟧₁ᵐcc
Try it online!
Function submission. (The TIO link contains a command-line argument to run a function as though it were a full program.) … Explanation
⟦₁⟧₁ᵐcc
⟦₁ Range from 1 to {the function input}
ᵐ On each element of that range,
⟧₁ take a descending range from that value to 1
c Concatenate the ranges
c …
4
votes
Reconstruct an integer from its prime exponents
Brachylog, 13 bytes
wᵐ<₁ṗᵐ≜;?z^ᵐ×
Try it online!
Function submission which dumps some garbage to STDOUT since it saves a byte over l~l<₁ṗᵐ≜;?z^ᵐ× or ∧ċ<₁ṗᵐ;? …
3
votes
Enumerate all palindromic numbers (in decimal) between 0 and n
Brachylog
With the I/O format stated in the question, 8 bytes
≥ℕA↔A≜ẉ⊥
Try it online!
With modern PPCG I/O rules, 4 bytes
≥ℕ.↔
Try it online! … This is a function that generates all the outputs, not a full program like the previous example, and so doesn't comply with the spec as written, but I thought I'd show how the program would look like if …
36
votes
Accepted
Tips for Creating/Maintaining a Golfing Language
L = Brachylog: B = Prolog.
L = Husk: B = Haskell.
L = ShortC: B = C.
L = V: B = Vim.
Decide which "paradigm" your language will use. … function arguments which can be stored in variables. …
7
votes
Operational countdown
Brachylog, 19 16 bytes
-3 thanks to @Unrelated String
Ḋ|⟨ℕ{√₎|/|-}l⟩↰<
Try it online!
A recursive function. If n ≥ 10, the three operations are tried. For n < 10 we need n steps to 0. …
5
votes
Maximum summed subsequences with non-adjacent items
This is a function submission (it's almost usable as a full program, which is what the TIO link does, but the output format is a little weird; when used as a function, though, it just outputs the list … Explanation
I found a much terser algorithm (loosely inspired by my previous Brachylog answer), saving 6 bytes over the Jelly and Brachylog answers and 3 bytes over the current leading answer. …
2
votes
Find the minimum edit distance between two strings
This is a function submission (although it also works as a full program), taking a list of the two strings. … We can save any need to subtract from 0 (like the Brachylog submission does), because we have access to an absolute-difference builtin. …
1
vote
Display Peter's keyboard pattern
Brachylog, 26 bytes
Ị↺,Ạ,".,?!"ụḍ₄{i↔ⁱ⁾}ᶠcs₃ẉ⊥
Try it online!
Essentially a translation of my Jelly answer. A full program which prints the desired output with a trailing newline. … If a trailing newline is unacceptable:
Brachylog, 27 bytes
Ị↺,Ạ,".,?!"ụḍ₄{i↔ⁱ⁾}ᶠcs₃ᶠ~ṇ
Try it online!
Outputs as a function. …
20
votes
Tips for Creating/Maintaining a Golfing Language
A type mismatch is usually a sign of a function that's not generic enough. … In Brachylog, arithmetic operations only work on numeric types. …
1
vote
Implement Bogosort
Brachylog (v2), 5 bytes
≤₁|ṣ↰
Try it online!
Function submission. (The TIO link uses a command-line argument that automatically wraps a function into a full program.) … recursively on it, {outputting its output}
Prolog (the language that Brachylog compiles into) is tail-recursive, so this function ends up being compiled into a tight loop. …