Skip to content

Commit

Permalink
Another rosetta sync
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinborner committed May 9, 2024
1 parent a25ed8a commit 99ec17a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion samples/rosetta/harmonic_series.bruijn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

harmonic [0 &[[(Q.add 1 op) : N.++0]] start [[1]]] ⧗ Unary → Rational
op (+1) : N.--0
start (+0.0f) : (+1)
start (+0.0q) : (+1)

custom-gt? &[[[N.gt? 2 (N.mul 0 N.++1)]]] ⧗ Rational → Νumber → Boolean

Expand Down
10 changes: 10 additions & 0 deletions samples/rosetta/towers_of_hanoi.bruijn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:import std/Combinator .
:import std/Number .
:import std/String .

hanoi y [[[[=?2 empty go]]]]
go [(4 --3 2 0) ++ str ++ (4 --3 0 1)] ((+6) - 1 - 0)
str "Move " ++ disk ++ " from " ++ source ++ " to " ++ destination ++ "\n"
disk number→string 3
source number→string 2
destination number→string 1

0 comments on commit 99ec17a

Please sign in to comment.