[honu] add != operator. provide some other basic functions

This commit is contained in:
Jon Rafkind 2012-01-18 12:33:41 -07:00
parent 9d11622968
commit 1b81ed5d8d
4 changed files with 16 additions and 2 deletions

View File

@ -20,6 +20,7 @@
[honu-function function]
[honu-var var]
[honu-equal =]
[honu-not-equal !=]
[honu--> %arrow]
[honu-class class]
[honu-require require]

View File

@ -248,6 +248,9 @@
(define-unary-operator honu-not 0.7 'left not)
(define-binary-operator honu-equal 1 'left equal?)
(define-binary-operator honu-not-equal 1 'left (lambda (left right)
(not (equal? left right))))
(begin-for-syntax
(define (fix-module-name name)

View File

@ -36,7 +36,7 @@
(define-lex-abbrev string-character (:or (:: #\\ any-char)
(:~ #\")))
(define-lex-abbrev string (:: #\" (:* string-character) #\"))
(define-lex-abbrev operator (:or "+" "=" "==" "*" "/" "-" "^" "||" "|" "&&" "<="
(define-lex-abbrev operator (:or "+" "!=" "=" "==" "*" "/" "-" "^" "||" "|" "&&" "<="
">=" "<-" "<" ">" "!" "::" ":=" "%"))
(define-lex-abbrev block-comment (:: "/*"
(complement (:: any-string "*/" any-string))
@ -68,6 +68,7 @@
#;
[block-comment (token-whitespace)]
["/*" (token-block-comment)]
["..." (token-identifier '...)]
["." (token-identifier '%dot)]
["," (token-identifier '%comma)]
[":" (token-identifier '%colon)]

View File

@ -1,6 +1,6 @@
#lang honu/private
(require (prefix-in racket: (combine-in racket/base racket/list)))
(require (prefix-in racket: (combine-in racket/base racket/list racket/file)))
;; require's and provide's a module
(define-syntax-rule (provide-module module ...)
@ -17,6 +17,9 @@
;;"private/function.honu"
)
(define (int x)
(inexact->exact (round x)))
(racket:provide sqr sqrt sin max
number? symbol?
null
@ -28,11 +31,17 @@
cos sin
random
filter
append
values
int
regexp
(racket:rename-out [honu-cond cond]
[null empty]
[current-inexact-milliseconds currentMilliseconds]
[string-length string_length]
[string-append string_append]
[racket:find-files find_files]
[racket:empty? empty?]
[regexp-match regexp_match]
[racket:first first]
[racket:rest rest]))