Skip to content

Instantly share code, notes, and snippets.

View jplaza's full-sized avatar

Juan Antonio Plaza jplaza

View GitHub Profile
@jplaza
jplaza / toolbox.clj
Created May 18, 2018 20:37
Extrae la clave de acceso de un RIDE PDF
(ns co.datil.toolbox.pdf
(:require [pdfboxing.text :as pdfbox]
[clojure.java.io :as io]
[clojure.string :as string]))
(defn -remove-trailing-slash
[url]
(string/replace #"(?<=.)/$" ""))
(defn -rand-name
const data = [
{ category: "Fruits", price: "$1", stocked: true, name: "Apple" },
{ category: "Fruits", price: "$1", stocked: true, name: "Dragonfruit" },
{ category: "Fruits", price: "$2", stocked: false, name: "Passionfruit" },
{ category: "Vegetables", price: "$2", stocked: true, name: "Spinach" },
{ category: "Vegetables", price: "$4", stocked: false, name: "Pumpkin" },
{ category: "Vegetables", price: "$1", stocked: true, name: "Peas" }
]
@jplaza
jplaza / data.clj
Created October 21, 2023 02:52
Aggregate data in the form of a list of hash maps in Clojure. Inspired by SQL GROUP BY and aggregate functions like SUM and MAX
(defn aggregate-data
"data - collection of hash-maps to aggregate
group-key - vector of keys to group hash-maps
aggregates - vector of vectors of key, aggregate fn and optionally a new
name for this key e.g.
[[+ :amount :stock]
[max :date :latest-tx-date]]
Aggregate functions receive variable arguments"
[data group-keys aggregates]

Se dice que la programación funcional es declarativa, permite expresar la solución a un problema en términos del qué en lugar del cómo. A lo largo de este módulo de Front-end Programming con React utilizaremos preferentemente este estilo de programación.

Estos ejercicios tiene el objetivo de ayudarlos a familiarce un poco más con las funciones para arreglos de JS que ya aprendieron.

Aquí la documentación a las funciones y una característica del lenguaje que necesitarán para resolver los siguientes ejercicios