or iinterpreter [duplicate]

or is a dubious esoteric programming language. The author is unknown but it is known that fungot (a chatbot) is currently learning or but it remains unknown how it does it and where it receives the required material to learn or. Check out this IRC log to see fungot revealing part of the language.

Instruction reference

It is only known that a space followed by an f pushes false to the stack. The false value may by any falsy value of your choosing. (You are allowed to set this falsy value to f prepended with a space, of course.) Since this language does not support output, in order to make verifying answers possible, you should output the resulting stack in the end of the program.

In other words, count the number of appearances of this exact text f prepended with a space in unary.

Test cases

Expects one false to the stack

 f


Expects 2 falses on the stack

m f ma f


Expects 1 false on the stack

 f a lf


Expects 2 falses on the stack

a f fa


Scoring

This is , so shortest answer in bytes wins.

marked as duplicate by Luis Mendo, caird coinheringaahing, pppery, Community♦Oct 21 at 23:02

• what does our code even have to do? After reading this question, I have absolutely no idea. Do we have to count "f" characters in the input? – my pronoun is monicareinstate Oct 21 at 14:09
• Whoops, the documentation is a bit unclear. You have to count the number of the two characters space and f consecutively. (In other words, count the appearances of the exact text f prepended with a space.) – A _ Oct 21 at 14:15
• Can our falsy value be f prepended by a space? – my pronoun is monicareinstate Oct 21 at 14:35
• So the 'falsy' value may actually be truthy, right? – Arnauld Oct 21 at 14:54
• I got confused with the backstory. It looks like all that’s needed is Count the number of appearances of this exact text f prepended with a space in unary. Can you confirm? – Luis Mendo Oct 21 at 15:44

Pyth, 9 8 bytes

*]0/z" f


Try it online!

Alternatively, to print nice falses: *]!1/z" f

-1 byte thanks to @FryAmTheEggman

• @FryAmTheEggman: I forgot about the single-element list constructor, thanks! – randomdude999 Oct 21 at 14:44

Python 3, 38 26 bytes

lambda s:[0]*s.count(" f")


Thanks to:
- @A_ for saving me 12 bytes

Try it online!

• – A _ Oct 21 at 14:33
• @A_ Thanks :), is it possible that you specify the output even more? Do I have to output an array with false values or is an int value with the occurrence of the pattern? – Delta Oct 21 at 14:36
• @Delta: the description clearly states "count the number of appearances ... in unary", so you can't just print the number directly. – randomdude999 Oct 21 at 14:41
• @randomdude999 Thanks, my bad. – Delta Oct 21 at 14:43

Retina, 5 4 bytes

-1 byte thanks to @FryAmTheEggman

L f


This creates the newline-separated list of all matches of the regex / f/.

Try it online!

• You could use L and remove the last newline assuming that is still valid. The "falsy" requirement is sort of meaningless in Retina, unfortunately. – FryAmTheEggman Oct 21 at 15:03

WDC 65816 machine code, 22 bytes

Hex: A2 00 9B B5 00 C9 20 D0 07 B5 01 C9 66 D0 01 5A E8 B5 00 D0 EE DB

Disassembled:

    LDX #$00 TXY start: LDA$00,x
CMP #$20 ; space BNE skip LDA$01,x
CMP #$66 ; 'f' BNE skip PHY skip: INX LDA$00,x
BNE start
STP


Assumes starting in 8-bit accumulator and index mode. (SEP #\$30)

I/O format: input is a null-terminated string starting at the start of zero page. Output is null bytes on the actual stack. This seems to be allowed according to meta.

Try it online? Something as obscure as this isn't on TIO. This link is to a web interface of an IRC bot that has a command to assemble and execute 65816 code. (It uses the emulation from the bsnes SNES emulator, which is known for being very accurate.) All the LDA/STA at the start is just setting up the string in zero page. You can see the fact that stuff is being pushed by the stack register decreasing occasionally.

Japt, 4 bytes

èfù2


Try it

It's not entirely clear what exactly we should be outputting so this may need to be ...

ffù2


Try it

Or even ...

ffù2)ç


Try it

• The first two are invalid, as we have to output a list of "falsy" values that cannot be " f". The fù2 is very clever though – Embodiment of Ignorance Oct 22 at 5:12

Japt v2.0a0 -Q, 7 bytes

f/ f/ ç


Try it

Perl 5, 8 bytes

say/ f/g


Try it online!

Keg, 18 10 bytes

?( =[f=[0.


Try it online!

-8 bytes thanks to @A_

?(!2/|++f =[0.
`