Jamesj999 Lemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Cipherd@lemmy.ml to Programmer Humor@lemmy.ml · 2 days ago

functions

lemmy.ml

message-square
31
fedilink
257

functions

lemmy.ml

Cipherd@lemmy.ml to Programmer Humor@lemmy.ml · 2 days ago
message-square
31
fedilink
alert-triangle
You must log in or register to comment.
  • Captain Aggravated@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    3
    ·
    5 hours ago

    Python: def :

    derpface.jpg

  • Echo5@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    4 hours ago

    Idk much about programming but that looks like a beautiful reduction of bloat in coding language 😶

  • HiddenLayer555@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    6 hours ago

    I don’t use any but I’m sure there are functional languages where () is a valid function.

    • chaos@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      3 hours ago

      In Haskell, that’s “unit” or the empty tuple. It’s basically an object with no contents, behavior, or particular meaning, useful for representing “nothing”. It’s a solid thing that is never a surprise, unlike undefined or other languages’ nulls, which are holes in the language or errors waiting to happen.

      You might argue that it’s a value and not a function, but Haskell doesn’t really differentiate the two anyway:

      value :: String
      value = "I'm always this string!"
      
      funkyFunc :: String -> String
      funkyFunc name = "Rock on, "++name++", rock on!"
      

      Is value a value, or is it a function that takes no arguments? There’s not really a difference, Haskell handles them both the same way: by lazily replacing anything matching the pattern on the left side of the equation with the right side of the equation at runtime.

  • somerandomperson@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    1
    ·
    6 hours ago

    deleted by creator

  • benagain@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 hours ago

    They could have put php up the top where it belongs.

  • Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    13
    ·
    1 day ago

    Bash fucks me up so much, too. You just put the parentheses there to say that something is a function, not for actually declaring the parameters that can be passed in…

    • vala@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      3
      ·
      10 hours ago

      This really sends me

    • tetris11@feddit.uk
      link
      fedilink
      English
      arrow-up
      1
      ·
      17 hours ago

      |{}

  • The_Hideous_Orgalorg@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    20 hours ago

    Remember kids:

    public void doFun();

    • tetris11@feddit.uk
      link
      fedilink
      English
      arrow-up
      2
      ·
      17 hours ago

      Teacher, I just voided myself in public, are we having fun?

  • potatoguy@lemmy.eco.br
    link
    fedilink
    arrow-up
    41
    arrow-down
    1
    ·
    2 days ago

    And the best:

    public static void () {}

    spoiler

    /s

    • Baizey@feddit.dk
      link
      fedilink
      arrow-up
      4
      ·
      1 day ago

      Technically java would also be (){} since the modifiers are optional (outside of public static void main(String… args)) and return type is ignore for the others :D

      • potatoguy@lemmy.eco.br
        link
        fedilink
        arrow-up
        6
        ·
        1 day ago

        Yeah, it’s a joke, but I disagree on the void, the other languages on the meme doesn’t need a return type (when they are returning nothing), java needs it.

      • RaphaelSchmitz@feddit.org
        link
        fedilink
        arrow-up
        1
        arrow-down
        3
        ·
        edit-2
        17 hours ago

        Yeah the thing is that each part of “public static void” is a feature. Which other languages don’t have.

        Still makes a good meme for programmers who are not experienced enough to know that.

        • orc_princess@lemmy.ml
          link
          fedilink
          arrow-up
          1
          ·
          5 hours ago

          Many other languages have a more readable way of conveying access, class vs instance methods, and of course return type.

          Newer Java versions look great but the industry is slow to catch on, I’ve worked with Java 8 for an NGO for only a few months before landing a better job with a different language and the amount of boilerplate we made in just that little while is insane. A lot of it is generated by the IDE, sure, but it’s so incredibly redundant.

  • KSP Atlas@sopuli.xyz
    link
    fedilink
    arrow-up
    12
    ·
    1 day ago

    Haskell: =

    • codemankey@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      18 hours ago

      The language of the gods

  • Ŝan • 𐑖ƨɤ@piefed.zip
    link
    fedilink
    English
    arrow-up
    27
    ·
    2 days ago

    :(){:|: &};:

    • bleistift2@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      11
      ·
      2 days ago
      :(){:|: &};:
      :(){:|: &};:
      
      • HumanPerson@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        9
        ·
        edit-2
        1 day ago
        :(){:|: &};:
        :(){:|: &};:
        :(){:|: &};:
        :(){:|: &};:
        
        • cryoistalline@lemmy.ml
          link
          fedilink
          arrow-up
          7
          ·
          1 day ago
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          :(){:|: &};:
          
  • bleistift2@sopuli.xyz
    link
    fedilink
    arrow-up
    12
    ·
    2 days ago
    function() {}
    
    • davel [he/him]@lemmy.ml
      link
      fedilink
      English
      arrow-up
      14
      arrow-down
      1
      ·
      2 days ago

      JavaScript can do better than that:

      () => {}
      
      • Oriel Jutty :hhHHHAAAH:@infosec.exchange
        link
        fedilink
        arrow-up
        5
        ·
        1 day ago

        C++: [](){}

        • davel [he/him]@lemmy.ml
          link
          fedilink
          English
          arrow-up
          4
          ·
          edit-2
          1 day ago

          Huh, I haven’t looked at C++ in decades, and I didn’t know they’d added lambda functions/expressions, in C++11. Apparently you can shorten it further: []{}

      • bleistift2@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 days ago

        The intention was to provide a longer version for the first step of the ladder.

  • davel [he/him]@lemmy.ml
    link
    fedilink
    English
    arrow-up
    9
    ·
    1 day ago

    Some Lisp dialects: (λ () )

    • tetris11@feddit.uk
      link
      fedilink
      English
      arrow-up
      1
      ·
      17 hours ago

      your IDE is hiding 6 characters there

      • davel [he/him]@lemmy.ml
        link
        fedilink
        arrow-up
        4
        ·
        17 hours ago

        Some Lisps will accept a literal Unicode lambda character.

  • Prunebutt@slrpnk.net
    link
    fedilink
    arrow-up
    3
    ·
    1 day ago

    Nix:

    x:;

  • bort@sopuli.xyz
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    kotlin also has ()->{} and {} (when there is just 1 parameter)

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 701 users / day
  • 1.4K users / week
  • 2.88K users / month
  • 7.94K users / 6 months
  • 1 local subscriber
  • 39.2K subscribers
  • 1.91K Posts
  • 39.8K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.9
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org