sema-docs 1.20.2

Canonical structured documentation for Sema builtins/special forms; powers LSP hover/completion and REPL apropos
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
name: "string->float"
module: "strings"
section: "Type Conversions"
aliases: ["string/to-float"]
params: [{ name: x, type: "string | number" }]
returns: "float"
---

Parse a string as a float. Integers and floats are accepted directly and returned as a float. Raises an error when a string cannot be parsed.

```sema
(string->float "3.14")   ; => 3.14
(string->float "42")     ; => 42.0
(string->float 7)        ; => 7.0
```