recursive-type Questions
2
In scala I am wondering if there is a way I can define a new type including itself
For example
type A = Tuple(e1: Int, e2: A)
Ofcourse type A = List[A] is illegal so is there another way to do thi...
Trossachs asked 3/11, 2022 at 8:33
1
Solved
Consider I have a tuple of tuples:
type Example = [[3,5,7], [4,9], [0,1,10,9]];
I want to create an utility type Flatten<T> such that Flatten<Example> gives:
type FlatExample = Flatten...
Proverbial asked 24/8, 2020 at 19:59
2
Solved
I am currently working on a simple interpreter for a programming language and I have a data type like this:
data Expr
= Variable String
| Number Int
| Add [Expr]
| Sub Expr Expr
And I have m...
Untwine asked 17/10, 2019 at 18:57
1
Solved
My original problem is this.
I made the following type but it does not work due to the circular references error and I don't know how to solve it:
type Increment<T extends number, Tuple extend...
Duky asked 17/1, 2019 at 20:10
1
Solved
Here is a data structure I can write down and which is accepted by the Rust compiler:
pub struct Pair<S, T>(S, T);
pub enum List<T> {
Nil,
Cons(T, Box<List<Pair<i32, ...
Herzen asked 23/7, 2018 at 12:3
3
Solved
I have functions that represent steps in a process. Each function also knows the next step, if there is one. I'd like to be able to do something like:
fun fooStep() : Step? {
... do something ......
Kaufman asked 9/6, 2017 at 21:8
2
I have a situation where I need a method that can take in types:
Array[Int]
Array[Array[Int]]
Array[Array[Array[Int]]]
Array[Array[Array[Array[Int]]]]
etc...
let's call this type RAI for "recurs...
Methylnaphthalene asked 20/5, 2017 at 21:18
2
Solved
This is a purely academic question, but riffing off of this question
about type constraints. The questioner gave this as an example:
type Something<'a, 'b when 'b :> seq<'b>>() =
m...
Unemployable asked 1/6, 2016 at 20:50
1
© 2022 - 2024 — McMap. All rights reserved.