OCaml And Advent of Code?!? Day 01

preview_player
Показать описание


Thanks, let me know what you think!

#adventofcode #aoc #nvim #ocaml #programming
Рекомендации по теме
Комментарии
Автор

So happy to see you on ocaml, because my favorite Lang is FSharp and ocaml was an inspiration for Don Syme for creating FSharp. =) type inference is a Godsend. Simple, concise, clear code with so little boilerplate to get real things done. So awesome.

WillEhrendreich
Автор

Am also doing some of the challenges in ocaml, cool to see you are too!

goosechaser
Автор

For anyone having trouble understanding what's going on here, "list" is a linked list (I think) and "::" allows you to pluck out the first element of the linked list.

At least that's what I think is going on. I have no idea of OCaml works but this seems to make sense.

architbhonsle
Автор

I could just sit there and even watch TJ talking about dolphin's sexuality and I would enjoy it as well.

Jokes aside, recently I took a Programming Language class which also teaches Ocaml, but even though it is beautiful the standard library felt lacking to me, i.e.
I couldn't find any "standard" way to read a file or iterate through its lines, I had to write it on my own, or the string library is a bit hard to work with, and I had to convert it to List of characters most of the times.

Probably I was and still missing something about Ocaml and Functional Programming in general, and online I couldn't find any good resources apart from some articles from realworldocaml and Michael Ryan Clarkson's fantastic videos, but compared to F# I really prefer the latter as dev experience.

cattohappy
Автор

I feel like learning Rust really helped me with understanding this video.I watched it when it came out and didn't understand a thing but now I think I do because Rust is half functional.
It's the `C++ -> Rust -> OCaml` pipeline for me.

JakobKenda
Автор

this video appeared weirdly in time with when I just started learning OCaml

pinkorcyanbutlong
Автор

I study in France, ocaml is the language taught in schools (with C)

cyprienh
Автор

Haha great to have the interaction with flip!

jrmoulton
Автор

Nice video!
Curious about the syntax highlighting for a single line vs the whole file, is that done at the neovim level or whole editing the video?

abdellahcodes
Автор

one nice thing that you can do to avoid lost of nested parens is to use the pipe operator, like so:

let () =
group result []
|> max_of_list (* if you rewrote max of list to take one arg *)
|> string_of_int
|> print_endline
;;

simondebevoise
Автор

Great vídeo, I've never tried Ocaml before and this gives me a strong grasp of it. Bye the way, I'm curious what's the app you're using as a whiteboard? Looks neat.

spaghettispaghetto
Автор

Teej got that big big energy right now. Love to see it

Zzznmop
Автор

Very reminiscent of my uni course (‘96). We started with Miranda.

billeterk
Автор

Can believe you use a proper keyboard and a proper language. I'm impressed

Danielo
Автор

Just left a long comment with some OCaml tips to make the code you wrote a bit more idiomatic. Seems to have gotten deleted (maybe because I included a link?). Hopefully you can revive it because I'd really like to not type all that out again, but if you can't please let me know

dimensionaldot
Автор

You can write max_of_list = List.fold_left max 0

fredfred
Автор

This reminds me of times when I played with LISP :)

alekseiabakumkin
Автор

Beautiful video! Just one curiosity: suppose the second part of the problem asked to find the top n values, with n arbitrarily large (but meaningfully smaller than the lenght of the list). Is the method you used (and which I really enjoyed) scalable in a sense that does not require you to write all the n cases? Also I'm wondering: as n approaches the lenght of the list does this just become a sorting algorithm?
P.S.: my questions might be dumb... if so, I'm sorry but I'm not an expert in algorithms, although I really enjoy the subject.

marcoradocchia
Автор

What tools do you use to write on screen like scratchpad?

nachiketkanore
Автор

How did you get the code to highlight selectively?

notAGreatGamer