objecthub / swift-lispkit

Interpreter framework for Lisp-based extension and scripting languages on macOS and iOS. LispKit is based on the R7RS standard for Scheme. Its compiler generates bytecode for a virtual machine. LispKit is fully implemented in Swift 5.
https://lisppad.app
Apache License 2.0
392 stars 16 forks source link

How to use `(import (srfi sicp))` in Apple App Store for MacOS LispPad.app Version 1.6.0 (1226) #13

Closed jonBoone closed 3 years ago

jonBoone commented 3 years ago

What is the best way to be able to use the (srfi sicp) support in the MacOS LispPad.app Version 1.6.0 (1226)?

Has a new version with that support been submitted to the MacOS App Store yet?

Thanks in advance!

FYI, I'm hoping to use this on both Intel and Apple Silicon (M1) MacBooks.

objecthub commented 3 years ago

Not yet! Only the iOS version of LispPad supports SRFI 216 via (srfi 216). I will submit a new version for macOS in the coming week. If you want to use this library in the meantime already, you can do the following:

  1. Download 216.sld into the directory in which you store the source code of a Scheme application (let's assume it's program.scm)
  2. At the top of program.scm, insert the following instructions:
    (load "<absolute path to 216.sld>") ; make (srfi 216) known to LispKit
    (import (srfi 216)) ; import (srfi 216)

I am aware that SRFI 216 requires the library to be called (srfi sicp). Will be fixed when this is submitted to the AppStore.

There's also currently two "load" related bugs: one in LispPad (when the "Play" button in the editor is clicked), requiring that (load (path (source-directory) "216.sld")) needs to be replace by (load "<absolute path to 216.sld>") and one in LispKit where load does not return a result. Both will be fixed with the next submission to the AppStore.

jonBoone commented 3 years ago

Thank you so much for this quick response.

I suppose the signing of the app precludes replacing the LispKit libraries embedded in the LispPad app?

Assuming so, I’ll follow your suggestion about loading it from another source directory.

objecthub commented 3 years ago

It looks like Apple reviews AppStore submissions even on the weekend. So, you don't need the workaround and you can just download LispPad 1.6.1 from the AppStore. A simple (import (srfi sicp)) should do the trick.