Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I store Java Methods in a List in Clojure

Tags:

clojure

I want to keep a list of normalizing functions for a text. How do I store .toLowercase? I was thinking of something like this:

(def normalizing-functions (list remove-punctuations .toLowerCase))
like image 307
unj2 Avatar asked Jan 31 '26 10:01

unj2


1 Answers

It looks like your making a list of functions to apply to something on a regular basis. the java method is not quite a clojure function in this sense though its really easy to wrap it up just like you would if you where going to feed it to the map function.

#(. tolowercase %)
like image 137
Arthur Ulfeldt Avatar answered Feb 03 '26 03:02

Arthur Ulfeldt