11

!rant
...i realized i can actually pattern-match like this (as in, sequence of elements (including "whatever") instead of just head::rest in F#...

...from watching a talk about prolog.

like "wait... prolog can do this when pattern-matching? that seems very useful. i think i tried to do that in F# but it didn't work, which seems stupid... I'm gonna go try it again".

and sure enough =D
i think i really am gonna like F# if i find the time and resolve to break through how its different mode of thinking stretches my brain in ways it hasn't been stretched for a long time =D

Comments
  • 6
    The fuck is that syntax

    _::_::

    Man's speaking morse code
  • 1
    @Ranchonyx The man is coding in Braile lmaooo
  • 1
    This is why I love F#
  • 0
    @Ranchonyx pattern matching a list.
    don't know enough yet, but _ is "any value" and "::" is "join elements to form a list out of them".
  • 2
    It would be valuable if more programmers began to think of list-like types as being divided into "head" and "tail" elements.

    ALMOST all tutorials and material that I've seen teach about sequential data structures, without going in depth beyond standard manipulation and syntax.

    I learned to treat lists as their component head/tail from Erlang and I recommend it (for learning both that, and pattern matching), to anyone who will listen.
  • 1
    @Wisecrack i agree, still just learning that thinking, but what makes me dislike/nervous about it is the ever-implied recursion, and its limit.

    especially in languages where recursive functions are the official right way to do things
Add Comment