Output the area \$A\$ of a triangle given its side lengths \$a, b, c\$ as inputs. This can be computed using Heron's formula:
$$ A=\sqrt{s(s-a)(s-b)(s-c)}\textrm{, where } s=\frac{a+b+c}{2}.$$
This can be written in various ways, such as
$$ A= \frac{1}{4}\sqrt{(a+b+c)(-a+b+c)(a-b+c)(a+b-c)}$$
$$ ...
Make CIGAR from two strings
In the field of genomics, CIGAR (Concise Idiosyncratic Gapped Alignment Report) strings are sometimes used to indicate how a DNA sequence aligns to a reference sequence of DNA. CIGAR strings are sequences of <operation, length> pairs. An operation can be M, meaning "match
Well RIP my browser history Apparently every time you update the `location.hash` on a local file, it adds a new history entry, since it's always considered cross-domain even in the same file
@lyxal for simplicity, i guess id just say that only regular notes and sustains exist. would it make sense to only have one note as well? or does having different notes playing at the same time make the challenge better :P
Checking for two vowels in a row is maybe slightly interesting but probably a near-dupe, and the diacritic check is just going to be containsing a combining diacritic character in a normalized string
@tybocopperkettle Not an exact dupe, but as in it doesn't add much new
Can we doubt all knowledge from all sources (perception, reports, and reason)?
Regarding doubting reason, reason can't be proven, it is preceived and judged instantly by our logic, but what if our logic is not true?
Did anyone ever doubt that much? What definitely proves or disporves his/her doub...
hm. so i know sometimes when a language has a builtin function that solves a challenge, the answer is posted as nameoffunction, rather than x=>nameoffunction(x) or whatever
can someone run by me why that wouldnt work for like, dot operator functions?
@emanresuA Philosophy.SE is a 50/50 mix between rigorous questions about logic and the vaguest shower thought garbage imaginable
@thejonymyster Some things like searching have an especially low rate limit. I still wouldn't think a human would be able to reach it though.
@thejonymyster In most existing languages that's a syntax error, submitting nameoffunction works because if you do f=nameoffunction you get a usable f(x). No reason you couldn't make a language that works that way though.
It would just be rather cursed
Since for a f = .toLowerCase you don't know what type you're applying it to later on
@NoHaxJustRadvylf ok so thats sort of what i was thinking, function submissions are about the function being like, a valid object / element in your language, rather than a snippet
Flax, also known as common flax or linseed, is a flowering plant, Linum usitatissimum, in the family Linaceae. It is cultivated as a food and fiber crop in regions of the world with temperate climates. Textiles made from flax are known in Western countries as linen and are traditionally used for bed sheets, underclothes, and table linen. Its oil is known as linseed oil. In addition to referring to the plant, the word "flax" may refer to the unspun fibers of the flax plant. The plant species is known only as a cultivated plant and appears to have been domesticated just once from the wild species...
nah ive got a dumb pun in mind, but im trying to figure out if the joke actually relates to something unique abt the lang :think:
every operator in the language has variable arity (i forget the term) and the way you take multiple args to the operator is using it as a delimiter for the args
Find The Average String
code-golf string
Inspired by this
Your task today: given two strings, find the string with the lowest average Levenshtein distance to the input strings. For example, using Steffan and Seggan, the average string will be Steggan. It is distance 2 from Steffan (replace the ...
> A friendly message from The Name of All that is Good and Holy: Hello! This is The Name of All that is Good and Holy. Before you think of making your own extension to this language, here's another idea for you to consider: Don't! For the love of me, please don't make another derivative of this language! Unless you have something truly new to contribute, it's been done a million times before and will probably make it worse than the original.
@thejonymyster I... don't know, actually. I could see it either way: either space (i.e. no delimiter) binds more tightly than any operator, like in Haskell, or the runs with no space are visual units and thus comma binds more tightly.
Another option: 1,2,3;4,5,6;7,8,9. Now that I look at it, tho, it's kind of hard to see the difference between , and ; at a glance.
@Zionmyceliaadamancy Sure, it's a pretty minor change, and trivial BF variants are extremely common and rather boring, but...actually I have no defense for it lol
BF derivatives are good "I want to make something today even if it's not all that good" langs though :p
Something like that could be useful, yeah, depending on the syntax. But the classic [1 2 3]-type syntax costs n + 1 additional chars per item, which is way more than that or pair-append would.
Is it? Suppose pair is , and append is ;. Then with left-associative infix operators of the same precedence, you'd have 1,2;3,(4,5;6);(7,8;9). My guess is that different precedences or associativities would simply lead to putting the parentheses somewhere else.
A lot depends on whether you need a separator between consecutive values when there's no operator between them.
Have a couple single byte number literals, sure, but for anything bigger than like 8 or 10 or 16, just have a digraph that covers all the two digit numbers and some common three-or-more digit ones
And then for bigger numbers you'll usually have a shorter way of generating them anyway, like number compression or multiplying factors
And it doesn't even have to cost more operators. If you replace, say, 9 (the least common single digit number used in golfed code) with a digraph operator, the number 9 costs exactly one more byte, but literally every other number becomes the same size or shorter.
If golfiness isn't a concern, I'd say wrapping each level in [ ] is the best option. Once you get past two, trying to count how many spaces in a row there are sounds unnecessarily difficult.
@thejonymyster Which, in a way, is the problem I have with the language: it throws all kinds of function overloads into the global namespace together, which makes it hard to find the one you want. (Maybe there's a better way that I haven't encountered.)
If I ever make a golfing library for BQN, ↕∘≠ is gonna be the first builtin I add
@UnrelatedString See, I really like overloading, I just think there's gotta be a better way to handle it than dumping everything in the same namespace.
the fundamental idea being that instead of having discrete overloads of individual functions you have single functions that are implemented differently for individual types on the types' side
@UnrelatedString ... Okay, I think I understood that. (Had to get my brain out of Python land and into non-object-oriented, overloadable-functions Haskell land.)
So if you define a type and you put it in the Show typeclass, the compiler will complain unless you've also overloaded the show function to handle arguments of your new type?
@thejonymyster CMC: Given a string consisting of letters and spaces, replace any uppercase letter with an a followed by the lowercase version of that letter. E.g. "cNt test rn" -> "cant test rn" and "CMC" -> "acamac"
@Zionmyceliaadamancy it even happened for the same reason, except that im on mobile, so shift is a lock character and goes away after you type the char
it is kinda funny that 2,2,0 is basically a failsafe for when the alternative would be an unparseable nilad, when otherwise 2,0 has "precedence" over 0,2