Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do you view computed items when creating UCM transcripts?

Given the following transcript:

```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
```

When this is executed, I get the following output:

```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]

```

I understand why it is this way but is there an alternative approach that would show the computed value of foo (i.e. [2, 4, 6]), as if we’re working in a scratch.u file?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I also tried:

```ucm
.> foo

```

But get the error I don't know how to foo..

>Solution :

Yes, try display foo. 🙂

The naming is a bit weird. We keep thinking of renaming view to source, and then maybe leave display (or rename it to eval and allow arbitrary expressions, like a REPL).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading