代码之家  ›  专栏  ›  技术社区  ›  bbarker

创建UCM成绩单时,如何查看计算项目?

  •  0
  • bbarker  · 技术社区  · 4 年前

    鉴于以下成绩单:

    ```ucm:hide
    .> pull https://github.com/unisonweb/base:v3:.releases._latest .base
    ```
    
    ```unison
    foo = List.map (x -> x * 2) [1,2,3]
    ```
    
    
    ```ucm
    .> add foo
    .> view foo
    ```
    

    执行此操作时,我得到以下输出:

    ```unison
    foo = List.map (x -> x * 2) [1,2,3]
    ```
    
    ```ucm
    
      I found and typechecked these definitions in scratch.u. If you
      do an `add` or `update`, here's how your codebase would
      change:
      
        ⍟ These new definitions are ok to `add`:
        
          foo : [Nat]
    
    ```
    ```ucm
    .> add foo
    
      ⍟ I've added these definitions:
      
        foo : [Nat]
    
    .> view foo
    
      foo : [Nat]
      foo =
        use Nat *
        List.map (x -> x * 2) [1, 2, 3]
    
    ```
    

    我理解为什么会这样,但是否有其他方法可以显示 foo (即。 [2, 4, 6 ]),就好像我们在 scratch.u 文件

    我还尝试了:

    ```ucm
    .> foo
    
    ```
    

    但是得到错误 I don't know how to foo. .

    1 回复  |  直到 4 年前
        1
  •  1
  •   pchiusano    4 年前

    是的,试试看 display foo . :)

    这个名字有点奇怪。我们一直在考虑重命名 view source ,然后可能离开 display (或将其重命名为 eval 并允许任意表达式,如REPL)。

    推荐文章