Code Review: Ocaml

  Рет қаралды 38,380

TheVimeagen

TheVimeagen

Күн бұрын

Пікірлер: 60
@btv9960
@btv9960 Жыл бұрын
A subtle thing that wasn't quite clear is that `in` is continuing the expression in a child scope. Those functions are actually just giant expressions , which themselves have child expressions. Functional code has generally more of a tree structure (as opposed to a linear series of operations) and you mostly don't need the opening/closing delimiters.
@sebastianselander161
@sebastianselander161 Жыл бұрын
Indeed! Saying "let statement" is a bit misleading as there are no statements in functional programming languages (Haskell atleast, a bit unsure about OCaml)
@kmdsummon
@kmdsummon 6 ай бұрын
All programs are trees. Imperative languages are just replace “let” with “var” and “in” with “;” so you as a programmer had impression it is not a tree/list.
@laughingvampire7555
@laughingvampire7555 Жыл бұрын
one thing you algol-ish people should know about the functional side of the programming spectrum, when SML made its syntax which is the syntax that OCAML took from, they did it as the anti-lisp syntax, lisp was "the researcher's language" and some researchers got fed up with the parenthesis so they made SML the with minimal punctuation. As the legend says Lisp was supposed to have 2 syntaxes, Symbolic-Expressions & Meta-Expressions, but they only implemented Symbolic-Expressions, then people who wanted to get out of the parenthesis decided to "Let's make a language that is the Meta-Expressions that Lisp should've had" and they name it MetaLanguage, or ML for short.
@kellybmackenzie
@kellybmackenzie Жыл бұрын
I love Haskell and this video makes me wanna learn OCaml so much, it looks so much like Haskell but with its own quirks, I love it!! So pretty!!
@BosonCollider
@BosonCollider Жыл бұрын
It's basically Haskell, but without function overloading. You still have the ability to derive "typeclasses" with a ppx, but instead of deriving an instance of show or eq for example it will autogenerate functions like show_foo, show_bar and so on. So you end up just writing very concrete and readable application code as the path of least resistance instead of using abstractions by default, while still being able to write generic code with module functors if you actually need to write a generic library. The other nice thing about it is that you can add print statements anywhere and execution order is not UB, unlike Haskell where code is easy to test but fundamentally undebuggable. Laziness is opt-in instead of opt-out Of course, the flipside is that the community is smaller than the Haskell one, and not even in the same ballpark as something like Rust or Go. And in some cases you do in fact miss typeclasses, especially for mathy code.
@PhatPazzo
@PhatPazzo Жыл бұрын
Not knowing OCaml, but knowing Haskell, I think that what confuses you about “let … in” is the function definition. Things doesn’t necessarily happen in the order it’s written. A function is defined as exactly one expression (such as “function a = a + 5”). This is pretty useless, though, so you can define symbols for that expression as such: “countSpaces text = let all_spaces = filter isSpace text in Text.len all_spaces”. The expression here is “Text.len all_spaces” and the symbol “all_spaces” is valid for the expression after “in”.
@kubre
@kubre Жыл бұрын
I understood every other language, this was just over my fkin head
@FusionHyperion
@FusionHyperion Жыл бұрын
I really like the synthax but in the same time I don't understand anything
@ardnys35
@ardnys35 Жыл бұрын
that's functional for ya
@32gigs96
@32gigs96 Жыл бұрын
Because every other language is the same fkin language
@DMSBrian24
@DMSBrian24 Жыл бұрын
it's not that hard, just some syntax quirks but the concepts are pretty clear i think
@cassildaandcarcosa294
@cassildaandcarcosa294 Жыл бұрын
It way less Cognitive load write code this way.
@erik6575
@erik6575 Жыл бұрын
Such a beautiful language !
@SkinnyGeek_1010
@SkinnyGeek_1010 Жыл бұрын
I wish they would have brought up the ReasonML homepage because the first example there was a case statement with brackets :D I found that it's much easier to transition from C style languages to Reason, learn how the ML system works, and then once comfortable learn OCaml and it's only a small jump to get there.
@cassildaandcarcosa294
@cassildaandcarcosa294 Жыл бұрын
I agree with that, learn semantics in a friendly syntax goes a long way. I went from Ruby to Elixir and the syntax was similar but the semantics are completely different. I picked up Standard ML afterwards which is pretty similar to OCaml. I just had to wrap my head around the type semantics. That said, I re
@VovaY
@VovaY Жыл бұрын
Guys, what plugin is used to display nesting hierarchy at the top of the screen?
@ildarakhmetgaleev
@ildarakhmetgaleev Жыл бұрын
nvim-treesitter/nvim-treesitter-context
@crides0
@crides0 Жыл бұрын
Given that Prime knows Rust already, I'm surprised he didn't get the Ocaml constructs (I didn't come from Ocaml either)
@charliemalmqvist1152
@charliemalmqvist1152 7 ай бұрын
the more I look into functional programming, the more I realize it's even worse than oop
@PaulSebastianM
@PaulSebastianM Жыл бұрын
Clojurescript -> TypeScript... TypeScript -> Rescript... OCaml -> Rust... C# -> F#... we need ADTs to be the norm along with pattern matching and maybe we could stick with our programming langs for longer. 😂
@rogergalindo7318
@rogergalindo7318 Жыл бұрын
if they used haskell it would be easier to understand the let bindings ;) /s
@_manne
@_manne Жыл бұрын
Haskell--
@mihaiprocopi5207
@mihaiprocopi5207 Жыл бұрын
Pretty good F# code
@WillEhrendreich
@WillEhrendreich Жыл бұрын
Hell yeah fsharp. They're likely getting sick of me gushing about it. Lol.
@ProjectVastness
@ProjectVastness Жыл бұрын
For me F# is one of the best Functional languages for sure.
@orderandchaos_at_work
@orderandchaos_at_work Жыл бұрын
OCaml > Rust
@32gigs96
@32gigs96 Жыл бұрын
If your dealing with a lot of recursive data structures then it blows it away. If perf is critical then u gotta go rust ofc
@PaulSebastianM
@PaulSebastianM Жыл бұрын
use the best tool for you
@zahash1045
@zahash1045 Жыл бұрын
#[derive(skill_issue)]
@ProjectVastness
@ProjectVastness Жыл бұрын
OCaml and F# ❤
@etooamill9528
@etooamill9528 8 ай бұрын
I'm wondering which of the two i should start learning, do you suggest more F# or OCaml?
@AlexanderPrussak
@AlexanderPrussak Ай бұрын
Can you do an explanation on the ocaml 3rd party lib fmt? as a challenge
@totally_not_a_troll
@totally_not_a_troll Жыл бұрын
Describing OCaml as "Visually clear" is just ... insulting.
@kubre
@kubre Жыл бұрын
Is this haskell but ugly?
@soumen_pradhan
@soumen_pradhan Жыл бұрын
OCaml is not lazy also.
@netfri25
@netfri25 Жыл бұрын
Ugly Haskell with optional immutability
@replikvltyoutube3727
@replikvltyoutube3727 Жыл бұрын
Haskell but usable
@kooraiber
@kooraiber Жыл бұрын
@TheVimeAgen this guy right here
@mskiptr
@mskiptr Жыл бұрын
Looks like it lol
@sangamo38
@sangamo38 Жыл бұрын
Ocaml is inspired from plsql devs !??
@davidengelmann1636
@davidengelmann1636 Жыл бұрын
OCaml is the shit
@taylorswe
@taylorswe 10 ай бұрын
Haskell mentioned
@Jabberwockybird
@Jabberwockybird 7 ай бұрын
Ocaml my caml!
@laughingvampire7555
@laughingvampire7555 Жыл бұрын
Javascript and all these algolish languages copied the "let" wrong. Let has always being a syntactic block, never a statement like in lisp (let ((var value)...) _expressions...) in the MLs let _var = values_ in _expressions_
@G3rain1
@G3rain1 Жыл бұрын
Do you have to be criminally insane to understand code like this? Or am I just stupid.
@ea_naseer
@ea_naseer 10 ай бұрын
I'm late I'm learning Ocaml now and my brain is in this state where I can read the code but would never think to write this.
@mskiptr
@mskiptr Жыл бұрын
T.o be honest, I R.eally like that Y.ou have decided to E.xperience at L.east a fraction of what -true- FP has to offer. M.ay you eventually see the light of lambda and pi!
@WillEhrendreich
@WillEhrendreich Жыл бұрын
What you did there, I see it.
@lostarts9946
@lostarts9946 Жыл бұрын
Might do an Idris2 one >:)
Learning OCAML Part 1
49:53
TheVimeagen
Рет қаралды 79 М.
Code Review: CPP
12:29
TheVimeagen
Рет қаралды 73 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Ocaml My Caml
1:15:43
TheVimeagen
Рет қаралды 13 М.
Code Review: Dart
12:37
TheVimeagen
Рет қаралды 28 М.
The Unhinged Nature of GTA V Source Code
2:16
kpjVideo
Рет қаралды 1,6 МЛН
Okay, but how does airstrafing ACTUALLY work?
37:13
zweek
Рет қаралды 317 М.
OCaml And Advent of Code?!? Day 01
17:25
TJ DeVries
Рет қаралды 24 М.
More Zig Learning
33:33
TheVimeagen
Рет қаралды 13 М.
Clean Code : Horrible Performance | Full Interview
47:13
ThePrimeTime
Рет қаралды 243 М.
The Truth About HTMX | Prime Reacts
49:56
ThePrimeTime
Рет қаралды 388 М.
Code Review: C
10:14
TheVimeagen
Рет қаралды 56 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН