Array Pattern Matching Language
popularity-contest array-manipulation language-design
Everyone is (or should be) acquainted with the ways of the regular expression. At its core, a regex is made for matching strings. However, it's just matching something, right? Why not match arrays? That would ...
I wish I could play it with someone... Unfortunately my University days are long gone, and I won't find two others that are willing to try this out now (that find such games fun)...
The snippet used in many questions to generate a leaderboard is not displaying correctly for me, and some links are not working. I am using Firefox 59.0.2 (64-bit) on macOS 10.13.2 (High Sierra).
The snippet can be found (and run) here.
Here's how the snippet, when run, renders for me:
That'...
Challenge
Your task is to write a piece of code that outputs another piece of code. That code must in turn output yet another code until the final code outputs the integer 1.
None of your programs may share any characters (there's one exception in the Rules-section).
The winning submission wi...
@ASCII-only In Dyalog APL, ><> is a dyadic function which returns an array of 0s (expanded to match both arguments) for numeric arguments of compatible shapes and errors for all other arguments. E.g. [1,2,3] and 2 gives [0,0,0] but [1,2,3] and [1,2] errors.
@ASCII-only [a-fxyz] in normal regex includes all of them. What do you mean by AND and OR?
@ASCII-only A specific integer would just be 42. Brackets are for ranges. Obviously, a whole host of number properties should be built-in, just like \b\w\d and \p… etc. But a custom function could be specified e.g. using \f{…} where the ellipsis is some concise programming language taking a single number and returning a Boolean.
@Adám the regex itself basically has to be a concise programming language in the first place
@Adám yes. but you can't do [0-9123], so I was thinking [0-9;1;2;3]? re: AND, sometimes (see conor's sandbox post) you might need, say, something like (?:-/ 1,1) (pseudocode representing it has to be: - dyadic minus with arguments / = /1 = previous element and 1, logical AND 1)
@ASCII-only Sure, but instead of inventing a whole new mathematical notation to specify mathematical properties, just include an existing one. So, e.g. to use APL, one could match a sequence of between 5 and 7 numbers that are divisible by 4: \f{0=4|⍵}{5,7}
@Adám (well, in this case it would work, since element needs to be one)
@Adám but it would be possible in a theoretical integer regex language with no nth previous element but with lookbehinds (fibonacci probably possible too, but if there are too many lookbehinds it may start to get confusing)
So I had to convert my disk from MBR to GPT to update Windows, and in the process had to fix it misplacing the boot sector. Somehow, that caused me to grow an extra Windows entry in the UEFI boot menu, and more impressively, three extra entries for the motherboard's built-in UEFI shell.
@ASCII-only Well, so too here, it isn't obvious that this potential language should be able to do so. However, it could be useful to tentatively match a given number of elements, and then use a function to determine if it is an actual match or not. E.g. \n{5,7,{0=4|⍵}} matches all runs of length between 5 and 7 where all members are divisible by 4.
It's strange this question hasn't been asked yet, so here it is:
Calculate the length of a string given through STDIN
Rules
As said, your string will be given through STDIN, not via command line arguments
Print the length of the string to STDOUT
Only ASCII chars will be given, but every ASCII...
Slightly more sophisticated version, allowing saving up to four bytes in when using it: https://tio.run/##bVXNbttGEL77Kaan2OiS2l0ubSloDskhQBvkB3B7EnxgJMYiIJEOSbcw2ubSwJGVqGhRBM2lBRqgSBD0FgQFCvTSvMm@iDszu6QoJrBMzgx3Z775ZnY2OZkH07NkXhxf2uWT0p7/dDupJ7NLkuyPz784vHsHyoFdv0blW3n1qgT79DHY5auBumaXK7v@B39g1@@@/@91d49d/04OL9kbar@BCuHLWVJfqaCYTj/ZGY@VgEhALEChFKgjAWNURqhLjR8ibSKyaTTwSkOa5B37AuTR0Y7@zq5e7uxsYugQPs8nZZpUWX4MWQ6LdHE/LatZdoIBpVBCC@80FkpKoWWkNFsCE2kRGK0EGkSktYvGe/g77hQBL1UoaQr/2aAXPwrhRjE9Oz5NymnFEQm7JrQt9kZ0b@ePlrBrg0voPRqh/0d29YPACINuCBPC7eI0r5MsdxxqR07DS8xyxHbV8f5xsxM3Oq4Z8rP51ro2HqF3sYH…
A Math.SE user have a funny game explained as such:
Pick a random positive integer X.
Add +1, 0, -1 to make it divisible by 3Keep track of how much you've added and subtracted. That is your "score"..
Divide by 3 to create a new X.
Repeat steps 2 and 3 until you reach one.
I'm ex...
@ngn If you're not familiar with Nethack already the only part that you'll find relevant in a month of playing is the part about eating your enemies' corpses
It takes people years if not decades to get to the "fight your way through heaven" part.
> Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program.
> There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.
@FreezePhoenix Leading tabs are always the same, unless you use Word. And unlike space, you can configure their width in most editors, only visible this way for you (so nobody has to scream for your code using wrong indent amount).
pi@raspberrypi:~/Downloads/XtraUtils $ apt-get install moreutils
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
pi@raspberrypi:~/Downloads/XtraUtils $
@Pavel And then there are blogs that replace ordinary ASCII quotes with fancy Unicode ones. Copy-pasting those commands is only marginally better than piping /dev/random to bash.
Final-obstruent devoicing or terminal devoicing is a systematic phonological process occurring in languages such as Catalan, German, Dutch, Breton, Russian, Turkish, and Wolof. In such languages, voiced obstruents become voiceless before voiceless consonants and in pausa.
== Dutch and Afrikaans ==
In Dutch and Afrikaans, terminal devoicing results in homophones such as hard 'hard' and hart 'heart' as well as differences in consonant sounds between the singular and plural forms of nouns, for example golf–golven (Dutch) and golf–golwe (Afrikaans) for 'wave–waves'.
The history of the devoici...
Write a function in Python 2.7 that takes a list of integers as an argument. It should return True or False depending on whether there are any 2 integers in the argument list that sum to zero.
[4,-4,9,6,5]
True
[6,5,-3,2]
False
OP posted and I think left their computer. Wondering if someone should just edit it to make it non-language-specific because the challenge idea is good just the language-restriction is not encouraged.
Hm. Possibly, but I don't think so... Not sure though. I've never been given CS homework that isn't something like "spend half an hour dragging GUI stuff around in Eclipse and 2 seconds writing code" but OP might have a competent CS program.
The Task
Your task is to create a program or a function that, given a sentence, outputs it translated to the Farfallino language. 'Y' is treated as a consonant.
The usual rules for farfallino alphabet are based on the substitution of each vowel with a 3 letter sequence where the vowel itself is...
A velar click, or more precisely a back-released velar click, is any of a family of click consonants found in paralinguistic use in several languages of Africa such as Wolof. The tongue is in a similar position to other click articulations, such as an alveolar click, and like other clicks, the airstream mechanism is lingual. However, unlike other clicks, the salient sound is produced by releasing the rear (probably velar) closure of the tongue rather than the front closure. Consequently, the air that fills the vacuum comes from behind the tongue, from the nasal cavity or the throat.
== IP...
If I remember correctly, there is one sound that if done exactly (opposed to using the symbol as an approximation), you would be in grave danger of swallowing your tongue >_<
@ngn "possible" and "impossible" in IPA correspond mostly to impracticality in language, (c.f. palatal trill)
If I have a JSON object as below:
var json = {
"key1": "value1", // possible values value1, value1.1, value1.2 ...
"key2": "value2", // possible values value2, value2.1, value2.2 ...
"key3": "value3", // possible values value3, value3.1, value3.2 ...
}
I need to create a function which w...
The Utility class should keep track of its own activation state, otherwise calling .activate() multiple times on the same instance (without calling .deactivate() in between) might cause some problems; also, in the current code, calling .addUtil() after .activate() leaves the instance in a limbo s...
A potential end-user response. The best.
Heh. So is javascript not that great for code golf?
I'd assume so, considering the number of "nicities" and such.