Jonkman Microblog
  • Login
Show Navigation
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. clacke (clacke@social.heldscal.la)'s status on Tuesday, 05-Dec-2017 04:38:22 EST clacke clacke
    @pho4cexa Things like list comprehension syntax basically aren't a thing in curried languages like Haskell, because functions are so composable you can express it in the base syntax.

    And of course, in a lazy language generators aren't a thing because what would be arrays behave like generators.
    In conversation Tuesday, 05-Dec-2017 04:38:22 EST from social.heldscal.la permalink
    1. kat (kat@quitter.se)'s status on Tuesday, 05-Dec-2017 06:19:09 EST kat kat
      in reply to
      @clacke @pho4cexa defo list comprehension in Haskell 
       [ x*x | x <- [1..10]]

      [1,4,9,16,25,36,49,64,81,100]
      In conversation Tuesday, 05-Dec-2017 06:19:09 EST from quitter.se permalink
      1. clacke (clacke@social.heldscal.la)'s status on Tuesday, 05-Dec-2017 06:28:02 EST clacke clacke
        in reply to
        @kat @pho4cexa Schooled! Thank you.
        In conversation Tuesday, 05-Dec-2017 06:28:02 EST from social.heldscal.la permalink
        1. clacke (clacke@social.heldscal.la)'s status on Tuesday, 05-Dec-2017 06:33:05 EST clacke clacke
          in reply to
          @kat @pho4cexa Ah! But is that using the List monad and not the LISP-like lists matched like x:xs?
          In conversation Tuesday, 05-Dec-2017 06:33:05 EST from social.heldscal.la permalink
          1. clacke (clacke@social.heldscal.la)'s status on Tuesday, 05-Dec-2017 06:41:02 EST clacke clacke
            in reply to
            @kat @pho4cexa Ok, they seem to be the same thing.

            > Prelude> let head x:xs = x
            > Prelude> head [(+1) i | i <- [1..]]
            > 2
            In conversation Tuesday, 05-Dec-2017 06:41:02 EST from social.heldscal.la permalink
            1. clacke (clacke@social.heldscal.la)'s status on Tuesday, 05-Dec-2017 06:44:12 EST clacke clacke
              in reply to
              @kat @pho4cexa In my trivial example though, I'm not so sure the comprehension buys any readability. This is shorter and less cluttered:

              > Prelude> head . map (+1) $ [1..]
              > 2
              In conversation Tuesday, 05-Dec-2017 06:44:12 EST from social.heldscal.la permalink
          2. kat (kat@quitter.se)'s status on Tuesday, 05-Dec-2017 06:41:06 EST kat kat
            in reply to
            @clacke @pho4cexa http://qttr.at/20nx  http://qttr.at/20nw Lists are just nested con? It's part of Prelude.
            In conversation Tuesday, 05-Dec-2017 06:41:06 EST from quitter.se permalink
            1. clacke (clacke@social.heldscal.la)'s status on Tuesday, 05-Dec-2017 06:46:28 EST clacke clacke
              in reply to
              @kat @pho4cexa Seems that way. I just wrote my first couple of lines of this language, so. :-)

              Apparently head is actually called head, so no need to define it. :-)
              In conversation Tuesday, 05-Dec-2017 06:46:28 EST from social.heldscal.la permalink
              1. kat (kat@quitter.se)'s status on Tuesday, 05-Dec-2017 06:49:49 EST kat kat
                in reply to
                @clacke @pho4cexa Oh me too, I just started with it, after playing with Python lambda calculus over the summer. http://qttr.at/20ny
                In conversation Tuesday, 05-Dec-2017 06:49:49 EST from quitter.se permalink
            2. clacke (clacke@social.heldscal.la)'s status on Tuesday, 05-Dec-2017 06:51:27 EST clacke clacke
              in reply to
              @kat @pho4cexa Seems it's both. Intriguing!

              Prelude> head $ [1..] >>= return . (+1)
              2
              In conversation Tuesday, 05-Dec-2017 06:51:27 EST from social.heldscal.la permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.