News for hackers. Stuff that matters.
Re:I Hate the Letter F by robin_reala on Saturday October 19, 2024 @02:51AM (#41886127)
As a commenter points out, that’d make programming a difficult pastime. Can’t think of a non-esolang without if and for apart from Brainfuck, and that’s got an f in the name.
Re:I Hate the Letter F by reikonomusha on Saturday October 19, 2024 @03:21AM (#41886238)
Easy in Common Lisp without sacrificing ergonomics or getting stuck in a Turing tarpit.

We'd make a small preamble to define new names for things like DEFUN, Lisp's operator to define new functions. No F's needed to do that either. We can do this by taking advantage of read-time evaluation.

First we get references to the symbols DEFMACRO and DEFUN.

    (eval-when (:compile-toplevel :load-toplevel :execute)
      (setq de*un (intern (map 'string 'code-char '(68 69 70 85 78))))
      (setq de*macro (intern (map 'string 'code-char '(68 69 70 77 65 67 82 79)))))
This technique can be used to access any symbol in Common Lisp that may have an F in it.

Now, to make life-without-F easy, we define new names for DEFMACRO (mac) and DEFUN (proc) without actually lexically referring to the F-infected symbols:

    (#.de*macro mac (&body r) `(,de*macro ,@r))
    
    (mac proc (&body r) `(,de*un ,@r))
Now we can define functions with PROC instead of DEFUN. Here's the Fibonacci function, with the F censored out. Note that we don't need IF since Lisp has the superior COND:

    (proc *ib (n)
      (cond
        ((= 0 n) 0)
        ((= 1 n) 1)
        (t (+ (*ib (- n 1)) (*ib (- n 2))))))
Test it:

    > (print (*ib 10))
    55
Re:I Hate the Letter F by benrutter on Saturday October 19, 2024 @04:07AM (#41886402)
This is excellent! I was playing around with a lisp (hy) recently, and hadn't really used macros before then. It's amazing how much you can reengineer lisp from within to meet your needs, even if they're as small as "I don't want to use F".

I haven't seen any non-lisp languages that give you that kind of power, for better or worse.

Re:I Hate the Letter F by amenhotep on Saturday October 19, 2024 @07:13AM (#41887162)
I think that's cheating. 70 is just F with a different hat on.
Re:I Hate the Letter F by reikonomusha on Saturday October 19, 2024 @02:37PM (#41889665)
Would it be better for you if we took the Nth symbol in alphabetical order from the list of 978 standard symbols? You could do that.

How about searching for all symbols with the letters DEMACRO that are 8 letters long? We could do that too.

The technique works so long as you can uniquely determine the symbol through some combination of standard Lisp functions that don't contain F. Lisp has a big library, so it's not tough.

"70" isn't a number that is associated to F in any common person's understanding, and the pronunciation of the number "70" in English has no objectionable F sounds, so I don't agree it's cheating. :)

Re:I Hate the Letter F by kagevf on Saturday October 19, 2024 @10:11PM (#41892372)
A garbage reddit post produces this great comment - only on HN! :)

And somehow, my reply managed to avoid using that letter ...

Re:I Hate the Letter F by evmar on Saturday October 19, 2024 @03:01AM (#41886168)
With Rust you could get by with "match bool { true => ..., _ => ... }" and "loop { ... break }" I think.
Re:I Hate the Letter F by xanathar on Saturday October 19, 2024 @04:17AM (#41886448)
But you would not be able to define functions.
Re:I Hate the Letter F by Trung0246 on Saturday October 19, 2024 @03:30AM (#41886262)
`unsafe` code is a little bit tough since the keyword have an F, unless there's another way to create unsound code by abusing rustc.
Re:I Hate the Letter F by notpushkin on Saturday October 19, 2024 @03:15AM (#41886216)
Yeah, using a language with pattern matching should do the trick. Maybe OCaml or even F#.

rimshot

Re:I Hate the Letter F by RodgerTheGreat on Saturday October 19, 2024 @03:23AM (#41886243)
In Lil[0], avoiding "F" is doable, but not very convenient.

The if/elseif keywords are off the table, but you still have both explicit looping constructs and function declarations:

    while x ... end
    each x y z in w ... end
    on name x y do ... end
There are five primitive operators with "F": typeof (rarely needed), floor (inconvenient to work around but at least you still have % for modulo), first (can be replaced with indexing), flip (transpose a matrix/table; this could be replaced (slowly) with a user-defined function), fuse (join a list of strings into a single string; very difficult to do without, since Lil doesn't have a vanilla string-concat operator), format (string formatting; this removes tons of functionality and the easiest ways of working around not having fuse).

Most of the query forms (select, extract, and update expressions) would be OK, but they all need a "from" clause to specify the source table, so no dice.

What you're left with is still very much Turing-Complete, but much less ergonomic.

[0] http://beyondloom.com/tools/trylil.html

Re:I Hate the Letter F by frogulis on Saturday October 19, 2024 @03:13AM (#41886204)
I infer from the wording in your comment that you consider Brainfuck to be a non-esolang. Your mind must operate on a different plane to mine!
Re:I Hate the Letter F by robin_reala on Saturday October 19, 2024 @03:51AM (#41886347)
It’s the most well known of the esolangs at least.
Re:I Hate the Letter F by skykooler on Saturday October 19, 2024 @03:41AM (#41886302)
You could do a lot in assembly (which uses instructions like JNZ for "if"), as long as you don't need any floating point math.
Re:I Hate the Letter F by Someone on Saturday October 19, 2024 @03:16AM (#41886223)
https://en.cppreference.com/w/cpp/language/charset:

“Mapping from source file (other than a UTF-8 source file)(since C++23) characters to the basic character set(until C++23)translation character set(since C++23) during translation phase 1 is implementation-defined, so an implementation is required to document how the basic source characters are represented in source files.”*

⇒ pre C++23, you could have a C++ compiler that used an Unicode “Pile of poo” (https://www.unicode.org/L2/L2017/17407-frowning-poo.pdf) instead of the letter F.

Re:I Hate the Letter F by yojo on Saturday October 19, 2024 @03:16AM (#41886222)
JavaScript gives you the ternary operator (?/:) to handle conditionals plus switch/case. Plus you get map/reduce methods on iterables, and you can write procedures with “const thing = ()=> {}”

I think I could write an arbitrarily complex program without major issue.

Re:I Hate the Letter F by xigoi on Saturday October 19, 2024 @03:40AM (#41886299)

    if (x) { y; } → while (x) { y; break; }
    for (a; b; c) { d; } → a; while (b) { d; c; }
Re:I Hate the Letter F by pfortuny on Saturday October 19, 2024 @03:00AM (#41886164)
I guess you can (at least in C ) use && where you would use “if” and a convoluted while where you could write a “for”.
Re:I Hate the Letter F by akira2501 on Saturday October 19, 2024 @03:13AM (#41886206)

    #include <stdio.h>

    int main() {
            int a = 1;
        
            switch(a) case 1: puts("there's always this");
    }
Switch accepts a statement. It does not have to be compound.
Re:I Hate the Letter F by tgv on Saturday October 19, 2024 @03:18AM (#41886227)
When you're dedicated and don't have to work in a large team:

ihatetheletterf.h:

    #define cond if
    #define loop for
    #define otherwise default
    #define untrue false
    #define real float
And when you work in a (large) team, they won't likely accept weird constructions just to avoid a letter anyway.
Re:I Hate the Letter F by reshlo on Saturday October 19, 2024 @03:21AM (#41886239)
You just used the letter f 13 times to make that file, though.
Re:I Hate the Letter F by thaumasiotes on Saturday October 19, 2024 @03:26AM (#41886251)
> and a convoluted while where you could write a “for”

What's convoluted about it? A `for` is about as simple as syntactic sugar gets.

    for( a; b; c ) {
    }
is exactly equivalent to

    a;
    while( b ) {
      c;
    }
(OK, a variable declared in `a` will remain in scope after the while loop terminates, but the only way for this to have an effect on anything is if you intentionally refer to it afterwards, in which case you needed to predeclare it for the for loop too.)
Re:I Hate the Letter F by reshlo on Saturday October 19, 2024 @03:20AM (#41886234)
You might be able to get by in Haskell if you avoid case expressions.
Re:I Hate the Letter F by danielheath on Saturday October 19, 2024 @03:43AM (#41886317)
Unless and Each, in ruby?
Re:I Hate the Letter F by coffee_ on Saturday October 19, 2024 @02:59AM (#41886160)
happenstance x > 0:

per x in y:

Re:I Hate the Letter F by fragmede on Saturday October 19, 2024 @03:08AM (#41886184)
whitespace
Re:I Hate the Letter F by thayne on Saturday October 19, 2024 @03:20AM (#41886236)
Definitely an esolang