Files
ikarus/lab/objc-create-class.ss
T
Abdulaziz Ghuloum 1e5e516b08 - added (ikarus foreign) library that should be used instead of
(ikarus system $foreign).
- changed the names of some of the pointer primitives
- changed the name of the procedure make-ffi to make-callout
- updated examples and libraries to conform with new names
- updated the users guide to provide a complete description of 
  the (ikarus foreign) library
- updated list of missing R6RS features in the users guide
2008-10-06 01:19:27 -04:00

27 lines
629 B
Scheme
Executable File

#!/usr/bin/env ikarus --r6rs-script
(import (ikarus) (objc))
(define-framework Cocoa)
(define-class NSObject)
(define IKFact
(create-class "IKFact" NSObject '() #f))
(class-add-class-method IKFact 'fact: 'int '(class selector int)
(trace-lambda fact (self sel n)
(if (zero? n)
1
(* n [$ self fact: (sub1 n)]))))
(class-add-class-method IKFact 'fact:ac: 'int '(class selector int int)
(trace-lambda fact (self sel n ac)
(if (zero? n)
ac
[$ self fact: (sub1 n) ac: (* n ac)])))
(printf "(fact 5) = ~s\n" [$ IKFact fact: 5])
(printf "(fact 5) = ~s\n" [$ IKFact fact: 5 ac: 1])