• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. *Error* *INTERNAL*: helper function missing for - syntax...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 142
  • Views 1316
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

*Error* *INTERNAL*: helper function missing for - syntax:or

archive
archive over 17 years ago

I'm trying to work my way through this famous paper about Functional Programming. Naturally, I'm trying to use my favorite language, SKILL!

Unfortunately, I've run into something curious when I try to run this code in SKILL++ mode:

; Here's a function to sum a list. (define (sum list) (if (null list) 0 (plus (car list) (sum (cdr list))))) ; Note the "0" and "plus" are the only parts unique to (sum). ; We can modularise sum by glueing together a general recursive pattern: (define (reduce f x list) (if (null list) x (f (car list) (reduce f x (cdr list))))) ; Now we can redefine sum: (define (sum list) (reduce plus 0 list)) ; We can also reap benefits by re-using reduce to write other functions: (define (product list) (reduce times 1 list)) (define (anytrue list) (reduce or nil list))

All this code works fine, until I get to anytrue():

(anytrue '(nil nil t)) *Error* *INTERNAL*: helper function missing for - syntax:or

Yet this works if I re-write reduce() to use funcall():

(define (reduce f x list) (if (null list) x (funcall f (car list) (reduce f x (cdr list))))) (anytrue '(nil nil t)) t (anytrue '(nil nil nil)) nil

What's going on here?


Originally posted in cdnusers.org by tweeks
  • Cancel
  • archive
    archive over 17 years ago

    Looks like a fairly obscure bug in the SKILL Virtual Machine. I filed CCR 569072 to get this fixed. Whilst syntax forms (e.g. or, and) are a little different (they don't evaluate their arguments before calling - they selectively evaluate depending on the value of each argument in turn), I don't see any reason why this should fail in this case.

    I suspect it may be something to do with the fact that the compiler cannot correctly produce the VM code that it normally would for a call to "or" because it can't see that the (f) call is actually a syntax form. But I'll leave it to R&D to check that.

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 17 years ago

    I was right. It seems that handling of syntax forms needs something special, which hasn't been implemented for or/and. In practice these are the only two syntax forms which are likely to be used in this scenario, so the plan is to add the missing "helper functions" in the next release.

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 17 years ago

    Thanks Andrew! (BTW, is there any way for me to view that CCR? I only seem to be able to see my own...)

    I wonder if my continued voyages into the wonders of Functional Programming will reveal any other as-yet unexplored corners of the SKILL language?

    Speaking of Functional Programming, it's too bad SKILL++ doesn't have tail recursion--that would really make it a lot more Scheme-like. I don't suppose there are any plans to add that in.

    --tom


    Originally posted in cdnusers.org by tweeks
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 17 years ago

    You'd need to contact customer support and ask for a duplicate CCR to be filed - that way you can see the status from sourcelink.

    Tail recursion optimisation is requested, but not committed. You need to watch out when using recursion as an alternative to loops in SKILL because the stack for the call frame is not that large... (and because there's no tail call optimisation, you can't reduce it that way).

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information