home.social

#programmingpuzzle — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #programmingpuzzle, aggregated by home.social.

  1. This is an unbirthday present for @screwlisp,
    who posted earlier about quines.

    To give it as a puzzle at first:

    find a Python quine as a string Q such that eval(Q) == Q.

    A spoiler to follow.

    _________
    The term "fixed point" comes to mind. And the Y combinator comes into
    this picture as well; wie another day.

    (Estimating Python's degree of homoiconicity is left as an exercise.)

    #ComputerProgramming
    #Homoiconicity
    #ProgrammingPuzzle
    #Puzzle
    #Python
    #Quine

  2. This is an unbirthday present for @screwlisp,
    who posted earlier about quines.

    To give it as a puzzle at first:

    find a Python quine as a string Q such that eval(Q) == Q.

    A spoiler to follow.

    _________
    The term "fixed point" comes to mind. And the Y combinator comes into
    this picture as well; wie another day.

    (Estimating Python's degree of homoiconicity is left as an exercise.)

    #ComputerProgramming
    #Homoiconicity
    #ProgrammingPuzzle
    #Puzzle
    #Python
    #Quine

  3. This is an unbirthday present for @screwlisp,
    who posted earlier about quines.

    To give it as a puzzle at first:

    find a Python quine as a string Q such that eval(Q) == Q.

    A spoiler to follow.

    _________
    The term "fixed point" comes to mind. And the Y combinator comes into
    this picture as well; wie another day.

    (Estimating Python's degree of homoiconicity is left as an exercise.)

    #ComputerProgramming
    #Homoiconicity
    #ProgrammingPuzzle
    #Puzzle
    #Python
    #Quine

  4. This is an unbirthday present for @screwlisp,
    who posted earlier about quines.

    To give it as a puzzle at first:

    find a Python quine as a string Q such that eval(Q) == Q.

    A spoiler to follow.

    _________
    The term "fixed point" comes to mind. And the Y combinator comes into
    this picture as well; wie another day.

    (Estimating Python's degree of homoiconicity is left as an exercise.)

    #ComputerProgramming
    #Homoiconicity
    #ProgrammingPuzzle
    #Puzzle
    #Python
    #Quine

  5. This is an unbirthday present for @screwlisp,
    who posted earlier about quines.

    To give it as a puzzle at first:

    find a Python quine as a string Q such that eval(Q) == Q.

    A spoiler to follow.

    _________
    The term "fixed point" comes to mind. And the Y combinator comes into
    this picture as well; wie another day.

    (Estimating Python's degree of homoiconicity is left as an exercise.)

    #ComputerProgramming
    #Homoiconicity
    #ProgrammingPuzzle
    #Puzzle
    #Python
    #Quine

  6. #JavaScript #ProgrammingPuzzle ...

    It's very simple to make a readable function to generate an increasing numerical sequence that wraps using the modulo operator.

    num = 1;
    1
    num = (num % 3) + 1;
    2
    num = (num % 3) + 1;
    3
    num = (num % 3) + 1;
    1

    The reverse function I came up with seems unreasonable and unreadable!

    num = 3
    3
    num = (((num + 2) % 3) + 2) % 3 + 1;
    2
    num = (((num + 2) % 3) + 2) % 3 + 1;
    1
    num = (((num + 2) % 3) + 2) % 3 + 1;
    3

    Am feeling tired ;-)