[pure-lang-svn] SF.net SVN: pure-lang:[490] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-08-14 07:57:53
|
Revision: 490 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=490&view=rev Author: agraef Date: 2008-08-14 07:58:03 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Removed obsolete fun and arg functions. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/lib/primitives.pure pure/trunk/runtime.cc pure/trunk/runtime.h Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-14 07:30:45 UTC (rev 489) +++ pure/trunk/ChangeLog 2008-08-14 07:58:03 UTC (rev 490) @@ -1,3 +1,10 @@ +2008-08-14 Albert Graef <Dr....@t-...> + + * lib/primitives.pure, runtime.cc/h: Removed obsolete fun and arg + functions, as 'arg' conflicted with math.pure. Also, applp is now + implemented directly in Pure, and the corresponding runtime + routine has been removed as well. + 2008-08-13 Albert Graef <Dr....@t-...> * interpreter.cc (declare_extern, named_type, type_name): Add Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-08-14 07:30:45 UTC (rev 489) +++ pure/trunk/lib/primitives.pure 2008-08-14 07:58:03 UTC (rev 490) @@ -45,9 +45,11 @@ /* Predicates to check for function objects, global (unbound) variables, function applications, proper lists, list nodes and tuples. */ -extern bool funp(expr*), bool lambdap(expr*), bool varp(expr*), - bool applp(expr*); +extern bool funp(expr*), bool lambdap(expr*), bool varp(expr*); +applp (_ _) = 1; +applp _ = 0 otherwise; + listp [] = 1; listp (x:xs) = listp xs; listp _ = 0 otherwise; @@ -60,10 +62,6 @@ tuplep (x,xs) = 1; tuplep _ = 0 otherwise; -/* Operations to return the function and the argument in an application. */ - -extern expr* fun(expr*), expr* arg(expr*); - /* Compute a 32 bit hash code of a Pure expression. */ extern int hash(expr*); Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-14 07:30:45 UTC (rev 489) +++ pure/trunk/runtime.cc 2008-08-14 07:58:03 UTC (rev 490) @@ -2391,30 +2391,6 @@ } extern "C" -bool applp(const pure_expr *x) -{ - return (x->tag == EXPR::APP); -} - -extern "C" -pure_expr *fun(const pure_expr *x) -{ - if (x->tag == EXPR::APP) - return x->data.x[0]; - else - return 0; -} - -extern "C" -pure_expr *arg(const pure_expr *x) -{ - if (x->tag == EXPR::APP) - return x->data.x[1]; - else - return 0; -} - -extern "C" int32_t pointer_get_byte(void *ptr) { uint8_t *p = (uint8_t*)ptr; Modified: pure/trunk/runtime.h =================================================================== --- pure/trunk/runtime.h 2008-08-14 07:30:45 UTC (rev 489) +++ pure/trunk/runtime.h 2008-08-14 07:58:03 UTC (rev 490) @@ -531,16 +531,6 @@ bool lambdap(const pure_expr *x); bool varp(const pure_expr *x); -/* Check whether an object is a function application, and return the function - and the argument of an application. Note that these operations can't be - defined in Pure because of the "head is function" rule which means that in - a pattern of the form f x, f is always a literal function symbol and not a - variable. */ - -bool applp(const pure_expr *x); -pure_expr *fun(const pure_expr *x); -pure_expr *arg(const pure_expr *x); - /* Direct memory accesses. */ int32_t pointer_get_byte(void *ptr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |