diff options
| author | Tom Harley | 2020-01-11 02:53:36 +0000 |
|---|---|---|
| committer | Tom Harley | 2020-01-11 02:53:36 +0000 |
| commit | 1a3dc02a18a9050877288a5867e44d9c47a53542 (patch) | |
| tree | 9e0ace97436d177ab81f79372156e3f8d6a0a451 /examples/nq/nqueens.sin | |
| parent | Add option to enable/disable boxing (diff) | |
| download | sinter-1a3dc02a18a9050877288a5867e44d9c47a53542.tar.gz sinter-1a3dc02a18a9050877288a5867e44d9c47a53542.zip | |
Added int width specifiers
The width of an int can be specified at the site of its creation. For example, the following function returns an int of width 2 bits and value 1:
[def two_bit_int [] (2 1)]
Ints can still be written the old way; in these cases the compiler looks for a default int bit-width (specified with the -w flag). If a default has not been defined, the compiler throws an error.
Diffstat (limited to 'examples/nq/nqueens.sin')
| -rw-r--r-- | examples/nq/nqueens.sin | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/nq/nqueens.sin b/examples/nq/nqueens.sin index 6839dc0..35777fd 100644 --- a/examples/nq/nqueens.sin +++ b/examples/nq/nqueens.sin @@ -23,6 +23,11 @@ [dec !> [c a]] [dec closure [f a]] +[dec count_solns [n]] + +[dec + [x y]] +[dec - [x y]] + [def safe [x d qs] [if [is_nil qs] 1 @@ -78,6 +83,3 @@ [!>>= [gen [- n 1] nq] [!> [closure gen_1 2] nq]] [cons [nil] [nil]]]] - -[def count_solns [n] - [length [gen n n]]] |
