multiple-dispatch Questions

20

I know that Python does not support method overloading, but I've run into a problem that I can't seem to solve in a nice Pythonic way. I am making a game where a character needs to shoot a variety ...
Roaster asked 22/6, 2011 at 3:11

2

Solved

I would like to use overloading in Python. I know it's not possible by design (Python is dynamically typed language), there is quite good thread here on this topic. That's why I could use something...
Shive asked 19/3, 2021 at 16:0

4

Solved

I am trying to understand what multiple dispatch is. I read a lot of various texts but I still have no idea what multiple dispatch is and what it is good for. Maybe the thing I am missing is piece ...
Semeiology asked 17/11, 2009 at 15:12

3

Solved

I'm writing a throwaway script to compute some analytical solutions to a few simulations I'm running. I would like to implement a function in a way that, based on its inputs, will compute the rig...
Trajectory asked 16/1, 2020 at 0:40

2

Solved

How would you implement a function like this: function foo(a,b...,c) println(a,b,c) end foo(2,3,3,"last") => a = 2 , b = (3,3) , c = "last" I cannot use something like: fu...
Claus asked 18/12, 2021 at 20:34

1

Here's the program: my %SUB-COUNTS; say "Start"; multi sub trait_mod:<is>(Sub $s where .name().contains("-logged"), :$AOP) { $s.wrap({ say "Entering { $s.name }&q...
Wizen asked 25/7, 2021 at 11:7

0

I am using multipledispatch to make a Point class, which has three constructors: one that takes a single integer, one that takes two, and one that takes an object of type Point. But I am unable to ...
Machmeter asked 4/11, 2020 at 8:53

1

Solved

First of all: raku (perl6) is amazing. And so is Cro. It only took a week-end to fall in love. However now I stumble over something that must be extremely simple. If I use a slurpy parameter in a...

2

Solved

OP UPDATE: Note that in the latest version of Julia (v0.5), the idiomatic approach to answering this question is to just define mysquare(x::Number) = x^2. The vectorised case is covered using autom...
Cortege asked 29/7, 2014 at 6:2

2

Solved

I can choose a multi based on some non-argument value but I have to have at least one argument so I can kludge the where in there: our $*DEBUG = 1; debug( 'This should print', 'Phrase 2' ); $*DEB...
Mcalister asked 1/1, 2018 at 19:49

2

Solved

I am reading Modern C++ Design Generic Programming and Design Patterns Applied by Andrei Alexandrescu and chapter 11 on multimethods deals exactly with the problem I am trying to solve. All source ...
Insinuating asked 28/4, 2014 at 8:52

3

Solved

I am wondering if it is possible to build something similar to multiple dispatch in OCaml. To do that, I tried to make an explicit type for the input signature of a multimethod. As an example, I de...
Dishpan asked 18/12, 2016 at 23:27

1

Solved

I was wondering if there was a way to use Symbols for multiple dispatch, but also include a "catch-all method". i.e. something like function dispatchtest{alg<:Symbol}(T::Type{Val{alg}}) prin...
Zoon asked 4/9, 2016 at 8:21

1

I'm considering writing a type similar to those defined in NamedArrays and Images. Let's say I just want essentially an Array with a piece of metadata, say a user-friendly name that I'll write at t...
Damle asked 7/6, 2016 at 18:32

3

Solved

Can someone think of a good way to implement multiple dispatch with something like the Object::foo overloads below? class A { public: virtual void accept (Visitor&) = 0; }; class B : publi...
Continuate asked 26/3, 2015 at 18:39

1

Solved

I have defined the following variable julia> X = (1:10) * ones(1,10) which defines a matrix with each row equals to the same number and the numbers in the column increasing from 1 to 10 by 1....
Matrilineage asked 1/2, 2016 at 1:52

1

Solved

My question is how can I overload certain method within a certain class in Julia? In other words suppose I have a following definition of a class: type Sometype prop::String setValue::Function...
Kruse asked 23/9, 2015 at 0:12

5

Solved

Reading myself into Lisp, currently on this page (http://landoflisp.com), I found the following statement on the second last paragraph on the page that shows when clicking the link CLOS GUILD: T...
Voroshilov asked 31/8, 2015 at 9:59

1

Solved

I've been reading a bit from http://c2.com/cgi/wiki?ImplementingMultipleDispatch I've been having some trouble finding reference on how Julia implements multimethods. What's the runtime complexity...
Stearic asked 21/8, 2015 at 15:30

1

Solved

In Julia, I want to specify the type of a function argument as an array of arrays. So I have function foo{T <: Any}(x::Array{Array{T}}) but if I set the argument x in the REPL, for example: ...
Rame asked 21/1, 2015 at 14:40

8

Solved

I'm trying to understand what single and multiple dispatch are, exactly. I just read this: http://en.wikipedia.org/wiki/Multiple_dispatch And from that definition is seems to me that C# and VB.Ne...
Pantsuit asked 26/1, 2009 at 14:17

2

Solved

I wondered if Java7's new invokedynamic bytecode instruction could be used to implement multiple dispatch for the Java language. Would the new API under java.lang.invoke be helpful to perform such ...
Have asked 13/6, 2012 at 12:34

3

Solved

I have these classes : class Asset { } class House:Asset { } consider these outsiders static functions : static void Foo (Asset a) { } static void Foo (House h) { } If i write : House h =...
Dilapidate asked 26/4, 2012 at 9:36

9

Solved

Is it the same as overloading, if not, can you please provide and example of each in C# I have read the responses to a similar question asked in SO ... i did not understand the responses posted to...
Redstone asked 26/1, 2009 at 16:43

10

Solved

(This question should probably be answered with a reference to Stroustrup.) It seems extremely useful to be able to request a pointer to the most derived class, as in the following: class Base { ...
Limber asked 16/6, 2010 at 14:15

© 2022 - 2024 — McMap. All rights reserved.