English 中文(简体)
我如何安排树种,以便与克隆人一道工作?
原标题:How do I format a tree so that it works with Clojure s zipper?

我正在为基因规划问题制造press树,需要在发展过程中改变树木的部分。 我来过。 Clojure zipper功能似乎好像,但对于我来说,我可以说明如何使用。

例如,我要说的是,我创造了一名助手。

(def zipped (zip/seq-zip `(+ (- 1 2) 3)))

我的理解是,这代表一个根植的树木,一个看起来如此:

   +
 -   3
1 2

然而,我的施舍者不同意这一点: 如果我请第一个名字到<代码>(-> zipped zip/down zip/node>>,则请让我<代码>+(正确)但<代码>(-> zipped zip/down zip/down)t_code-,改为<回归代码>。 事实上,(-> zipped zip/down zip/rights)将树中的其余部分作为兄弟姐妹赋予了根基的权利,这给我说,我根本没有树木:

user> (-> zipped zip/down zip/rights)
((clojure.core/- 1 2) 3)

我确信,我是代表我的树木正确无误的,因为在我执行时,我得到了正确的回答。 动工是否期望有不同的布局?

最佳回答

问题是,这里有两种不同的树木观念。 你们的树木是一个图表,说明如何通过评价使价值观相互融合,但LISP正在考虑清单,并利用预先固定的标记:

(+ (- 1 2) 3) is also (list + (list - 1 2) 3), which is actual that:

+  .     3
   - 1 2

(-> zipped down node) gives you the first element, +, an atom. (-> zipped down down) thus gives you nil because the first element, +, is an atom. (-> zipped down right down node) gives you the minus sign you want because that s the first element of the second element of the expression.

问题回答

树木是你如何用透射的。 根 no有3名儿童:+,(- 1 2)3。 页: 1 因此,见<条码+

查阅<代码>-

user=> (-> zipped zip/down zip/right zip/down zip/node)
clojure.core/-




相关问题
Alpha Beta Searching and Transposition Tables

I have alpha beta search working and want to implement transposition tables to make it faster. The problem I m having is the relationship between the entries in the table and the current position ...

Objects that represent trees [closed]

Are there any objects in C# (or in .net) that represents a binary tree (or for curiosity) and n-ary tree? I am not talking about presentation tree controls, but as model objects. If not, are there ...

Data structure to sync a file-tree

I m in the process of a writing an application, which needs to synchronize a file-structure between a client and a (http) server. The file-structure is essentially a list of file-paths where each ...

draw dependency graph for a java class

Heyho, I m searching for a tool like JDepend to draw a graph for a java classfile. JDepend seams to be fine, but it s not resolving the deps from the deps (maybe I m just missing some special options?)...

Nested join on same table (tree structure)

My date is organized in tree structure. The following applies (Oracle SQL syntax): CREATE TABLE TREE ( NAME VARCHAR2(20), ID NUMBER(10, 0), PARENT NUMBER(10, 0) ) ; INSERT INTO "TREE" (NAME, ...

sql query tree like structure

I have a tree like structure of Categories, the leaf Nodes in the tree have Products and the products have Cods I need to select all the top level Categories (parent=null) that have leafs (Cods) that ...

xsl loop to split a fragment tree every n times

This is a sample of my XML, it can possibly have thousands of rows of items in a range of categories. <store> <products type="computer"> <item desc="text" amount="99"></c&...

Family Tree in Silverlight

Hello Currently I am working on a project in which I have to create family tree. It will have almostn number of hierarchy. Whole tree should be displayed to user as well as zoom in zoom out facility ...

热门标签