7

Is the function of the clojure card desirable?

 3 years ago
source link: https://www.codesd.com/item/is-the-function-of-the-clojure-card-desirable.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Is the function of the clojure card desirable?

advertisements

According to Mark's awesome tutorial page, "The map function applies a given function that takes one parameter to each item in a collection, returning a lazy sequence of the results".

Yet when I do the following:

(def input-message-list (range 100 126))

(defn test-123 [in]
  (println "doing " in)
  (str "out " in))

(def output-test (map
                   test-123
                   input-message-list))

(first output-test)

, in the REPL I get the println side effects for the full range, not just the first element!

What is going on here people?


Already answered in here:

as really 32 elements are evaluated at a time

Your range has less than 32 elements.

Related Articles

Make my implementation of the Clojure card function faster

I've been experimenting with Clojure lately. I tried writing my own map function (two actually) and timed them against the built in function. However, my map functions are way way slower than the built in one. I wanted to know how I could make my imp

Extract entries from the Clojure card with a pattern in a list of cards?

I have a map like this (with 1 or more items mixed together): {:item_name_1 "Great Deal" :item_options_2 "blah: 2" :item_name_2 "Awesome Deal" :item_options_1 "foo: 3" :item_quantity_1 "1" :item_price_2 &q

Why trim () does not work in the Clojure card?

user=> (.trim " kkk ") "kkk" user=> (map .trim ["jjj " " llll" " o "] ) CompilerException java.lang.RuntimeException: Unable to resolve symbol: .trim in this context, compiling:(NO_SOURCE_PATH:1:1) A

compare the Clojure cards with large and integer values

In my REPL : (== 1 1M) ;;=>true (= {:a 1 :b 2} {:a 1 :b 2}) ;;=>true (= {:a 1 :b 2} {:a 1 :b 3}) ;;=>false (= {:a 1M :b 2M} {:a 1 :b 2}) ;;=>false How can I compare these maps so that the result of the last example would return true ?You want

Get the Clojure card from the POST application

Here is my code: (ns cowl.server (:use compojure.core) (:require [ring.adapter.jetty :as jetty] [ring.middleware.params :as params] [ring.middleware.json :refer [wrap-json-response]] [ring.util.response :refer [response]] [clojure.data.json :as json]

Long-lasting function in the Clojure atom

I have a function that will load lots of users (which takes a while) and store them in an atom. I am wondering if there is any difference between loading the users into a let binding and then resetting the atom or just loading them in the atom reset!

Why do the clojure libraries try to use unique names for common function names

Why do clojure libraries reuse commonly occurring function names forcing you to namespace qualify them? For instance clojure.zip uses next, replace and remove which already exist in clojure core and "replace" already exists in clojure.string. No

How do I run this selection to_char ('01 -jan-2016 ', day dd ddspth month yyyy) of double; why does the to_date function not output to our desire format?

Why this query not run on oracle select to_date('01-jan-2016',day dd ddspth month yyyy) from dual;? Why date function not give output to our desire format? Why to_char function not run in at runtime? Why it run only in in any attribute like sysdate o

The evaluation of the Clojure function

I was searching for a Clojure logarithm function and concluded there really isn't one for v1.3+. What took me so long to invoke Math/log was this: user=> Math/log CompilerException java.lang.RuntimeException: Unable to find static field: log in class

Cleaning the Clojure function

Coming from imperative programming languages, I am trying to wrap my head around Clojure in hopes of using it for its multi-threading capability. One of the problems from 4Clojure is to write a function that generates a list of Fibonacci numbers of l

Are the cyclic dependencies of the clojure function specifically prohibited by design, or is it simply a drive behavior?

If I do the following in clojure (defn sub1a [a] (cond (= a 0) 0 true (sub1b (- a 1) ))) (defn sub1b [a] (cond (= a 0) 0 true (sub1a (- a 1) ))) (println (sub1a 10)) I get the following error: java.lang.Exception: Unable to resolve symbol: sub1b in t

Is there a smart way to validate the function entry in Clojure?

I'm writing a simple DiceRoller application and I've created the primary function, however I'm wondering if there is a "smart" way to validate function inputs in Clojure rather than using branching conditionals to validate input? My function is

What function does the Clojure protocol derive from?

What feature of what language does Clojure Protocols derive from? Note: this is not a question about "How to Use Protocols" This is a question about what inspired the idea. In particular, what I want is to get something like: XYZ + ABC inspired

What are the Clojure Globals?

Which globals are always present in Clojure code? The Leiningen docs hint at there being a list of them along with their meaningful values. But I have not been able to find it.A start is just listing the global variables, something dysfun on #clojure

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK