2024/05/18

Newest at the top

2024-05-18 20:22:13 +0200 <monochrom> There is no dedicated subrange function, so yeah ixmap with id is one solution. But you can also try array (3,5) [ (i, a ! i) | i <- [3..5] ]
2024-05-18 20:18:38 +0200 <ncf> doesn't look like a subrange to me
2024-05-18 20:18:34 +0200 <ncf> <ncf> ixmap (1, 3) (subtract 1) a
2024-05-18 20:17:27 +0200 <justsomeguy> So would I only use ixmap to get subranges of the input IArray? I don't see how else I could use it. I guess it depends on what type you chose as your index.
2024-05-18 20:15:16 +0200 <ncf> (length wouldn't make sense for higher-dimensional arrays)
2024-05-18 20:15:00 +0200 <EvanR> r[i] = a[f(i)]
2024-05-18 20:14:53 +0200 <monochrom> Eh, if anything, I would expect length to be second, not first. :)
2024-05-18 20:14:26 +0200 <monochrom> And I guess also b ! i = a ! (i+1) as you specified (+1).
2024-05-18 20:14:14 +0200 <lambdabot> [1]
2024-05-18 20:14:12 +0200 <ncf> > [1..1]
2024-05-18 20:14:08 +0200 <ncf> and the second one is the last index
2024-05-18 20:14:02 +0200 <ncf> it is the starting index
2024-05-18 20:14:01 +0200 <EvanR> justsomeguy, the resulting array effectively uses a function on the incoming index to get the value
2024-05-18 20:13:52 +0200 <justsomeguy> Oh man... I thought the first element of the tuple was the starting index, not the length.
2024-05-18 20:13:25 +0200 <monochrom> (1,1) means an array of length 1, the only index being 1.
2024-05-18 20:12:08 +0200 <ncf> as expected
2024-05-18 20:11:15 +0200 <justsomeguy> So when I run b = ixmap (1,1) (+1) a I get array (1,1) [(1,'c')]. Now I have a = array (0,2) [(0,'a'),(1,'b'),(2,'c')] and b = array (1,1) [(1,'c')].
2024-05-18 20:05:26 +0200 <ncf> (0, 2) in your `a`
2024-05-18 20:05:12 +0200 <ncf> first and last index
2024-05-18 20:05:00 +0200 <justsomeguy> What is a bounds?
2024-05-18 20:04:43 +0200 <justsomeguy> (an IArray, sorry)
2024-05-18 20:04:34 +0200 <justsomeguy> and the last argument is an Array.
2024-05-18 20:04:24 +0200 <justsomeguy> And they you provide a unary function to manipulate each index.
2024-05-18 20:04:08 +0200 <justsomeguy> So, the first argument is a range of indices supplied as a tulpe, right?
2024-05-18 20:03:20 +0200 <justsomeguy> I'm 100% lost.
2024-05-18 19:59:12 +0200 <ncf> so if you want to apply some transformation f to the indices, you need to apply f to the bounds and give f⁻¹ as the mapping
2024-05-18 19:59:01 +0200 <aryah> hahah, yeah, well it was a bad accident with my credentials overall tbh.
2024-05-18 19:58:34 +0200 <ncf> the function creates an array with the given bounds, then applies the function to each *new* index to get the element corresponding to that index from the old array
2024-05-18 19:58:05 +0200 <geekosaur> I use a password manager to keep track of such things 🙂
2024-05-18 19:57:39 +0200 <aryah> yeah, prob, I didn't want to need to dig up my github acc...
2024-05-18 19:57:18 +0200 <mauke> justsomeguy: ah, then what ncf said
2024-05-18 19:57:02 +0200 <geekosaur> aryah, that might best be posted to the proposal issue?
2024-05-18 19:57:00 +0200 <ncf> justsomeguy: read the type carefully
2024-05-18 19:56:50 +0200 <aryah> soo, which is it? I guess the latter, but the text should surely be consistent before acceptence.
2024-05-18 19:56:37 +0200 <ncf> well i guess your Iso would need to be well-behaved
2024-05-18 19:56:36 +0200 <justsomeguy> I was expecting to use ixmap (0,2) (+1) a to create a new Array like array (1,3) [(1,'a'),(2,'b'),(3,'c')]. But honestly I'm not sure what ixmap does and I'm just trying to go through each function in IArray and try them out on sample inputs.
2024-05-18 19:56:09 +0200 <ncf> apply it backwards to the bounds to determine the new bounds, then forwards to get the elements
2024-05-18 19:55:56 +0200 <aryah> there's a contradiction in the 'extensions lifecycle' proposal (601). explaining experimental, it says "an Experimental extension must be Deprecated prior to removal", but then they recently expanded the section "transitions that are possible but left at the discretion of implementers..." with Experimental -> (does not exist)
2024-05-18 19:55:49 +0200 <ncf> surprised there isn't a lens combinator that takes an Iso
2024-05-18 19:54:20 +0200y04nn(~username@45.129.56.202)
2024-05-18 19:54:18 +0200 <mauke> justsomeguy: what do you mean by "map (+1) to each index"?
2024-05-18 19:54:09 +0200 <ncf> "what bounds do you want", "how do you get back to the old indices"
2024-05-18 19:53:53 +0200 <lambdabot> (Ix i, Ix j) => (i, i) -> (i -> j) -> Array j e -> Array i e
2024-05-18 19:53:52 +0200 <ncf> :t ixmap
2024-05-18 19:53:22 +0200 <ncf> ixmap (1, 3) (subtract 1) a
2024-05-18 19:53:20 +0200 <glguy> subtract 1
2024-05-18 19:53:18 +0200 <glguy> subtrace 1
2024-05-18 19:53:17 +0200 <glguy> otherway
2024-05-18 19:53:14 +0200 <ncf> nope
2024-05-18 19:53:05 +0200 <glguy> that is tricky