Exercism
Exercism
  • 91
  • 281 059
Using Pattern Matching & Regular Expressions to solve Pig Latin on Exercism
We look at 8 different solutions to Exercism's Pig Latin exercise - exploring solutions using different approaches to pattern matching and regular expressions in Go, Kotlin, Scala, Prolog, AWK, JavaScript, C#. and Python
Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism.
Solve the exercise at: exercism.org/exercises/pig-latin
Join #48in24 at: exercism.org/challenges/48in24
Featured solutions:
- exercism.org/tracks/go/exercises/pig-latin/solutions/bobahop
- exercism.org/tracks/kotlin/exercises/pig-latin/solutions/dsdebastiani
- exercism.org/tracks/scala/exercises/pig-latin/solutions/jaratma
- exercism.org/tracks/prolog/exercises/pig-latin/solutions/jinwoo
- exercism.org/tracks/awk/exercises/pig-latin/solutions/glennj
- exercism.org/tracks/awk/exercises/pig-latin/solutions/glennj
- exercism.org/tracks/javascript/exercises/pig-latin/solutions/glennj
- exercism.org/tracks/python/exercises/pig-latin/solutions/dfhwze
Timestamps:
00:00:00 Introduction
00:01:13 Go: for loops and maps
00:09:43 Kotlin: rotate using special cases
00:18:57 Scala: rotate using pattern matching
00:23:30 Prolog: define relations and use unification
00:33:22 AWK: regex matches
00:37:27 JS: regex matches using pig latinified functions
00:40:43 C#: conditional regex replace
00:47:31 Python: single regex replace
00:44:37 Conclusion
Переглядів: 961

Відео

Understanding Randomness: 7 Ways to Solve D&D Character
Переглядів 1,2 тис.Місяць тому
We look at 7 different solutions to Exercism's D&D Character exercise - exploring solutions using different approaches to randomness and metaprogramming in Kotlin, Nim, Racket, Tcl, Python, C and Haskell. Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism. Solve the exercise at: exercism.org/exercises/dnd-character Join #48i...
7 Ways to Solve Minesweeper
Переглядів 1,6 тис.Місяць тому
We look at 7 different solutions to Exercism's Minesweeper exercise - exploring solutions using nested loops, clever use of min/max to simplify bounds checking, functional pipelines and using two-dimensional matrices in Julia, C , F#, Rust, Ruby, Crystal, and Java. Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism. Solve th...
10 ways to check if a word is a Pangram
Переглядів 1,6 тис.2 місяці тому
We look at 10 different solutions to Exercism's Pangram exercise - exploring approaches including string manipulation, sets and bitshifting! This is a really interesting exercise for finding the right balance between CPU usage, memory allocation, and readability! Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism. Solve the ...
10 ways to solve Scrabble Score on Exercism
Переглядів 9302 місяці тому
In this video, we explore 10 different approaches to solve the Scrabble Score exercise on Exercism. We explore pattern matching, higher order functions, generator expressions, helper classes and more! We look at a variety of different languages including Go, F#, Python, Groovy, Ruby, Raku, Rust, AWK, JavaScript, and MIPS Assembly Kick back and enjoy half an hour of learning with Jeremy and Erik...
How to validate credit card numbers (Solving Luhn on Exercism)
Переглядів 1,5 тис.2 місяці тому
In this video, we explore 9 different ways to solve the Lunn exercise on Exercism. We explore guards, method chains, vectorised operations, and a fun SQLite solution! We look at a variety of different languages including Swift, C , Ruby, Gleam, R, Pharo, Tcl, Raku and SQLite. Kick back and enjoy an hour of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exerci...
Coding "The Sieve of Eratosthenes": An ancient algorithm for calculating prime numbers.
Переглядів 1,8 тис.2 місяці тому
In this video, we explore 7 different approaches to coding The Sieve of Eratosthenes. We look at solutions in C , C#, Python, Raku, Julia, R and F#, looking at nested loops, lazy evaluation, and recursion. Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism. Solve the exercise at: exercism.org/exercises/sieve Join #48in24 at:...
Bit Shifting, Bitwise Comparisons and other Binary Number Magic (Solving Allergies on Exercism)
Переглядів 1,6 тис.3 місяці тому
In this video, we explore 8 different approaches to solving Allergies, focussing on Binary numbers and techniques like bitshifting and bitwise comparison. We look at solutions from Clojure, Ruby, JavaScript, C#, Nim, Python, Gleam and Erlang! Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism. Solve the exercise at: exercism...
Parallelism vs Concurrency (Solving Parallel Letter Frequency on Exercism)
Переглядів 1 тис.3 місяці тому
In this video, we explore the differences between Parallelism and Concurrency and look at 8 examples in solving Parallel Letter Frequency in JavaScript, Go, Delphi, Java, C#, Elixir and Rust. Kick back and enjoy 50mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism. Solve the exercise at: exercism.org/exercises/parallel-letter-frequency Join #48in...
6 Ways to Code Circular Buffers
Переглядів 2,4 тис.3 місяці тому
In this video, we explore 6 different approaches to creating Circular Buffers, exploring solutions in C#, Python, Crystal, C , Elm and Erlang. We explore queues, static and dynamic arrays, immutable data structures and a fun agent based implementation. Circular Buffers are First In, First Out (FIFO) queues that are a fixed size. They're usually backed by an array, which gives it great spatial/d...
Regular Expressions: A hands on introduction (Solving Acronym on Exercism)
Переглядів 2 тис.3 місяці тому
In this video we take a gentle dive into regular expressions as we solve the Acronym exercise. We look at the most basic solutions (such splitting on whitespace) and end up with unicode and negative lookbehinds. We finish off by looking at some other approaches to Acronym including state machines! Sit back and enjoy 45mins of learning with Jeremy and Erik, then go solve the exercise in your fav...
Recursion: A Practical Introduction (via a deep dive into List Ops!)
Переглядів 3,1 тис.4 місяці тому
In this video, Jeremy introduces us to recursion and Erik explains tail-call recursion and accumulator functions. It's a live coding, practical video that's perfect for people new to functional programming, but also has some deeper topics for those more experienced! Enjoy an hour of learning with Jeremy and Erik, then go solve the List Ops exercise yourself in your favourite language on Exercis...
11 Ways to Solve Protein Translation on Exercism
Переглядів 1,7 тис.4 місяці тому
11 Ways to Solve Protein Translation on Exercism
12 ways to Convert Arabic Numbers to Roman Numerals
Переглядів 2,8 тис.4 місяці тому
12 ways to Convert Arabic Numbers to Roman Numerals
14 Ways to Solve Raindrops (FizzBuzz, but harder!)
Переглядів 4,4 тис.4 місяці тому
14 Ways to Solve Raindrops (FizzBuzz, but harder!)
14 Ways to Reverse a String! (And solve the exercise on Exercism)
Переглядів 7 тис.5 місяців тому
14 Ways to Reverse a String! (And solve the exercise on Exercism)
10 Ways to solve Leap on Exercism
Переглядів 6 тис.5 місяців тому
10 Ways to solve Leap on Exercism
Introducing #48in24 - Exercism's new programming challenge for 2024!
Переглядів 6 тис.5 місяців тому
Introducing #48in24 - Exercism's new programming challenge for 2024!
December Diversions: ColdFusion, Groovy, Lua, Vimscript & Wren
Переглядів 8176 місяців тому
December Diversions: ColdFusion, Groovy, Lua, Vimscript & Wren
A Brief Introduction to WebAssembly
Переглядів 1,7 тис.7 місяців тому
A Brief Introduction to WebAssembly
A Brief Introduction to C#
Переглядів 2,6 тис.7 місяців тому
A Brief Introduction to C#
Nibbly November: An intro to Assembly (x86-64, MIPS, and WASM)
Переглядів 1,7 тис.7 місяців тому
Nibbly November: An intro to Assembly (x86-64, MIPS, and WASM)
Object Oriented October: An intro to C#, Ruby, Powershell and Crystal!
Переглядів 1 тис.8 місяців тому
Object Oriented October: An intro to C#, Ruby, Powershell and Crystal!
Slimline September: An intro to 8th, AWK, Bash, JQ, Perl and Raku!
Переглядів 1,5 тис.9 місяців тому
Slimline September: An intro to 8th, AWK, Bash, JQ, Perl and Raku!
New features: Feedback in the editor, track trophies, grouped community solutions, and more!
Переглядів 25610 місяців тому
New features: Feedback in the editor, track trophies, grouped community solutions, and more!
A Brief Introduction to Swift
Переглядів 1,4 тис.10 місяців тому
A Brief Introduction to Swift
Adding Concept Detectors to Exercism [Insiders Preview]
Переглядів 22310 місяців тому
Adding Concept Detectors to Exercism [Insiders Preview]
It's Appy August: Introductions to 14 different languages (see the thumbnail!)
Переглядів 2 тис.10 місяців тому
It's Appy August: Introductions to 14 different languages (see the thumbnail!)
An intro to Cobol, Fortran, and Visual Basic for Jurassic July!
Переглядів 1 тис.11 місяців тому
An intro to Cobol, Fortran, and Visual Basic for Jurassic July!
A Brief Introduction to Prolog
Переглядів 13 тис.11 місяців тому
A Brief Introduction to Prolog

КОМЕНТАРІ

  • @megetmorsomt
    @megetmorsomt День тому

    Nim: import os,strutils echo if( let year = parseInt paramStr 1; year mod 400 == 0 or year mod 100 == 0 or year mod 4 == 0 ):true else:false

  • @delightful-ish
    @delightful-ish 7 днів тому

    Why does the philosophy of this language seem to be that everyone has 3 hours to wade through cruft to learn how to just get some code running?

  • @bigdogg365
    @bigdogg365 11 днів тому

    For the Python solution (@ 5:50 ) would it be quicker to convert the string/sentence to lowercase once before running the comparison? ( s = s.lower() ) and then run all(c in s for c in ascii_lowercase)

  • @DaimonAugustus
    @DaimonAugustus 14 днів тому

    Great video, as always.

  • @tamhuynhthanh874
    @tamhuynhthanh874 15 днів тому

    for Rust: pub fn reverse(input: &str) -> String { let mut reverse_str = String::new(); for c in input.chars().rev() { reverse_str.push(c); } reverse_str }

  • @robinheyer708
    @robinheyer708 18 днів тому

    4:09 I'm always a bit envious of those that can read the instructions of an exercise that says "Solve without using X" and think to themselves: "Ok, but what's the next best way that I can cheat?" Why don't I think like that?

  • @Pul_1964
    @Pul_1964 18 днів тому

    I did it in Elixir: No regex, but efficient tail call-recursion with multiple clauses and pattern matching, which declares the domain rules quite nicely IMO. Btw: The function `split_swappable/2` is a simple example, how one can implement a state machine (what every parser essentially is) with recursion in a functional language. ```elixir defmodule PigLatin do @vowels [?a, ?e, ?i, ?o, ?u] @consonants Enum.to_list(?a..?z) -- @vowels @spec translate(phrase :: String.t()) :: String.t() def translate(phrase), do: with( words <- String.split(phrase), do: Enum.map_join(words, " ", &to_pig_latin/1)) defp to_pig_latin(word), do: with( {swappable, rest} <- split_swappable(word), do: rest <> swappable <> "ay") # splits word into the swappable prefix and the rest by the following rules: defp split_swappable(word, swappable \\ <<>>) # word starts with x or y followed by consonant -> no swap at all defp split_swappable(word = <<?x, c, _ :: binary>>, <<>>) when c in @consonants, do: {<<>>, word} defp split_swappable(word = <<?y, c, _ :: binary>>, <<>>) when c in @consonants, do: {<<>>, word} # y or a vowel terminate the swappable part defp split_swappable(rest = <<?y, _::binary>>, swappable=<<_, _::binary>>), do: {swappable, rest} defp split_swappable(rest = <<v, _::binary>>, swappable) when v in @vowels, do: {swappable, rest} # a consonant grows the swappable part, # "qu" are treated as consonant, not as consonant/vowel pair defp split_swappable("qu" <> rest, swappable), do: split_swappable(rest, swappable <> "qu") defp split_swappable(<<c, rest::binary>>, swappable) when c in @consonants, do: split_swappable(rest, swappable <> <<c>>) end ```

  • @Falvarezs
    @Falvarezs 19 днів тому

    starting here good luck to me, and thanks for your work

  • @aa-xn5hc
    @aa-xn5hc 19 днів тому

    great video, thanks!

  • @maasnelsonhailey218
    @maasnelsonhailey218 20 днів тому

    thank you pewdiepie

  • @dustinyochim
    @dustinyochim 22 дні тому

    Regular expressions just keep coming up. Maybe it's finally time to finally sit down and learn them 😅 Also, loved the pigified source code in JS was so fun!

    • @exercism_org
      @exercism_org 22 дні тому

      Ha! Yeah, that was a great effort by Glenn! Thanks for the encouragement - glad you're enjoying the videos!

    • @ErikSchierboom
      @ErikSchierboom 20 днів тому

      Our acronym video (ua-cam.com/video/ofzqp4MFHvM/v-deo.htmlsi=s4cgoyjClPAVkgVL) goes into a lot more detail on regular expressions. That might be useful.

    • @Pul_1964
      @Pul_1964 19 днів тому

      I am rather opiniated on regular expressions: They are mighty, but basically a further and for some quite scary language. Introducing them to code just like that, can decay readability and maintainability. Therefore they should never be introduced without consideration. I suggest to always check: - Can I do that without regex with means of my main language. If you have an expressive declarative language, you should prefer staying in it (my solution in Elixir shows, that it is possible, more efficient and IMHO more readable) - Are RegEx accepted in my project? (since every new technology introduced comes with risks)

  • @joericeulemans1068
    @joericeulemans1068 22 дні тому

    Thanks for another great video! Enjoyed and learned something new. Keep it up! 👊

  • @glennjackman759
    @glennjackman759 24 дні тому

    39:35, Jeremy, sooo sorry for not inventing a new avajayiptscray language. I’ll get right on that. Easily do-able in Tcl though ...

    • @exercism_org
      @exercism_org 23 дні тому

      Thank you! I hope my deep sense of disappointment showed! 😁

  • @yagosanyago2551
    @yagosanyago2551 24 дні тому

    Thanks Erik Sage of Programming ! ;)

  • @exercism_org
    @exercism_org 25 днів тому

    So.... Did you solve the exercise or the just get the tests to pass? 😈

  • @dariuselijah9277
    @dariuselijah9277 26 днів тому

    Honestly, this should have conveyed more real life benefits of FP, such as Data Modeling with ADTs - "WHY is this better than looping and creating OOP classes" - why folds perfectly abstract away the need to write explicit recursion every time - the elegance of function composition - Monadic laws that guarantee that data types are safe and sound (without mentioning Monads obv). Tutorials like this are why FP is seen as a niche when a JS, Python, C++, Go or whatever dev comes to see this. No one is going to see an adder function or a pattern match on a list of numbers and think: WOW, this is much better than my language of choice which... oh wait, is already on the way to adopting pattern matching (like most modern imperative languages already did or are doing). As much as I love to see people passionate about FP, such videos need to be more comprehensive and practical in demonstrating the real-world advantages of functional programming. They need to highlight how FP can simplify complex tasks, enhance code maintainability, and improve reliability through concepts that go beyond basic examples. EVEN FOR A BEGINNER, because we're assuming coders are dumb otherwise.

    • @exercism_org
      @exercism_org 25 днів тому

      This video is intended more as an introduction to the programming languages rather than functional programming itself. We put out a video every week that shows up different paradigms and approaches and we nearly always show things like pattern matching and recursion as elegant solutions to problems, so those might be more to your taste. Thanks for the feedback 🙂

  • @bobweiram6321
    @bobweiram6321 26 днів тому

    Another useless programming language.

    • @exercism_org
      @exercism_org 25 днів тому

      What programming languages do you find useful? What did you hope Gleam would do that others don't?

  • @murilo_dev
    @murilo_dev 28 днів тому

    Thank you for sharing this video! I love exercism! Have a nice week!

    • @exercism_org
      @exercism_org 27 днів тому

      Thanks so much! Really appreciate the comment! 😊

  • @blz777
    @blz777 Місяць тому

    That is a great introduction to the language, thank you! :)

    • @exercism_org
      @exercism_org 29 днів тому

      Great that it was useful! Thanks for commenting :)

  • @AbdulrahmanSheikho
    @AbdulrahmanSheikho Місяць тому

    I was planning to solve this exercise before the video came up using Elm, which I started my journey on exercism this year primarily with it, (plus some Go & Python "haven't solved it in either of them yet") and I refrained from watching the video until I solve it. I found that when I try to solve an exercise, I over complicate the problem if there is no obvious guidelines to solve it. Should I go for the mines '*' or clear '.'? Should I find the number of mines and then turn it to character 'n' in place for each character at a time, or should I go and scan for mines and then start counting?! Can my solution be generalized?? And different languages has different "flavours" of programming. For example Elm and Go are both simple and minimalistic languages, but the way I would solve it in Go would be dramatically different from the way I solved it in Elm. (And I got 250-ish lines to solve it, while the rest of the community is under 150) and this makes me go backwards and look for ways to optimise my solution which is more intuitive for me. (I'm not an optimization-first guy) Watching these videos is quite helpful, because unlike scrolling through communities' solutions, each exercise is getting a deep explanation and understanding for its different ways of solving it and optimise it. For example, I would never tried any bitwise solutions from the first try. Great work have been put into these videos, website, exercises, and communities. Thanks a lot for your and everyone's efforts. Maybe at the end of this year's challenge you can make a bounce video about how to tackle a problem and different optimisation technics. And next year the challenge could be 3-level project for each month similar to last year's theme "appy, analytic, system, ..."

  • @ArthurKhazbs
    @ArthurKhazbs Місяць тому

    Kotlin has floorDiv too!

  • @iosimion
    @iosimion Місяць тому

    Thank you for the video, it was interesting, as always. Seeing it, I got some ideeas on how I could improve my solution also and hopefully I did :). I liked the way Erik explained the issue with the pseudo-random number ganarators during the C++ solution presentation. I also found the Kotlin and Python solutions very nice. They are readable and concise.

    • @exercism_org
      @exercism_org Місяць тому

      Thanks for the comment! Yeah - generating ideas of how to improve my solutions as we record these videos is definitely one of the joys of them - I'm glad that translates to watching them too! :)

  • @Pul_1964
    @Pul_1964 Місяць тому

    Hi, thanks for the video! But IMHO the Erlang solution is ridiculously repetitive and frankly bad and error-prone code. What if there were far more allergies? This is particularly sad here, since Erlang has fantastic bitstring pattern matching, which is highly optimized (stemming from its history in telecom signal processing). So you would probably never implement it like that in an Erlang production system. People get a totally wrong impression of a language, when such code is showcased in your videos. Here is a clause from iteration 2 of my Elixir solution to illustrate, how one would rather code that (as you might know Elixir is pretty close to Erlang with a more modern syntax). This tail-call-recursive function consumes all known allergies together with the bits of the flags, which are shifted to the right in each recursion. Here is the clause, that adds the allergy, if the current LSB is set (the 1::1 in the pattern is the bit in question). The advantage of this solution is, that it has no repetition and would work efficiently with thousands of allergies (by a simple change of one module attribute holding their symbols), since we are using bitstrings and not limited integers: ```elixir defp decode_allergies( [allergy_marked_by_lsb | allergies], <<flags::@trailing_bits_before_lsb, 1::1>>, decoded_allergies ), do: decode_allergies(allergies, <<flags::@significant_bits>>, [ allergy_marked_by_lsb | decoded_allergies ]) ``` But in Elixir, there is an even more elegant way to implement this efficiently and maintainably: With the fantastic meta-programming. Interested? Checkout my solution and the comments below it. exercism.org/tracks/elixir/exercises/allergies/solutions/Pul

    • @ErikSchierboom
      @ErikSchierboom Місяць тому

      We don't always mention it, but the idea isn't to show the idiomatic solution in a language, but to show an approach in any language. That means that we regularly feature solutions that are not optimal for a language, just to showcase the approach. We've also featured some really nice Erlang solutions in other videos, but this one is indeed very verbose, but still illustrative of the approach.

    • @exercism_org
      @exercism_org Місяць тому

      We put out posts on the forum a week or two before recording, where people share their solutions for us to feature. If you've got good Erlang versions we can showcase, please do add them there in advance! :) Also - love the comments on your solutions - always great to understand the motivations and learnings from the different iterations :)

    • @Pul_1964
      @Pul_1964 28 днів тому

      @@ErikSchierboom Thanks for your answer, even if I don't necessarily agree with that policy. If I were to get in first contact with a language via such a video, I would like to get a realistic impression, how the language really feels and if it might be interesting for me. And that is unfortunately not the case here: Anybody who doesn't know Erlang could turn away from this mess (which is really diametral to how one would actually implement it) and say "This Erlang crap doesn't look interesting" as if they just had seen some convoluted imperative language. I mean not to criticize you, just to give smoe feedback. In general, you guys are doing an amazing job. Thank you for bringing a glimpse of diversity into the far too mainstreamed world of software, which is in urgent need of new horizons!

    • @Pul_1964
      @Pul_1964 28 днів тому

      @@exercism_org > Also - love the comments on your solutions - always great to understand the motivations and learnings from the different iterations :) Thanks! I do that on full purpose, since I think, that it is a great opportunity to share insights additionally to the one-on-one mentoring. I wished, the comment section wasn't so orphaned and would be more used for discussions on solution approaches. And since I am wishing anyway: It would be great to have some benchmarking in the solution overview as well. From many mentoring sessions I know, that people often have no clue about the runtime complexity of their solutions, but most are open to it. And many are shocked, when they are shown, that their solution performs 100+x worse than it could. Having some indicator about the relative performance of ones solution would probably help more than the "slow tests" in some exercises, who are IMO swiftly ignored by most people (particularly if they don't work locally).

  • @Pul_1964
    @Pul_1964 Місяць тому

    @exercism_org I meant to link my Elixir solution (tracks/elixir/exercises/minesweeper/solutions/Pul) here, which has a quite unusual approach I explained in its comment section. But once again, my comment vanished twice without any transparency about the cause or reason (I did the link right this time). It's not fun contributing under these circumstances...

    • @exercism_org
      @exercism_org Місяць тому

      Thanks! Yeah - UA-cam sometimes deletes comments randomly without us knowing. Also, certain comments only appear when "Sort By" is set to "Newest", not "Top comments" - again I have no idea why. Maybe to do with whether you have a profile picture or not - that's the only consistency I can see. Anyway, thank you for posting and we'll take a look at your solution!

  • @iosimion
    @iosimion Місяць тому

    It's funny that I wanted to take a look at this for this week's 48in24 puzzle :). I stopped it, solved it, and now will continue. I saw some very nice comunity solution, including your's (Erik's), and one that is using reflection to initialize the fields of the object. Thank you, for the intro, and to all the contributors for the excelent content on the site.

  • @robinheyer708
    @robinheyer708 Місяць тому

    I like these grid navigation style exercises and I love that Crystal implementation! But it does sound a bit weird when someone talks about a Crystal method... which I just checked is what they are referred to officially. Maybe they want to change that to function. I half expected a more pure OOP version with a Point class that has its own Neighbours array. I used a Span<char> in C# (which is sort of like a slice in Rust, I think) that I pre-allocate with the size of the first string and then, since there is an action on each character, you can keep using the same span in every row loop, and create a string in the result array based on the span at the end of the loop.

  • @computersciencestudentriverbat
    @computersciencestudentriverbat Місяць тому

    I learn so much from these conversations meets tech-talks. Also love the chemistry too, just two dudes hanging out and talking about something they care about, nothing beats that sincerity. I would love to see more developer talk plainly about how/why they do X or Y. Really glad y'all are doing what you do!

    • @ErikSchierboom
      @ErikSchierboom Місяць тому

      Thanks so much! What a lovely comment

    • @exercism_org
      @exercism_org Місяць тому

      Love to read. Thanks for all your comments and support - really always appreciate them! :)

  • @ganderston
    @ganderston Місяць тому

    thank you!

  • @iosimion
    @iosimion Місяць тому

    Hi. I liked Jeremy's solution most, along with the next one - probably because I went for the same strategy. I also liked the Julia and F# solutions. I have tried to put a comment with a link to my solution, but I guess it is not allowed :), so I'll try something else: /tracks/cpp/exercises/minesweeper/solutions/ionutsimion. I had several iterations, but the algorithm is the same.

    • @exercism_org
      @exercism_org Місяць тому

      First time someone's liked my solution the most - whoop! :D Thanks for sharing your solutions - we'll take a look!

  • @rodolfo_carvalho
    @rodolfo_carvalho Місяць тому

    At 34:56 Erik's comment that "the author had to use mutable" in F# made me intrigued! So much so that I went to install dotnet and run the F# interactive shell. After reading the docs and a few attempts, @Exercism turns out there is a short and readable way to sum items in a 2D array: > let a = array2D [[' '; '*'; ' ']; [' '; ' '; '*']; ['*'; '*'; '*']];; val a: char[,] = [[' '; '*'; ' '] [' '; ' '; '*'] ['*'; '*'; '*']] > a.[0..2, 0..2] |> Seq.cast<char> |> Seq.map (fun x -> if x = '*' then 1 else 0) |> Seq.sum;; val it: int = 5 > a.[0..2, 0..2] |> Seq.cast<char> |> Seq.filter ((=) '*') |> Seq.length;;

    • @rodolfo_carvalho
      @rodolfo_carvalho Місяць тому

      Oh, and the whole "board" can be removed too. Indexing out of bounds is apparently ok, so not need to do explicit bounds check either :)

    • @ErikSchierboom
      @ErikSchierboom Місяць тому

      That's really cool. What I meant to say was that the author tried to use Array2D functions primarily, and that they don't lend themselves well to the summing

    • @rodolfo_carvalho
      @rodolfo_carvalho Місяць тому

      @@ErikSchierboom Yeah, I love your commentary and how you and Jeremy interact. You're always very insightful! When I saw "mutable" on the screen I almost immediately paused the video and went "there must be a better way to do it", only later did I listen to the rest and realized the nuance you added to it. Spot on!

  • @phix3471
    @phix3471 Місяць тому

    This is what it looks like in Phix (no such track yet, but soon) global function annotate(sequence board) integer h = length(board) sequence res = repeat(0,h) if h then integer w = length(board[1]) for y,line in board do string outline = "" for x,ch in line do if ch!='*' then integer m = 0 for i=y-(y>1) to y+(y<h) do for j=x-(x>1) to x+(x<w) do m += board[i][j]=='*' end for end for if m then ch = '0'+m end if end if outline &= ch end for res[y] = outline end for end if return res end function

    • @exercism_org
      @exercism_org Місяць тому

      Nice! Phix is similar to our Euphoria, I think? Have you played with the OpenEuphoria track yet? exercism.org/tracks/openeuphoria

    • @phix3471
      @phix3471 Місяць тому

      @@exercism_org yes, and yes!

  • @benitoe.4878
    @benitoe.4878 Місяць тому

    Great video, thank guys. "Minesweeper" should be re-classified to "medium". It's above the level of other "easy" exercises on exercism.

    • @exercism_org
      @exercism_org Місяць тому

      Thanks! Exercises are rated differently per track as they can vary wildly in difficulty. If there's a specific track that you found it misclassified in, please do open an issue in the forum (forum.exercism.org) and the maintainers of that track can take a look! :)

  • @VolodymyrPavlyshyn
    @VolodymyrPavlyshyn Місяць тому

    ua-cam.com/video/0IkSLj-oCZ8/v-deo.html my take on prolog and ai

  • @henrikorpela2818
    @henrikorpela2818 Місяць тому

    Great stuff. I would have also liked to hear drawbacks of Lisp and its dialects. I mean, there must be reasons why the languages are not widely used in the enterprise world, for example.

    • @exercism_org
      @exercism_org Місяць тому

      Lisps are pretty widely used, but definitely nowhere as near as common as other languages. A lot of it comes down to where there's been investment and/or huge players, which subsequently means investment in performance, ecosystem tooling etc. Java makes a lot of money for Oracle for example, and there is a huge industry around something like Java (think editors, training, etc). Often languages that have been around for a long time and very niche become more mainstream over time - Haskell is a good example, and maybe the resurgence of BEAM (Erlang stack too). Thanks for the comment! :)

  • @thewetfly9207
    @thewetfly9207 Місяць тому

    I like your enthusiasm.

  • @91kap
    @91kap Місяць тому

    what app are you using to code in?

    • @ErikSchierboom
      @ErikSchierboom 28 днів тому

      That's Visual Studio Code: code.visualstudio.com/

  • @GmailNexus
    @GmailNexus Місяць тому

    Can't read the terminal part, covered by UA-cam UI Overlay (Title + Tags)

    • @exercism_org
      @exercism_org Місяць тому

      Yeah - it's annoying how mobile covers 1/3 of the video with its UI!

    • @GmailNexus
      @GmailNexus Місяць тому

      @@exercism_org 100% agree

  • @AbdulrahmanSheikho
    @AbdulrahmanSheikho Місяць тому

    Lovely walkthrough each step, thanks for your effort guys, I really appreciate it.

    • @exercism_org
      @exercism_org Місяць тому

      You're very welcome! Thanks for commenting :)

  • @ramykader3578
    @ramykader3578 Місяць тому

    Nim could also write the same solution as julia using the <= operator on sets while still being as efficient as the bitset-based solutions as Nim's set type is actually a bitset for ordinals. proc isPangram*(s: string): bool = {'a'..'z'} <= s.toLower.toSet

  • @01xdev21
    @01xdev21 Місяць тому

    Hi, can anyone let me know why 'score & 1 << allergen' gives the answer to ''is_allergic_to' function? I know how & and << operators work but how do you know that you should perform & ? What is reason / logic behind performing & here?

    • @ErikSchierboom
      @ErikSchierboom Місяць тому

      It's (ab)using the fact that 0 is falsy and not zero is truthy. If the (1 << allergen) bit was not set in score, the returned value will be zero (false). Consequently, if the bit was set in both numbers, it will return a non-zero number (true).

  • @thepatzer
    @thepatzer Місяць тому

    What a contrast between the vibe of Golang development and management vs Luis and Gleam. Great work, Jeremy.

    • @exercism_org
      @exercism_org Місяць тому

      Thanks! And yeah, I can imagine different people/mindsets really gravitating to the alternate approaches.

  • @joeogle3472
    @joeogle3472 2 місяці тому

    This is very informative. Thank you for making this

    • @exercism_org
      @exercism_org Місяць тому

      Awesome. Glad you enjoyed it!

  • @glennjackman759
    @glennjackman759 2 місяці тому

    Correction to the description: Lua starts at 10:36 at 11:07, Lua patterns use `%a` for "letters" (a for alphabetic, I assume), and `%l` is lowercase letters.

  • @cosoraul
    @cosoraul 2 місяці тому

    Awesome video, many thanks Erik!

  • @Pul_1964
    @Pul_1964 2 місяці тому

    Thanks for the video! I liked particularly the elegance of Julia and the bitmap idea (in Rust, which can also be done in FP with recursion as I show below in Elixir). I added the bitmap approach to my existing Elixir solutions and have now 4 iterations/versions: 1. Creating and counting a unique downcase set (must be size of alphabet) 2. Subtracting the downcase charlist from the alphabet (must be empty) 3. Recursion over the sentence filling a bitmap (just an integer) until all chars are set or no characters left 4. like 3 but with clauses generated with metaprogramming Iteration 3 is the fastest, if we have long strings, in which a complete pangram can early be detected, since it terminates early, while 1 and 2 always process the whole input. Iteration 2 has the best tradeoff between performance and readability. Checkit out here: exercism.org/tracks/elixir/exercises/pangram/solutions/Pul

    • @exercism_org
      @exercism_org 2 місяці тому

      Awesome. Really cool to see those different approaches. Thanks for commenting and sharing!

  • @ErikSchierboom
    @ErikSchierboom 2 місяці тому

    Minor correction: there of course _is_ a character class for lowercase letters, namely [[:lower:]]

    • @glennjackman759
      @glennjackman759 2 місяці тому

      That's not necessarily only ASCII lowercase (probably depends on the regex flavour)

  • @luizagabie
    @luizagabie 2 місяці тому

    watching this I just realized how unoptimized my python code looks lol, nice video though 😃

    • @exercism_org
      @exercism_org 2 місяці тому

      Ha. Yes. We here this a lot! (And find it ourselves when making them :D)

  • @computersciencestudentriverbat
    @computersciencestudentriverbat 2 місяці тому

    Another great video! I really like what ya'll are doing. I really hope more folks (students and job-seekers especially) find Exercism. I think Exercism does a great service of being a learning tool first and foremost. Keep it up :-)

  • @alveek
    @alveek 2 місяці тому

    The best video on recursion 👏👏

  • @iosimion
    @iosimion 2 місяці тому

    About the ASCII code difference between lower case and upper case, it was actually very good design. There are exactly 2^5 characters between corresponding letters ('a' and 'A' etc.), which means that it's enough to use bitwise OR to transform from upper-case to lower-case: c | 0b100000 or c | 0x20. Also, it's not very difficult to transform for lower-case to upper-case.

    • @exercism_org
      @exercism_org 2 місяці тому

      Yeah - we go on to discover that in the next solution we show! :)

    • @nitkonigde1381
      @nitkonigde1381 2 місяці тому

      I guess you can do xor to get to uppercase, in Python this yields "Z": chr(ord('z') ^ 0x20)

    • @iosimion
      @iosimion 2 місяці тому

      @@nitkonigde1381 I think it's NAND - AND with the bitwise complement of 0x20. XOR toggles between lower case and upper case.

    • @nitkonigde1381
      @nitkonigde1381 2 місяці тому

      @@iosimion Thanks!