Sliding window over seq
In Clojure, what would be the nicest way to have a sliding window over a (finite, not too large) seq? Should I just use drop and take and keep track of the current index or is there a nicer way I'm missing? ...
In Clojure, what would be the nicest way to have a sliding window over a (finite, not too large) seq? Should I just use drop and take and keep track of the current index or is there a nicer way I'm missing? ...
I was trying to use Seq.first today, and the compiler says it has been deprecated in favor of Seq.tryPick. It says that that it applies a function and returns the first result that returns Some. I guess I can just say fun x -> x!=0 since I know the first one will return Some in my case, but what is the proper constraint to put here? What...
Using Seq.cast seems to constantly fail, even for something as simple as the following: let xor c = Seq.cast c |> Seq.reduce (^^^) xor [1;3] // Works, assuming because no cast is necessary xor ['a';'b'] // Fails xor [2u] // Fails The latter two fail with Specified Cast is not valid. What am I missing? I'm trying to use...
Bash allows me to write the statement, $ for i in {h..k} ; do echo $i ; done but zsh only allows number list expansion such as {8..13}. What's the best workaround? Something like seq for characters... ...