« first day (2465 days earlier)      last day (2009 days later) » 

12:42 AM
I just realized properly OOP in Mathematica has been eminently possible since at least V9:
b = System`Utilities`HashTable[];
a = b;
System`Utilities`HashTableAdd[a, 1, 2];
System`Utilities`HashTableToAssociation[b]

<|1 -> 2|>

b = <||>;
a = b;
a[1] = 2;
b

<||>
That mutability means that we can just use a HashTable backend and do things exactly like we would in python...
I wish I'd known this like 4 years ago
 
I have sometimes faked Farthest by using a negated DistanceFunction in Nearest[].
 
 
2 hours later…
 
6 hours later…
8:23 AM
I've generated a line from extracting some pixel positions from an image, and I'm now trying to turn that back into an Image, but can't figure out how to do that and keep the original coordinate system
 
Several new Wolfram projects are up on GitHub as open source:
Wolfram Client for Python github.com/WolframResearch/WolframClientForPython @b3m2a1
MongoLink is now open source github.com/WolframResearch/MongoLink
And several other very cool looking projects
I do not know when these appeared. I went there looking for the draw tool today.
Thank you @JohnFultz ! ^
2
 
8:48 AM
@Szabolcs I actually saw that one a bit ago. It seems pretty cool. Looks like it uses ByteArray to serialize data so as long as that gets translated into an efficient python-side data structure (i.e. not list-of-lists of python numbers) we may not even need MathLink? Still not entirely clear to me how it works, but...hopefully it's fast.
 
nm, figured it out.
Is there a function similar to Partition (or option for it) that lets me drop some elements in between each subset? For instance f[{1,2,3,4,5,6,7,8,9,10,11}]={{1,2},{4,5},{7,8},{10,11}}
I can use something like Take[#, 2] & /@ Partition[pts, 3], but feels like something that is probably a built-in
 
9:17 AM
@KraZug this might perform better:
takeInNs[l_, take_, part_] :=
 With[{len = Length@l},
  TakeList[l, Array[{0, take - 1} + # &, Ceiling[len/part]]]
  ]

takeInNs[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 2, 3]

{{1, 2}, {4, 5}, {7, 8}, {10, 11}}
Especially if you have longer partitions and shorter runs
Ah wait that's not quite right. I don't account for the offset properly...
 
My runs are going to be relatively long. If there isn't a quick answer, shall I ask it as a proper question
just thought there may be a built-in that I was unaware of
 
@KraZug yeah I'd ask a proper question. Someone might have a clever-er approach.
@KraZug this works:
takeInNs[l_, take_, part_] :=
 Module[{spec},
  spec = Array[{0, take - 1} + # + (# - 1)*(part - take - 1) &,
    Floor[Length@l/part]];
  TakeList[l, spec]
  ]
But TakeList is embarrassingly slow so that's amazingly slower than the version that uses Partition.
And scales worse
 
0
Q: Partition data but dropping elements between each sublist

KraZugIs there a neat way to partition a list into sublists of fixed length $n$, discarding a fixed number $k$ elements between each one? E.g for $n=3, k=1$, f[Range[1,11],3,1]={{1,2},{4,5},{7,8},{10,11}} I can do it with Take[#, 2] & /@ Partition[pts, 3] (or wrapped into a function) but I was ...

My data is actually relatively small, so not really an issue of timing for me
just when I come across relatively simple list operations I like to learn the neater ways of doing it
 
@KraZug ah okay. Then definitely avoid TakeList.
 
9:50 AM
@b3m2a1, apparently it is one of the examples of Partition, doh.
 
@KraZug oh nice
I didn't realize Partition was so powerful
I'm always using Riffle[Most[#], Rest[#]] but Partition[#, 2, 1] gets the job done cleaner
Although somehow it's not faster...
Actually it's pretty seriously slower:
Module[{rrr = Range[50000]},
 {
  First@RepeatedTiming@Partition[Riffle[Most[rrr], Rest[rrr]], 2],
  First@RepeatedTiming@Partition[rrr, 2, 1]
  }
 ]

{0.00071, 0.0031}
...wow
 
10:28 AM
Heh
Maybe you should post an answer with timing on large datasets
 
 
3 hours later…
1:27 PM
A lot of new posters today. I wonder...
 
1:38 PM
@J.M.iscomputer-less true. mid semester crisis?
 
2:00 PM
Wtc2018 meetup proposal:
0
A: Meet at Wolfram Technology Conference?

KubaI am trying to schedule a meeting. 5pm today, the meetup room in Homewood Suites, a hotel next to the conference hotel. If anyone is around, please come :)

 
 
4 hours later…
6:00 PM
Hi @CarlWoll . I'm a physics phd student at UW. Lawrence Y. suggested I get in touch with you regarding a conference we're organizing. (Specifically, it was mentioned that you're active on Mathematica.SE - hence this message!) If you'd like to get in touch, please check my profile for email. Thanks!
 
 
2 hours later…
8:13 PM
@J.M.iscomputer-less @Alucard If I had the time I think it'd be fun to revisit some cohort analysis of StackExchange posters I did a while back to look at what the use cases look like now
 
 
3 hours later…
11:00 PM
Greetings from the Wolfram Technology Conference!
user image
9
 

« first day (2465 days earlier)      last day (2009 days later) »