Let's Talk About Functional Programming

แชร์
ฝัง

ความคิดเห็น • 130

  • @Lars-ce4rd
    @Lars-ce4rd 7 หลายเดือนก่อน +30

    tsoding: "Let's see if I remember any OCaml from 8 years ago"
    *proceeds explaining me all the syntax of OCaml*

  • @aradarbel4579
    @aradarbel4579 3 ปีที่แล้ว +13

    Nice! I've wanted to learn OCaml for a long time now, this is the perfect opportunity to follow along (however slowly) and get some problems solved :D

  • @_vsnwprintf_s_l
    @_vsnwprintf_s_l 3 ปีที่แล้ว +108

    Lisp's main feature is homoiconicity, that being that all code is also data, and therefore lisp has incredibly powerful macros that look just as nice as regular code. I don't know of anything in Python that can achieve anything close to this. The rest of that sentiment was good but I think that's not a good comparison.

    • @dwightk.schrute8696
      @dwightk.schrute8696 2 ปีที่แล้ว +23

      the problem is that "regular code" in Lisp looks like garbage anyway, hard to screw that up even more than it is

    • @huistelefoon5375
      @huistelefoon5375 ปีที่แล้ว +7

      ​@@dwightk.schrute8696what makes you say that?

    • @dwightk.schrute8696
      @dwightk.schrute8696 ปีที่แล้ว

      @@huistelefoon5375 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
      ^^ half of your lisp code

    • @angelcaru
      @angelcaru 8 หลายเดือนก่อน

      (what
      (makes
      (you
      (say
      (that)))))
      @@huistelefoon5375

    • @insertoyouroemail
      @insertoyouroemail 5 หลายเดือนก่อน

      @@dwightk.schrute8696 I don't think Lisp code looks like garbage.

  • @jonathanschmider8446
    @jonathanschmider8446 3 ปีที่แล้ว +51

    Maybe the weird Clang behaviour is because of undefined behaviour? If the function loops infinitely, it causes integer overflow, which is UB. Since the function always loops infinitely, calling it always invokes UB. In case of UB, the compiler can do whatever it wants, and it decided it wants to print garbage.

    • @dnkreative
      @dnkreative ปีที่แล้ว +5

      Weird clang behavior is because of they completely lost sense while chasing mythical "optimization". This just shows that compiler produces incorrect program. There are many other cases with it (and probably GCC) which even Linus commented.

    • @iuppiterzeus9663
      @iuppiterzeus9663 11 หลายเดือนก่อน +1

      not a bad argument

  • @digitalspecter
    @digitalspecter 3 ปีที่แล้ว +44

    Well, yeah, syntax is mostly inconsequential. However, I think with Lisp you're also seeing pretty much the AST which is very handy when writing macros. They can can do whatever manipulations to data/code and spit out code and with Lisp's syntax it's easier to see the structure you're manipulating / trying to achieve. Also Lisp's object model is nicer than Python's (multiple dispatch etc). Also, debugging/modifying a running program is sometimes really nice :) My main objection against Lisp is that it isn't statically typed so the compiler doesn't help me as much as I would like to :)

    • @ribosomerocker
      @ribosomerocker 3 ปีที่แล้ว +5

      Some lisps are statically typed

    • @digitalspecter
      @digitalspecter 3 ปีที่แล้ว +9

      @@ribosomerocker Yup, I meant Common Lisp. I've been following a language called Carp which is quite interesting statically typed compiled language with Rust-inspired memory management.. but it's still quite early in the develpoment.

    • @apestogetherstrong341
      @apestogetherstrong341 ปีที่แล้ว +2

      Well, static typing would require a static language. Lisp is dynamic. However, with just a few (DECLARE (TYPE ...)) forms, the compiler will not only warn you, but actually refuse to compile when it'll see type conflicts of variables. Common Lisp doesn't lack strict type enforcement, it's just optional.

    • @insertoyouroemail
      @insertoyouroemail 10 หลายเดือนก่อน +1

      When you have the program running, static analysis is not as important. You're running your code and getting instant feedback anyway. But yeah, sometimes types are nice anyway.

  • @MrPetzold123
    @MrPetzold123 ปีที่แล้ว +5

    You are an exceptionally good teacher, you actually got me to understand tail call optimization 🤩

  • @RicardoValero95
    @RicardoValero95 3 ปีที่แล้ว +40

    This man should do APL

    • @leastexpected3115
      @leastexpected3115 3 ปีที่แล้ว +1

      oh, he will love it

    • @BigBeesNase
      @BigBeesNase 3 ปีที่แล้ว +12

      After using APL:
      This man and its viewers looses their sanity.

    • @digitalspecter
      @digitalspecter 3 ปีที่แล้ว +4

      @@rallokkcaz well, you can use FFI to call C-functions.. (at least BQN can). Shouldn't be too hard to open sockets :)

    • @stintaa
      @stintaa ปีที่แล้ว

      ew apl

  • @alexanderkhodos
    @alexanderkhodos 3 ปีที่แล้ว +3

    This video also captures a good part of explanations and recipes from HtDP, which even more agrees with Tsoding's rant on syntax/semantics

  • @lightningx10
    @lightningx10 3 ปีที่แล้ว +18

    Loved Haskell, functional programming truly requires you to think outside of the box

    • @leo848
      @leo848 3 ปีที่แล้ว +9

      Would you think of that as a good thing? I think a language should be as straightforward as possible and not require you to "think outside the box".

    • @ja31ya
      @ja31ya 3 ปีที่แล้ว +16

      @@leo848 I guess it depends if thinking outside the box results in more elegant code, or over-engineering...

    • @avananana
      @avananana 3 ปีที่แล้ว +5

      @@leo848 I'd argue it's a good thing, but it has its downsides, the obvious one being that it's not super straight-forward of what to do of course. But the upsides of it is that it forces you to really know what you're doing, which inevitably leads to better and cleaner code if you take coding seriously. There are so many python libraries and projects out there which's source code is pure nonsense because it's so poorly written that it's not even funny as a joke.

    • @CaptainWumbo
      @CaptainWumbo 3 ปีที่แล้ว +7

      it's very useful for solving certain kinds of problems. For me I found that once you start trying to do optimizations to improve performance, you can find yourself bending over backward. Caching is really hard, for example.

    • @superscatboy
      @superscatboy 2 ปีที่แล้ว +5

      I want to make a C compiler that makes you solve a cryptic riddle before it compiles anything. That way I could advertise C as being a language that makes you think outside the box.

  • @blackbeard3449
    @blackbeard3449 4 หลายเดือนก่อน +1

    1:24:40 clang is so good it calculated the value of infinity!

  • @rodelias9378
    @rodelias9378 3 ปีที่แล้ว +5

    Really good one! Thanks a lot and keep doing more stuff like this one please.

  • @paulzupan3732
    @paulzupan3732 ปีที่แล้ว +3

    An interesting thought about the 'rec' keyword in OCaml and why you need to add it to the beginning of recursive function definitions:
    I know that in some functional languages, especially Haskell, the compiled binary of the program includes a runtime which is basically just a lambda calculus interpreter. In the lambda calculus, you can't actually bind functions to names, so that means that before you evaluate an expression, every name needs to be replaced with its corresponding definition before evaluation can begin. There arises a problem when you try to do this with a recursive definition, however, since every time you replace the name of the recursive function with its body, you end up with another copy of it which then needs to be replaced again, etc.
    There is a way to get around it using the Y combinator, but the recursive function needs to take another argument which would stand in for the recursive call in its body.
    In short, the rec keyword may be syntactic sugar for that process. Just a thought though.

  • @demolazer
    @demolazer 6 หลายเดือนก่อน

    The best explanation of recursion on the internet.

  • @markblacket8900
    @markblacket8900 2 ปีที่แล้ว +2

    the thing with tuples without parentheses is also applicable to python in some cases, so yeah, basically the same language

  • @zwanzikahatzel9296
    @zwanzikahatzel9296 2 ปีที่แล้ว +6

    youtuber xah lee would disagree: to him syntax is the most important thing. I've heard that progress in calculus pretty much stalled because of the awkward newtonian notation f' f" etc. until the german started using the df/dx notation, not sure it's true, but syntax does make certain patterns or semantics more visible/exploitable.

  • @trabelsiadam3149
    @trabelsiadam3149 2 ปีที่แล้ว +5

    Need to make a video on how you use the terminal this way 🤤 which multiplexer?.. The hole setup

  • @frechjo
    @frechjo 2 ปีที่แล้ว +4

    I found this funny
    > Complains about people who care about syntax, because it's superficial and not important at all in a language.
    > Obviously frustrated with the syntactic choices in OCaml for comments, lists and tuples. ;P
    Who doesn't care at least a little about syntax? It is the interface between the semantics and our reading eyes. It should be as transparent as possible; if you can't avoid thinking about it, it's maybe bad in some way (after you have learned it, of course).
    A couple things about tail call optimizations (TCO) that were not mentioned in the video:
    Tail calls can be optimized also across functions, not only in self recursive ones. In
    f(x)=g(x)
    the call to g is in tail position, so it can be optimized in the same way (the stack frame for f is not needed when g returns).
    Another thing is that TCO can be a problem for analyzing a stack trace, something to take into account. It eliminates part of the stack context, so when you are trying to understand a bug (after the fact), you might not know how you effectively got there.
    BTW, I think mrbotka being a bot is no excuse for it being impolite. Shame on it >:(

    • @TsodingDaily
      @TsodingDaily  2 ปีที่แล้ว +11

      I usually ignore majority of the comments, but your take regarding my position on the syntax was just beyond imagination stupid so I had to answer.
      > Complains about people who care **ONLY** about syntax
      I'm not saying that there are no problems with syntaxes. My frustration is the people who keep discussing only syntax despite having way more important problems (a.k.a. bikeshedding).

    • @frechjo
      @frechjo 2 ปีที่แล้ว +5

      @@TsodingDaily
      Look, I had no bad intentions with my comment. If it reads like I'm trying to make fun or something, I apologize.
      I think your point about people bike-shedding syntax is sufficiently clear, don't worry (if not from this, at least from other videos for sure).
      I was just putting together two things that you said, because the *contrast* made it funny (which is probably a matter of perspective).

    • @TsodingDaily
      @TsodingDaily  2 ปีที่แล้ว +10

      @@frechjo Oh, I see! It's hard for me to read the intentions through the text! I'm sorry for my reaction as well. No offense taken either.

  • @flleaf
    @flleaf 2 ปีที่แล้ว +5

    38:20 tsoding is probably on thousands levels of irony

  • @aucusticguitar8069
    @aucusticguitar8069 3 หลายเดือนก่อน

    Some libraries in OCaml utilize the OOP functionality to manage the state of UI widgets. I've used Lamda-term for TUI projects and it is far easier to use their widget classes than defining your own draw functions for each widget especially for interacting with them later. Both work fine though so it's just personal preference. Probably just skill issues on my part tbh

  • @stanle1101
    @stanle1101 2 ปีที่แล้ว +5

    Hey nice video, just a note on the stack-pushing behavior of a function call, the first couples of arguments are passed into registers first (regular for int, xmm for float etc.) and if you have extra it'll be pushed onto the stack. In your case I don't think the int x will show up on stack, it'll be passed using the %rcx register :) (the return is given in a register also so no stack space needed)
    So in the end this recursion will just show up on the stack as a bunch of ret addresses, with optimization as you said I guess it'll just be one single ret on the stack. Actually a lot more efficient isn't it?

  • @alexloktionoff6833
    @alexloktionoff6833 ปีที่แล้ว +1

    By what OCaml is better than Rust? generics, matching, optional...
    I see only a more weird syntax of OCaml.

  • @casey206969
    @casey206969 ปีที่แล้ว +1

    Funny thing, fairly recently linux added the option to disable #! or make it a module . So in addition to a system that probably won't boot, your ocamlc programs won't run.

  • @apestogetherstrong341
    @apestogetherstrong341 ปีที่แล้ว +5

    Baseless claim that Common Lisp has the same semantics as Python.

  • @hendrikd2113
    @hendrikd2113 3 ปีที่แล้ว +2

    since every list you tested the length functions with was incrementing from 1, the best solution would have been to just reuse the last-element function. Less bloat!

  • @anilraghu8687
    @anilraghu8687 ปีที่แล้ว

    Understood the tail call on first reading .😀😃

  • @Rene-tu3fc
    @Rene-tu3fc 3 ปีที่แล้ว +8

    Golang is fast and newbie friendly! though it doesn't have generics, unnullable pointers and lots of useful modern features. But I think sometimes it's easier to read (and code) 50 lines of if/elses than 10 lines of flatmaps juggling monad transformers and converting between different types

    • @ktaleentkekma5777
      @ktaleentkekma5777 3 ปีที่แล้ว +2

      also, converting between different types? I dont think you really wanna do that in languages like haskell

    • @romankocherezhchenko34
      @romankocherezhchenko34 2 ปีที่แล้ว +2

      I dont think so, Golang maybe is fast, but not newbie friendly, i bet

    • @john.dough.
      @john.dough. 2 ปีที่แล้ว +6

      It got generics! (finally)

    • @vladlu6362
      @vladlu6362 2 ปีที่แล้ว +2

      @@john.dough. sorry for the 8th month too late reply, but "generics" in go is an half-assed implementation of Rust's traits in order to get an half-assed generic interface for functions.

    • @NathanHedglin
      @NathanHedglin ปีที่แล้ว

      @@vladlu6362 two half asses make a whole ass 😂

  • @Simon-xi8tb
    @Simon-xi8tb 2 ปีที่แล้ว +27

    No, Lisp is not basically python with different syntax. By that logic, every other c -like language is basically Lisp. Lisp has expressions, python has statements. Expressions > statemets, because of better REPL ergonomics. Also Lisp is homoiconic and this allows you to have the best macro system. Also, not all lisps are the same, Clojure is a totally different beast than Python.

    • @vytah
      @vytah 2 ปีที่แล้ว +6

      One imperative, dynamically-typed garbage-collected language with bolted-on functional programming and runtime type information vs another imperative, dynamically-typed garbage-collected language with bolted-on functional programming and runtime type information... A lot of popular languages today are quasi-Lisps - and if you ignore the static vs dynamic typing difference, which only affects how strict your compiler is, then almost all of them are. Code in Common Lisp, Scheme, Python, Java, Ruby, C#, Javascript etc. is pretty similar structure-wise. You have references to heap-allocated objects and you toss them around, imperatively, without worrying about cleaning them up.
      You want something different from all of those Lisps and quasi-Lisps? There's Haskell, C, APL, Forth, COBOL, Erlang.

    • @Simon-xi8tb
      @Simon-xi8tb 2 ปีที่แล้ว +12

      @@vytah Clojure is a functional lisp, it does not have "bolted-on functional programming", it's functional by design. Immutable data structures via persistent collections, support for higher order functions, functions as values... I don't really care for your definition of quasy-lisps. The main difference with lisps and your quasi-lisps is that lisps actually have s-expressions, while your quasi-lisps don't and this is the big difference. This is what is the reason of great repl experience. You can never have as great repl experience using your quasi-lisps.

    • @monad_tcp
      @monad_tcp ปีที่แล้ว

      Its the opposite. Python list comprehension is just a bad sort of Lisp

    • @marcossidoruk8033
      @marcossidoruk8033 หลายเดือนก่อน

      ​​@@vytah What you say is partially true but in terms of syntax and metaprogramming they are very different.
      Python parses into a quite complicated AST because it has to differentiate between many kinds of expressions and statements. The power of lisp is that you learn how lists are notated and then using that notation you write code directly in the internal representation of the AST, wich is much simpler than pythons because it basically consists of symbols, literals and expressions and nothing else. This makes metaprogramming simply superior in lisp, although in other aspects you are right it isn't tremendously different.

  • @AdamSchelenbergCom
    @AdamSchelenbergCom 2 ปีที่แล้ว

    Nice clarification on tuples. I was wondering about the semicolon.

  • @-aexc-
    @-aexc- 3 หลายเดือนก่อน +1

    holy shit thank u for rlwrap

  • @AdamWong
    @AdamWong 2 ปีที่แล้ว +6

    My best friend works for Jane street and I work @ another one of the market makers. Lemme assure you that you are smart enough to work work at these companies.
    I think you just don’t want to cause it doesn’t appeal to your creativity 😏

    • @stas4112
      @stas4112 2 ปีที่แล้ว +1

      came looking for this comment, if this guy is "too dumb" to work somewhere we are all fucked haha

    • @stas4112
      @stas4112 2 ปีที่แล้ว +1

      btw, amazing channel!

    • @AdamWong
      @AdamWong 2 ปีที่แล้ว

      @@stas4112 thank you!

    • @Lars-ce4rd
      @Lars-ce4rd 7 หลายเดือนก่อน +1

      Pretty sure he was joking. Just a weird flex

  • @nitair7808
    @nitair7808 3 ปีที่แล้ว +2

    Why I was thinking he was talking about Apache Camel :D

  • @Simon-xi8tb
    @Simon-xi8tb 2 ปีที่แล้ว +2

    OOP came from a hype. There is a guy on youtube that made several videos titled like "OOP is garbage" and similar LOL

  • @andreffrosa
    @andreffrosa หลายเดือนก่อน

    What do you use tmux for? How can it be useful for programming?

  • @9SMTM6
    @9SMTM6 3 ปีที่แล้ว +7

    37:30 Yeah, at this point it's clear to me I do not like OCAML.
    It started to annoy me with the already flipped relation with option, where the type was 'a option and the value Some x, and continued with the traditional parameter definition with Haskell style argument passing, but now this shit with tuples and their types.
    Dont get me wrong, while it's slightly annoying, I tend not to be a person that dislikes a language when it's just different.
    But there's different but of equal sense, like the way you pass arguments in HASKELL, and there's nonsensical different. And, at least from what I see, Ocaml chose the nonsensical route.
    Why would you break the Symmetry between so many elements of the language apparently by purpose? At least at this point I can't see a legitimate reason to do that shit.
    EDIT: Oh, and I could not agree less with you on your comment about Rust. Rust HAS A REASON to be different. Maybe I'm not fair to Ocaml, I'm open for proper explanations, but I do not see it right now.
    EDIT 2: Watching on I see I was wrong about the parameter/argument symmetry break. But continuing to watch Ive yet to see a good reason to end statements with TWO semicolons. Also, how could I forget about that, the head :: rest match, when matching just one element uses [x] and empty [].

    • @csbnikhil
      @csbnikhil 3 ปีที่แล้ว +3

      You can match a one element list with x::[]. And I think the two semi colons are because of it supporting Imperative Programming, where you separate the statements by a single semicolon. Yes, there is a single semi colon in OCaml, and has a different meaning than the double semi colon. You don’t actually need the double semi colons in you source. They’re there to just make the interpreter happy, afaik. And the standards discourage the use of them.

    • @YoTengoUnLCD
      @YoTengoUnLCD 3 ปีที่แล้ว +3

      Ugh, the pattern matching you mentioned works exactly like it does in Haskell, which you supposedly like.

  • @Mladjooo
    @Mladjooo 2 ปีที่แล้ว +5

    Has anybody else noticed "Porn folder" at the bottom of his edtior xd

  • @enderger5308
    @enderger5308 2 ปีที่แล้ว +1

    8:30 - The bike shed will be HOT PINK

  • @generix1240
    @generix1240 2 ปีที่แล้ว +1

    Tsoding : A beginner friendly and fast language doesn't exist. Meanwhile Go :

    • @marcossidoruk8033
      @marcossidoruk8033 หลายเดือนก่อน

      Not being very very very very slow doesn't make you fast.
      Go is not fast.

  • @Gornius
    @Gornius 3 ปีที่แล้ว +7

    What's this colorscheme? It's beautiful!

    • @pushqrdx
      @pushqrdx 3 ปีที่แล้ว +7

      gruber-darker

    • @semninrussia
      @semninrussia 3 ปีที่แล้ว +1

      @@pushqrdx thank you!

  • @lhpaoletti
    @lhpaoletti 9 หลายเดือนก่อน

    I never know if Alexey messes up the pronunciation of "raise" on purpose or not, and at this point, I'm too afraid to ask XD

  • @jpr8124
    @jpr8124 3 ปีที่แล้ว +1

    A good soul who would suggest an OCaml solution to problem 99?

  • @stokedfool
    @stokedfool ปีที่แล้ว

    "Common Lisp is straight up Python with s-expressions".
    hot take

  • @sukaisnaini1843
    @sukaisnaini1843 หลายเดือนก่อน

    hmm afaik, .run file in linux also had shebang with byte-code content.
    cmiiw

  • @reisaki18
    @reisaki18 3 ปีที่แล้ว +3

    APL/DYALOG review

  • @berndeckenfels
    @berndeckenfels 5 หลายเดือนก่อน

    Unshar does that shebang trick, but I think with base64

  • @ujjawalsinha8968
    @ujjawalsinha8968 3 ปีที่แล้ว +1

    Non linear curve of difficulty :)

  • @dmitrypetrov6557
    @dmitrypetrov6557 3 ปีที่แล้ว

    Why are you explicitly specifying types? Why not left that stuff to the compiler?

  • @adicide9070
    @adicide9070 9 หลายเดือนก่อน

    ocaml is a beast.

  • @antferdom
    @antferdom 3 ปีที่แล้ว +1

    Any thoguths on Coq?

  • @simonfarre4907
    @simonfarre4907 3 ปีที่แล้ว +3

    She bangs are used by all languages that can produce scripts, interpreted or compiled. Python does it, Kotlin does it, D does it. The she bang is just telling the shell what to run it with.

  • @benjaminscherrey1124
    @benjaminscherrey1124 3 ปีที่แล้ว

    I can't find the Tsoding discord channel for some reason. Anyone got an invite link?

  • @patryk_49
    @patryk_49 3 ปีที่แล้ว +7

    Here's the algorithm for solving problems with tail recursion:
    step 1: solve the problem using for loop
    step 2: transform the for loop into recursive function.

    • @patryk_49
      @patryk_49 3 ปีที่แล้ว +2

      @Mohammed Shahid Tail recursion is when the recursive call is the last instruction of the recursive function.

  • @mooncorizer290
    @mooncorizer290 5 หลายเดือนก่อน

    Bytecode exists in js

  • @zwanzikahatzel9296
    @zwanzikahatzel9296 2 ปีที่แล้ว +2

    another "creative" solution to the length problem is to map all elements of the list to 1 and then sum all the 1s hahah

  • @Narblo
    @Narblo 3 ปีที่แล้ว +2

    Wait a second. So how old is he???

    • @pushqrdx
      @pushqrdx 3 ปีที่แล้ว +11

      i believe he's 69

    • @zavier3644
      @zavier3644 3 ปีที่แล้ว +14

      Either 23 or 54

    • @Narblo
      @Narblo 3 ปีที่แล้ว +1

      @@pushqrdx Nice

    • @0ia
      @0ia ปีที่แล้ว +1

      32

  • @ruslansmirnov9006
    @ruslansmirnov9006 ปีที่แล้ว

    7:41 I REMEMBA NINETEEN...

  • @wantharry
    @wantharry 3 ปีที่แล้ว +4

    Hey Buddy, please include screen key , will be helpful as you type commands

  • @ammarhoussenbay1844
    @ammarhoussenbay1844 3 ปีที่แล้ว

    Thank you so much you save my exams. 🙂🙏🙏

  • @caiodavi9829
    @caiodavi9829 ปีที่แล้ว

    51:20 i am LOLing 😂😂😂

  • @majam1n
    @majam1n ปีที่แล้ว

    Ocamlator

  • @mohnishkumar6847
    @mohnishkumar6847 3 ปีที่แล้ว +1

    Name of editor?

  • @monad_tcp
    @monad_tcp ปีที่แล้ว

    I have 99 problems but OCaml aint one

  • @matthijshebly
    @matthijshebly 8 หลายเดือนก่อน

    Everyone is pinkt

  • @bursthooverbag10
    @bursthooverbag10 ปีที่แล้ว

    99 problems but Haskel aint one

  • @UncleJacki
    @UncleJacki 3 ปีที่แล้ว

    acm t-shirt!

  • @anilraghu8687
    @anilraghu8687 ปีที่แล้ว

    Now Tsording stopped using fucking, crap etc.

  • @Pompomatic
    @Pompomatic 5 หลายเดือนก่อน

    mrbotka not obviously a bot lmao

  • @blt_r
    @blt_r 3 ปีที่แล้ว +2

    Can someone explain to me why all of these are basically O(N) solutions of O(1) problems. I get it that optimization is not the main thing here, but if you can do something in constant time why iterate over whole thing? And if performance really doesn't matter at all, why are you trying to make code more performant using tail recursion by sacrificing readability with that function inside a function?
    Why we can't just do something like this to get last element of the list:
    match List.length xs with
    | 0 -> None
    | n -> Some (List.nth xs (n-1))
    knowing lists length and indexing in constant time are very basic things, why someone would even try to solve problems without them?

    • @TsodingDaily
      @TsodingDaily  3 ปีที่แล้ว +8

      But List.nth is also O(n) github.com/ocaml/ocaml/blob/7997b65fdc87909e83f497da866763174699936e/stdlib/list.ml#L37-L43

    • @blt_r
      @blt_r 3 ปีที่แล้ว +6

      @@TsodingDaily oh, so these lists are linked lists. Therefore you can take head and tail so easily. Now that's makes a lot of sense

  • @neuzen
    @neuzen 3 ปีที่แล้ว

    стопэ, ты может скалу ещё не уважаешь?

  • @lanceang795
    @lanceang795 3 ปีที่แล้ว

    Second

  • @Colaholiker
    @Colaholiker 2 หลายเดือนก่อน

    I just don't get it. I have been programming in C/C++ for close to 20 years, before that in Pascal, Delphi, Java... but I never understood why anyone voluntarily goes through the migrain-inducing ordeal of functional programming. It just seems so far away from anything real-world...To me, it just seems like a totally wrong and unintuitive attempt to solve problems you otherwise wouldn't have.

  • @Dziaji
    @Dziaji 3 ปีที่แล้ว +2

    You did a great job explaining this language. I have never seen it before. Unfortunately, it is the biggest piece of crap I have ever seen. Why would anyone use this when we have the programming masterpiece that is C++ and the high-level, convenient language that is python??

    • @marcossidoruk8033
      @marcossidoruk8033 หลายเดือนก่อน

      Calling C++ (the most horrifyingly garbage language ever deviced) a programming masterpiece is wild.

    • @Dziaji
      @Dziaji หลายเดือนก่อน

      @@marcossidoruk8033 you apparently just don't understand modern c++ and are confusing it with C plus classes.

  • @greob
    @greob 3 ปีที่แล้ว +3

    Super interesting once again!