about summary refs log tree commit diff stats
path: root/078table.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-08 01:30:14 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-03-08 01:46:47 -0800
commit1ead356219bb2eb59487d1012f837bd07ec336f5 (patch)
treeaf15f390b81e4d6b3e0940c5756a0d7fd1060bb5 /078table.mu
parent27ba0937a3747684f299bb7a8b3cdd0fbb689db3 (diff)
downloadmu-1ead356219bb2eb59487d1012f837bd07ec336f5.tar.gz
2735 - define recipes using 'def'
I'm dropping all mention of 'recipe' terminology from the Readme. That
way I hope to avoid further bike-shedding discussions while I very
slowly decide on the right terminology with my students.

I could be smarter in my error messages and use 'recipe' when code uses
it and 'function' otherwise. But what about other words like ingredient?
It would all add complexity that I'm not yet sure is worthwhile. But I
do want separate experiences for veteran programmers reading about Mu on
github and for people learning programming using Mu.
Diffstat (limited to '078table.mu')
-rw-r--r--078table.mu10
1 files changed, 5 insertions, 5 deletions
diff --git a/078table.mu b/078table.mu
index 4ab30d4a..56b7c9fd 100644
--- a/078table.mu
+++ b/078table.mu
@@ -36,7 +36,7 @@ container table_row:_key:_value [
   value:_value
 ]
 
-recipe new-table capacity:number -> result:address:shared:table:_key:_value [
+def new-table capacity:number -> result:address:shared:table:_key:_value [
   local-scope
   load-ingredients
   result <- new {(table _key _value): type}
@@ -46,7 +46,7 @@ recipe new-table capacity:number -> result:address:shared:table:_key:_value [
   *data <- new {(table_row _key _value): type}, capacity
 ]
 
-recipe put table:address:shared:table:_key:_value, key:_key, value:_value -> table:address:shared:table:_key:_value [
+def put table:address:shared:table:_key:_value, key:_key, value:_value -> table:address:shared:table:_key:_value [
   local-scope
   load-ingredients
   hash:number <- hash key
@@ -62,15 +62,15 @@ recipe put table:address:shared:table:_key:_value, key:_key, value:_value -> tab
   *x <- merge 1/true, key, value
 ]
 
-recipe abs n:number -> result:number [
+def abs n:number -> result:number [
   local-scope
   load-ingredients
   positive?:boolean <- greater-or-equal n, 0
-  reply-if positive?, n
+  return-if positive?, n
   result <- multiply n, -1
 ]
 
-recipe index table:address:shared:table:_key:_value, key:_key -> result:_value [
+def index table:address:shared:table:_key:_value, key:_key -> result:_value [
   local-scope
   load-ingredients
   hash:number <- hash key