系列算法(Algorithm for series)
A,B,C,.... Z,AA,AB,......。AZ,BA,BB,.... ,ZZ,AAA,...,编写一个取整数n并返回字符串表示的函数。 有人能告诉我算法找到系列中的第n个值吗?
A, B, C,…. Z, AA, AB, ….AZ, BA,BB,…. , ZZ,AAA, …., write a function that takes a integer n and returns the string presentation. Can somebody tell me the algorithm to find the nth value in the series?
原文:https://stackoverflow.com/questions/2390804
最满意答案
Clojure承诺不会失败,因为它们不依赖于特定的执行线程。 快速了解Clojure期货和承诺如何不同?
听取未来或承诺是否有办法在clojure未来结束时得到通知? 如果您不介意创建另一个线程,则会显示一个可选的选项。
其他选择是使用一些Java库,如Guava ListenableFuture,或者查看新的和花哨的core.async
Clojure promises cannot fail as they are not tied to a particular execution thread. Have a quick look at How do Clojure futures and promises differ?
For listen to either a future or a promise Is there a way to be notified when a clojure future finishes? shows a posible option if you don't mind creating another thread.
Other options is to use some Java library like Guava ListenableFuture or look at the new and fancy core.async
相关问答
更多-
什么是Clojure波动?(What is Clojure volatile?)[2023-11-30]
新的易失性与真正的“变量”(就像它来自许多其他编程语言一样),因为它可以用于clojure。 从公告 : 有一组新功能( volatile! , vswap! , vreset! , volatile? )创建并使用易失性“盒子”来保持有状态换能器的状态。 挥发物比原子快,但放弃原子性保证,所以只能用于线程隔离。 例如,你可以像设置C中的变量一样设置/获取和更新它们。唯一的附加(也就是名称)是实际Java对象的volatile关键字。 这是为了防止JVM进行优化,并确保它在每次访问时都读取内存位置。 从JI ... -
Rich Hickey(他是Clojure的设计师)评论说,这是wiki上的第一个参考链接: 你是否选择了从“关闭”一词开始的名字,并用“j”代替“s”? 这似乎很有可能,但是这样做会很好。 这个名字被选为独一无二的。 我想要涉及c(c#),l(lisp)和j(java)。 一旦我想出了Clojure,给予关闭的双关语,可用的域名和谷歌空间的空虚,这是一个容易的决定。 http://groups.google.com/group/clojure/msg/766b75baa7987850 Rich Hicke ...
-
这是一个工作示例项目: project.clj: (defproject parse "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies ...
-
clojure无顺序让(clojure unsequential let)[2021-07-31]
我认为binding宏是并行的而不是顺序的。 请参阅: http : //clojuredocs.org/clojure_core/clojure.core/binding I believe binding macro is parallel not sequential. See: http://clojuredocs.org/clojure_core/clojure.core/binding -
不幸的是,你已经在表达式中使用了符号对象(apply (first a) (rest a)) 。 符号对象查找自身的值作为映射中的键: ('/ {'+ :plus '/ :slash '- :minus} :not-found) => :slash ('/ {'+ :plus '$ :dollar '- :minus} :not-found) => :not-found ('/ 1 :not-found) => :not-found ('/ 1 2) => 2 Unfortunately, you ...
-
Clojure中的默认整数类型很long 。 如果你想指定一个整数文字应该被认为是一个clojure.lang.BigInt只需在该数字后面加一个N 。 (defn fib-pair [[a b]] [b (+ a b)]) (nth (map first (iterate fib-pair [1N 1N])) 500) ;= 2255915161619363308725126950360720720460113249137581905886388664184746277386868834050159870 ...
-
如果实现或失败,如何听取Clojure的承诺?(How to listen to a Clojure promise when it is was realized or failed?)[2023-10-02]
Clojure承诺不会失败,因为它们不依赖于特定的执行线程。 快速了解Clojure期货和承诺如何不同? 听取未来或承诺是否有办法在clojure未来结束时得到通知? 如果您不介意创建另一个线程,则会显示一个可选的选项。 其他选择是使用一些Java库,如Guava ListenableFuture,或者查看新的和花哨的core.async Clojure promises cannot fail as they are not tied to a particular execution thread. H ... -
如果你注释掉(deref ~q) ,那么用q传递的代码永远不会被评估,所以嵌套的期货不会存在。 宏扩展: (macroexpand '(-> (future (wait 200 (println "'Ello, gov'na!"))) (enqueue saying (wait 400 "Pip pip!") (println @saying)) (enqueue saying (wait 100 "Cheerio!") (printl ...
-
Travis CI问题跟踪器[ 1 ]和clojurians Slack进行了讨论。 原因是OpenJDK 9没有附带签署Clojars证书的证书。 Christian Stein提到Travis CI将始终提供未修补的JDK安装。 如有必要,用户需要对系统CA证书进行符号链接( 原始单词 )。 解 这是更新的最小Travis CI配置。 它涉及在before_install阶段手动对系统CA证书进行符号链接。 language: clojure lein: 2.8.1 jdk: - openjdk8 ...
-
什么时候懒惰序列的不同元素在clojure中实现?(When are the different elements of a lazy sequence realized in clojure?)[2021-11-23]
Clojure的序列是懒惰的,但为了提高效率,一次实现了32个结果的块。 =>(def lz-seq (map #(do (println (str "fn call " %)) (identity %)) (range 100))) =>(first lz-seq) fn call 0 fn call 1 ... fn call 31 0 一旦你首先越过32边界,就会发生同样的事情 =>(nth lz-seq 33) fn call 0 fn call 1 ... fn call 63 33 对于需 ...