Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Mehmet Hakan Satman
@mhsatman@fosstodon.org  ·  activity timestamp 2 weeks ago

This feature of Julia makes it a unique tool for my courses. Almost all of my courses require some type of solver. This solver provides a unique algorithm that obtains the solution to a specific problem. Thanks to Julia, I gain the opportunity to write multiple versions of the solve function with a single solve() method. This is called multiple dispatch, and the fact that it can be applied to all arguments distinguishes it from function overloading.

julia #JuliaLang

Sorry, no caption provided by author
Sorry, no caption provided by author
Sorry, no caption provided by author
  • Copy link
  • Flag this post
  • Block
Jonathan Carroll
@jonocarroll@fosstodon.org replied  ·  activity timestamp 2 weeks ago

@mhsatman I'm going to risk a run-of-the-mill "akshually..." reply, but I know several people who get stuck on this definition and now I'm wondering if I'm the one who has it wrong.

Aren't these all single-dispatch examples? I thought the "multiple" in multiple dispatch referred to dispatching based the entire signature. I think that's supported here https://www.youtube.com/watch?v=kc9HwsxE1OY&t=415s where the distinction from function overloading is explained quite nicely (extends to abstract types, not just concrete)

  • Copy link
  • Flag this comment
  • Block
Mehmet Hakan Satman
@mhsatman@fosstodon.org replied  ·  activity timestamp 2 weeks ago

@jonocarroll right, the examples are of single one, I thought it was a special case of the multiple one. I was comparing it to R in my mind in which I used to struggle with too much.

  • Copy link
  • Flag this comment
  • Block
Jonathan Carroll
@jonocarroll@fosstodon.org replied  ·  activity timestamp 2 weeks ago

@mhsatman yeah, S3 in R can only dispatch on a single argument, but S4 can do multiple (with a bit more work).

  • Copy link
  • Flag this comment
  • Block
Mehmet Hakan Satman
@mhsatman@fosstodon.org replied  ·  activity timestamp 2 weeks ago

@jonocarroll I only worked with setRefClass in context of object orientation in R. Indeed, it was the real pain on the head! Thanks to Julia, It's now easy to create custom data structures and to define functions that operate on them.

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login