<commit_before>(ns flambo.destructuring
  "Contains wrapper-functions to destructure scala/spark data structures"
  (:require [flambo.api :as f])
  (:import [scala Tuple2 Tuple3]
           [com.google.common.base Optional]))

(defn cogroup-2-fn [f]
  (fn [^Tuple2 t]
    (let [k (._1 t)
          v ^Tuple2 (._2 t)]
      (f k (seq (._1 v)) (seq (._2 v))))))

(defn cogroup-3-fn [f]
  (fn [^Tuple2 t]
    (let [k (._1 t)
          v ^Tuple3 (._2 t)]
      (f k (seq (._1 v)) (seq (._2 v)) (seq (._3 v))))))

(defn tuple-fn [f]
  (fn [^Tuple2 t]
    (f (._1 t) (._2 t))))

(defn tuple-value-fn [f]
  (fn [^Tuple2 t]
    (let [k (._1 t)
          v ^Tuple2 (._2 t)]
      (f k (._1 v) (._2 v)))))

(defn second-value [^Tuple2 t]
  (._2 t)<commit_msg>added another destructuring function<commit_after>(ns flambo.destructuring
  "Contains wrapper-functions to destructure scala/spark data structures"
  (:require [flambo.api :as f])
  (:import [scala Tuple2 Tuple3]
           [com.google.common.base Optional]))

(defn cogroup-2-fn [f]
  (fn [^Tuple2 t]
    (let [k (._1 t)
          v ^Tuple2 (._2 t)]
      (f k (seq (._1 v)) (seq (._2 v))))))

(defn cogroup-3-fn [f]
  (fn [^Tuple2 t]
    (let [k (._1 t)
          v ^Tuple3 (._2 t)]
      (f k (seq (._1 v)) (seq (._2 v)) (seq (._3 v))))))

(defn tuple-fn [f]
  (fn [^Tuple2 t]
    (f (._1 t) (._2 t))))

(defn tuple-seq-fn [f]
  (fn [^Tuple2 t]
    (f (seq (._1 t)) (seq (._2 t)))))

(defn tuple-value-fn [f]
  (fn [^Tuple2 t]
    (let [k (._1 t)
          v ^Tuple2 (._2 t)]
      (f k (._1 v) (._2 v)))))

(defn second-value [^Tuple2 t]
  (._2 t)
{'fraction_non_alphanumeric': 0.20924422236102436, 'fraction_numerical': 0.03685196752029981, 'mean_word_length': 2.2962962962962963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '913725', 'n_tokens_mistral': 715, 'n_tokens_neox': 688, 'n_words': 221}