Questions tagged [transducer]
83 questions
1
vote
1 answer
Apertium + Python: POS-tagger not providing surface form
I'm trying to POS-tag some sentences in Italian with Apertium's tagger.
While according to the Apertium GitHub page I am supposed to get as output also the surface form in addition to the morphological analysis, I only get the analysis. I want also…

Elanor
- 13
- 3
1
vote
1 answer
ramda transducers with final R.sum
I'm trying to understand Ramda's transducers. Here's a slightly modified example from the docs:
const numbers = [1, 2, 3, 4];
const isOdd = (x) => x % 2 === 1;
const firstFiveOddTransducer = R.compose(R.filter(isOdd),…

Eugene Barsky
- 5,780
- 3
- 17
- 40
1
vote
1 answer
[a,b].reduce(f,x) code to [a,b].reduce(f) using transducer /CPS based functional references?
In my previous Quesion:
Extracting data from a function chain without arrays
@Aadit M Shah gave me astonishing solution as follows:
https://stackoverflow.com/a/51420884/6440264
Given an expression like A(a)(b)(f) where f is a function, it's…
user6440264
1
vote
1 answer
Troubleshooting a stateful transducer
I'm trying to create a stateful transducer, join-averages (gist here).
Running the let block shows me that I'm correctly joining values. But the result output still doesn't have the joined value.
...
c' {:tick-list {:uuid 1, :last-trade-price 11.1},…

Nutritioustim
- 2,686
- 4
- 32
- 57
1
vote
3 answers
function composition with rest operator, reducer and mapper
I'm following an article about Transducers in JavaScript, and in particular I have defined the following functions
const reducer = (acc, val) => acc.concat([val]);
const reduceWith = (reducer, seed, iterable) => {
let accumulation = seed;
for…
user6996876
1
vote
1 answer
Parsing either font style or block of paragraph in GATE
I have a word document. I need to match particular table section or heading section of it using GATE. I thought if there were any steps from where we can first check any font size or font style of the heading and then match rest of the content till…

Sumit Ramteke
- 1,487
- 1
- 16
- 39
1
vote
2 answers
Creating refs with transducers
Is it possible to create a ref with a transducer in Clojure, in a way analogous to creating a chan with a transducer?
i.e., when you create a chan with a transducer, it filters/maps all the inputs into the outputs.
I'd expect there's also a way to…

lobsterism
- 3,469
- 2
- 22
- 36
0
votes
2 answers
transduce - adds numbers
I have a calculation someting like the following:
;; for sake of simplicity we use round numbers
(def data [{:a 1} {:a 10} {:a 100}])
(reduce - 0.0 (map :a data))
And it evaluates to -111.0. I want to do the transformation with a transducer to…

erdos
- 3,135
- 2
- 16
- 27
0
votes
2 answers
Ramda.js transducers: average the resulting array of numbers
I'm currently learning about transducers with Ramda.js. (So fun, yay! )
I found this question that describes how to first filter an array and then sum up the values in it using a transducer.
I want to do something similar, but different. I have an…

J. Hesters
- 13,117
- 31
- 133
- 249
0
votes
2 answers
How to utilize memory/performance when processing a big file in Clojure
How to utilize memory/performance when processing a large data set of time series data ?
Size : ~3.2G
Lines : ~54 million
First few line of dataset
{:ts 20200601040025269 :bid 107.526000 :ask 107.529000}
{:ts 20200601040025370 :bid 107.525000 :ask…

madeinQuant
- 1,721
- 1
- 18
- 29
0
votes
1 answer
Aggregating transducers with intermediate values
I am still trying to understand better how to work with transducers in clojure. Here, I am interested in applying aggregating transducers, such as the ones in https://github.com/cgrand/xforms, but reporting at each step the intermediate values of…

GermanK
- 1,676
- 2
- 14
- 21
0
votes
1 answer
Composing transducers; Order of composition and order of execution
There is a paragraph here stating:
Composition of the transformer runs right-to-left but builds a
transformation stack that runs left-to-right (filtering happens before
mapping in this example).
I don't get it. What does this mean: Composition of…

Curcuma_
- 851
- 2
- 12
- 37
0
votes
2 answers
Why do I get an error when I use transduce?
I am still new to functional programming and have been trying to learn how to use transducers. I thought I had a good use case but every time I attempt to write a transducer with Ramda for it, I get the following error:
reduce: list must be array…

webstermath
- 555
- 1
- 5
- 14
0
votes
0 answers
How can I find the parameters needed to steer an ultrasonic beam?
To be honest, I don't know if this question is more appropriate for Stack Overflow, Software Engineering, or Physics, so apologies in advance if I guessed wrong.
I'm trying to build a 3D ultrasound machine out of commercially available parts (just…

HiddenWindshield
- 246
- 1
- 8
0
votes
1 answer
Converting Reducer To Tranducer With Ramda
The following function reduceIfEven uses a predicate to check the value the reducer function receives for every step. If the predicate returns true, the value is added to the result (acc), otherwise the result is returned from the reducer untouched.…

Undistraction
- 42,754
- 56
- 195
- 331