Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Tooling
0 votes
3 replies
150 views

I'm in the process of learning Golang, and I'm currently trying to create a Todo project. My knowledge is limited to the GO base. Please take a look at my code and tell me how I can delete a task. The ...
Score of 2
3 answers
139 views

I have a 3D numerical array X, of shape=(N,N,6); and a 2D logical array mask, of shape=(N,N). I would like to find all unique 1D subarrays (length=6, along axis=2) of X, searching over the first two ...
Advice
0 votes
7 replies
172 views

I’m looking to understand both: A brute force solution An optimal solution (in terms of time and space complexity) The input is a slice of integers, for example: nums := []int{10, 5, 20, 8, 15} ...
Score of 1
1 answer
133 views

If i would compare by references i can deal with raw_data from What is the preferred method of comparing values? I think it's too generic to not exist in std... // Maybe I can make `return false` on `...
Score of 1
1 answer
167 views

We have a boxed slice of an arbitrary type T. I'd like to slice it at a given index, then move the remaining elements after the index into a new Box<[T]>. It's fine if the original Box<[T]>...
Score of 10
2 answers
360 views

R version 4.5.0 (2025-04-11 ucrt) RGui console in Windows 11. I happened to come across the following problem. Consider the global assignment statement: xxx <<- c(1,2) xxx[1:2] ls() This gives [...
Advice
0 votes
2 replies
95 views

I have a problem where I need to cut off text based on a max length. But the inputted string could be html a la <p>hello</p>. the html tags do not count towards the max length. for example ...
Score of 1
1 answer
193 views

I'm facing an AlignmentMismatch error while trying to cast a Vec<u8> to Vec<T>, where T is a struct that uses repr(C) and Pod + Zeroable. I've also tried the slice road &[u8] -> &...
Best practices
0 votes
3 replies
117 views

If I define a slice as follows then it will have a length of 0 and a capacity of 10: var logs = make([]string, 0, 10) After appending data to this slice, I check to see if it is at capacity and if it ...
Score of 3
1 answer
155 views

In Rust, both references and pointers to unsized types have metadata indicating the actual type of the reference. For example, a *mut [T] consist of a pointer to the start of a slice, plus a length ...
Score of 0
4 answers
181 views

I'm trying to remove the first/last two characters of each iterable record in a string (which I converted from a list and split into separate lines). newString = "\n".join([str(item) for ...
Score of -3
2 answers
177 views

I was trying to slice the extension '.txt' from some file names. It look like the Python cut the last letter - before the dot- if its a t or x: filenames = ["report.txt", "downloads....
Score of 3
1 answer
158 views

Consider the following (traditional) Fortran code, which performs matrix-vector multiplication z = X y, but instead of the full matrix, we exclude the top two rows: subroutine matrix_vector_product(m, ...
Score of 0
1 answer
71 views

So I have this code in SwiftUI, it's working great. .background( Image("felt") .resizable(resizingMode: .tile) ...
Score of 3
1 answer
288 views

In the Go Tour we have var pow = []int{1, 2, 4, 8, 16, 32, 64, 128} func main() { for i, v := range pow { fmt.Printf("2**%d = %d\n", i, v) } } which outputs: 2**0 = 1 2**1 ...

15 30 50 per page
1
2 3 4 5
424