Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple improvements to function calls #156

Open
justinethier opened this issue Feb 4, 2014 · 4 comments
Open

Simple improvements to function calls #156

justinethier opened this issue Feb 4, 2014 · 4 comments
Labels

Comments

@justinethier
Copy link
Owner

A few simple improvements can be made:

  • If an invalid form (probably not a symbol or list) is found in the function position, an error should be thrown at compile time
  • If an atom is found in the function position, it should be possible to inline it and avoid creating a wrapper function at runtime.

This is closely related to the other ticket on streamlining generated code since targeting function compilation is the best way to improve the compiler at this point.

@justinethier
Copy link
Owner Author

Another thought - would explicit type signatures improve compile times?

@justinethier
Copy link
Owner Author

Added explicit type signatures for a modest speed improvement.

compileAllArgs func' needs to be updated to inline the function portion, if it is an Atom. In addition, this function should be able to be modified to append literal args directly to args, instead of creating unnecessary wrapper functions.

justinethier added a commit that referenced this issue Feb 12, 2014
Attempting to pass literal arguments directly instead of through a wrapper function. As it is, the implementation is flawed (remove the TODO's) as the following program is broken:

    (load "skim-unit.scm")
    (assert/equal `(list ,(+ 1 2) 4)
          '(list 3 4))
@justinethier
Copy link
Owner Author

Test case for previous commit:

(list `(list ,(+ 1 2) 4)
  '(list 3 4)) 

> Expected 2 args; found values list

@justinethier
Copy link
Owner Author

Previous issues are fixed up, but now there is another problem:

(define (assv obj alist)
    (foldl (mem-helper (curry eqv? obj) car) #f alist))   
(assv 'b '((a 1)))

foldl should receive args of #f ((a 1)) but gets mem-helper instead of #f.

Should compare generated hs code in both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant