├── .gitattributes
├── .gitignore
├── Assets
├── bar-chart-params.png
├── lispkit-repl-ios.png
├── lispkit_logo_small.png
├── sample-graph.png
└── thread-states.png
├── CHANGELOG.md
├── File.txt
├── LICENSE
├── LispKit.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── swiftpm
│ │ └── Package.resolved
└── xcshareddata
│ └── xcschemes
│ ├── LispKit iOS.xcscheme
│ ├── LispKit.xcscheme
│ ├── LispKitRepl iOS.xcscheme
│ ├── LispKitRepl.xcscheme
│ └── LispKitTools.xcscheme
├── Makefile
├── Package.resolved
├── Package.swift
├── README.md
├── Sources
├── LispKit iOS
│ ├── Info.plist
│ └── LispKit_iOS.h
├── LispKit
│ ├── Base
│ │ ├── Bitset.swift
│ │ ├── Boxes.swift
│ │ ├── Compression.swift
│ │ ├── Data.swift
│ │ ├── Global.swift
│ │ ├── Locks.swift
│ │ ├── ManagedObject.swift
│ │ ├── ManagedObjectPool.swift
│ │ ├── MethodProfiler.swift
│ │ ├── MultiMap.swift
│ │ ├── OAuth2DeviceGrantLK.swift
│ │ ├── ObjectPool.swift
│ │ ├── Owners.swift
│ │ ├── Reference.swift
│ │ ├── ScanBuffer.swift
│ │ ├── String.swift
│ │ ├── StringBuilder.swift
│ │ ├── Sysctl.swift
│ │ ├── Timer.swift
│ │ └── TrackedObject.swift
│ ├── Compiler
│ │ ├── BindingGroup.swift
│ │ ├── CaptureGroup.swift
│ │ ├── Checkpointer.swift
│ │ ├── Compiler.swift
│ │ ├── Env.swift
│ │ ├── EvalError.swift
│ │ ├── LexicalError.swift
│ │ ├── Parser.swift
│ │ ├── RuntimeError.swift
│ │ ├── Scanner.swift
│ │ ├── SourcePosition.swift
│ │ └── SyntaxError.swift
│ ├── Data
│ │ ├── Cell.swift
│ │ ├── CharSet.swift
│ │ ├── Collection.swift
│ │ ├── CustomExpr.swift
│ │ ├── Environment.swift
│ │ ├── Equality.swift
│ │ ├── Expr.swift
│ │ ├── Exprs.swift
│ │ ├── Hash.swift
│ │ ├── HashTable.swift
│ │ ├── NativeObject.swift
│ │ ├── Port.swift
│ │ ├── Procedure.swift
│ │ ├── Promise.swift
│ │ ├── Serialization.swift
│ │ ├── SpecialForm.swift
│ │ ├── Symbol.swift
│ │ ├── Tuple.swift
│ │ └── Type.swift
│ ├── Graphics
│ │ ├── Barcode.swift
│ │ ├── Color.swift
│ │ ├── Drawing.swift
│ │ ├── DrawingDocument.swift
│ │ ├── Drawing_iOS.swift
│ │ ├── Shape.swift
│ │ ├── Transformation.swift
│ │ └── Transformation_iOS.swift
│ ├── IO
│ │ ├── BinaryInput.swift
│ │ ├── BinaryInputSource.swift
│ │ ├── BinaryOutput.swift
│ │ ├── TextInput.swift
│ │ ├── TextInputSource.swift
│ │ ├── TextOutput.swift
│ │ └── TextOutputTarget.swift
│ ├── Info.plist
│ ├── LispKit.h
│ ├── Primitives
│ │ ├── BaseLibrary.swift
│ │ ├── BitsetLibrary.swift
│ │ ├── BoxLibrary.swift
│ │ ├── BytevectorLibrary.swift
│ │ ├── CharLibrary.swift
│ │ ├── CharSetLibrary.swift
│ │ ├── ControlFlowLibrary.swift
│ │ ├── CoreLibrary.swift
│ │ ├── CryptoLibrary.swift
│ │ ├── DateTimeLibrary.swift
│ │ ├── DebugLibrary.swift
│ │ ├── DrawBarcodeLibrary.swift
│ │ ├── DrawingLibrary.swift
│ │ ├── DrawingLibrary_iOS.swift
│ │ ├── DynamicControlLibrary.swift
│ │ ├── EnumLibrary.swift
│ │ ├── FormatLibrary.swift
│ │ ├── GrowableVectorLibrary.swift
│ │ ├── HTTPLibrary.swift
│ │ ├── HTTPOAuthLibrary.swift
│ │ ├── HTTPServerLibrary.swift
│ │ ├── HashTableLibrary.swift
│ │ ├── ImageLibrary.swift
│ │ ├── InternalLibrary.swift
│ │ ├── JSONLibrary.swift
│ │ ├── JSONSchemaLibrary.swift
│ │ ├── KeychainLibrary.swift
│ │ ├── LibraryRegistry.swift
│ │ ├── ListLibrary.swift
│ │ ├── MarkdownLibrary.swift
│ │ ├── MathLibrary.swift
│ │ ├── PDFLibrary.swift
│ │ ├── PasteboardLibrary.swift
│ │ ├── PasteboardLibrary_iOS.swift
│ │ ├── PortLibrary.swift
│ │ ├── RecordLibrary.swift
│ │ ├── RegexpLibrary.swift
│ │ ├── SQLiteLibrary.swift
│ │ ├── SerializeLibrary.swift
│ │ ├── SharedQueueLibrary.swift
│ │ ├── StringLibrary.swift
│ │ ├── StyledTextLibrary.swift
│ │ ├── SystemCallLibrary.swift
│ │ ├── SystemLibrary.swift
│ │ ├── TarArchiveLibrary.swift
│ │ ├── ThreadFutureLibrary.swift
│ │ ├── ThreadLibrary.swift
│ │ ├── TypeLibrary.swift
│ │ ├── URLLibrary.swift
│ │ ├── VectorLibrary.swift
│ │ ├── VisionLibrary.swift
│ │ └── ZipArchiveLibrary.swift
│ ├── Resources
│ │ ├── Assets
│ │ │ ├── ColorLists
│ │ │ │ └── HtmlColors.plist
│ │ │ ├── Datasets
│ │ │ │ └── Covid
│ │ │ │ │ ├── 2020-01-22.data
│ │ │ │ │ ├── 2020-01-23.data
│ │ │ │ │ ├── 2020-01-24.data
│ │ │ │ │ ├── 2020-01-25.data
│ │ │ │ │ ├── 2020-01-26.data
│ │ │ │ │ ├── 2020-01-27.data
│ │ │ │ │ ├── 2020-01-28.data
│ │ │ │ │ ├── 2020-01-29.data
│ │ │ │ │ ├── 2020-01-30.data
│ │ │ │ │ ├── 2020-01-31.data
│ │ │ │ │ ├── 2020-02-01.data
│ │ │ │ │ ├── 2020-02-02.data
│ │ │ │ │ ├── 2020-02-03.data
│ │ │ │ │ ├── 2020-02-04.data
│ │ │ │ │ ├── 2020-02-05.data
│ │ │ │ │ ├── 2020-02-06.data
│ │ │ │ │ ├── 2020-02-07.data
│ │ │ │ │ ├── 2020-02-08.data
│ │ │ │ │ ├── 2020-02-09.data
│ │ │ │ │ ├── 2020-02-10.data
│ │ │ │ │ ├── 2020-02-11.data
│ │ │ │ │ ├── 2020-02-12.data
│ │ │ │ │ ├── 2020-02-13.data
│ │ │ │ │ ├── 2020-02-14.data
│ │ │ │ │ ├── 2020-02-15.data
│ │ │ │ │ ├── 2020-02-16.data
│ │ │ │ │ ├── 2020-02-17.data
│ │ │ │ │ ├── 2020-02-18.data
│ │ │ │ │ ├── 2020-02-19.data
│ │ │ │ │ ├── 2020-02-20.data
│ │ │ │ │ ├── 2020-02-21.data
│ │ │ │ │ ├── 2020-02-22.data
│ │ │ │ │ ├── 2020-02-23.data
│ │ │ │ │ ├── 2020-02-24.data
│ │ │ │ │ ├── 2020-02-25.data
│ │ │ │ │ ├── 2020-02-26.data
│ │ │ │ │ ├── 2020-02-27.data
│ │ │ │ │ ├── 2020-02-28.data
│ │ │ │ │ ├── 2020-02-29.data
│ │ │ │ │ ├── 2020-03-01.data
│ │ │ │ │ ├── 2020-03-02.data
│ │ │ │ │ ├── 2020-03-03.data
│ │ │ │ │ ├── 2020-03-04.data
│ │ │ │ │ ├── 2020-03-05.data
│ │ │ │ │ ├── 2020-03-06.data
│ │ │ │ │ ├── 2020-03-07.data
│ │ │ │ │ ├── 2020-03-08.data
│ │ │ │ │ ├── 2020-03-09.data
│ │ │ │ │ ├── 2020-03-10.data
│ │ │ │ │ ├── 2020-03-11.data
│ │ │ │ │ ├── 2020-03-12.data
│ │ │ │ │ ├── 2020-03-13.data
│ │ │ │ │ ├── 2020-03-14.data
│ │ │ │ │ ├── 2020-03-15.data
│ │ │ │ │ ├── 2020-03-16.data
│ │ │ │ │ ├── 2020-03-17.data
│ │ │ │ │ ├── 2020-03-18.data
│ │ │ │ │ ├── 2020-03-19.data
│ │ │ │ │ ├── 2020-03-20.data
│ │ │ │ │ ├── 2020-03-21.data
│ │ │ │ │ ├── 2020-03-22.data
│ │ │ │ │ ├── 2020-03-23.data
│ │ │ │ │ ├── 2020-03-24.data
│ │ │ │ │ ├── 2020-03-25.data
│ │ │ │ │ ├── 2020-03-26.data
│ │ │ │ │ ├── 2020-03-27.data
│ │ │ │ │ ├── 2020-03-28.data
│ │ │ │ │ ├── 2020-03-29.data
│ │ │ │ │ ├── 2020-03-30.data
│ │ │ │ │ ├── 2020-03-31.data
│ │ │ │ │ ├── 2020-04-01.data
│ │ │ │ │ ├── 2020-04-02.data
│ │ │ │ │ ├── 2020-04-03.data
│ │ │ │ │ ├── 2020-04-04.data
│ │ │ │ │ ├── 2020-04-05.data
│ │ │ │ │ ├── 2020-04-06.data
│ │ │ │ │ ├── 2020-04-07.data
│ │ │ │ │ ├── 2020-04-08.data
│ │ │ │ │ ├── 2020-04-09.data
│ │ │ │ │ ├── 2020-04-10.data
│ │ │ │ │ ├── 2020-04-11.data
│ │ │ │ │ ├── 2020-04-12.data
│ │ │ │ │ ├── 2020-04-13.data
│ │ │ │ │ ├── 2020-04-14.data
│ │ │ │ │ ├── 2020-04-15.data
│ │ │ │ │ ├── 2020-04-16.data
│ │ │ │ │ ├── 2020-04-17.data
│ │ │ │ │ ├── 2020-04-18.data
│ │ │ │ │ ├── 2020-04-19.data
│ │ │ │ │ ├── 2020-04-20.data
│ │ │ │ │ ├── 2020-04-21.data
│ │ │ │ │ ├── 2020-04-22.data
│ │ │ │ │ ├── 2020-04-23.data
│ │ │ │ │ ├── 2020-04-24.data
│ │ │ │ │ ├── 2020-04-25.data
│ │ │ │ │ ├── 2020-04-26.data
│ │ │ │ │ ├── 2020-04-27.data
│ │ │ │ │ ├── 2020-04-28.data
│ │ │ │ │ ├── 2020-04-29.data
│ │ │ │ │ ├── 2020-04-30.data
│ │ │ │ │ ├── 2020-05-01.data
│ │ │ │ │ ├── 2020-05-02.data
│ │ │ │ │ ├── 2020-05-03.data
│ │ │ │ │ ├── 2020-05-04.data
│ │ │ │ │ ├── 2020-05-05.data
│ │ │ │ │ ├── 2020-05-06.data
│ │ │ │ │ ├── 2020-05-07.data
│ │ │ │ │ ├── 2020-05-08.data
│ │ │ │ │ ├── 2020-05-09.data
│ │ │ │ │ ├── 2020-05-10.data
│ │ │ │ │ ├── 2020-05-11.data
│ │ │ │ │ ├── 2020-05-12.data
│ │ │ │ │ ├── 2020-05-13.data
│ │ │ │ │ ├── 2020-05-14.data
│ │ │ │ │ ├── 2020-05-15.data
│ │ │ │ │ ├── 2020-05-16.data
│ │ │ │ │ ├── 2020-05-17.data
│ │ │ │ │ ├── 2020-05-18.data
│ │ │ │ │ ├── 2020-05-19.data
│ │ │ │ │ ├── 2020-05-20.data
│ │ │ │ │ ├── 2020-05-21.data
│ │ │ │ │ ├── 2020-05-22.data
│ │ │ │ │ ├── 2020-05-23.data
│ │ │ │ │ ├── 2020-05-24.data
│ │ │ │ │ ├── 2020-05-25.data
│ │ │ │ │ ├── 2020-05-26.data
│ │ │ │ │ ├── 2020-05-27.data
│ │ │ │ │ ├── 2020-05-28.data
│ │ │ │ │ ├── 2020-05-29.data
│ │ │ │ │ ├── 2020-05-30.data
│ │ │ │ │ ├── 2020-05-31.data
│ │ │ │ │ ├── 2020-06-01.data
│ │ │ │ │ ├── 2020-06-02.data
│ │ │ │ │ ├── 2020-06-03.data
│ │ │ │ │ ├── 2020-06-04.data
│ │ │ │ │ ├── 2020-06-05.data
│ │ │ │ │ ├── 2020-06-06.data
│ │ │ │ │ ├── 2020-06-07.data
│ │ │ │ │ ├── 2020-06-08.data
│ │ │ │ │ ├── 2020-06-09.data
│ │ │ │ │ ├── 2020-06-10.data
│ │ │ │ │ ├── 2020-06-11.data
│ │ │ │ │ ├── 2020-06-12.data
│ │ │ │ │ ├── 2020-06-13.data
│ │ │ │ │ ├── 2020-06-14.data
│ │ │ │ │ ├── 2020-06-15.data
│ │ │ │ │ ├── 2020-06-16.data
│ │ │ │ │ ├── 2020-06-17.data
│ │ │ │ │ ├── 2020-06-18.data
│ │ │ │ │ ├── 2020-06-19.data
│ │ │ │ │ ├── 2020-06-20.data
│ │ │ │ │ ├── 2020-06-21.data
│ │ │ │ │ ├── 2020-06-22.data
│ │ │ │ │ ├── 2020-06-23.data
│ │ │ │ │ ├── 2020-06-24.data
│ │ │ │ │ ├── 2020-06-25.data
│ │ │ │ │ ├── 2020-06-26.data
│ │ │ │ │ ├── 2020-06-27.data
│ │ │ │ │ ├── 2020-06-28.data
│ │ │ │ │ ├── 2020-06-29.data
│ │ │ │ │ ├── 2020-06-30.data
│ │ │ │ │ └── Covid.sqlite3
│ │ │ ├── Images
│ │ │ │ ├── Billboard.jpg
│ │ │ │ ├── Diagram.pdf
│ │ │ │ ├── Inga.jpg
│ │ │ │ ├── LispkitLogo.png
│ │ │ │ └── Page.jpg
│ │ │ └── JSON
│ │ │ │ ├── Schema
│ │ │ │ ├── 2020-12
│ │ │ │ │ ├── meta
│ │ │ │ │ │ ├── applicator
│ │ │ │ │ │ ├── content
│ │ │ │ │ │ ├── core
│ │ │ │ │ │ ├── format-annotation
│ │ │ │ │ │ ├── meta-data
│ │ │ │ │ │ ├── unevaluated
│ │ │ │ │ │ └── validation
│ │ │ │ │ └── schema
│ │ │ │ └── Custom
│ │ │ │ │ └── person
│ │ │ │ └── Tests
│ │ │ │ └── 2020-12
│ │ │ │ ├── LICENSE
│ │ │ │ ├── additionalProperties.json
│ │ │ │ ├── allOf.json
│ │ │ │ ├── anchor.json
│ │ │ │ ├── anyOf.json
│ │ │ │ ├── boolean_schema.json
│ │ │ │ ├── const.json
│ │ │ │ ├── contains.json
│ │ │ │ ├── content.json
│ │ │ │ ├── debug.json
│ │ │ │ ├── default.json
│ │ │ │ ├── defs.json
│ │ │ │ ├── dependentRequired.json
│ │ │ │ ├── dependentSchemas.json
│ │ │ │ ├── dynamicRef.json
│ │ │ │ ├── enum.json
│ │ │ │ ├── exclusiveMaximum.json
│ │ │ │ ├── exclusiveMinimum.json
│ │ │ │ ├── format.json
│ │ │ │ ├── id.json
│ │ │ │ ├── if-then-else.json
│ │ │ │ ├── infinite-loop-detection.json
│ │ │ │ ├── items.json
│ │ │ │ ├── maxContains.json
│ │ │ │ ├── maxItems.json
│ │ │ │ ├── maxLength.json
│ │ │ │ ├── maxProperties.json
│ │ │ │ ├── maximum.json
│ │ │ │ ├── minContains.json
│ │ │ │ ├── minItems.json
│ │ │ │ ├── minLength.json
│ │ │ │ ├── minProperties.json
│ │ │ │ ├── minimum.json
│ │ │ │ ├── multipleOf.json
│ │ │ │ ├── not.json
│ │ │ │ ├── oneOf.json
│ │ │ │ ├── pattern.json
│ │ │ │ ├── patternProperties.json
│ │ │ │ ├── prefixItems.json
│ │ │ │ ├── properties.json
│ │ │ │ ├── propertyNames.json
│ │ │ │ ├── ref.json
│ │ │ │ ├── required.json
│ │ │ │ ├── type.json
│ │ │ │ ├── unevaluatedItems.json
│ │ │ │ ├── unevaluatedProperties.json
│ │ │ │ └── uniqueItems.json
│ │ ├── Examples
│ │ │ ├── AvlTrees.scm
│ │ │ ├── Blockchain.scm
│ │ │ ├── Channels.scm
│ │ │ ├── Compiler.scm
│ │ │ ├── Coroutines.scm
│ │ │ ├── Covid.scm
│ │ │ ├── DrawBarCharts.scm
│ │ │ ├── DrawTrees.scm
│ │ │ ├── EUStats.scm
│ │ │ ├── EditDistance.scm
│ │ │ ├── HTTP.scm
│ │ │ ├── ImageComposition.scm
│ │ │ ├── JSON.scm
│ │ │ ├── Keychain.scm
│ │ │ ├── Math.scm
│ │ │ ├── Maze.scm
│ │ │ ├── OCR.scm
│ │ │ ├── ObjectOrientation.scm
│ │ │ ├── PDF.scm
│ │ │ ├── Pi.scm
│ │ │ ├── Plot.scm
│ │ │ ├── Polynomials.scm
│ │ │ ├── Prolog.scm
│ │ │ ├── Queens.scm
│ │ │ ├── Schelog.scm
│ │ │ ├── Simplifier.scm
│ │ │ ├── SpellNumbers.scm
│ │ │ ├── Streams.scm
│ │ │ ├── StyledTextDoc.scm
│ │ │ ├── Sudoku.scm
│ │ │ ├── Topological.scm
│ │ │ ├── Turtle.scm
│ │ │ ├── VisualizePointSets.scm
│ │ │ ├── WebAPIs.scm
│ │ │ ├── Webserver.scm
│ │ │ └── paip
│ │ │ │ ├── patmatch.sld
│ │ │ │ ├── simplifier.sld
│ │ │ │ └── util.sld
│ │ ├── Libraries
│ │ │ ├── lispkit
│ │ │ │ ├── clos.sld
│ │ │ │ ├── clos
│ │ │ │ │ └── support.sld
│ │ │ │ ├── combinator.sld
│ │ │ │ ├── comparator.sld
│ │ │ │ ├── csv.sld
│ │ │ │ ├── datatype.sld
│ │ │ │ ├── disjoint-set.sld
│ │ │ │ ├── draw
│ │ │ │ │ ├── chart
│ │ │ │ │ │ └── bar.sld
│ │ │ │ │ └── turtle.sld
│ │ │ │ ├── enum
│ │ │ │ │ └── r6rs.sld
│ │ │ │ ├── graph.sld
│ │ │ │ ├── heap.sld
│ │ │ │ ├── image
│ │ │ │ │ └── process.sld
│ │ │ │ ├── iterate.sld
│ │ │ │ ├── json
│ │ │ │ │ └── deprecated.sld
│ │ │ │ ├── list
│ │ │ │ │ └── set.sld
│ │ │ │ ├── log.sld
│ │ │ │ ├── log
│ │ │ │ │ └── internal.sld
│ │ │ │ ├── logic.sld
│ │ │ │ ├── match.sld
│ │ │ │ ├── math
│ │ │ │ │ ├── matrix.sld
│ │ │ │ │ ├── stats.sld
│ │ │ │ │ └── util.sld
│ │ │ │ ├── object.sld
│ │ │ │ ├── pdf
│ │ │ │ │ └── legacy.sld
│ │ │ │ ├── prettify.sld
│ │ │ │ ├── prolog.sld
│ │ │ │ ├── queue.sld
│ │ │ │ ├── set.sld
│ │ │ │ ├── stack.sld
│ │ │ │ ├── stream.sld
│ │ │ │ ├── sxml.sld
│ │ │ │ ├── sxml
│ │ │ │ │ ├── html.sld
│ │ │ │ │ └── xml.sld
│ │ │ │ ├── test.sld
│ │ │ │ ├── text-table.sld
│ │ │ │ ├── thread
│ │ │ │ │ └── channel.sld
│ │ │ │ └── wt-tree.sld
│ │ │ ├── scheme
│ │ │ │ ├── base.sld
│ │ │ │ ├── bitwise.sld
│ │ │ │ ├── box.sld
│ │ │ │ ├── case-lambda.sld
│ │ │ │ ├── char.sld
│ │ │ │ ├── charset.sld
│ │ │ │ ├── comparator.sld
│ │ │ │ ├── complex.sld
│ │ │ │ ├── cxr.sld
│ │ │ │ ├── division.sld
│ │ │ │ ├── eval.sld
│ │ │ │ ├── file.sld
│ │ │ │ ├── fixnum.sld
│ │ │ │ ├── flonum.sld
│ │ │ │ ├── generator.sld
│ │ │ │ ├── hash-table.sld
│ │ │ │ ├── ideque.sld
│ │ │ │ ├── inexact.sld
│ │ │ │ ├── lazy.sld
│ │ │ │ ├── list.sld
│ │ │ │ ├── load.sld
│ │ │ │ ├── mapping.sld
│ │ │ │ ├── process-context.sld
│ │ │ │ ├── r5rs-syntax.sld
│ │ │ │ ├── r5rs.sld
│ │ │ │ ├── read.sld
│ │ │ │ ├── red.sld
│ │ │ │ ├── repl.sld
│ │ │ │ ├── rlist.sld
│ │ │ │ ├── set.sld
│ │ │ │ ├── sort.sld
│ │ │ │ ├── stream.sld
│ │ │ │ ├── text.sld
│ │ │ │ ├── time.sld
│ │ │ │ ├── vector.sld
│ │ │ │ └── write.sld
│ │ │ ├── srfi
│ │ │ │ ├── 14
│ │ │ │ │ └── ascii.sld
│ │ │ │ ├── 41
│ │ │ │ │ ├── derived.sld
│ │ │ │ │ └── primitive.sld
│ │ │ │ ├── 69
│ │ │ │ │ └── internal.sld
│ │ │ │ ├── 135
│ │ │ │ │ └── kernel0.sld
│ │ │ │ ├── 146
│ │ │ │ │ └── rbtree.sld
│ │ │ │ ├── 166
│ │ │ │ │ ├── base.sld
│ │ │ │ │ ├── color.sld
│ │ │ │ │ ├── columnar.sld
│ │ │ │ │ ├── pretty.sld
│ │ │ │ │ └── unicode.sld
│ │ │ │ ├── 167
│ │ │ │ │ ├── engine.sld
│ │ │ │ │ ├── memory.sld
│ │ │ │ │ └── pack.sld
│ │ │ │ ├── 1.sld
│ │ │ │ ├── 101.sld
│ │ │ │ ├── 102.sld
│ │ │ │ ├── 11.sld
│ │ │ │ ├── 111.sld
│ │ │ │ ├── 112.sld
│ │ │ │ ├── 113.sld
│ │ │ │ ├── 118.sld
│ │ │ │ ├── 121.sld
│ │ │ │ ├── 125.sld
│ │ │ │ ├── 128.sld
│ │ │ │ ├── 129.sld
│ │ │ │ ├── 131.sld
│ │ │ │ ├── 132.sld
│ │ │ │ ├── 133.sld
│ │ │ │ ├── 134.sld
│ │ │ │ ├── 135.sld
│ │ │ │ ├── 137.sld
│ │ │ │ ├── 14.sld
│ │ │ │ ├── 141.sld
│ │ │ │ ├── 142.sld
│ │ │ │ ├── 143.sld
│ │ │ │ ├── 144.sld
│ │ │ │ ├── 145.sld
│ │ │ │ ├── 146.sld
│ │ │ │ ├── 149.sld
│ │ │ │ ├── 151.sld
│ │ │ │ ├── 152.sld
│ │ │ │ ├── 154.sld
│ │ │ │ ├── 155.sld
│ │ │ │ ├── 158.sld
│ │ │ │ ├── 16.sld
│ │ │ │ ├── 161.sld
│ │ │ │ ├── 162.sld
│ │ │ │ ├── 165.sld
│ │ │ │ ├── 166.sld
│ │ │ │ ├── 17.sld
│ │ │ │ ├── 173.sld
│ │ │ │ ├── 174.sld
│ │ │ │ ├── 175.sld
│ │ │ │ ├── 177.sld
│ │ │ │ ├── 18.sld
│ │ │ │ ├── 180.sld
│ │ │ │ ├── 189.sld
│ │ │ │ ├── 19.sld
│ │ │ │ ├── 194.sld
│ │ │ │ ├── 195.sld
│ │ │ │ ├── 196.sld
│ │ │ │ ├── 2.sld
│ │ │ │ ├── 204.sld
│ │ │ │ ├── 208.sld
│ │ │ │ ├── 209.sld
│ │ │ │ ├── 210.sld
│ │ │ │ ├── 214.sld
│ │ │ │ ├── 215.sld
│ │ │ │ ├── 216.sld
│ │ │ │ ├── 217.sld
│ │ │ │ ├── 219.sld
│ │ │ │ ├── 221.sld
│ │ │ │ ├── 222.sld
│ │ │ │ ├── 223.sld
│ │ │ │ ├── 224.sld
│ │ │ │ ├── 227.sld
│ │ │ │ ├── 228.sld
│ │ │ │ ├── 229.sld
│ │ │ │ ├── 23.sld
│ │ │ │ ├── 230.sld
│ │ │ │ ├── 232.sld
│ │ │ │ ├── 233.sld
│ │ │ │ ├── 235.sld
│ │ │ │ ├── 236.sld
│ │ │ │ ├── 239.sld
│ │ │ │ ├── 258.sld
│ │ │ │ ├── 26.sld
│ │ │ │ ├── 27.sld
│ │ │ │ ├── 28.sld
│ │ │ │ ├── 31.sld
│ │ │ │ ├── 33.sld
│ │ │ │ ├── 34.sld
│ │ │ │ ├── 35.sld
│ │ │ │ ├── 39.sld
│ │ │ │ ├── 41.sld
│ │ │ │ ├── 46.sld
│ │ │ │ ├── 48.sld
│ │ │ │ ├── 51.sld
│ │ │ │ ├── 54.sld
│ │ │ │ ├── 55.sld
│ │ │ │ ├── 6.sld
│ │ │ │ ├── 63.sld
│ │ │ │ ├── 64.sld
│ │ │ │ ├── 69.sld
│ │ │ │ ├── 8.sld
│ │ │ │ ├── 87.sld
│ │ │ │ ├── 9.sld
│ │ │ │ ├── 95.sld
│ │ │ │ ├── 98.sld
│ │ │ │ └── sicp.sld
│ │ │ └── third-party
│ │ │ │ └── adapton
│ │ │ │ ├── memoization.sld
│ │ │ │ ├── micro.sld
│ │ │ │ ├── mini.sld
│ │ │ │ └── set.sld
│ │ ├── Prelude.scm
│ │ └── Tests
│ │ │ ├── All.scm
│ │ │ ├── Import.scm
│ │ │ ├── LispKit-Channel.scm
│ │ │ ├── LispKit-Control.scm
│ │ │ ├── LispKit-Enum.scm
│ │ │ ├── LispKit-JSON-Schema.scm
│ │ │ ├── LispKit-List-Set.scm
│ │ │ ├── LispKit-Match.scm
│ │ │ ├── LispKit-Record.scm
│ │ │ ├── LispKit-Shared-Queue.scm
│ │ │ ├── LispKit-WT-Tree.scm
│ │ │ ├── R7RS.scm
│ │ │ ├── SRFI-101.scm
│ │ │ ├── SRFI-125.scm
│ │ │ ├── SRFI-128.scm
│ │ │ ├── SRFI-14.scm
│ │ │ ├── SRFI-143.scm
│ │ │ ├── SRFI-144.scm
│ │ │ ├── SRFI-146.scm
│ │ │ ├── SRFI-154.scm
│ │ │ ├── SRFI-155.scm
│ │ │ ├── SRFI-165.scm
│ │ │ ├── SRFI-166.scm
│ │ │ ├── SRFI-167.scm
│ │ │ ├── SRFI-173.scm
│ │ │ ├── SRFI-174.scm
│ │ │ ├── SRFI-175.scm
│ │ │ ├── SRFI-18.scm
│ │ │ ├── SRFI-189.scm
│ │ │ ├── SRFI-194.scm
│ │ │ ├── SRFI-196.scm
│ │ │ ├── SRFI-204.scm
│ │ │ ├── SRFI-209.scm
│ │ │ ├── SRFI-210.scm
│ │ │ ├── SRFI-214.scm
│ │ │ ├── SRFI-217.scm
│ │ │ ├── SRFI-219.scm
│ │ │ ├── SRFI-221.scm
│ │ │ ├── SRFI-222.scm
│ │ │ ├── SRFI-223.scm
│ │ │ ├── SRFI-224.scm
│ │ │ ├── SRFI-227.scm
│ │ │ ├── SRFI-228.scm
│ │ │ ├── SRFI-229.scm
│ │ │ ├── SRFI-232.scm
│ │ │ ├── SRFI-233.scm
│ │ │ ├── SRFI-235.scm
│ │ │ └── SRFI-258.scm
│ └── Runtime
│ │ ├── Code.swift
│ │ ├── Context.swift
│ │ ├── ContextDelegate.swift
│ │ ├── Evaluator.swift
│ │ ├── FeatureRequirement.swift
│ │ ├── Features.swift
│ │ ├── FileHandler.swift
│ │ ├── Formatter.swift
│ │ ├── GarbageCollector.swift
│ │ ├── Heap.swift
│ │ ├── ImportSet.swift
│ │ ├── Instruction.swift
│ │ ├── Library.swift
│ │ ├── LibraryManager.swift
│ │ ├── LispKitContext.swift
│ │ ├── NativeLibrary.swift
│ │ ├── Registers.swift
│ │ ├── SourceManager.swift
│ │ ├── SymbolTable.swift
│ │ ├── SyntaxRules.swift
│ │ ├── Threads
│ │ ├── EvalCondition.swift
│ │ ├── EvalMutex.swift
│ │ ├── EvalThread.swift
│ │ └── ThreadManager.swift
│ │ ├── VirtualMachine.swift
│ │ └── VirtualMachineState.swift
├── LispKitRepl iOS
│ ├── Assets.xcassets
│ │ ├── AccentColor.colorset
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── ConsoleOutput.swift
│ ├── ConsoleView.swift
│ ├── ContentView.swift
│ ├── Info.plist
│ ├── Interpreter.swift
│ ├── LispKitReplApp.swift
│ ├── LispKitReplOAuthConfig.swift
│ ├── PortableURL.swift
│ ├── Preview Content
│ │ └── Preview Assets.xcassets
│ │ │ └── Contents.json
│ └── UIApplication.swift
├── LispKitRepl
│ ├── AppInfo.swift
│ ├── AppInfo.tmpl
│ └── LispKitRepl.swift
└── LispKitTools
│ ├── Info.plist
│ ├── LispKitRepl.swift
│ └── LispKitTools.h
├── TODO.md
├── Tests
└── LispKitTests
│ ├── Code
│ ├── CallCC.scm
│ ├── ControlFlow.scm
│ ├── Datatypes.scm
│ ├── Definitions.scm
│ ├── DelayedEvaluation.scm
│ ├── DynamicWind.scm
│ ├── Environments.scm
│ ├── Format.scm
│ ├── HashTables.scm
│ ├── JSON.scm
│ ├── Libraries.scm
│ ├── LightweightTypes.scm
│ ├── LocalSyntaxRules.scm
│ ├── Logic.scm
│ ├── Markdown.scm
│ ├── Math.scm
│ ├── Parameters.scm
│ ├── Ports.scm
│ ├── Procedures.scm
│ ├── Records.scm
│ ├── SQLite.scm
│ ├── SRFI113.scm
│ ├── SRFI121.scm
│ ├── SRFI132.scm
│ ├── SRFI133.scm
│ ├── SRFI134.scm
│ ├── SRFI135.scm
│ ├── SRFI152.scm
│ ├── SRFI19.scm
│ ├── SRFI35.scm
│ ├── SRFI69.scm
│ ├── SyntaxRules.scm
│ └── Vectors.scm
│ ├── Info.plist
│ ├── LispKitTestCase.swift
│ ├── RegressionTests.swift
│ └── SmallTests.swift
└── _config.yml
/.gitattributes:
--------------------------------------------------------------------------------
1 | Sources/LispKit/Resources/* linguist-vendored
2 | Tests/LispKitTests/Code/* linguist-vendored
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.xccheckout
22 | *.moved-aside
23 | *.xcuserstate
24 | *.xcscmblueprint
25 |
26 | ## Obj-C/Swift specific
27 | *.hmap
28 | *.ipa
29 | *.dSYM.zip
30 | *.dSYM
31 |
32 | ## Playgrounds
33 | timeline.xctimeline
34 | playground.xcworkspace
35 |
36 | # Swift Package Manager
37 | .build/
38 | Packages/
39 |
40 | # CocoaPods
41 | #
42 | # We recommend against adding the Pods directory to your .gitignore. However
43 | # you should judge for yourself, the pros and cons are mentioned at:
44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
45 | #
46 | # Pods/
47 |
48 | # Carthage
49 | Carthage/Checkouts
50 | Carthage/Build
51 |
52 | # macOS
53 | .DS_Store
54 |
55 | # edit
56 | .*.swp
57 |
58 | # ObjectHub defaults
59 | SCRATCH
60 |
--------------------------------------------------------------------------------
/Assets/bar-chart-params.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Assets/bar-chart-params.png
--------------------------------------------------------------------------------
/Assets/lispkit-repl-ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Assets/lispkit-repl-ios.png
--------------------------------------------------------------------------------
/Assets/lispkit_logo_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Assets/lispkit_logo_small.png
--------------------------------------------------------------------------------
/Assets/sample-graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Assets/sample-graph.png
--------------------------------------------------------------------------------
/Assets/thread-states.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Assets/thread-states.png
--------------------------------------------------------------------------------
/File.txt:
--------------------------------------------------------------------------------
1 | static let burnInAnnotationsOption: PDFDocumentWriteOption
2 | static let optimizeImagesForScreenOption: PDFDocumentWriteOption
3 | static let saveImagesAsJPEGOption: PDFDocumentWriteOption
4 | static let saveTextFromOCROption: PDFDocumentWriteOption
5 |
--------------------------------------------------------------------------------
/LispKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LispKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: clean run debug release clean
2 |
3 | all: run
4 |
5 | run: debug
6 | ifeq ($(program),)
7 | .build/debug/LispKitRepl -x -r Sources/LispKit/Resources -d LispKit
8 | else
9 | .build/debug/LispKitRepl -x -r Sources/LispKit/Resources -d LispKit $(program)
10 | endif
11 |
12 | debug: replinfo
13 | swift build
14 |
15 | repl: release
16 | ifeq ($(program),)
17 | .build/release/LispKitRepl -x -r Sources/LispKit/Resources -d LispKit
18 | else
19 | .build/release/LispKitRepl -x -r Sources/LispKit/Resources -d LispKit $(program)
20 | endif
21 |
22 | release: replinfo
23 | swift build -c release
24 |
25 | replinfo:
26 | sed "s/CURRENT-DATE/$(shell date +%s)/" Sources/LispKitRepl/AppInfo.tmpl > Sources/LispKitRepl/AppInfo.swift
27 |
28 | test:
29 | swift test
30 |
31 | update:
32 | carthage update --platform macOS
33 |
34 | clean:
35 | rm -rf .build
36 |
--------------------------------------------------------------------------------
/Sources/LispKit iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en_US
7 | CFBundleDisplayName
8 | LispKit
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSHumanReadableCopyright
24 | Copyright © 2016–2025 Matthias Zenger. All rights reserved.
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Sources/LispKit iOS/LispKit_iOS.h:
--------------------------------------------------------------------------------
1 | //
2 | // LispKit_iOS.h
3 | // LispKit iOS
4 | //
5 | // Created by Matthias Zenger on 23/02/2021.
6 | // Copyright © 2021 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 |
23 | //! Project version number for LispKit_iOS.
24 | FOUNDATION_EXPORT double LispKit_iOSVersionNumber;
25 |
26 | //! Project version string for LispKit_iOS.
27 | FOUNDATION_EXPORT const unsigned char LispKit_iOSVersionString[];
28 |
29 | // In this header, you should import all the public headers of your framework using statements like #import
30 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/Boxes.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Boxes.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 03/02/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// Generic box for value and reference types.
23 | ///
24 | public final class ImmutableBox: Reference {
25 | public let value: T
26 |
27 | public init(_ value: T) {
28 | self.value = value
29 | }
30 | }
31 |
32 | ///
33 | /// Generic mutable box for value and reference types.
34 | ///
35 | public final class MutableBox: Reference {
36 | public var value: T
37 |
38 | public init(_ value: T) {
39 | self.value = value
40 | }
41 | }
42 |
43 | ///
44 | /// Generic weak, mutable box for reference types.
45 | ///
46 | public final class WeakBox: Reference {
47 | public weak var value: T?
48 |
49 | public init(_ value: T?) {
50 | self.value = value
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/Data.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Data.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 18/02/2023.
6 | // Copyright © 2023 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 |
23 | extension Data {
24 |
25 | func hexEncodedString(upperCase: Bool = false) -> String {
26 | let utf8Digits = Array((upperCase ? "0123456789ABCDEF" : "0123456789abcdef").utf8)
27 | return String(unsafeUninitializedCapacity: 2 * self.count) { (ptr) -> Int in
28 | var p = ptr.baseAddress!
29 | for byte in self {
30 | p[0] = utf8Digits[Int(byte / 16)]
31 | p[1] = utf8Digits[Int(byte % 16)]
32 | p += 2
33 | }
34 | return 2 * self.count
35 | }
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/Global.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Global.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 12/04/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | infix operator %%: MultiplicationPrecedence
22 |
23 | func %%(lhs: T, rhs: T) -> T {
24 | let rem = lhs % rhs
25 | return (rem < 0) == (rhs < 0) ? rem : rem + rhs
26 | }
27 |
28 | internal func log(_ str: String) {
29 | #if LOG
30 | print(str)
31 | #endif
32 | }
33 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/ManagedObject.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ManagedObject.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 20/03/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// A managed object can be registered with a managed object pool. Once registered, the
23 | /// `managed` property will be set to true. As soon as there is no reference pointing at this
24 | /// object anymore, `clean` will be called to reset the object and break any strong cyclic
25 | /// references.
26 | ///
27 | /// Managed objects are currently:
28 | /// - Cells
29 | /// - Tuples
30 | /// - Vectors
31 | /// - Records
32 | /// - Hashtables
33 | /// - Futures
34 | ///
35 | open class ManagedObject: Reference {
36 |
37 | /// Used internally to declare that a managed object is registered in a managed object pool.
38 | internal final var managed: Bool = false
39 |
40 | /// A tag that defines the last GC cyle in which this object was marked (by following the
41 | /// root set references).
42 | internal final var tag: UInt8 = 0
43 |
44 | /// Clean up the object; i.e. remove possible cycles to free up the object for
45 | /// garbage collection.
46 | open func clean() {}
47 | }
48 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/MethodProfiler.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MethodProfiler.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 01/01/2022.
6 | // Copyright © 2022 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 |
23 | public final class MethodProfiler {
24 | let className: String
25 | var open: [Double] = []
26 | var stats: [String : (Int, Double)] = [:]
27 |
28 | init(_ className: String) {
29 | self.className = className
30 | }
31 |
32 | func enter() {
33 | open.append(Timer.absoluteTimeInSec)
34 | }
35 |
36 | func exit(_ name: String) {
37 | let time = Timer.absoluteTimeInSec - open.last!
38 | open.removeLast()
39 | if let (count, average) = stats[name] {
40 | stats[name] = (count + 1, (average * Double(count) + time)/Double(count + 1))
41 | } else {
42 | stats[name] = (1, time)
43 | }
44 | }
45 |
46 | public func printStats() {
47 | Swift.print("==== \(self.className) ================")
48 | for (name, (count, average)) in self.stats {
49 | Swift.print("\(name),\(count),\(average),\(average * Double(count))")
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/MultiMap.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MultiMap.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 18/09/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// Minimalistic multi map implementation.
23 | ///
24 | public struct MultiMap: CustomStringConvertible {
25 | private var map: [Key : [Value]]
26 |
27 | public init() {
28 | self.map = [:]
29 | }
30 |
31 | public var keys: Dictionary.Keys {
32 | return map.keys
33 | }
34 |
35 | public func hasValues(for key: Key) -> Bool {
36 | return self.map[key] != nil
37 | }
38 |
39 | public func values(for key: Key) -> [Value] {
40 | return self.map[key] ?? []
41 | }
42 |
43 | public mutating func insert(_ key: Key, mapsTo value: Value) {
44 | if self.map[key] == nil {
45 | self.map[key] = [value]
46 | } else {
47 | self.map[key]!.append(value)
48 | }
49 | }
50 |
51 | public var description: String {
52 | var builder = StringBuilder(prefix: "{", postfix: "}", separator: ", ")
53 | for (key, value) in self.map {
54 | builder.append("\(key) → \(value)")
55 | }
56 | return builder.description
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/Reference.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Reference.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 06/03/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// A `Reference` is a hashable object whose identity is used for the definition of
23 | /// equality and the hash value.
24 | ///
25 | open class Reference: Hashable {
26 |
27 | public final var identity: UInt {
28 | return UInt(bitPattern: ObjectIdentifier(self))
29 | }
30 |
31 | public final var identityString: String {
32 | return String(self.identity, radix: 16)
33 | }
34 |
35 | public final func hash(into hasher: inout Hasher) {
36 | hasher.combine(ObjectIdentifier(self))
37 | }
38 |
39 | open var typeDescription: String {
40 | return "reference"
41 | }
42 |
43 | public static func ==(lhs: Reference, rhs: Reference) -> Bool {
44 | return lhs === rhs
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/Timer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Timer.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 20/03/2016.
6 | // Copyright © 2016-2022 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 |
23 | ///
24 | /// Timer utilities based on Darwin framework.
25 | ///
26 | public struct Timer {
27 |
28 | private static let (TIME_NUMER, TIME_DENOM): (UInt64, UInt64) = {
29 | var info: mach_timebase_info = mach_timebase_info(numer: 0, denom: 0)
30 | mach_timebase_info(&info)
31 | return (UInt64(info.numer), UInt64(info.denom))
32 | }()
33 |
34 | /// Returns a current time measurement in seconds, as a Double. This is only useful for
35 | /// measuring short time intervals.
36 | public static var absoluteTimeInSec: Double {
37 | return Double(mach_absolute_time() * Timer.TIME_NUMER / Timer.TIME_DENOM) / 1e9
38 | }
39 |
40 | /// Returns a current time measurement in milliseconds, as a UInt64. This is only useful for
41 | /// measuring short time intervals.
42 | public static var absoluteTimeInMSec: UInt64 {
43 | return (mach_absolute_time() * Timer.TIME_NUMER) / (Timer.TIME_DENOM * 1000000)
44 | }
45 |
46 | /// Returns the current time in seconds using standard UNIX data structures.
47 | public static var currentTimeInSec: Double {
48 | var tv = timeval(tv_sec: 0, tv_usec: 0)
49 | gettimeofday(&tv, nil)
50 | return Double(tv.tv_sec) + (Double(tv.tv_usec) / 1000000.0)
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Sources/LispKit/Base/TrackedObject.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TrackedObject.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 29/03/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// Objects inheriting from `TrackedObject` can be registered in `ManagedObjectPool`
23 | /// instances for tracking managed objects. LispKit currently defines three subclasses
24 | /// of `TrackedObject`:
25 | /// - `Heap`
26 | /// - `VirtualMachine`
27 | /// - `LibraryManager`
28 | ///
29 | open class TrackedObject {
30 | open func mark(in: GarbageCollector) {}
31 | }
32 |
--------------------------------------------------------------------------------
/Sources/LispKit/Compiler/SyntaxError.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SyntaxError.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 01/03/2018.
6 | // Copyright © 2018 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 |
23 | ///
24 | /// Enumeration `SyntaxError` represents syntactical errors emitted by the parser.
25 | ///
26 | public enum SyntaxError: Int, Hashable, Codable {
27 | case empty
28 | case closingParenthesisMissing
29 | case unexpectedClosingParenthesis
30 | case unexpectedDot
31 | case notAByteValue
32 | case syntaxNotYetSupported
33 |
34 | public var message: String {
35 | switch self {
36 | case .empty:
37 | return "empty input"
38 | case .closingParenthesisMissing:
39 | return "closing parenthesis missing"
40 | case .unexpectedClosingParenthesis:
41 | return "unexpected closing parenthesis"
42 | case .unexpectedDot:
43 | return "unexpected dot"
44 | case .notAByteValue:
45 | return "bytevector element not a byte"
46 | case .syntaxNotYetSupported:
47 | return "syntax not yet supported"
48 | }
49 | }
50 |
51 | public static func ==(_ lhs: SyntaxError, _ rhs: SyntaxError) -> Bool {
52 | return lhs.rawValue == rhs.rawValue
53 | }
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/Sources/LispKit/Data/Cell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Cell.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 07/02/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// `Cell` implements a mutable expression.
23 | ///
24 | public class Cell: ManagedObject, CustomStringConvertible {
25 |
26 | /// The current value of the cell.
27 | public var value: Expr
28 |
29 | /// Create a new cell with a given initial value.
30 | public init(_ value: Expr) {
31 | self.value = value
32 | }
33 |
34 | /// Clear cell value.
35 | public override func clean() {
36 | self.value = .undef
37 | }
38 |
39 | /// A string representation of this cell.
40 | public var description: String {
41 | return "«cell \(self.value)»"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Sources/LispKit/Data/CustomExpr.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CustomExpr.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 05/05/2024.
6 | // Copyright © 2024 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 |
23 | ///
24 | /// Protocol implementing custom values.
25 | ///
26 | public protocol CustomExpr: Hashable {
27 | var type: Type { get }
28 | var typeDescription: String { get }
29 | var string: String { get }
30 | var tagString: String { get }
31 | var isAtom: Bool { get }
32 | var hash: Int { get }
33 | func equals(to expr: Expr) -> Bool
34 | func eqv(to expr: Expr) -> Bool
35 | func eq(to expr: Expr) -> Bool
36 | func mark(in gc: GarbageCollector)
37 | func unpack(in context: Context) -> Exprs
38 | }
39 |
40 | extension CustomExpr {
41 | public var string: String {
42 | return "#<\(self.tagString)>"
43 | }
44 |
45 | public var typeDescription: String {
46 | return self.type.description
47 | }
48 |
49 | public var isAtom: Bool {
50 | return true
51 | }
52 |
53 | public func eqv(to expr: Expr) -> Bool {
54 | return self.equals(to: expr)
55 | }
56 |
57 | public func eq(to expr: Expr) -> Bool {
58 | return self.equals(to: expr)
59 | }
60 |
61 | public func mark(in gc: GarbageCollector) {
62 | // do nothing by default
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Sources/LispKit/Data/Exprs.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Exprs.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 24/01/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 |
22 | /// A sequence of expressions, represented as an array.
23 | public typealias Exprs = ContiguousArray
24 |
25 | /// An immutable empty set of expressions
26 | public let noExprs = Exprs()
27 |
28 | /// Equality function for sequences of expressions.
29 | public func ==(lhs: Exprs, rhs: Exprs) -> Bool {
30 | guard lhs.count == rhs.count else {
31 | return false
32 | }
33 | for i in lhs.indices {
34 | guard lhs[i] == rhs[i] else {
35 | return false
36 | }
37 | }
38 | return true
39 | }
40 |
--------------------------------------------------------------------------------
/Sources/LispKit/Data/Tuple.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Tuple.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 15/07/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// `Tuple` implements a mutable pair of expressions.
23 | ///
24 | public final class Tuple: ManagedObject, CustomStringConvertible {
25 |
26 | /// The current value of the variable.
27 | public var fst: Expr
28 | public var snd: Expr
29 |
30 | /// Create a new tuple with initial values for `fst` and `snd`.
31 | public init(_ fst: Expr = .undef, _ snd: Expr = .undef) {
32 | self.fst = fst
33 | self.snd = snd
34 | }
35 |
36 | /// Clear tuple
37 | public override func clean() {
38 | self.fst = .undef
39 | self.snd = .undef
40 | }
41 |
42 | /// A string representation of this tuple.
43 | public var description: String {
44 | return "«tuple \(self.fst), \(self.snd)»"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Sources/LispKit/IO/TextInputSource.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TextInputSource.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 19/06/2016.
6 | // Copyright © 2016-2017 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 |
23 | ///
24 | /// Generalized source for a `TextInput` object.
25 | ///
26 | public protocol TextInputSource {
27 | var nextReadMightBlock: Bool { get }
28 | mutating func readString() -> String?
29 | }
30 |
31 | ///
32 | /// Default `TextInputSource` implementation for decoding UTF8 from a `BinaryInput` object.
33 | ///
34 | public struct UTF8EncodedSource: TextInputSource {
35 | private var input: BinaryInput
36 | private let length: Int
37 | private var codec: UTF8
38 |
39 | public init(input: BinaryInput, length: Int) {
40 | self.input = input
41 | self.length = length
42 | self.codec = UTF8()
43 | }
44 |
45 | public var nextReadMightBlock: Bool {
46 | return self.input.readMightBlock
47 | }
48 |
49 | /// Decodes the binary input as UTF8 and returns strings of at most
50 | /// `length` characters (where a character is a unicode scalar).
51 | public mutating func readString() -> String? {
52 | var str = ""
53 | for _ in 0.. Bool
28 | func writeString(_ str: String) -> Bool
29 | }
30 |
31 | ///
32 | /// Default `TextOutputSource` implementation for encoding strings via UTF8 into a
33 | /// `BinaryOutput` object.
34 | ///
35 | public struct UTF8EncodedTarget: TextOutputTarget {
36 | private let output: BinaryOutput
37 |
38 | public init(output: BinaryOutput) {
39 | self.output = output
40 | }
41 |
42 | @discardableResult public func flush(_ completely: Bool = false) -> Bool {
43 | return self.output.flush(completely)
44 | }
45 |
46 | public func writeString(_ str: String) -> Bool {
47 | for byte in str.utf8 {
48 | guard self.output.write(byte) else {
49 | return false
50 | }
51 | }
52 | return true
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Sources/LispKit/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en_US
7 | CFBundleDisplayName
8 | LispKit
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | NSAppTransportSecurity
26 |
27 | NSAllowsArbitraryLoads
28 |
29 |
30 | NSHumanReadableCopyright
31 | Copyright © 2016–2025 Matthias Zenger. All rights reserved.
32 | NSPrincipalClass
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Sources/LispKit/LispKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // LispKit.h
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 14/01/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 |
23 | // In this header, you should import all the public headers of your
24 | // framework using statements like #import
25 |
26 | //! Project version number for LispKit.
27 | FOUNDATION_EXPORT double LispKitVersionNumber;
28 |
29 | //! Project version string for LispKit.
30 | FOUNDATION_EXPORT const unsigned char LispKitVersionString[];
31 |
--------------------------------------------------------------------------------
/Sources/LispKit/Primitives/BaseLibrary.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BaseLibrary.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 23/01/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 |
22 | public final class BaseLibrary: NativeLibrary {
23 |
24 | /// Name of the library.
25 | public override class var name: [String] {
26 | return ["lispkit", "base"]
27 | }
28 |
29 | /// Exported definitions.
30 | public override func reexports() throws {
31 | try self.exportAll()
32 | }
33 |
34 | /// Dependencies of the library.
35 | public override func dependencies() {
36 | self.import(from: CoreLibrary.name)
37 | self.import(from: ControlFlowLibrary.name)
38 | self.import(from: SystemLibrary.name)
39 | self.import(from: BoxLibrary.name)
40 | self.import(from: MathLibrary.name)
41 | self.import(from: ListLibrary.name)
42 | self.import(from: HashTableLibrary.name)
43 | self.import(from: DynamicControlLibrary.name)
44 | self.import(from: TypeLibrary.name)
45 | self.import(from: VectorLibrary.name)
46 | self.import(from: RecordLibrary.name)
47 | self.import(from: BytevectorLibrary.name)
48 | self.import(from: CharLibrary.name)
49 | self.import(from: StringLibrary.name)
50 | self.import(from: PortLibrary.name)
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/ColorLists/HtmlColors.plist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Sources/LispKit/Resources/Assets/ColorLists/HtmlColors.plist
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/Datasets/Covid/Covid.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Sources/LispKit/Resources/Assets/Datasets/Covid/Covid.sqlite3
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/Images/Billboard.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Sources/LispKit/Resources/Assets/Images/Billboard.jpg
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/Images/Diagram.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Sources/LispKit/Resources/Assets/Images/Diagram.pdf
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/Images/Inga.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Sources/LispKit/Resources/Assets/Images/Inga.jpg
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/Images/LispkitLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Sources/LispKit/Resources/Assets/Images/LispkitLogo.png
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/Images/Page.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/objecthub/swift-lispkit/513544c7977270211daa4f766d7383f592ac88e7/Sources/LispKit/Resources/Assets/Images/Page.jpg
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Schema/2020-12/meta/applicator:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "https://json-schema.org/draft/2020-12/meta/applicator",
4 | "$dynamicAnchor": "meta",
5 |
6 | "title": "Applicator vocabulary meta-schema",
7 | "type": ["object", "boolean"],
8 | "properties": {
9 | "prefixItems": { "$ref": "#/$defs/schemaArray" },
10 | "items": { "$dynamicRef": "#meta" },
11 | "contains": { "$dynamicRef": "#meta" },
12 | "additionalProperties": { "$dynamicRef": "#meta" },
13 | "properties": {
14 | "type": "object",
15 | "additionalProperties": { "$dynamicRef": "#meta" },
16 | "default": {}
17 | },
18 | "patternProperties": {
19 | "type": "object",
20 | "additionalProperties": { "$dynamicRef": "#meta" },
21 | "propertyNames": { "format": "regex" },
22 | "default": {}
23 | },
24 | "dependentSchemas": {
25 | "type": "object",
26 | "additionalProperties": { "$dynamicRef": "#meta" },
27 | "default": {}
28 | },
29 | "propertyNames": { "$dynamicRef": "#meta" },
30 | "if": { "$dynamicRef": "#meta" },
31 | "then": { "$dynamicRef": "#meta" },
32 | "else": { "$dynamicRef": "#meta" },
33 | "allOf": { "$ref": "#/$defs/schemaArray" },
34 | "anyOf": { "$ref": "#/$defs/schemaArray" },
35 | "oneOf": { "$ref": "#/$defs/schemaArray" },
36 | "not": { "$dynamicRef": "#meta" }
37 | },
38 | "$defs": {
39 | "schemaArray": {
40 | "type": "array",
41 | "minItems": 1,
42 | "items": { "$dynamicRef": "#meta" }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Schema/2020-12/meta/content:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "https://json-schema.org/draft/2020-12/meta/content",
4 | "$dynamicAnchor": "meta",
5 |
6 | "title": "Content vocabulary meta-schema",
7 |
8 | "type": ["object", "boolean"],
9 | "properties": {
10 | "contentEncoding": { "type": "string" },
11 | "contentMediaType": { "type": "string" },
12 | "contentSchema": { "$dynamicRef": "#meta" }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Schema/2020-12/meta/core:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "https://json-schema.org/draft/2020-12/meta/core",
4 | "$dynamicAnchor": "meta",
5 |
6 | "title": "Core vocabulary meta-schema",
7 | "type": ["object", "boolean"],
8 | "properties": {
9 | "$id": {
10 | "$ref": "#/$defs/uriReferenceString",
11 | "$comment": "Non-empty fragments not allowed.",
12 | "pattern": "^[^#]*#?$"
13 | },
14 | "$schema": { "$ref": "#/$defs/uriString" },
15 | "$ref": { "$ref": "#/$defs/uriReferenceString" },
16 | "$anchor": { "$ref": "#/$defs/anchorString" },
17 | "$dynamicRef": { "$ref": "#/$defs/uriReferenceString" },
18 | "$dynamicAnchor": { "$ref": "#/$defs/anchorString" },
19 | "$vocabulary": {
20 | "type": "object",
21 | "propertyNames": { "$ref": "#/$defs/uriString" },
22 | "additionalProperties": {
23 | "type": "boolean"
24 | }
25 | },
26 | "$comment": {
27 | "type": "string"
28 | },
29 | "$defs": {
30 | "type": "object",
31 | "additionalProperties": { "$dynamicRef": "#meta" }
32 | }
33 | },
34 | "$defs": {
35 | "anchorString": {
36 | "type": "string",
37 | "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
38 | },
39 | "uriString": {
40 | "type": "string",
41 | "format": "uri"
42 | },
43 | "uriReferenceString": {
44 | "type": "string",
45 | "format": "uri-reference"
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Schema/2020-12/meta/format-annotation:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation",
4 | "$dynamicAnchor": "meta",
5 |
6 | "title": "Format vocabulary meta-schema for annotation results",
7 | "type": ["object", "boolean"],
8 | "properties": {
9 | "format": { "type": "string" }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Schema/2020-12/meta/meta-data:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "https://json-schema.org/draft/2020-12/meta/meta-data",
4 | "$dynamicAnchor": "meta",
5 |
6 | "title": "Meta-data vocabulary meta-schema",
7 |
8 | "type": ["object", "boolean"],
9 | "properties": {
10 | "title": {
11 | "type": "string"
12 | },
13 | "description": {
14 | "type": "string"
15 | },
16 | "default": true,
17 | "deprecated": {
18 | "type": "boolean",
19 | "default": false
20 | },
21 | "readOnly": {
22 | "type": "boolean",
23 | "default": false
24 | },
25 | "writeOnly": {
26 | "type": "boolean",
27 | "default": false
28 | },
29 | "examples": {
30 | "type": "array",
31 | "items": true
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Schema/2020-12/meta/unevaluated:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated",
4 | "$dynamicAnchor": "meta",
5 |
6 | "title": "Unevaluated applicator vocabulary meta-schema",
7 | "type": ["object", "boolean"],
8 | "properties": {
9 | "unevaluatedItems": { "$dynamicRef": "#meta" },
10 | "unevaluatedProperties": { "$dynamicRef": "#meta" }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Schema/Custom/person:
--------------------------------------------------------------------------------
1 | {
2 | "$id": "https://lisppad.app/schema/person",
3 | "$schema": "https://json-schema.org/draft/2020-12/schema",
4 | "title": "person",
5 | "type": "object",
6 | "properties": {
7 | "name": {
8 | "type": "string",
9 | "minLength": 1
10 | },
11 | "birthday": {
12 | "type": "string",
13 | "format": "date"
14 | },
15 | "numChildren": {
16 | "type": "integer",
17 | "default": 0
18 | },
19 | "address": {
20 | "oneOf": [
21 | {
22 | "type": "string",
23 | "default": "12345 Mcity"
24 | },
25 | {
26 | "$ref": "#address",
27 | "default": {
28 | "city": "Mcity",
29 | "postalCode": "12345"
30 | }
31 | }
32 | ]
33 | },
34 | "email": {
35 | "type": "array",
36 | "maxItems": 3,
37 | "items": {
38 | "type": "string",
39 | "format": "email"
40 | }
41 | }
42 | },
43 | "required": ["name", "birthday"],
44 | "$defs": {
45 | "address": {
46 | "$anchor": "address",
47 | "type": "object",
48 | "properties": {
49 | "street": {
50 | "type": "string"
51 | },
52 | "city": {
53 | "type": "string"
54 | },
55 | "postalCode": {
56 | "type": "string",
57 | "pattern": "\\d{5}"
58 | }
59 | },
60 | "required": ["city", "postalCode"]
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Julian Berman
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/debug.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "order of evaluation: $id and $anchor and $ref",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "$id": "https://example.com/draft2020-12/ref-and-id2/base.json",
7 | "$ref": "#bigint",
8 | "$defs": {
9 | "bigint": {
10 | "$anchor": "bigint",
11 | "maximum": 10
12 | },
13 | "smallint": {
14 | "$id": "https://example.com/draft2020-12/ref-and-id2/",
15 | "$anchor": "bigint",
16 | "maximum": 2
17 | }
18 | }
19 | },
20 | "tests": [
21 | {
22 | "description": "data is valid against first definition",
23 | "data": 5,
24 | "valid": true
25 | },
26 | {
27 | "description": "data is invalid against first definition",
28 | "data": 50,
29 | "valid": false
30 | }
31 | ]
32 | }
33 | ]
34 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/defs.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "validate definition against metaschema",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "$ref": "https://json-schema.org/draft/2020-12/schema"
7 | },
8 | "tests": [
9 | {
10 | "description": "valid definition schema",
11 | "data": {"$defs": {"foo": {"type": "integer"}}},
12 | "valid": true
13 | },
14 | {
15 | "description": "invalid definition schema",
16 | "data": {"$defs": {"foo": {"type": 1}}},
17 | "valid": false
18 | }
19 | ]
20 | }
21 | ]
22 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/exclusiveMaximum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "exclusiveMaximum validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "exclusiveMaximum": 3.0
7 | },
8 | "tests": [
9 | {
10 | "description": "below the exclusiveMaximum is valid",
11 | "data": 2.2,
12 | "valid": true
13 | },
14 | {
15 | "description": "boundary point is invalid",
16 | "data": 3.0,
17 | "valid": false
18 | },
19 | {
20 | "description": "above the exclusiveMaximum is invalid",
21 | "data": 3.5,
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-numbers",
26 | "data": "x",
27 | "valid": true
28 | }
29 | ]
30 | }
31 | ]
32 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/exclusiveMinimum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "exclusiveMinimum validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "exclusiveMinimum": 1.1
7 | },
8 | "tests": [
9 | {
10 | "description": "above the exclusiveMinimum is valid",
11 | "data": 1.2,
12 | "valid": true
13 | },
14 | {
15 | "description": "boundary point is invalid",
16 | "data": 1.1,
17 | "valid": false
18 | },
19 | {
20 | "description": "below the exclusiveMinimum is invalid",
21 | "data": 0.6,
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-numbers",
26 | "data": "x",
27 | "valid": true
28 | }
29 | ]
30 | }
31 | ]
32 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/infinite-loop-detection.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "evaluating the same schema location against the same data location twice is not a sign of an infinite loop",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "$defs": {
7 | "int": { "type": "integer" }
8 | },
9 | "allOf": [
10 | {
11 | "properties": {
12 | "foo": {
13 | "$ref": "#/$defs/int"
14 | }
15 | }
16 | },
17 | {
18 | "additionalProperties": {
19 | "$ref": "#/$defs/int"
20 | }
21 | }
22 | ]
23 | },
24 | "tests": [
25 | {
26 | "description": "passing case",
27 | "data": { "foo": 1 },
28 | "valid": true
29 | },
30 | {
31 | "description": "failing case",
32 | "data": { "foo": "a string" },
33 | "valid": false
34 | }
35 | ]
36 | }
37 | ]
38 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/maxItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maxItems validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "maxItems": 2
7 | },
8 | "tests": [
9 | {
10 | "description": "shorter is valid",
11 | "data": [1],
12 | "valid": true
13 | },
14 | {
15 | "description": "exact length is valid",
16 | "data": [1, 2],
17 | "valid": true
18 | },
19 | {
20 | "description": "too long is invalid",
21 | "data": [1, 2, 3],
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-arrays",
26 | "data": "foobar",
27 | "valid": true
28 | }
29 | ]
30 | },
31 | {
32 | "description": "maxItems validation with a decimal",
33 | "schema": {
34 | "$schema": "https://json-schema.org/draft/2020-12/schema",
35 | "maxItems": 2.0
36 | },
37 | "tests": [
38 | {
39 | "description": "shorter is valid",
40 | "data": [1],
41 | "valid": true
42 | },
43 | {
44 | "description": "too long is invalid",
45 | "data": [1, 2, 3],
46 | "valid": false
47 | }
48 | ]
49 | }
50 | ]
51 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/maxLength.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maxLength validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "maxLength": 2
7 | },
8 | "tests": [
9 | {
10 | "description": "shorter is valid",
11 | "data": "f",
12 | "valid": true
13 | },
14 | {
15 | "description": "exact length is valid",
16 | "data": "fo",
17 | "valid": true
18 | },
19 | {
20 | "description": "too long is invalid",
21 | "data": "foo",
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-strings",
26 | "data": 100,
27 | "valid": true
28 | },
29 | {
30 | "description": "two graphemes is long enough",
31 | "data": "\uD83D\uDCA9\uD83D\uDCA9",
32 | "valid": true
33 | }
34 | ]
35 | },
36 | {
37 | "description": "maxLength validation with a decimal",
38 | "schema": {
39 | "$schema": "https://json-schema.org/draft/2020-12/schema",
40 | "maxLength": 2.0
41 | },
42 | "tests": [
43 | {
44 | "description": "shorter is valid",
45 | "data": "f",
46 | "valid": true
47 | },
48 | {
49 | "description": "too long is invalid",
50 | "data": "foo",
51 | "valid": false
52 | }
53 | ]
54 | }
55 | ]
56 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/maximum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maximum validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "maximum": 3.0
7 | },
8 | "tests": [
9 | {
10 | "description": "below the maximum is valid",
11 | "data": 2.6,
12 | "valid": true
13 | },
14 | {
15 | "description": "boundary point is valid",
16 | "data": 3.0,
17 | "valid": true
18 | },
19 | {
20 | "description": "above the maximum is invalid",
21 | "data": 3.5,
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-numbers",
26 | "data": "x",
27 | "valid": true
28 | }
29 | ]
30 | },
31 | {
32 | "description": "maximum validation with unsigned integer",
33 | "schema": {
34 | "$schema": "https://json-schema.org/draft/2020-12/schema",
35 | "maximum": 300
36 | },
37 | "tests": [
38 | {
39 | "description": "below the maximum is invalid",
40 | "data": 299.97,
41 | "valid": true
42 | },
43 | {
44 | "description": "boundary point integer is valid",
45 | "data": 300,
46 | "valid": true
47 | },
48 | {
49 | "description": "boundary point float is valid",
50 | "data": 300.00,
51 | "valid": true
52 | },
53 | {
54 | "description": "above the maximum is invalid",
55 | "data": 300.5,
56 | "valid": false
57 | }
58 | ]
59 | }
60 | ]
61 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/minItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minItems validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "minItems": 1
7 | },
8 | "tests": [
9 | {
10 | "description": "longer is valid",
11 | "data": [1, 2],
12 | "valid": true
13 | },
14 | {
15 | "description": "exact length is valid",
16 | "data": [1],
17 | "valid": true
18 | },
19 | {
20 | "description": "too short is invalid",
21 | "data": [],
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-arrays",
26 | "data": "",
27 | "valid": true
28 | }
29 | ]
30 | },
31 | {
32 | "description": "minItems validation with a decimal",
33 | "schema": {
34 | "$schema": "https://json-schema.org/draft/2020-12/schema",
35 | "minItems": 1.0
36 | },
37 | "tests": [
38 | {
39 | "description": "longer is valid",
40 | "data": [1, 2],
41 | "valid": true
42 | },
43 | {
44 | "description": "too short is invalid",
45 | "data": [],
46 | "valid": false
47 | }
48 | ]
49 | }
50 | ]
51 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/minLength.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minLength validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "minLength": 2
7 | },
8 | "tests": [
9 | {
10 | "description": "longer is valid",
11 | "data": "foo",
12 | "valid": true
13 | },
14 | {
15 | "description": "exact length is valid",
16 | "data": "fo",
17 | "valid": true
18 | },
19 | {
20 | "description": "too short is invalid",
21 | "data": "f",
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-strings",
26 | "data": 1,
27 | "valid": true
28 | },
29 | {
30 | "description": "one grapheme is not long enough",
31 | "data": "\uD83D\uDCA9",
32 | "valid": false
33 | }
34 | ]
35 | },
36 | {
37 | "description": "minLength validation with a decimal",
38 | "schema": {
39 | "$schema": "https://json-schema.org/draft/2020-12/schema",
40 | "minLength": 2.0
41 | },
42 | "tests": [
43 | {
44 | "description": "longer is valid",
45 | "data": "foo",
46 | "valid": true
47 | },
48 | {
49 | "description": "too short is invalid",
50 | "data": "f",
51 | "valid": false
52 | }
53 | ]
54 | }
55 | ]
56 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/minProperties.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minProperties validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "minProperties": 1
7 | },
8 | "tests": [
9 | {
10 | "description": "longer is valid",
11 | "data": {"foo": 1, "bar": 2},
12 | "valid": true
13 | },
14 | {
15 | "description": "exact length is valid",
16 | "data": {"foo": 1},
17 | "valid": true
18 | },
19 | {
20 | "description": "too short is invalid",
21 | "data": {},
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores arrays",
26 | "data": [],
27 | "valid": true
28 | },
29 | {
30 | "description": "ignores strings",
31 | "data": "",
32 | "valid": true
33 | },
34 | {
35 | "description": "ignores other non-objects",
36 | "data": 12,
37 | "valid": true
38 | }
39 | ]
40 | },
41 | {
42 | "description": "minProperties validation with a decimal",
43 | "schema": {
44 | "$schema": "https://json-schema.org/draft/2020-12/schema",
45 | "minProperties": 1.0
46 | },
47 | "tests": [
48 | {
49 | "description": "longer is valid",
50 | "data": {"foo": 1, "bar": 2},
51 | "valid": true
52 | },
53 | {
54 | "description": "too short is invalid",
55 | "data": {},
56 | "valid": false
57 | }
58 | ]
59 | }
60 | ]
61 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/minimum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minimum validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "minimum": 1.1
7 | },
8 | "tests": [
9 | {
10 | "description": "above the minimum is valid",
11 | "data": 2.6,
12 | "valid": true
13 | },
14 | {
15 | "description": "boundary point is valid",
16 | "data": 1.1,
17 | "valid": true
18 | },
19 | {
20 | "description": "below the minimum is invalid",
21 | "data": 0.6,
22 | "valid": false
23 | },
24 | {
25 | "description": "ignores non-numbers",
26 | "data": "x",
27 | "valid": true
28 | }
29 | ]
30 | },
31 | {
32 | "description": "minimum validation with signed integer",
33 | "schema": {
34 | "$schema": "https://json-schema.org/draft/2020-12/schema",
35 | "minimum": -2
36 | },
37 | "tests": [
38 | {
39 | "description": "negative above the minimum is valid",
40 | "data": -1,
41 | "valid": true
42 | },
43 | {
44 | "description": "positive above the minimum is valid",
45 | "data": 0,
46 | "valid": true
47 | },
48 | {
49 | "description": "boundary point is valid",
50 | "data": -2,
51 | "valid": true
52 | },
53 | {
54 | "description": "boundary point with float is valid",
55 | "data": -2.0,
56 | "valid": true
57 | },
58 | {
59 | "description": "float below the minimum is invalid",
60 | "data": -2.0001,
61 | "valid": false
62 | },
63 | {
64 | "description": "int below the minimum is invalid",
65 | "data": -3,
66 | "valid": false
67 | },
68 | {
69 | "description": "ignores non-numbers",
70 | "data": "x",
71 | "valid": true
72 | }
73 | ]
74 | }
75 | ]
76 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Assets/JSON/Tests/2020-12/pattern.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "pattern validation",
4 | "schema": {
5 | "$schema": "https://json-schema.org/draft/2020-12/schema",
6 | "pattern": "^a*$"
7 | },
8 | "tests": [
9 | {
10 | "description": "a matching pattern is valid",
11 | "data": "aaa",
12 | "valid": true
13 | },
14 | {
15 | "description": "a non-matching pattern is invalid",
16 | "data": "abc",
17 | "valid": false
18 | },
19 | {
20 | "description": "ignores booleans",
21 | "data": true,
22 | "valid": true
23 | },
24 | {
25 | "description": "ignores integers",
26 | "data": 123,
27 | "valid": true
28 | },
29 | {
30 | "description": "ignores floats",
31 | "data": 1.0,
32 | "valid": true
33 | },
34 | {
35 | "description": "ignores objects",
36 | "data": {},
37 | "valid": true
38 | },
39 | {
40 | "description": "ignores arrays",
41 | "data": [],
42 | "valid": true
43 | },
44 | {
45 | "description": "ignores null",
46 | "data": null,
47 | "valid": true
48 | }
49 | ]
50 | },
51 | {
52 | "description": "pattern is not anchored",
53 | "schema": {
54 | "$schema": "https://json-schema.org/draft/2020-12/schema",
55 | "pattern": "a+"
56 | },
57 | "tests": [
58 | {
59 | "description": "matches a substring",
60 | "data": "xxaayy",
61 | "valid": true
62 | }
63 | ]
64 | }
65 | ]
66 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Examples/HTTP.scm:
--------------------------------------------------------------------------------
1 | ;;; HTTP GET demo
2 | ;;;
3 | ;;; This is a small example for how to use the LispKit-specific `http-get`
4 | ;;; function. `http-get` expects two parameters `url` and `timeout`. `url`
5 | ;;; refers to the URL from which content should be fetched. `timeout` is a
6 | ;;; floating point number defining the time in seconds it should take at
7 | ;;; most for receiving a response. `http-get` returns two values: the HTTP
8 | ;;; headers in form of an alist, and the content in form of a bytevector.
9 | ;;; The example below assumes that the content is a UTF8 encoded string.
10 | ;;;
11 | ;;; With the example functions below, it is possible to display this example
12 | ;;; code by fetching it from GitHub:
13 | ;;; (display (http-get-content "https://raw.githubusercontent.com/objecthub/swift-lispkit/master/Sources/LispKit/Resources/Examples/HTTP.scm"))
14 | ;;;
15 | ;;; There is also a way to open a web page in a browser by using the
16 | ;;; `open-url` function. The following code opens the GitHub page of LispKit
17 | ;;; in a browser: (open-url "https://github.com/objecthub/swift-lispkit")
18 | ;;;
19 | ;;; For more control and an asynchronous API, the library `(lispkit http)`
20 | ;;; provides a dedicated API for handling the HTTP protocol.
21 | ;;;
22 | ;;; Author: Matthias Zenger
23 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
24 | ;;;
25 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may
26 | ;;; not use this file except in compliance with the License. You may obtain
27 | ;;; a copy of the License at
28 | ;;;
29 | ;;; http://www.apache.org/licenses/LICENSE-2.0
30 | ;;;
31 | ;;; Unless required by applicable law or agreed to in writing, software
32 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
33 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 | ;;; See the License for the specific language governing permissions and
35 | ;;; limitations under the License.
36 |
37 | (import (lispkit base))
38 |
39 | (define (http-get-header url)
40 | (let-values (((header _) (http-get url)))
41 | header))
42 |
43 | (define (http-get-content url)
44 | (let-values (((header content) (http-get url)))
45 | (utf8->string content)))
46 |
47 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Examples/Pi.scm:
--------------------------------------------------------------------------------
1 | ;;; Approximate Pi
2 | ;;;
3 | ;;; Example usage: (pi-as-string 200)
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may
9 | ;;; not use this file except in compliance with the License. You may obtain
10 | ;;; a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software
15 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
16 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | ;;; See the License for the specific language governing permissions and
18 | ;;; limitations under the License.
19 |
20 | (import (lispkit base))
21 |
22 | ;; Returns a string representation of pi with `n` decimal digits
23 | (define (pi-as-string n)
24 | (pi->string (approx-pi n)))
25 |
26 | ;; Returns a list of `n` decimal digits of pi
27 | (define (approx-pi n)
28 | (let ((u 0) (y 0) (j (+ n 2)))
29 | (do ((q 1 (* 10 q i (- (* 2 i) 1)))
30 | (r 180 (* 10 (- (+ (* q (- (* 5 i) 2)) r) (* y t)) u))
31 | (t 60 (* t u))
32 | (i 2 (+ i 1))
33 | (res '() (cons y res)))
34 | ((> i j) (reverse res))
35 | (set! u (* 3 (+ (* 3 i) 1) (+ (* 3 i) 2)))
36 | (set! y (floor-quotient (+ (* q (- (* 27 i) 12)) (* 5 r)) (* 5 t))))))
37 |
38 | ;; Converts a list of decimal digits into a string representation of pi
39 | (define (pi->string xs)
40 | (let ((out (open-output-string)))
41 | (write-string "3." out)
42 | (for-each (lambda (x) (write x out)) (cdr xs))
43 | (get-output-string out)))
44 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Examples/Queens.scm:
--------------------------------------------------------------------------------
1 | ;;; Solve n-queens problem
2 | ;;;
3 | ;;; Author: Matthias Zenger
4 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
5 | ;;;
6 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may
7 | ;;; not use this file except in compliance with the License. You may obtain
8 | ;;; a copy of the License at
9 | ;;;
10 | ;;; http://www.apache.org/licenses/LICENSE-2.0
11 | ;;;
12 | ;;; Unless required by applicable law or agreed to in writing, software
13 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
14 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ;;; See the License for the specific language governing permissions and
16 | ;;; limitations under the License.
17 |
18 | (import (lispkit base))
19 |
20 | (define (queens n)
21 | (let try ((x 0) (y 0) (ps '()) (pss '()))
22 | (cond ((>= y n) ; all solutions found
23 | pss)
24 | ((>= x n) ; new solution found
25 | (cons (reverse ps) pss))
26 | ((safe? (cons x y) ps) ; is the current position safe?
27 | (try x (+ y 1) ps (try (+ x 1) 0 (cons (cons x y) ps) pss)))
28 | (else
29 | (try x (+ y 1) ps pss)))))
30 |
31 | (define (safe? q ps)
32 | (cond ((null? ps) #t)
33 | ((reach? (car q) (cdr q) (caar ps) (cdar ps)) #f)
34 | (else (safe? q (cdr ps)))))
35 |
36 | (define (reach? x1 y1 x2 y2)
37 | (or (= x1 x2) (= y1 y2) (= (abs (- x1 x2)) (abs (- y1 y2)))))
38 |
39 | (define (pp-solutions pss n)
40 | (define (index p) (+ (* n (cdr p)) (car p)))
41 | (define (pp-board ps)
42 | (let ((board (make-vector (square n) ".")))
43 | (for-each (lambda (queen) (vector-set! board (index queen) "x")) ps)
44 | (let loop ((x 0) (y 0))
45 | (cond ((>= y n) (newline))
46 | ((>= x n) (newline)
47 | (loop 0 (+ 1 y)))
48 | (else (display (vector-ref board (index (cons x y))))
49 | (loop (+ 1 x) y))))))
50 | (display (string-append (number->string (length pss)) " SOLUTIONS FOR N = " (number->string n)))
51 | (newline)
52 | (newline)
53 | (for-each pp-board pss))
54 |
55 | (do ((i 4 (+ i 1)))
56 | ((= i 9))
57 | (pp-solutions (queens i) i))
58 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/bitwise.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME BITWISE
2 | ;;;
3 | ;;; Library implementing bitwise numeric arithmetic. This library is part of the Scheme Tangerine
4 | ;;; edition of the R7RS large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2021 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme bitwise)
20 |
21 | (export bitwise-not
22 | bitwise-and
23 | bitwise-ior
24 | bitwise-xor
25 | bitwise-eqv
26 | bitwise-nand
27 | bitwise-nor
28 | bitwise-andc1
29 | bitwise-andc2
30 | bitwise-orc1
31 | bitwise-orc2
32 | arithmetic-shift
33 | bit-count
34 | integer-length
35 | bitwise-if
36 | bit-set?
37 | copy-bit
38 | bit-swap
39 | any-bit-set?
40 | every-bit-set?
41 | first-set-bit
42 | bit-field
43 | bit-field-any?
44 | bit-field-every?
45 | bit-field-clear
46 | bit-field-set
47 | bit-field-replace
48 | bit-field-replace-same
49 | bit-field-rotate
50 | bit-field-reverse
51 | bits->list
52 | list->bits
53 | bits->vector
54 | vector->bits
55 | bits
56 | bitwise-fold
57 | bitwise-for-each
58 | bitwise-unfold
59 | make-bitwise-generator)
60 |
61 | (import (srfi 151))
62 | )
63 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/box.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME BOX
2 | ;;;
3 | ;;; Scheme box library. This library is part of the Scheme Red edition of the R7RS
4 | ;;; large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme box)
20 |
21 | (export box
22 | box?
23 | unbox
24 | set-box!)
25 |
26 | (import (lispkit box))
27 | )
28 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/case-lambda.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME CASE-LAMBDA
2 | ;;;
3 | ;;; Library exporting the `case-lambda` form. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme case-lambda)
19 |
20 | (export case-lambda)
21 |
22 | (import (lispkit core))
23 | )
24 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/char.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME CHAR
2 | ;;;
3 | ;;; Library exporting character-related functions. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme char)
19 | (export char-alphabetic?
20 | char-ci<=?
21 | char-ci
22 | char-ci=?
23 | char-ci>=?
24 | char-ci>?
25 | char-downcase
26 | char-foldcase
27 | char-lower-case?
28 | char-numeric?
29 | char-upcase
30 | char-upper-case?
31 | char-whitespace?
32 | digit-value
33 | string-ci<=?
34 | string-ci
35 | string-ci=?
36 | string-ci>=?
37 | string-ci>?
38 | string-downcase
39 | string-foldcase
40 | string-upcase)
41 |
42 | (import (lispkit char)
43 | (lispkit string))
44 | )
45 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/comparator.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME COMPARATOR
2 | ;;;
3 | ;;; Library implementing comparators. This library is part of the Scheme Red edition of the
4 | ;;; R7RS large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme comparator)
20 |
21 | (export comparator?
22 | comparator-ordered?
23 | comparator-hashable?
24 | make-comparator
25 | make-pair-comparator
26 | make-list-comparator
27 | make-vector-comparator
28 | make-eq-comparator
29 | make-eqv-comparator
30 | make-equal-comparator
31 | boolean-hash
32 | char-hash
33 | char-ci-hash
34 | string-hash
35 | string-ci-hash
36 | symbol-hash
37 | number-hash
38 | hash-bound
39 | hash-salt
40 | make-default-comparator
41 | default-hash
42 | comparator-register-default!
43 | comparator-type-test-predicate
44 | comparator-equality-predicate
45 | comparator-ordering-predicate
46 | comparator-hash-function
47 | comparator-test-type
48 | comparator-check-type
49 | comparator-hash
50 | =?
51 |
52 | >?
53 | <=?
54 | >=?
55 | comparator-if<=>)
56 |
57 | (import (srfi 128))
58 | )
59 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/complex.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME COMPLEX
2 | ;;;
3 | ;;; Library exporting functions for handling complex numbers. This library is part of the
4 | ;;; R7RS standard.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme complex)
20 |
21 | (export angle
22 | imag-part
23 | magnitude
24 | make-polar
25 | make-rectangular
26 | real-part)
27 |
28 | (import (lispkit math))
29 | )
30 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/cxr.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME CXR
2 | ;;;
3 | ;;; Library exporting shortcuts for combinations of `car` and `cdr`. This library is part of
4 | ;;; the R7RS standard.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme cxr)
20 |
21 | (export caaar
22 | caadr
23 | cadar
24 | caddr
25 | cdaar
26 | cdadr
27 | cddar
28 | cdddr
29 | caaaar
30 | caaadr
31 | caadar
32 | caaddr
33 | cadaar
34 | cadadr
35 | caddar
36 | cadddr
37 | cdaaar
38 | cdaadr
39 | cdadar
40 | cdaddr
41 | cddaar
42 | cddadr
43 | cdddar
44 | cddddr)
45 |
46 | (import (lispkit list))
47 | )
48 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/eval.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME EVAL
2 | ;;;
3 | ;;; Library exporting `eval` and `environment`. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme eval)
19 |
20 | (export eval
21 | environment)
22 |
23 | (import (lispkit core))
24 | )
25 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/file.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME FILE
2 | ;;;
3 | ;;; Library exporting file-related functions. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme file)
19 |
20 | (export call-with-input-file
21 | call-with-output-file
22 | delete-file
23 | file-exists?
24 | open-binary-input-file
25 | open-binary-output-file
26 | open-input-file
27 | open-output-file
28 | with-input-from-file
29 | with-output-to-file)
30 |
31 | (import (lispkit port)
32 | (lispkit system))
33 | )
34 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/fixnum.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME FIXNUM
2 | ;;;
3 | ;;; Scheme fixnum library. This library is part of the Scheme Tangerine edition of the R7RS
4 | ;;; large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2021 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme fixnum)
20 |
21 | (export fx-width
22 | fx-greatest
23 | fx-least
24 | fixnum?
25 | fx=?
26 | fx
27 | fx>?
28 | fx<=?
29 | fx>=?
30 | fxzero?
31 | fxpositive?
32 | fxnegative?
33 | fxodd?
34 | fxeven?
35 | fxmax
36 | fxmin
37 | fxneg
38 | fx+
39 | fx-
40 | fx*
41 | fxquotient
42 | fxremainder
43 | fxabs
44 | fxsquare
45 | fxsqrt
46 | fx+/carry
47 | fx-/carry
48 | fx*/carry
49 | fxnot
50 | fxand
51 | fxior
52 | fxxor
53 | fxarithmetic-shift
54 | fxarithmetic-shift-left
55 | fxarithmetic-shift-right
56 | fxbit-count
57 | fxlength
58 | fxif
59 | fxbit-set?
60 | fxcopy-bit
61 | fxfirst-set-bit
62 | fxbit-field
63 | fxbit-field-rotate
64 | fxbit-field-reverse)
65 |
66 | (import (srfi 143))
67 | )
68 |
69 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/generator.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME GENERATOR
2 | ;;;
3 | ;;; Library implementing generators. This library is part of the Scheme Red edition of the
4 | ;;; R7RS large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme generator)
20 |
21 | (export generator
22 | make-iota-generator
23 | make-range-generator
24 | make-coroutine-generator
25 | list->generator
26 | vector->generator
27 | reverse-vector->generator
28 | string->generator
29 | bytevector->generator
30 | make-for-each-generator
31 | make-unfold-generator
32 | gcons*
33 | gappend
34 | gcombine
35 | gfilter
36 | gremove
37 | gtake
38 | gdrop
39 | gtake-while
40 | gdrop-while
41 | gdelete
42 | gdelete-neighbor-dups
43 | gindex
44 | gselect
45 | generator->list
46 | generator->reverse-list
47 | generator->vector
48 | generator->vector!
49 | generator->string
50 | generator-fold
51 | generator-for-each
52 | generator-find
53 | generator-count
54 | generator-any
55 | generator-every
56 | generator-unfold)
57 |
58 | (import (srfi 121))
59 | )
60 |
61 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/hash-table.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME HASH-TABLE
2 | ;;;
3 | ;;; Scheme hashtable library. This library is part of the Scheme Red edition of the R7RS
4 | ;;; large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme hash-table)
20 |
21 | (export make-hash-table
22 | hash-table
23 | hash-table-unfold
24 | alist->hash-table
25 | hash-table?
26 | hash-table-contains?
27 | hash-table-exists?
28 | hash-table-empty?
29 | hash-table=?
30 | hash-table-mutable?
31 | hash-table-ref
32 | hash-table-ref/default
33 | hash-table-set!
34 | hash-table-delete!
35 | hash-table-intern!
36 | hash-table-update!
37 | hash-table-update!/default
38 | hash-table-pop!
39 | hash-table-clear!
40 | hash-table-size
41 | hash-table-keys
42 | hash-table-values
43 | hash-table-entries
44 | hash-table-find
45 | hash-table-count
46 | hash-table-map
47 | hash-table-for-each
48 | hash-table-walk
49 | hash-table-map!
50 | hash-table-map->list
51 | hash-table-fold
52 | hash-table-prune!
53 | hash-table-copy
54 | hash-table-empty-copy
55 | hash-table->alist
56 | hash-table-union!
57 | hash-table-merge!
58 | hash-table-intersection!
59 | hash-table-difference!
60 | hash-table-xor!
61 | hash
62 | string-hash
63 | string-ci-hash
64 | hash-by-identity
65 | hash-table-equivalence-function
66 | hash-table-hash-function)
67 |
68 | (import (srfi 125))
69 | )
70 |
71 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/ideque.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME IDEQUE
2 | ;;;
3 | ;;; Library implementing immutable deques. This library is part of the Scheme Red edition of
4 | ;;; the R7RS large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme ideque)
20 |
21 | (export ideque
22 | ideque-tabulate
23 | ideque-unfold
24 | ideque-unfold-right
25 | ideque?
26 | ideque-empty?
27 | ideque=
28 | ideque-any
29 | ideque-every
30 | ideque-front
31 | ideque-add-front
32 | ideque-remove-front
33 | ideque-back
34 | ideque-add-back
35 | ideque-remove-back
36 | ideque-ref
37 | ideque-take
38 | ideque-take-right
39 | ideque-drop
40 | ideque-drop-right
41 | ideque-split-at
42 | ideque-length
43 | ideque-append
44 | ideque-reverse
45 | ideque-count
46 | ideque-zip
47 | ideque-map
48 | ideque-filter-map
49 | ideque-for-each
50 | ideque-for-each-right
51 | ideque-fold
52 | ideque-fold-right
53 | ideque-append-map
54 | ideque-filter
55 | ideque-remove
56 | ideque-partition
57 | ideque-find
58 | ideque-find-right
59 | ideque-take-while
60 | ideque-take-while-right
61 | ideque-drop-while
62 | ideque-drop-while-right
63 | ideque-span
64 | ideque-break
65 | list->ideque
66 | ideque->list
67 | generator->ideque
68 | ideque->generator)
69 |
70 | (import (srfi 134))
71 | )
72 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/inexact.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME INEXACT
2 | ;;;
3 | ;;; Library exporting inexact mathematical functions. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme inexact)
19 |
20 | (export acos
21 | asin
22 | atan
23 | cos
24 | exp
25 | finite?
26 | infinite?
27 | log
28 | nan?
29 | sin
30 | sqrt
31 | tan)
32 |
33 | (import (lispkit math))
34 | )
35 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/lazy.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME LAZY
2 | ;;;
3 | ;;; Library implementing promises. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme lazy)
19 |
20 | (export delay
21 | delay-force
22 | force
23 | make-promise
24 | promise?)
25 |
26 | (import (lispkit core))
27 | )
28 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/load.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME LOAD
2 | ;;;
3 | ;;; Library exporting the `load` function. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme load)
19 |
20 | (export load)
21 |
22 | (import (lispkit system))
23 | )
24 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/process-context.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME PROCESS-CONTEXT
2 | ;;;
3 | ;;; Library exporting command-line related functions. This library is part of the
4 | ;;; R7RS standard.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme process-context)
20 |
21 | (export command-line
22 | exit
23 | emergency-exit
24 | get-environment-variable
25 | get-environment-variables)
26 |
27 | (import (lispkit system)
28 | (lispkit dynamic))
29 | )
30 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/r5rs-syntax.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME R5RS-SYNTAX
2 | ;;;
3 | ;;; Library exporting syntax definitions from R5RS. This library is used to implement
4 | ;;; `null-environment`.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme r5rs-syntax)
20 |
21 | (export and
22 | begin
23 | case
24 | cond
25 | define
26 | define-syntax
27 | delay
28 | do
29 | if
30 | lambda
31 | let
32 | let-syntax
33 | let*
34 | letrec
35 | letrec-syntax
36 | or
37 | quasiquote
38 | quote
39 | set!
40 | syntax-rules)
41 |
42 | (import (lispkit base))
43 | )
44 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/read.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME READ
2 | ;;;
3 | ;;; Library exporting `read`. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme read)
19 |
20 | (export read)
21 |
22 | (import (lispkit port))
23 | )
24 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/repl.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME REPL
2 | ;;;
3 | ;;; Library exporting `interaction-environment`. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme repl)
19 |
20 | (export interaction-environment)
21 |
22 | (import (lispkit core))
23 | )
24 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/sort.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME SORT
2 | ;;;
3 | ;;; Scheme sorting library. This library is part of the Scheme Red edition of the R7RS
4 | ;;; large language. It is incomplete in that it does not support mutable list-related
5 | ;;; procedures due to LispKit's lists being immutable. The following procedures are
6 | ;;; missing: `list-delete-neighbor-dups!`, `list-merge!`, `list-sort!`, `list-stable-sort!`.
7 | ;;;
8 | ;;; Author: Matthias Zenger
9 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
10 | ;;;
11 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
12 | ;;; except in compliance with the License. You may obtain a copy of the License at
13 | ;;;
14 | ;;; http://www.apache.org/licenses/LICENSE-2.0
15 | ;;;
16 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
17 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18 | ;;; either express or implied. See the License for the specific language governing permissions
19 | ;;; and limitations under the License.
20 |
21 | (define-library (scheme sort)
22 |
23 | (export list-sorted?
24 | vector-sorted?
25 | list-sort
26 | list-stable-sort
27 | ; list-sort!
28 | ; list-stable-sort!
29 | vector-sort
30 | vector-stable-sort
31 | vector-sort!
32 | vector-stable-sort!
33 | list-merge
34 | ; list-merge!
35 | vector-merge
36 | vector-merge!
37 | list-delete-neighbor-dups
38 | ; list-delete-neighbor-dups!
39 | vector-delete-neighbor-dups
40 | vector-delete-neighbor-dups!
41 | vector-find-median
42 | vector-find-median!
43 | vector-select!
44 | vector-separate!)
45 |
46 | (import (srfi 132))
47 | )
48 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/stream.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME STREAM
2 | ;;;
3 | ;;; Scheme stream library. This library is part of the Scheme Red edition of the R7RS
4 | ;;; large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme stream)
20 |
21 | (export stream-null
22 | stream-cons
23 | stream?
24 | stream-null?
25 | stream-pair?
26 | stream-car
27 | stream-cdr
28 | stream-lambda
29 | define-stream
30 | list->stream
31 | port->stream
32 | stream
33 | stream->list
34 | stream-append
35 | stream-concat
36 | stream-constant
37 | stream-drop
38 | stream-drop-while
39 | stream-filter
40 | stream-fold
41 | stream-for-each
42 | stream-from
43 | stream-iterate
44 | stream-length
45 | stream-let
46 | stream-map
47 | stream-match
48 | stream-of
49 | stream-range
50 | stream-ref
51 | stream-reverse
52 | stream-scan
53 | stream-take
54 | stream-take-while
55 | stream-unfold
56 | stream-unfolds
57 | stream-zip)
58 |
59 | (import (srfi 41))
60 | )
61 |
62 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/time.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME TIME
2 | ;;;
3 | ;;; Library exporting time-related functions. This library is part of the R7RS standard.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (define-library (scheme time)
19 |
20 | (export current-jiffy
21 | current-second
22 | jiffies-per-second)
23 |
24 | (import (lispkit system))
25 | )
26 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/vector.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME VECTOR
2 | ;;;
3 | ;;; Scheme vector library. This library is part of the Scheme Red edition of the R7RS
4 | ;;; large language.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme vector)
20 |
21 | (export make-vector
22 | vector
23 | vector-unfold
24 | vector-unfold-right
25 | vector-copy
26 | vector-reverse-copy
27 | vector-append
28 | vector-concatenate
29 | vector-append-subvectors
30 | vector?
31 | vector-empty?
32 | vector=
33 | vector-ref
34 | vector-length
35 | vector-fold
36 | vector-fold-right
37 | vector-map
38 | vector-map!
39 | vector-for-each
40 | vector-count
41 | vector-cumulate
42 | vector-index
43 | vector-index-right
44 | vector-skip
45 | vector-skip-right
46 | vector-binary-search
47 | vector-any vector-every
48 | vector-partition
49 | vector-set!
50 | vector-swap!
51 | vector-fill!
52 | vector-reverse!
53 | vector-copy!
54 | vector-reverse-copy!
55 | vector-unfold!
56 | vector-unfold-right!
57 | vector->list
58 | reverse-vector->list
59 | list->vector
60 | reverse-list->vector
61 | vector->string
62 | string->vector)
63 |
64 | (import (except (lispkit vector) vector-map!)
65 | (srfi 133))
66 | )
67 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/scheme/write.sld:
--------------------------------------------------------------------------------
1 | ;;; SCHEME WRITE
2 | ;;;
3 | ;;; Library exporting functions for writing data structures. This library is part of
4 | ;;; the R7RS standard.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
10 | ;;; except in compliance with the License. You may obtain a copy of the License at
11 | ;;;
12 | ;;; http://www.apache.org/licenses/LICENSE-2.0
13 | ;;;
14 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
15 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | ;;; either express or implied. See the License for the specific language governing permissions
17 | ;;; and limitations under the License.
18 |
19 | (define-library (scheme write)
20 |
21 | (export display
22 | write
23 | write-shared
24 | write-simple)
25 |
26 | (import (lispkit port))
27 | )
28 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/102.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 102
2 | ;;; Procedure Arity Inspection
3 | ;;;
4 | ;;; This SRFI identifies a common, core set of operations that make it possible to
5 | ;;; inspect the arity of procedures and determine if a given procedure accepts a
6 | ;;; given number of arguments.
7 | ;;;
8 | ;;; Author of spec: David Van Horn
9 | ;;;
10 | ;;; Copyright © 2021 Matthias Zenger. All rights reserved.
11 | ;;;
12 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
13 | ;;; except in compliance with the License. You may obtain a copy of the License at
14 | ;;;
15 | ;;; http://www.apache.org/licenses/LICENSE-2.0
16 | ;;;
17 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
18 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
19 | ;;; either express or implied. See the License for the specific language governing permissions
20 | ;;; and limitations under the License.
21 |
22 | (define-library (srfi 102)
23 |
24 | (export procedure-arity
25 | arity-at-least?
26 | arity-at-least-value
27 | procedure-arity-includes?)
28 |
29 | (import (lispkit core))
30 | )
31 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/11.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 11
2 | ;;; Syntax for receiving multiple values
3 | ;;;
4 | ;;; The SRFI introduces syntactic forms `let-values` and `let*-values` that bind the values
5 | ;;; of expressions that return multiple values.
6 | ;;;
7 | ;;; Author of spec: Lars T Hansen
8 | ;;;
9 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
10 | ;;;
11 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
12 | ;;; except in compliance with the License. You may obtain a copy of the License at
13 | ;;;
14 | ;;; http://www.apache.org/licenses/LICENSE-2.0
15 | ;;;
16 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
17 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18 | ;;; either express or implied. See the License for the specific language governing permissions
19 | ;;; and limitations under the License.
20 |
21 | (define-library (srfi 11)
22 |
23 | (export let-values
24 | let*-values)
25 |
26 | (import (lispkit control))
27 |
28 | ;; Both forms are implemented natively in library `(lispkit control)`
29 | )
30 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/111.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 111
2 | ;;; Boxes
3 | ;;;
4 | ;;; Boxes are objects with a single mutable state. Several Schemes have them, sometimes
5 | ;;; called cells. A constructor, predicate, accessor, and mutator are provided.
6 | ;;;
7 | ;;; Copyright © 2013 John Cowan. All rights reserved.
8 | ;;;
9 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
10 | ;;; software and associated documentation files (the "Software"), to deal in the Software
11 | ;;; without restriction, including without limitation the rights to use, copy, modify, merge,
12 | ;;; publish, distribute, sublicense, and/or sell copies of the Software, and to permit
13 | ;;; persons to whom the Software is furnished to do so, subject to the following conditions:
14 | ;;;
15 | ;;; The above copyright notice and this permission notice shall be included in all copies or
16 | ;;; substantial portions of the Software.
17 | ;;;
18 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19 | ;;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20 | ;;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
21 | ;;; FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 | ;;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | ;;; DEALINGS IN THE SOFTWARE.
24 | ;;;
25 | ;;; Adaptation to LispKit
26 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
27 |
28 | (define-library (srfi 111)
29 | (export box?
30 | box
31 | unbox
32 | set-box!)
33 | (import (lispkit base))
34 | )
35 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/112.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 112
2 | ;;; Environment Inquiry
3 | ;;;
4 | ;;; This is a library supporting environment inquiry, providing human-readable information
5 | ;;; at run time about the hardware and software configuration on which a Scheme program is
6 | ;;; being executed. They are mostly based on Common Lisp, with additions from the Posix
7 | ;;; `uname()` system call.
8 | ;;;
9 | ;;; Copyright © 2013 John Cowan. All rights reserved.
10 | ;;;
11 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
12 | ;;; software and associated documentation files (the "Software"), to deal in the Software
13 | ;;; without restriction, including without limitation the rights to use, copy, modify, merge,
14 | ;;; publish, distribute, sublicense, and/or sell copies of the Software, and to permit
15 | ;;; persons to whom the Software is furnished to do so, subject to the following conditions:
16 | ;;;
17 | ;;; The above copyright notice and this permission notice shall be included in all copies or
18 | ;;; substantial portions of the Software.
19 | ;;;
20 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21 | ;;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22 | ;;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23 | ;;; FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 | ;;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 | ;;; DEALINGS IN THE SOFTWARE.
26 | ;;;
27 | ;;; Adaptation to LispKit
28 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
29 |
30 | (define-library (srfi 112)
31 | (export implementation-name
32 | implementation-version
33 | cpu-architecture
34 | machine-name
35 | os-type
36 | os-version)
37 | (import (lispkit base))
38 | )
39 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/118.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 118
2 | ;;; Simple adjustable-size strings
3 | ;;;
4 | ;;; Scheme specifies mutable fixed-length strings. We add two procedures
5 | ;;; `string-append!` and `string-replace!` which allow the size of the string
6 | ;;; to change. We also require that the standard Scheme procedures `make-string`
7 | ;;; and `string-copy` return variable-size strings.
8 | ;;;
9 | ;;; Specification:
10 | ;;; Copyright © 2015 Per Bothner. All rights reserved.
11 | ;;;
12 | ;;; Implementation:
13 | ;;; Copyright © 2022 Matthias Zenger. All rights reserved.
14 | ;;;
15 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy
16 | ;;; of this software and associated documentation files (the "Software"), to deal
17 | ;;; in the Software without restriction, including without limitation the rights
18 | ;;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19 | ;;; copies of the Software, and to permit persons to whom the Software is
20 | ;;; furnished to do so, subject to the following conditions:
21 | ;;;
22 | ;;; The above copyright notice and this permission notice shall be included in
23 | ;;; all copies or substantial portions of the Software.
24 | ;;;
25 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 | ;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 | ;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 | ;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 | ;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 | ;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31 | ;;; DEALINGS IN THE SOFTWARE.
32 |
33 | (define-library (srfi 118)
34 |
35 | (export string-append!
36 | string-replace!)
37 |
38 | (import (except (lispkit base) string-replace!))
39 |
40 | (begin
41 | (define (string-replace! dst dst-start dst-end src . args)
42 | (let-optionals args ((start 0)
43 | (end (string-length src)))
44 | (string-insert! dst (substring src start end) dst-start dst-end)))
45 | )
46 | )
47 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/131.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 131
2 | ;;; ERR5RS Record Syntax (reduced)
3 | ;;;
4 | ;;; This SRFI is a reduced version of the SRFI 99 syntactic layer that can be
5 | ;;; implemented with syntax-rules without requiring low-level macros. Like
6 | ;;; SRFI-99's syntax layer, it is backward compatible with the `define-record-type`
7 | ;;; macro from SRFI 9 or R7RS-small. It is forward compatible with SRFI 99.
8 | ;;;
9 | ;;; Author of spec: John Cowan, Will Clinger
10 | ;;;
11 | ;;; Copyright © 2023 Matthias Zenger. All rights reserved.
12 | ;;;
13 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
14 | ;;; except in compliance with the License. You may obtain a copy of the License at
15 | ;;;
16 | ;;; http://www.apache.org/licenses/LICENSE-2.0
17 | ;;;
18 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
19 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
20 | ;;; either express or implied. See the License for the specific language governing permissions
21 | ;;; and limitations under the License.
22 |
23 | (define-library (srfi 131)
24 |
25 | (export define-record-type)
26 |
27 | (import (lispkit record))
28 |
29 | ;; The form is implemented natively in library `(lispkit record)`
30 | )
31 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/137.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 137
2 | ;;; Minimal Unique Types
3 | ;;;
4 | ;;; This SRFI is intended to standardize a primitive run-time mechanism to create
5 | ;;; disjoint types. This mechanism provides a simple hook to create new data types at
6 | ;;; run time that are disjoint from all existing types. allowing portable libraries to
7 | ;;; implement SRFI 9, SRFI 99, SRFI 131, SRFI 135, R6RS records, Chicken records, CLOS,
8 | ;;; persistent databases, remote access to data on servers, and the like on top of it.
9 | ;;; It is also portably implementable and usable entirely separately from any of these.
10 | ;;;
11 | ;;; Note that there is no concept of a type object here: a type is simply a name for a
12 | ;;; group of closely linked procedures that allow the creation and manipulation of type
13 | ;;; instances (which are objects) and subtypes. This SRFI exposes no ambient authority,
14 | ;;; and relies entirely on module exports for access control.
15 | ;;;
16 | ;;; Author of spec: John Cowan, Marc Nieper-Wißkirchen
17 | ;;;
18 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
19 | ;;;
20 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
21 | ;;; except in compliance with the License. You may obtain a copy of the License at
22 | ;;;
23 | ;;; http://www.apache.org/licenses/LICENSE-2.0
24 | ;;;
25 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
26 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
27 | ;;; either express or implied. See the License for the specific language governing permissions
28 | ;;; and limitations under the License.
29 |
30 | (define-library (srfi 137)
31 | (export make-type)
32 | (import (rename (lispkit base)
33 | (make-type native-make-type)))
34 |
35 | (begin
36 | (define (make-make-type mk-type)
37 | (lambda (payload)
38 | (let-values (((tpe constructor predicate accessor mk-subtype) (mk-type payload)))
39 | (values (lambda () payload)
40 | constructor
41 | predicate
42 | accessor
43 | (make-make-type mk-subtype)))))
44 |
45 | (define make-type (make-make-type native-make-type))
46 | )
47 | )
48 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/145.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 145
2 | ;;; Assumptions
3 | ;;;
4 | ;;; This SRFI specifies a means to denote the invalidity of certain code paths in a
5 | ;;; Scheme program. It allows Scheme code to turn the evaluation into a user-defined
6 | ;;; error that need not be signalled by the implementation. Optimizing compilers may
7 | ;;; use these denotations to produce better code and to issue better warnings about
8 | ;;; dead code.
9 | ;;;
10 | ;;; Author of spec: Marc Nieper-Wißkirchen
11 | ;;;
12 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
13 | ;;;
14 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
15 | ;;; except in compliance with the License. You may obtain a copy of the License at
16 | ;;;
17 | ;;; http://www.apache.org/licenses/LICENSE-2.0
18 | ;;;
19 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
20 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
21 | ;;; either express or implied. See the License for the specific language governing permissions
22 | ;;; and limitations under the License.
23 |
24 | (define-library (srfi 145)
25 | (export assume)
26 | (import (lispkit base))
27 |
28 | (begin
29 | (define-syntax assume
30 | (syntax-rules ()
31 | ((_ expression message ...)
32 | (unless expression (error "invalid assumption" (quote expression) message ...)))))
33 | )
34 | )
35 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/149.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 149
2 | ;;; Basic syntax-rules template extensions
3 | ;;;
4 | ;;; The rules for valid ``s of `` are slightly softened
5 | ;;; to allow for more than one consecutive `` in subtemplates, and to
6 | ;;; allow pattern variables in subtemplates to be followed by more instances of
7 | ;;; the identifier `` than they are followed in the subpattern in which
8 | ;;; they occur.
9 | ;;;
10 | ;;; Author of spec: Marc Nieper-Wißkirchen
11 | ;;;
12 | ;;; Copyright © 2022 Matthias Zenger. All rights reserved.
13 | ;;;
14 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use
15 | ;;; this file except in compliance with the License. You may obtain a copy of the
16 | ;;; License at
17 | ;;;
18 | ;;; http://www.apache.org/licenses/LICENSE-2.0
19 | ;;;
20 | ;;; Unless required by applicable law or agreed to in writing, software distributed
21 | ;;; under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
22 | ;;; CONDITIONS OF ANY KIND, either express or implied. See the License for the
23 | ;;; specific language governing permissions and limitations under the License.
24 |
25 | (define-library (srfi 149)
26 |
27 | (export syntax-rules)
28 |
29 | (import (lispkit core))
30 |
31 | ;; `syntax-rules` is implemented natively already in LispKit with the extensions of
32 | ;; SRFI 149.
33 | )
34 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/16.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 16
2 | ;;; Syntax for procedures of variable arity
3 | ;;;
4 | ;;; The SRFI introduces `case-lambda`, a syntax for procedures with a variable number
5 | ;;; of arguments. `case-lambda` reduces the clutter of procedures that execute different
6 | ;;; code depending on the number of arguments they were passed. It is a pattern-matching
7 | ;;; mechanism that matches on the number of arguments. CASE-LAMBDA is available in some
8 | ;;; Scheme systems.
9 | ;;;
10 | ;;; Author of spec: Lars T Hansen
11 | ;;;
12 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
13 | ;;;
14 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
15 | ;;; except in compliance with the License. You may obtain a copy of the License at
16 | ;;;
17 | ;;; http://www.apache.org/licenses/LICENSE-2.0
18 | ;;;
19 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
20 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
21 | ;;; either express or implied. See the License for the specific language governing permissions
22 | ;;; and limitations under the License.
23 |
24 | (define-library (srfi 16)
25 |
26 | (export case-lambda)
27 |
28 | (import (lispkit core))
29 |
30 | ;; `case-lambda` is implemented natively in library `(lispkit core)`
31 | )
32 |
33 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/166/pretty.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 166 PRETTY
2 | ;;; Monadic Formatting
3 | ;;;
4 | ;;; A library of procedures for formatting Scheme objects to text in various ways, and
5 | ;;; for easily concatenating, composing and extending these formatters efficiently
6 | ;;; without resorting to capturing and manipulating intermediate strings. This SRFI is
7 | ;;; an updated version of SRFI 159, primarily with the difference that state variables
8 | ;;; are hygienic.
9 | ;;;
10 | ;;; Copyright © 2020 Marc Nieper-Wißkirchen. All rights reserved.
11 | ;;;
12 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
13 | ;;; software and associated documentation files (the "Software"), to deal in the Software
14 | ;;; without restriction, including without limitation the rights to use, copy, modify, merge,
15 | ;;; publish, distribute, sublicense, and/or sell copies of the Software, and to permit
16 | ;;; persons to whom the Software is furnished to do so, subject to the following conditions:
17 | ;;;
18 | ;;; The above copyright notice and this permission notice shall be included in all copies or
19 | ;;; substantial portions of the Software.
20 | ;;;
21 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
22 | ;;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 | ;;; PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25 | ;;; CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
26 | ;;; OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 | ;;;
28 | ;;; LispKit Port:
29 | ;;; Copyright © 2021 Matthias Zenger. All rights reserved.
30 |
31 | (define-library (srfi 166 pretty)
32 |
33 | (export pretty
34 | pretty-shared
35 | pretty-simply
36 | pretty-color)
37 |
38 | (import (scheme base)
39 | (srfi 166 base))
40 |
41 | (begin
42 | (define pretty #f) ;FIXME
43 | (define pretty-shared #f) ;FIXME
44 | (define pretty-simply #f) ;FIXME
45 | (define pretty-color #f) ;FIXME
46 | )
47 | )
48 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/173.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 173
2 | ;;; Hooks
3 | ;;;
4 | ;;; This library describes a mechanism known as hooks. Hooks are a certain kind of
5 | ;;; extension point in a program that allows interleaving the execution of arbitrary
6 | ;;; code with the execution of the program without introducing any coupling between
7 | ;;; the two.
8 | ;;;
9 | ;;; Author of spec: Amirouche Boubekki
10 | ;;;
11 | ;;; Copyright © 2019 Matthias Zenger. All rights reserved.
12 | ;;;
13 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
14 | ;;; except in compliance with the License. You may obtain a copy of the License at
15 | ;;;
16 | ;;; http://www.apache.org/licenses/LICENSE-2.0
17 | ;;;
18 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
19 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
20 | ;;; either express or implied. See the License for the specific language governing permissions
21 | ;;; and limitations under the License.
22 |
23 | (define-library (srfi 173)
24 |
25 | (export make-hook
26 | hook?
27 | hook-type-tag
28 | hook-add!
29 | hook-delete!
30 | hook-reset!
31 | hook->list
32 | hook-run)
33 |
34 | (import (lispkit base))
35 |
36 | (begin
37 |
38 | (define-values (hook-type-tag new-hook hook? hook-ref make-hook-subtype) (make-type 'hook))
39 |
40 | (define (make-hook arity)
41 | (new-hook (cons arity (box '()))))
42 |
43 | (define (hook-add! hook proc)
44 | (let ((procs (cdr (hook-ref hook))))
45 | (set-box! procs (cons proc (unbox procs)))))
46 |
47 | (define (hook-delete! hook proc)
48 | (let ((procs (cdr (hook-ref hook))))
49 | (set-box! procs (remove (lambda (x) (eq? x proc)) (unbox procs)))))
50 |
51 | (define (hook-reset! hook)
52 | (set-box! (cdr (hook-ref hook)) '()))
53 |
54 | (define (hook->list hook)
55 | (unbox (cdr (hook-ref hook))))
56 |
57 | (define (hook-run hook . args)
58 | (if (not (= (length args) (car (hook-ref hook))))
59 | (error "arity of hook ($0) does not match number of arguments ($1)"
60 | (car (hook-ref hook))
61 | (length args)))
62 | (for-each (lambda (proc) (apply proc args))
63 | (hook->list hook)))
64 | )
65 | )
66 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/195.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 195
2 | ;;; Multiple-value boxes
3 | ;;;
4 | ;;; Boxes are objects with a single mutable state. Several Schemes have them, sometimes
5 | ;;; called cells. A constructor, predicate, accessor, and mutator are provided.
6 | ;;; This SRFI extends the specification of the boxes of SRFI 111 so that they are
7 | ;;; multiple-values aware. Whereas a SRFI 111 box is limited in that it can only
8 | ;;; box a single value, multiple values can be boxed with this SRFI.
9 | ;;;
10 | ;;; Copyright © 2020 Marc Nieper-Wißkirchen. All rights reserved.
11 | ;;;
12 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
13 | ;;; software and associated documentation files (the "Software"), to deal in the Software
14 | ;;; without restriction, including without limitation the rights to use, copy, modify, merge,
15 | ;;; publish, distribute, sublicense, and/or sell copies of the Software, and to permit
16 | ;;; persons to whom the Software is furnished to do so, subject to the following conditions:
17 | ;;;
18 | ;;; The above copyright notice and this permission notice shall be included in all copies or
19 | ;;; substantial portions of the Software.
20 | ;;;
21 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
22 | ;;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 | ;;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
24 | ;;; FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25 | ;;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 | ;;; DEALINGS IN THE SOFTWARE.
27 | ;;;
28 | ;;; Adaptation to LispKit
29 | ;;; Copyright © 2020 Matthias Zenger. All rights reserved.
30 |
31 | (define-library (srfi 195)
32 | (export box?
33 | box
34 | unbox
35 | set-box!)
36 | (import (lispkit base)))
37 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/2.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 2
2 | ;;; AND-LET*: an AND with local bindings, a guarded LET* special form
3 | ;;;
4 | ;;; Like an ordinary AND, an AND-LET* special form evaluates its arguments - expressions - one
5 | ;;; after another in order, till the first one that yields #f. Unlike AND, however, a non-#f
6 | ;;; result of one expression can be bound to a fresh variable and used in the subsequent
7 | ;;; expressions. AND-LET* is a cross-breed between LET* and AND.
8 | ;;;
9 | ;;; Author of spec: Oleg Kiselyov
10 | ;;;
11 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
12 | ;;;
13 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
14 | ;;; except in compliance with the License. You may obtain a copy of the License at
15 | ;;;
16 | ;;; http://www.apache.org/licenses/LICENSE-2.0
17 | ;;;
18 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
19 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
20 | ;;; either express or implied. See the License for the specific language governing permissions
21 | ;;; and limitations under the License.
22 |
23 | (define-library (srfi 2)
24 |
25 | (export and-let*)
26 |
27 | (import (lispkit base))
28 |
29 | (begin
30 | (define-syntax and-let*
31 | (syntax-rules ()
32 | ; no claws
33 | ((and-let* ())
34 | #t)
35 | ((and-let* () body ...)
36 | (begin body ...))
37 | ; claws but no body
38 | ((and-let* ((var expr)))
39 | (let ((var expr)) var))
40 | ((and-let* ((expr)))
41 | expr)
42 | ((and-let* (var))
43 | (begin (let ((var #f)) #f) var)) ; do this to check that `var` is an identifier
44 | ; both claws and body
45 | ((and-let* ((var expr) . bindings) . body)
46 | (let ((var expr)) (and var (and-let* bindings . body))))
47 | ((and-let* ((expr) . bindings) . body)
48 | (and expr (and-let* bindings . body)))
49 | ((and-let* (var . bindings) . body)
50 | (begin (let ((var #f)) #f) (and var (and-let* bindings . body))))))
51 | )
52 | )
53 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/208.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 208
2 | ;;; NaN procedures
3 | ;;;
4 | ;;; This SRFI provides procedures that dissect NaN (Not a Number) inexact values.
5 | ;;; IEEE 754:2008 is a standard for floating point numbers used on essentially all modern
6 | ;;; CPUs that have hardware floating point support. It specifies a set of floating-point
7 | ;;; values known as NaNs, i.e. "Not A Number". They are generated by such operations
8 | ;;; as `(/ 0.0 0.0)`, the mathematical result of which could be any number whatsoever, and
9 | ;;; by `(flsqrt -1.0)` from SRFI 144, the result of which cannot be any floating-point
10 | ;;; number. Scheme implementations that conform to R7RS use the external representations
11 | ;;; `+nan.0` and `-nan.0` for NaNs, and the procedure `nan?` will return `#t` when applied
12 | ;;; to any inexact real number (on R7RS systems, any inexact number) that is a NaN.
13 | ;;; In fact, however, there are 252 - 1 possible NaN values, assuming the representation
14 | ;;; is an IEEE binary64 float. This SRFI makes it possible to dissect a NaN to see which
15 | ;;; of these internal representations it corresponds to.
16 | ;;;
17 | ;;; Author of spec: Emmanuel Medernach, John Cowan
18 | ;;;
19 | ;;; Copyright © 2022 Matthias Zenger. All rights reserved.
20 | ;;;
21 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
22 | ;;; file except in compliance with the License. You may obtain a copy of the License at
23 | ;;;
24 | ;;; http://www.apache.org/licenses/LICENSE-2.0
25 | ;;;
26 | ;;; Unless required by applicable law or agreed to in writing, software distributed under
27 | ;;; the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
28 | ;;; ANY KIND, either express or implied. See the License for the specific language
29 | ;;; governing permissions and limitations under the License.
30 |
31 | (define-library (srfi 208)
32 |
33 | (export make-nan
34 | nan-negative?
35 | nan-quiet?
36 | nan-payload
37 | nan=?)
38 |
39 | (import (lispkit base)
40 | (rename (lispkit internal) (make-nan internal-make-nan)))
41 |
42 | (begin
43 |
44 | (define (make-nan neg quiet payload . args)
45 | (internal-make-nan neg quiet payload))
46 |
47 | (define (nan=? nan1 nan2)
48 | (assert (nan? nan1) (nan? nan2))
49 | (flbits=? nan1 nan2))
50 | )
51 | )
52 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/227.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 227
2 | ;;; Optional Arguments
3 | ;;;
4 | ;;; This SRFI specifies the `opt-lambda` syntax, which generalizes `lambda`. An
5 | ;;; `opt-lambda` expression evaluates to a procedure that takes a number of
6 | ;;; required and a number of optional (positional) arguments whose default values
7 | ;;; are determined by evaluating corresponding expressions when the procedure is
8 | ;;; called. This SRFI also specifies a variation `opt*-lambda`, which is to
9 | ;;; `opt-lambda` as `let*` is to `let` and the related binding constructs
10 | ;;; `let-optionals` and `let-optionals*`. Finally, for those who prefer less explicit
11 | ;;; procedure definitions, `define-optionals` and `define-optionals*` are provided.
12 | ;;;
13 | ;;; Author of spec: Marc Nieper-Wißkirchen
14 | ;;;
15 | ;;; Copyright © 2021 Matthias Zenger. All rights reserved.
16 | ;;;
17 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use
18 | ;;; this file except in compliance with the License. You may obtain a copy of the
19 | ;;; License at
20 | ;;;
21 | ;;; http://www.apache.org/licenses/LICENSE-2.0
22 | ;;;
23 | ;;; Unless required by applicable law or agreed to in writing, software distributed
24 | ;;; under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
25 | ;;; CONDITIONS OF ANY KIND, either express or implied. See the License for the
26 | ;;; specific language governing permissions and limitations under the License.
27 |
28 | (define-library (srfi 227)
29 |
30 | (export (rename let*-optionals let-optionals*)
31 | let-optionals
32 | opt-lambda
33 | opt*-lambda
34 | define-optionals
35 | define-optionals*)
36 |
37 | (import (lispkit base))
38 | )
39 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/229.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 229
2 | ;;; Tagged Procedures
3 | ;;;
4 | ;;; This SRFI defines tagged procedures, which are procedures that are tagged with
5 | ;;; a Scheme value when created through the syntax `lambda/tag` and `case-lambda/tag`.
6 | ;;; The value of the tag of a procedure can be retrieved with `procedure-tag`, and
7 | ;;; the predicate `procedure/tag?` discerns whether a procedure is tagged.
8 | ;;;
9 | ;;; Author of spec: Marc Nieper-Wißkirchen
10 | ;;;
11 | ;;; Copyright © 2021 Matthias Zenger. All rights reserved.
12 | ;;;
13 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
14 | ;;; except in compliance with the License. You may obtain a copy of the License at
15 | ;;;
16 | ;;; http://www.apache.org/licenses/LICENSE-2.0
17 | ;;;
18 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
19 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
20 | ;;; either express or implied. See the License for the specific language governing permissions
21 | ;;; and limitations under the License.
22 |
23 | (define-library (srfi 229)
24 |
25 | (export case-lambda/tag
26 | lambda/tag
27 | procedure/tag?
28 | procedure-tag)
29 |
30 | (import (lispkit base))
31 | )
32 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/23.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 23
2 | ;;; Error reporting mechanism
3 | ;;;
4 | ;;; The SRFI introduces a mechanism which allows Scheme code to report errors and abort
5 | ;;; the execution.
6 | ;;;
7 | ;;; Author of spec: Stephan Houben
8 | ;;;
9 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
10 | ;;;
11 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
12 | ;;; except in compliance with the License. You may obtain a copy of the License at
13 | ;;;
14 | ;;; http://www.apache.org/licenses/LICENSE-2.0
15 | ;;;
16 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
17 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18 | ;;; either express or implied. See the License for the specific language governing permissions
19 | ;;; and limitations under the License.
20 |
21 | (define-library (srfi 23)
22 |
23 | (export error)
24 |
25 | (import (lispkit dynamic))
26 |
27 | ;; `error` is implemented natively in library `(lispkit dynamic)`
28 | )
29 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/236.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 236
2 | ;;; Evaluating expressions in an unspecified order
3 | ;;;
4 | ;;; This SRFI defines the independently syntax, which can be used to
5 | ;;; combine side effects into one expression without specifying their
6 | ;;; relative order.
7 | ;;;
8 | ;;; Copyright © 2022 Marc Nieper-Wißkirchen. All rights reserved.
9 | ;;;
10 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy
11 | ;;; of this software and associated documentation files (the "Software"), to deal
12 | ;;; in the Software without restriction, including without limitation the rights
13 | ;;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | ;;; copies of the Software, and to permit persons to whom the Software is
15 | ;;; furnished to do so, subject to the following conditions:
16 | ;;;
17 | ;;; The above copyright notice and this permission notice shall be included in all
18 | ;;; copies or substantial portions of the Software.
19 | ;;;
20 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | ;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22 | ;;; FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23 | ;;; COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 | ;;; IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 | ;;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | ;;;
27 | ;;; Adaptation to LispKit
28 | ;;; Copyright © 2023 Matthias Zenger. All rights reserved.
29 |
30 | (define-library (srfi 236)
31 |
32 | (export independently)
33 |
34 | (import (lispkit base))
35 |
36 | (begin
37 | (define-syntax independently
38 | (syntax-rules ()
39 | ((independently expr ...)
40 | (independently-aux (expr ...)))))
41 | (define-syntax independently-aux
42 | (syntax-rules ()
43 | ((independently-aux () (expr tmp) ...)
44 | (let ((tmp (begin expr #f)) ...) (values)))
45 | ((independently-aux (expr . exprs) . binds)
46 | (independently-aux exprs (expr tmp) . binds))))
47 | )
48 | )
49 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/258.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 258
2 | ;;; Uninterned Symbols
3 | ;;;
4 | ;;; This SRFI provides functionality to deal with uninterend symbols.
5 | ;;; An uninterned symbol is not the same as any other symbol, even one
6 | ;;; with the same name. These symbols are useful in macro programming
7 | ;;; and in other situations where guaranteed-unique names are needed.
8 | ;;;
9 | ;;; Author of spec: Wolfgang Corcoran-Mathe.
10 | ;;;
11 | ;;; Copyright © 2025 Matthias Zenger. All rights reserved.
12 | ;;;
13 | ;;; Permission is hereby granted, free of charge, to any person obtaining
14 | ;;; a copy of this software and associated documentation files (the
15 | ;;; "Software"), to deal in the Software without restriction, including
16 | ;;; without limitation the rights to use, copy, modify, merge, publish,
17 | ;;; distribute, sublicense, and/or sell copies of the Software, and to
18 | ;;; permit persons to whom the Software is furnished to do so, subject to
19 | ;;; the following conditions:
20 | ;;;
21 | ;;; The above copyright notice and this permission notice shall be included
22 | ;;; in all copies or substantial portions of the Software.
23 | ;;;
24 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 | ;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
26 | ;;; FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
27 | ;;; COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
28 | ;;; IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 | ;;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | (define-library (srfi 258)
32 |
33 | (export generate-uninterned-symbol
34 | string->uninterned-symbol
35 | symbol-interned?)
36 |
37 | (import (lispkit base))
38 | )
39 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/31.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 31
2 | ;;; A special form rec for recursive evaluation.
3 | ;;;
4 | ;;; This SRFI implements a special form called `rec`. This form is a generalization and
5 | ;;; combination of the forms `rec` and `named-lambda` of [Clinger1985]. It allows the
6 | ;;; simple and non-imperative construction of self-referential expressions. As an important
7 | ;;; special case, it extends the A. Church form lambda such that it allows the direct
8 | ;;; definition of recursive procedures without using further special forms like `let` or
9 | ;;; `letrec`, without using advanced constructions like the H. B. Curry combinator and,
10 | ;;; unlike `define`, without introducing variable bindings into the external environment.
11 | ;;;
12 | ;;; Author of spec: Mirko Luedde (mirko.luedde@sap.com)
13 | ;;;
14 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
15 | ;;;
16 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
17 | ;;; except in compliance with the License. You may obtain a copy of the License at
18 | ;;;
19 | ;;; http://www.apache.org/licenses/LICENSE-2.0
20 | ;;;
21 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
22 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
23 | ;;; either express or implied. See the License for the specific language governing permissions
24 | ;;; and limitations under the License.
25 |
26 | (define-library (srfi 31)
27 | (export rec)
28 | (import (lispkit base))
29 |
30 | (begin
31 | (define-syntax rec
32 | (syntax-rules ()
33 | ((rec (name . args) body ...)
34 | (letrec ((name (lambda args body ...))) name))
35 | ((rec name expr)
36 | (letrec ((name expr)) name)))))
37 | )
38 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/34.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 34
2 | ;;; Exception Handling for Programs
3 | ;;;
4 | ;;; This SRFI defines exception-handling and exception-raising constructs for Scheme, including
5 | ;;; - a `with-exception-handler` procedure and a `guard` form for installing
6 | ;;; exception-handling procedures,
7 | ;;; - a `raise` procedure for invoking the current exception handler.
8 | ;;;
9 | ;;; Author of spec: Richard Kelsey, Michael Sperber
10 | ;;;
11 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
12 | ;;;
13 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
14 | ;;; except in compliance with the License. You may obtain a copy of the License at
15 | ;;;
16 | ;;; http://www.apache.org/licenses/LICENSE-2.0
17 | ;;;
18 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
19 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
20 | ;;; either express or implied. See the License for the specific language governing permissions
21 | ;;; and limitations under the License.
22 |
23 | (define-library (srfi 34)
24 |
25 | (export with-exception-handler
26 | guard
27 | raise)
28 |
29 | (import (lispkit dynamic))
30 |
31 | ;; `with-exception-handler`, `guard`, and `raise` are implemented natively in
32 | ;; library `(lispkit dynamic)`
33 | )
34 |
35 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/39.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 39
2 | ;;; Parameter objects
3 | ;;;
4 | ;;; This SRFI defines parameter objects, the procedure `make-parameter` to create parameter
5 | ;;; objects and the `parameterize` special form to dynamically bind parameter objects.
6 | ;;; In the dynamic environment, each parameter object is bound to a cell containing the
7 | ;;; value of the parameter. When a procedure is called, the called procedure inherits the
8 | ;;; dynamic environment from the caller. The `parameterize` special form allows the binding
9 | ;;; of a parameter object to be changed for the dynamic extent of its body.
10 | ;;;
11 | ;;; Author of spec: Marc Feeley
12 | ;;;
13 | ;;; Copyright © 2018 Matthias Zenger. All rights reserved.
14 | ;;;
15 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
16 | ;;; except in compliance with the License. You may obtain a copy of the License at
17 | ;;;
18 | ;;; http://www.apache.org/licenses/LICENSE-2.0
19 | ;;;
20 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
21 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
22 | ;;; either express or implied. See the License for the specific language governing permissions
23 | ;;; and limitations under the License.
24 |
25 | (define-library (srfi 39)
26 |
27 | (export make-parameter
28 | parameterize)
29 |
30 | (import (lispkit dynamic))
31 |
32 | ;; `make-parameter` and `parameterize` are implemented natively in library
33 | ;; `(lispkit dynamic)`
34 | )
35 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/46.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 46
2 | ;;; Basic Syntax-rules Extensions
3 | ;;;
4 | ;;; This SRFI proposes two extensions to the R5RS1 syntax-rules pattern language:
5 | ;;; the first allows syntax-rules macros to generate macros, where the macro-generated
6 | ;;; macros use ellipsis that is not used by the macro-generating macros; the second allows
7 | ;;; for 'tail patterns.'
8 | ;;;
9 | ;;; Author of spec: Taylor Campbell
10 | ;;;
11 | ;;; Copyright © 2019 Matthias Zenger. All rights reserved.
12 | ;;;
13 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
14 | ;;; except in compliance with the License. You may obtain a copy of the License at
15 | ;;;
16 | ;;; http://www.apache.org/licenses/LICENSE-2.0
17 | ;;;
18 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
19 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
20 | ;;; either express or implied. See the License for the specific language governing permissions
21 | ;;; and limitations under the License.
22 |
23 | (define-library (srfi 46)
24 |
25 | (export syntax-rules)
26 |
27 | (import (lispkit core))
28 | )
29 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/55.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 55
2 | ;;; require-extension
3 | ;;;
4 | ;;; This SRFI specifies an extremely simple facility for making an extension or library
5 | ;;; available to a Scheme toplevel environment.
6 | ;;;
7 | ;;; Authors of spec: Felix L. Winkelmann, D.C. Frost
8 | ;;;
9 | ;;; Copyright © 2019 Matthias Zenger. All rights reserved.
10 | ;;;
11 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
12 | ;;; except in compliance with the License. You may obtain a copy of the License at
13 | ;;;
14 | ;;; http://www.apache.org/licenses/LICENSE-2.0
15 | ;;;
16 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
17 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18 | ;;; either express or implied. See the License for the specific language governing permissions
19 | ;;; and limitations under the License.
20 |
21 | (define-library (srfi 55)
22 |
23 | (export require-extension)
24 |
25 | (import (lispkit base))
26 |
27 | (begin
28 | (define-syntax require-extension
29 | (syntax-rules ()
30 | ((require-extension (prefix mod ...))
31 | (begin (import (prefix mod) ...)))))
32 | )
33 | )
34 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/6.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 6
2 | ;;; Basic string ports
3 | ;;;
4 | ;;; Scheme's I/O primitives are extended by adding three new procedures that create an input
5 | ;;; port from a string, create an output port whose contents are accumulated in Scheme's
6 | ;;; working memory instead of an external file, and extract the accumulated contents of an
7 | ;;; in-memory output port and return them in the form of a string.
8 | ;;;
9 | ;;; Copyright © 1999 William D Clinger. All rights reserved.
10 | ;;;
11 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
12 | ;;; software and associated documentation files (the "Software"), to deal in the Software
13 | ;;; without restriction, including without limitation the rights to use, copy, modify, merge,
14 | ;;; publish, distribute, sublicense, and/or sell copies of the Software, and to permit
15 | ;;; persons to whom the Software is furnished to do so, subject to the following conditions:
16 | ;;;
17 | ;;; The above copyright notice and this permission notice shall be included in all copies or
18 | ;;; substantial portions of the Software.
19 | ;;;
20 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21 | ;;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22 | ;;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23 | ;;; FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 | ;;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 | ;;; DEALINGS IN THE SOFTWARE.
26 | ;;;
27 | ;;; Adaptation to LispKit
28 | ;;; Copyright © 2020 Matthias Zenger. All rights reserved.
29 |
30 | (define-library (srfi 6)
31 |
32 | (export open-input-string
33 | open-output-string
34 | get-output-string)
35 |
36 | (import (lispkit port))
37 |
38 | ;; all exported procedures are implemented natively in library `(lispkit port)`
39 | )
40 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/8.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 8
2 | ;;; Binding to multiple values
3 | ;;;
4 | ;;; The only mechanism that R5RS provides for binding identifiers to the values of a
5 | ;;; multiple-valued expression is the primitive call-with-values. This SRFI proposes
6 | ;;; a more concise, more readable syntax for creating such bindings.
7 | ;;;
8 | ;;; Copyright © 1999 John David Stone. All rights reserved.
9 | ;;;
10 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
11 | ;;; software and associated documentation files (the "Software"), to deal in the Software
12 | ;;; without restriction, including without limitation the rights to use, copy, modify, merge,
13 | ;;; publish, distribute, sublicense, and/or sell copies of the Software, and to permit
14 | ;;; persons to whom the Software is furnished to do so, subject to the following conditions:
15 | ;;;
16 | ;;; The above copyright notice and this permission notice shall be included in all copies or
17 | ;;; substantial portions of the Software.
18 | ;;;
19 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
20 | ;;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 | ;;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
22 | ;;; FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 | ;;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 | ;;; DEALINGS IN THE SOFTWARE.
25 | ;;;
26 | ;;; Adaptation to LispKit
27 | ;;; Copyright © 2017 Matthias Zenger. All rights reserved.
28 |
29 | (define-library (srfi 8)
30 |
31 | (export receive)
32 |
33 | (import (lispkit base))
34 |
35 | (begin
36 | (define-syntax receive
37 | (syntax-rules ()
38 | ((receive formals expression body ...)
39 | (call-with-values (lambda () expression)
40 | (lambda formals body ...)))))
41 | )
42 | )
43 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/87.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 87
2 | ;;; `=>` in case clauses
3 | ;;;
4 | ;;; This SRFI proposes an extension to the `case` syntax to allow `=>` clauses as in `cond`.
5 | ;;;
6 | ;;; Author of spec: Chongkai Zhu
7 | ;;;
8 | ;;; Copyright © 2020 Matthias Zenger. All rights reserved.
9 | ;;;
10 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
11 | ;;; except in compliance with the License. You may obtain a copy of the License at
12 | ;;;
13 | ;;; http://www.apache.org/licenses/LICENSE-2.0
14 | ;;;
15 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
16 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 | ;;; either express or implied. See the License for the specific language governing permissions
18 | ;;; and limitations under the License.
19 |
20 | (define-library (srfi 87)
21 |
22 | (export case)
23 |
24 | (import (lispkit control))
25 |
26 | ;; The form is implemented natively in library `(lispkit control)`
27 | )
28 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/9.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 9
2 | ;;; Defining Record Types
3 | ;;;
4 | ;;; This SRFI describes syntax for creating new data types, called record types. A predicate,
5 | ;;; constructor, and field accessors and modifiers are defined for each record type. Each new
6 | ;;; record type is distinct from all existing types, including other record types and Scheme's
7 | ;;; predefined types.
8 | ;;;
9 | ;;; Copyright © 1999 Richard Kelsey. All rights reserved.
10 | ;;;
11 | ;;; Permission is hereby granted, free of charge, to any person obtaining a copy of this
12 | ;;; software and associated documentation files (the "Software"), to deal in the Software
13 | ;;; without restriction, including without limitation the rights to use, copy, modify, merge,
14 | ;;; publish, distribute, sublicense, and/or sell copies of the Software, and to permit
15 | ;;; persons to whom the Software is furnished to do so, subject to the following conditions:
16 | ;;;
17 | ;;; The above copyright notice and this permission notice shall be included in all copies or
18 | ;;; substantial portions of the Software.
19 | ;;;
20 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21 | ;;; INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22 | ;;; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23 | ;;; FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 | ;;; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 | ;;; DEALINGS IN THE SOFTWARE.
26 | ;;;
27 | ;;; Adaptation to LispKit
28 | ;;; Copyright © 2020 Matthias Zenger. All rights reserved.
29 |
30 | (define-library (srfi 9)
31 |
32 | (export define-record-type)
33 |
34 | (import (lispkit record))
35 |
36 | ;; all exported procedures are implemented natively in library `(lispkit record)`
37 | )
38 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Libraries/srfi/98.sld:
--------------------------------------------------------------------------------
1 | ;;; SRFI 98
2 | ;;; An interface to access environment variables
3 | ;;;
4 | ;;; This SRFI specifies the procedure `get-environment-variable`, which gets the value of the
5 | ;;; specified environment variable, and the procedure `get-environment-variables`, which gets
6 | ;;; an association list of all environment variables.
7 | ;;;
8 | ;;; Author of spec: Taro Minowa (Higepon)
9 | ;;;
10 | ;;; Copyright © 2020 Matthias Zenger. All rights reserved.
11 | ;;;
12 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
13 | ;;; except in compliance with the License. You may obtain a copy of the License at
14 | ;;;
15 | ;;; http://www.apache.org/licenses/LICENSE-2.0
16 | ;;;
17 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
18 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
19 | ;;; either express or implied. See the License for the specific language governing permissions
20 | ;;; and limitations under the License.
21 |
22 | (define-library (srfi 98)
23 |
24 | (export get-environment-variable
25 | get-environment-variables)
26 |
27 | (import (lispkit system))
28 |
29 | ;; Both procedures are implemented natively in library `(lispkit system)`
30 | )
31 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Prelude.scm:
--------------------------------------------------------------------------------
1 | ;;; Default Prelude for LispKit
2 | ;;;
3 | ;;; Author: Matthias Zenger
4 | ;;; Copyright © 2017-2022 Matthias Zenger. All rights reserved.
5 | ;;;
6 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
7 | ;;; except in compliance with the License. You may obtain a copy of the License at
8 | ;;;
9 | ;;; http://www.apache.org/licenses/LICENSE-2.0
10 | ;;;
11 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
12 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 | ;;; either express or implied. See the License for the specific language governing permissions
14 | ;;; and limitations under the License.
15 |
16 | (import (lispkit base))
17 |
18 | (define-syntax for
19 | (syntax-rules (in from)
20 | ((for element in list body ...) (map (lambda (element) body ...) list))
21 | ((for element from (x ...) body ...) (map (lambda (element) body ...) (list x ...)))))
22 |
23 | (define-syntax while
24 | (syntax-rules ()
25 | ((while condition body ...)
26 | (let loop ()
27 | (if condition (begin body ... (loop)) #f)))))
28 |
29 | (define rnd
30 | (let ((a 69069)
31 | (c 1)
32 | (m (expt 2 32))
33 | (seed 19380110))
34 | (lambda new-seed
35 | (if (pair? new-seed)
36 | (set! seed (car new-seed))
37 | (set! seed (modulo (+ (* seed a) c) m)))
38 | (inexact (/ seed m)))))
39 |
40 | (define random-integer
41 | (case-lambda
42 | ((hi)
43 | (exact (floor (* (rnd) hi))))
44 | ((lo hi)
45 | (+ lo (exact (floor (* (rnd) (- hi lo))))))))
46 |
47 | (define (local-ip-address . args)
48 | (let ((intf (apply available-network-interfaces args)))
49 | (and (pair? intf) (cadar intf))))
50 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Tests/All.scm:
--------------------------------------------------------------------------------
1 | ;;; LISPKIT REGRESSION TEST SUITE
2 | ;;;
3 | ;;; Author: Matthias Zenger
4 | ;;; Copyright © 2019-2024 Matthias Zenger. All rights reserved.
5 | ;;;
6 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may
7 | ;;; not use this file except in compliance with the License. You may obtain
8 | ;;; a copy of the License at
9 | ;;;
10 | ;;; http://www.apache.org/licenses/LICENSE-2.0
11 | ;;;
12 | ;;; Unless required by applicable law or agreed to in writing, software
13 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
14 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | ;;; See the License for the specific language governing permissions and
16 | ;;; limitations under the License.
17 |
18 | (import (lispkit base)
19 | (lispkit test))
20 |
21 | (test-begin "LispKit regression tests")
22 |
23 | (load "Tests/R7RS")
24 | (load "Tests/LispKit-Control")
25 | (load "Tests/LispKit-Record")
26 | (load "Tests/LispKit-Enum")
27 | (load "Tests/LispKit-Match")
28 | (load "Tests/LispKit-Channel")
29 | (load "Tests/LispKit-Shared-Queue")
30 | (load "Tests/LispKit-List-Set")
31 | (load "Tests/LispKit-JSON-Schema")
32 | (load "Tests/SRFI-14")
33 | (load "Tests/SRFI-18")
34 | (load "Tests/SRFI-101")
35 | (load "Tests/SRFI-125")
36 | (load "Tests/SRFI-128")
37 | (load "Tests/SRFI-143")
38 | (load "Tests/SRFI-144")
39 | (load "Tests/SRFI-146")
40 | (load "Tests/SRFI-154")
41 | (load "Tests/SRFI-155")
42 | (load "Tests/SRFI-165")
43 | (load "Tests/SRFI-166")
44 | (load "Tests/SRFI-167")
45 | (load "Tests/SRFI-173")
46 | (load "Tests/SRFI-174")
47 | (load "Tests/SRFI-175")
48 | (load "Tests/SRFI-189")
49 | ; removed the following test suite as it is slow to execute
50 | ; (load "Tests/SRFI-194")
51 | (load "Tests/SRFI-196")
52 | (load "Tests/SRFI-204")
53 | (load "Tests/SRFI-209")
54 | (load "Tests/SRFI-210")
55 | (load "Tests/SRFI-214")
56 | (load "Tests/SRFI-217")
57 | (load "Tests/SRFI-219")
58 | (load "Tests/SRFI-221")
59 | (load "Tests/SRFI-222")
60 | (load "Tests/SRFI-223")
61 | (load "Tests/SRFI-224")
62 | (load "Tests/SRFI-227")
63 | (load "Tests/SRFI-228")
64 | (load "Tests/SRFI-229")
65 | (load "Tests/SRFI-232")
66 | (load "Tests/SRFI-233")
67 | (load "Tests/SRFI-235")
68 |
69 | (test-end)
70 |
71 | ;; Current number of failures: 6 (all from R7RS-Tests)
72 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Tests/LispKit-Control.scm:
--------------------------------------------------------------------------------
1 | ;;; LISPKIT CONTROL REGRESSION TEST SUITE
2 | ;;;
3 | ;;; This is the test suite for the procedures `if-let*` and `when-let*`
4 | ;;; of library `(lispkit control)`.
5 | ;;;
6 | ;;; Author: Matthias Zenger
7 | ;;; Copyright © 2024 Matthias Zenger. All rights reserved.
8 | ;;;
9 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may
10 | ;;; not use this file except in compliance with the License. You may obtain
11 | ;;; a copy of the License at
12 | ;;;
13 | ;;; http://www.apache.org/licenses/LICENSE-2.0
14 | ;;;
15 | ;;; Unless required by applicable law or agreed to in writing, software
16 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
17 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | ;;; See the License for the specific language governing permissions and
19 | ;;; limitations under the License.
20 |
21 | (import (lispkit base)
22 | (lispkit test))
23 |
24 | (test-begin "LispKit Control")
25 |
26 | (test-group "Single clause"
27 | (test 1 (if-let* () 1))
28 | (test 1 (if-let* () 1 2))
29 | (test 1 (let ((x #t)) (if-let* (x) (+ 0 1) (+ 1 1))))
30 | (test 2 (let ((x #f)) (if-let* (x) (+ 0 1) (+ 1 1))))
31 | (test 1 (let ((x #t)) (if-let* ((x)) (+ 0 1) (+ 1 1))))
32 | (test 1 (let ((x 10)) (if-let* (((= (+ x 1) 11))) (+ 0 1))))
33 | (test 2 (let ((x 11)) (if-let* (((= (+ x 1) 11))) (+ 0 1) (+ 1 1))))
34 | (test 17 (let ((x 10)) (if-let* ((y (+ 6 1))) (+ x y) (- 1 1))))
35 | (test 0 (let ((x 10)) (if-let* ((y #f)) (+ x y) (- 1 1))))
36 | (test 20 (let ((x 10)) (if-let* ((y x)) (+ x y))))
37 | )
38 |
39 | (test-group "Multiple clauses"
40 | (test 1 (let ((x #t)(y #f)) (if-let* (x ((not y))) 1 2)))
41 | (test 1 (let ((x #t)(y #f)) (if-let* ((z (= 1 1)) x ((not y)) z) 1 2)))
42 | (test 1 (let ((x #t)(y #f)) (if-let* ((z (= 1 1)) x (y #t) ((and y z))) 1 2)))
43 | (test 2 (let ((x #t)(y #f)) (if-let* ((z (= 1 1)) x (y #t) ((and y z))(r #f)) 1 2)))
44 | (test 10 (if-let* ((a (+ 1 2))(b (+ a 3))(c (+ b 4))) c 0))
45 | (test 0 (if-let* ((a (+ 1 2))(b #f)(c (+ b 4))) c 0))
46 | (test 3 (if-let* ((a 1)(b (if-let* ((c 2)(d (+ c 1))) d 0))) b -1))
47 | )
48 |
49 | (test-group "When-if*"
50 | (test 2 (let ((x #t)(y #f)) (when-let* ((z (= 1 1)) x (y #t) ((and y z))) 1 2)))
51 | (test 4 (when-let* ((a 1)(b (if-let* ((c 2)(d (+ c 1))) d 0))) b (+ b 1)))
52 | )
53 |
54 | (test-end)
55 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Tests/LispKit-List-Set.scm:
--------------------------------------------------------------------------------
1 | ;;; LISPKIT LIST SET REGRESSION TEST SUITE
2 | ;;;
3 | ;;; This is the test suite for library `(lispkit list set)`.
4 | ;;;
5 | ;;; Author: Matthias Zenger
6 | ;;; Copyright © 2023 Matthias Zenger. All rights reserved.
7 | ;;;
8 | ;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
9 | ;;; except in compliance with the License. You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software distributed under the
14 | ;;; License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | ;;; either express or implied. See the License for the specific language governing permissions
16 | ;;; and limitations under the License.
17 |
18 | (import (lispkit base)
19 | (lispkit test)
20 | (lispkit list set))
21 |
22 | (test-begin "LispKit List Set")
23 |
24 | (test-assert (lset<=? eq? '(a) '(a b a) '(a b c c)))
25 | (test-assert (lset<=? eq?))
26 | (test-assert (lset<=? eq? '(a)))
27 | (test-assert (lset=? eq? '(b e a) '(a e b) '(e e b a)))
28 | (test-assert (lset=? eq?))
29 | (test-assert (lset=? eq? '(a)))
30 | (test-equal '(u o i a b c d c e) (lset-adjoin eq? '(a b c d c e) 'a 'e 'i 'o 'u))
31 | (test-equal '(u o i a b c d e) (lset-union eq? '(a b c d e) '(a e i o u)))
32 | (test-equal '(x a a c) (lset-union eq? '(a a c) '(x a x)))
33 | (test-equal '() (lset-union eq?))
34 | (test-equal '(a b c) (lset-union eq? '(a b c)))
35 | (test-equal '(a e) (lset-intersection eq? '(a b c d e) '(a e i o u)))
36 | (test-equal '(a x a) (lset-intersection eq? '(a x y a) '(x a x z)))
37 | (test-equal '(a b c) (lset-intersection eq? '(a b c)))
38 | (test-equal '(b c d) (lset-difference eq? '(a b c d e) '(a e i o u)))
39 | (test-equal '(a b c) (lset-difference eq? '(a b c)))
40 | (test-assert (lset=? eq? '(d c b i o u) (lset-xor eq? '(a b c d e) '(a e i o u))))
41 | (test-equal '() (lset-xor eq?))
42 | (test-equal '(a b c d e) (lset-xor eq? '(a b c d e)))
43 |
44 | (test-end)
45 |
--------------------------------------------------------------------------------
/Sources/LispKit/Resources/Tests/SRFI-219.scm:
--------------------------------------------------------------------------------
1 | ;;; SRFI 219 REGRESSION TEST SUITE
2 | ;;;
3 | ;;; This is the test suite for SRFI 219.
4 | ;;;
5 | ;;; Copyright © 2021 Lassi Kortela. All rights reserved.
6 | ;;;
7 | ;;; Permission is hereby granted, free of charge, to any person
8 | ;;; obtaining a copy of this software and associated documentation
9 | ;;; files (the "Software"), to deal in the Software without restriction,
10 | ;;; including without limitation the rights to use, copy, modify, merge,
11 | ;;; publish, distribute, sublicense, and/or sell copies of the Software,
12 | ;;; and to permit persons to whom the Software is furnished to do so,
13 | ;;; subject to the following conditions:
14 | ;;;
15 | ;;; The above copyright notice and this permission notice shall be
16 | ;;; included in all copies or substantial portions of the Software.
17 | ;;;
18 | ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 | ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 | ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 | ;;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 | ;;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 | ;;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 | ;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 | ;;;
26 | ;;; LispKit Port:
27 | ;;; Copyright © 2021 Matthias Zenger. All rights reserved.
28 |
29 | (import (lispkit base)
30 | (lispkit test)
31 | (srfi 219))
32 |
33 | (test-begin "SRFI 219: Define higher-order lambda")
34 |
35 | (let ()
36 | (define ((greet/prefix prefix) suffix)
37 | (string-append prefix " " suffix))
38 | (let ((greet (greet/prefix "Hello")))
39 | (test-equal "Hello there!" (greet "there!"))))
40 |
41 | (let ()
42 | (define ((append-to . a) . b)
43 | (apply append (append a b)))
44 | (test-equal '()
45 | ((append-to '()) '()))
46 | (test-equal '(1 2 3 4 5 6 7 8)
47 | ((append-to '(1 2) '(3 4)) '(5 6) '(7 8))))
48 |
49 | (let ()
50 | (define (((jenga a b) c d))
51 | (list a b c d))
52 | (test-equal '(1 2 3 4)
53 | (((jenga 1 2) 3 4))))
54 |
55 | (test-end)
56 |
--------------------------------------------------------------------------------
/Sources/LispKit/Runtime/Heap.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Heap.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 29/12/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | ///
22 | /// Class encapsulating all objects referenced from global environments, including their
23 | /// documentation.
24 | ///
25 | public final class Heap: TrackedObject {
26 |
27 | /// Global locations.
28 | public var locations: Exprs
29 |
30 | /// Global documentation
31 | public var documentation: [Int : String]
32 |
33 | /// Capacity of the heap.
34 | public var capacity: Int {
35 | return self.locations.capacity
36 | }
37 |
38 | /// Number of globally allocated locations.
39 | public var count: Int {
40 | return self.locations.count
41 | }
42 |
43 | /// Initializer
44 | public init(capacity: Int = 1500) {
45 | self.locations = Exprs()
46 | self.locations.reserveCapacity(capacity)
47 | self.documentation = [Int : String]()
48 | }
49 |
50 | /// Allocates a new global location and initializes it with `expr`.
51 | public func allocateLocation(for expr: Expr = .undef) -> Int {
52 | self.locations.append(expr)
53 | return self.locations.count - 1
54 | }
55 |
56 | /// Reserve at least the given capacity to avoid continuous reallocations of the underlying
57 | /// locations array.
58 | public func reserveCapacity(_ capacity: Int) {
59 | if self.locations.capacity < capacity {
60 | self.locations.reserveCapacity(capacity)
61 | }
62 | }
63 |
64 | /// Mark all elements on the heap
65 | public override func mark(in gc: GarbageCollector) {
66 | for loc in self.locations {
67 | gc.markLater(loc)
68 | }
69 | }
70 |
71 | /// Reset heap
72 | public func release() {
73 | self.locations.removeAll()
74 | self.documentation.removeAll()
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Sources/LispKit/Runtime/Registers.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Registers.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 20/12/2021.
6 | // Copyright © 2021 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 | import Atomics
23 |
24 | ///
25 | /// `Registers` collects all register values in a single struct; it includes:
26 | /// - `rid`: a registers id
27 | /// - `code`: a reference to the code being executed
28 | /// - `captured`: a list of captured expressions
29 | /// - `ip`: the instruction pointer
30 | /// - `fp`: the frame pointer
31 | /// - `initialFp`: the initial frame pointer
32 | ///
33 | struct Registers {
34 | let rid: Int
35 | var code: Code
36 | var captured: Exprs
37 | var ip: Int
38 | var fp: Int
39 | let initialFp: Int
40 |
41 | /// Atomic counter for managing register ids
42 | private static let nextRid = ManagedAtomic(0)
43 |
44 | init(code: Code, captured: Exprs, fp: Int, root: Bool) {
45 | if root {
46 | self.rid = 0
47 | } else {
48 | self.rid = Registers.nextRid.wrappingIncrementThenLoad(ordering: .relaxed)
49 | }
50 | self.code = code
51 | self.captured = captured
52 | self.ip = 0
53 | self.fp = fp
54 | self.initialFp = fp
55 | }
56 |
57 | mutating func use(code: Code, captured: Exprs, fp: Int) {
58 | self.code = code
59 | self.captured = captured
60 | self.ip = 0
61 | self.fp = fp
62 | }
63 |
64 | var topLevel: Bool {
65 | return self.fp == self.initialFp
66 | }
67 |
68 | var isInitialized: Bool {
69 | return self.rid == 0 && self.code.instructions.count > 0
70 | }
71 |
72 | public func mark(in gc: GarbageCollector) {
73 | gc.mark(self.code)
74 | for i in self.captured.indices {
75 | gc.markLater(self.captured[i])
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "scale" : "1x",
46 | "size" : "20x20"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "scale" : "2x",
51 | "size" : "20x20"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "scale" : "1x",
56 | "size" : "29x29"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "scale" : "2x",
61 | "size" : "29x29"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "scale" : "1x",
66 | "size" : "40x40"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "scale" : "2x",
71 | "size" : "40x40"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "scale" : "1x",
76 | "size" : "76x76"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "scale" : "2x",
81 | "size" : "76x76"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "scale" : "2x",
86 | "size" : "83.5x83.5"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "scale" : "1x",
91 | "size" : "1024x1024"
92 | }
93 | ],
94 | "info" : {
95 | "author" : "xcode",
96 | "version" : 1
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/ConsoleOutput.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ConsoleOutput.swift
3 | // LispKitRepl iOS
4 | //
5 | // Created by Matthias Zenger on 24/04/2021.
6 | // Copyright © 2021 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 |
23 | struct ConsoleOutput: Identifiable, Equatable {
24 |
25 | enum Kind: Equatable {
26 | case command
27 | case output
28 | case result
29 | case error(String?)
30 | case info
31 | }
32 |
33 | let id = UUID()
34 | let kind: Kind
35 | var text: String
36 |
37 | var isError: Bool {
38 | guard case .error(_) = self.kind else {
39 | return false
40 | }
41 | return true
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleURLTypes
20 |
21 |
22 | CFBundleTypeRole
23 | Editor
24 | CFBundleURLName
25 | lispkit
26 | CFBundleURLSchemes
27 |
28 | lispkit
29 |
30 |
31 |
32 | CFBundleVersion
33 | 1
34 | LSRequiresIPhoneOS
35 |
36 | LSSupportsOpeningDocumentsInPlace
37 |
38 | NSMainNibFile
39 | LispKitReplApp
40 | UIApplicationSceneManifest
41 |
42 | UIApplicationSupportsMultipleScenes
43 |
44 |
45 | UIApplicationSupportsIndirectInputEvents
46 |
47 | UIFileSharingEnabled
48 |
49 | UILaunchScreen
50 |
51 | UIRequiredDeviceCapabilities
52 |
53 | armv7
54 |
55 | UISupportedInterfaceOrientations
56 |
57 | UIInterfaceOrientationPortrait
58 | UIInterfaceOrientationLandscapeLeft
59 | UIInterfaceOrientationLandscapeRight
60 |
61 | UISupportedInterfaceOrientations~ipad
62 |
63 | UIInterfaceOrientationPortrait
64 | UIInterfaceOrientationPortraitUpsideDown
65 | UIInterfaceOrientationLandscapeLeft
66 | UIInterfaceOrientationLandscapeRight
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/LispKitReplApp.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LispKitReplApp.swift
3 | // LispKitRepl iOS
4 | //
5 | // Created by Matthias Zenger on 24/04/2021.
6 | // Copyright © 2021 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import SwiftUI
22 | import LispKit
23 |
24 | @main
25 | struct LispKitReplApp: App {
26 | @StateObject private var interpreter = Interpreter()
27 |
28 | var body: some Scene {
29 | WindowGroup {
30 | ContentView()
31 | .environmentObject(self.interpreter)
32 | .onOpenURL { url in
33 | if url.scheme == "lispkit" && url.host == "oauth" {
34 | _ = HTTPOAuthLibrary.authRequestManager.redirect(url: url)
35 | }
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/LispKitReplOAuthConfig.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LispKitReplOAuthConfig.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 08/07/2024.
6 | // Copyright © 2024 ObjectHub. All rights reserved.
7 | //
8 |
9 | import OAuth2
10 | import LispKit
11 | import UIKit
12 |
13 | public final class LispKitReplOAuthConfig: HTTPOAuthConfig {
14 |
15 | public init(context: Context) {
16 | }
17 |
18 | public func configureEmbeddedAuth(oauth2: OAuth2) {
19 | if Thread.isMainThread {
20 | if let context = UIApplication.shared.keyWindowPresentedController {
21 | oauth2.authConfig.authorizeContext = context
22 | oauth2.authConfig.authorizeEmbedded = true
23 | oauth2.authConfig.ui.useSafariView = false
24 | oauth2.authConfig.ui.useAuthenticationSession = true
25 | }
26 | } else {
27 | DispatchQueue.main.sync {
28 | if let context = UIApplication.shared.keyWindowPresentedController {
29 | oauth2.authConfig.authorizeContext = context
30 | oauth2.authConfig.authorizeEmbedded = true
31 | oauth2.authConfig.ui.useSafariView = false
32 | oauth2.authConfig.ui.useAuthenticationSession = true
33 | }
34 | }
35 | }
36 | }
37 |
38 | public func createLogger(level: OAuth2LogLevel) -> OAuth2Logger {
39 | return OAuth2DebugLogger(level)
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl iOS/UIApplication.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIApplication.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 08/07/2024.
6 | // Copyright © 2024 ObjectHub. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | extension UIApplication {
12 |
13 | public var keyWindowPresentedController: UIViewController? {
14 | // Find the key window
15 | let window = UIApplication.shared
16 | .connectedScenes
17 | .flatMap { ($0 as? UIWindowScene)?.windows ?? [] }
18 | .last { $0.isKeyWindow }
19 | var viewController = window?.rootViewController
20 | // If root `UIViewController` is a `UITabBarController`
21 | if let presentedController = viewController as? UITabBarController {
22 | // Move to selected `UIViewController`
23 | viewController = presentedController.selectedViewController
24 | }
25 | // Go deeper to find the last presented `UIViewController`
26 | while let presentedController = viewController?.presentedViewController {
27 | // If root `UIViewController` is a `UITabBarController`
28 | if let presentedController = presentedController as? UITabBarController {
29 | // Move to selected `UIViewController`
30 | viewController = presentedController.selectedViewController
31 | } else {
32 | // Otherwise, go deeper
33 | viewController = presentedController
34 | }
35 | }
36 | return viewController
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl/AppInfo.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppInfo.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 05/05/2016.
6 | // Copyright © 2016-2023 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 | import LispKit
23 |
24 | ///
25 | /// Struct `AppInfo` provides meta-information on the application and build-related
26 | /// information.
27 | ///
28 | public struct AppInfo {
29 |
30 | // Name of the application
31 | public static let name = "LispKit Shell"
32 |
33 | // Version of the application
34 | public static let version = "2.5"
35 |
36 | // Copyright message
37 | public static let copyright = "Copyright © 2016–2025 Matthias Zenger. All rights reserved."
38 |
39 | // Prompt string
40 | public static let prompt = LispKitContext.bundle == nil ? "> " : "➤ "
41 |
42 | // Build date/time
43 | public static let buildDate = { () -> String in
44 | let dateFormatter = DateFormatter()
45 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
46 | return dateFormatter.string(from: Date(timeIntervalSince1970: 1749344867))
47 | }()
48 | public static let buildAnnotation = " (\(AppInfo.buildDate))"
49 | }
50 |
--------------------------------------------------------------------------------
/Sources/LispKitRepl/AppInfo.tmpl:
--------------------------------------------------------------------------------
1 | //
2 | // AppInfo.swift
3 | // LispKit
4 | //
5 | // Created by Matthias Zenger on 05/05/2016.
6 | // Copyright © 2016-2023 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import Foundation
22 | import LispKit
23 |
24 | ///
25 | /// Struct `AppInfo` provides meta-information on the application and build-related
26 | /// information.
27 | ///
28 | public struct AppInfo {
29 |
30 | // Name of the application
31 | public static let name = "LispKit Shell"
32 |
33 | // Version of the application
34 | public static let version = "2.5"
35 |
36 | // Copyright message
37 | public static let copyright = "Copyright © 2016–2025 Matthias Zenger. All rights reserved."
38 |
39 | // Prompt string
40 | public static let prompt = LispKitContext.bundle == nil ? "> " : "➤ "
41 |
42 | // Build date/time
43 | public static let buildDate = { () -> String in
44 | let dateFormatter = DateFormatter()
45 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
46 | return dateFormatter.string(from: Date(timeIntervalSince1970: CURRENT-DATE))
47 | }()
48 | public static let buildAnnotation = " (\(AppInfo.buildDate))"
49 | }
50 |
--------------------------------------------------------------------------------
/Sources/LispKitTools/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | $(MARKETING_VERSION)
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSHumanReadableCopyright
22 | Copyright © 2016-2025 Matthias Zenger. All rights reserved.
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Sources/LispKitTools/LispKitTools.h:
--------------------------------------------------------------------------------
1 | //
2 | // LispKitTools.h
3 | // LispKitTools
4 | //
5 | // Created by Matthias Zenger on 21/11/2019.
6 | // Copyright © 2019 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 |
23 | //! Project version number for LispKitTools.
24 | FOUNDATION_EXPORT double LispKitToolsVersionNumber;
25 |
26 | //! Project version string for LispKitTools.
27 | FOUNDATION_EXPORT const unsigned char LispKitToolsVersionString[];
28 |
29 | // In this header, you should import all the public headers of your framework using
30 | // statements like #import
31 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/CallCC.scm:
--------------------------------------------------------------------------------
1 | ;;; CallCC.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2016 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Call/cc in tail call"
21 | 20
22 | (define cont 0)
23 | (define (foo) (call-with-current-continuation (lambda (c) (set! cont c) 1)))
24 | (foo)
25 | (+ (cont 20) (cont 300))
26 | )
27 |
28 | (
29 | "Call/cc in regular call"
30 | 1020
31 | (define cont 0)
32 | (define (foo) (+ (call-with-current-continuation (lambda (c) (set! cont c) 1)) 1000))
33 | (foo)
34 | (+ (cont 20) (cont 300))
35 | )
36 |
37 | (
38 | "Call/cc with function"
39 | 27
40 | (define cont 0)
41 | (define (foo)
42 | (+ ((call-with-current-continuation (lambda (c)
43 | (set! cont c)
44 | (lambda (x) x))) 1) 20))
45 | (foo)
46 | (cont (lambda (x) 7))
47 | )
48 |
49 | (
50 | "Escaping continuation"
51 | (120 -1 2)
52 | (define (mult l)
53 | (call-with-current-continuation
54 | (lambda (exit) (let iter ((l l))
55 | (if (null? l)
56 | 1
57 | (if (= (car l) 0) (exit -1) (* (car l) (iter (cdr l)))))))))
58 | (list (mult '(2 3 4 5)) (mult '(2 3 4 0 5 4 3 2 1)) (mult '(2)))
59 | )
60 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/ControlFlow.scm:
--------------------------------------------------------------------------------
1 | ;;; ControlFlow.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2016 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Let"
21 | 6
22 | (let ((x 2) (y 3)) (* x y))
23 | )
24 |
25 | (
26 | "Nested let"
27 | 35
28 | (let ((x 2) (y 3))
29 | (let ((x 7) (z (+ x y)))
30 | (* z x)))
31 | )
32 |
33 | (
34 | "Let and let*"
35 | 70
36 | (let ((x 2) (y 3))
37 | (let* ((x 7) (z (+ x y)))
38 | (* z x)))
39 | )
40 |
41 | (
42 | "Let-values"
43 | 3
44 | (let-values ((() (values)) ((a) (+ 1 2))) a)
45 | )
46 |
47 | (
48 | "Let and let*-values"
49 | (x y x y)
50 | (let ((a 'a) (b 'b) (x 'x) (y 'y))
51 | (let*-values (((a b) (values x y))
52 | ((x y) (values a b)))
53 | (list a b x y)))
54 | )
55 |
56 | (
57 | "Letrec"
58 | #t
59 | (letrec ((even? (lambda (n) (if (zero? n) #t (odd? (- n 1)))))
60 | (odd? (lambda (n) (if (zero? n) #f (even? (- n 1))))))
61 | (even? 88))
62 | )
63 |
64 | (
65 | "Let loop"
66 | ((6 1 3) (-5 -2))
67 | (let loop ((numbers '(3 -2 1 6 -5))
68 | (nonneg '())
69 | (neg '()))
70 | (cond ((null? numbers) (list nonneg neg))
71 | ((>= (car numbers) 0)
72 | (loop (cdr numbers)
73 | (cons (car numbers) nonneg)
74 | neg))
75 | ((< (car numbers) 0)
76 | (loop (cdr numbers)
77 | nonneg
78 | (cons (car numbers) neg)))))
79 | )
80 |
81 | (
82 | "Let do"
83 | 25
84 | (let ((x '(1 3 5 7 9)))
85 | (do ((x x (cdr x))
86 | (sum 0 (+ sum (car x))))
87 | ((null? x) sum)))
88 | )
89 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/Datatypes.scm:
--------------------------------------------------------------------------------
1 | ;;; Datatypes.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2017 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Binary tree type"
21 | (1700 3 60)
22 | (import (lispkit datatype))
23 | (define-datatype binary-tree
24 | (leaf val)
25 | (node left right))
26 | (define bt1 (leaf 17))
27 | (define bt2 (node (node (leaf 1) (leaf 2)) (leaf 3)))
28 | (define bt3 (node (node (leaf 1) (node (leaf 2) (leaf 4))) (leaf 5)))
29 | (define (match-bt bt)
30 | (match bt
31 | ((node (node (leaf x) (leaf y)) _) (+ x y))
32 | ((node (node (leaf x) _) (leaf y)) (* (+ x y) 10))
33 | ((leaf x) (* x 100))
34 | (else 0)))
35 | (list (match-bt bt1)
36 | (match-bt bt2)
37 | (match-bt bt3))
38 | )
39 |
40 | (
41 | "List type"
42 | (0 2 5 50 1000)
43 | (define-datatype my-list my-list?
44 | (nil)
45 | (chain a b))
46 | (define ml1 (nil))
47 | (define ml2 (chain 2 (nil)))
48 | (define ml3 (chain 2 (chain 3 (nil))))
49 | (define ml4 (chain 2 (chain 3 (chain 4 (nil)))))
50 | (define (match-ml ml)
51 | (match ml
52 | ((nil) 0)
53 | ((chain a (nil)) a)
54 | ((chain a (chain b (nil))) (+ a b))
55 | ((chain a (chain b _)) (* (+ a b) 10))
56 | (else 1000)))
57 | (list (match-ml ml1)
58 | (match-ml ml2)
59 | (match-ml ml3)
60 | (match-ml ml4)
61 | (match-ml bt2))
62 | )
63 |
64 | (
65 | "Datatype predicates"
66 | (#t #t #f #f #f #f)
67 | (list (my-list? ml1) (my-list? ml4) (my-list? bt1) (my-list? bt3) (my-list? 12) (my-list? '(a)))
68 | )
69 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/Definitions.scm:
--------------------------------------------------------------------------------
1 | ;;; Definitions.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2016 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Mixed global local definitions"
21 | 111
22 | (define bar 1)
23 | (+ (let () (define (foo n) (+ n bar))
24 | (define bar 100)
25 | (foo 10))
26 | bar)
27 | )
28 |
29 | (
30 | "Multiple simultaneous definitions"
31 | ((0 1 2) ("hello") "hello" 0 1 0 1 () 0 1 (2 3))
32 | (define-values a (values 0 1 2))
33 | (define-values b "hello")
34 | (define-values (c) "hello")
35 | (define-values (d e) (values 0 1))
36 | (define-values (f g . h) (values 0 1))
37 | (define-values (i j . k) (values 0 1 2 3))
38 | (list a b c d e f g h i j k)
39 | )
40 |
41 | (
42 | "Definitions via syntax rules"
43 | 111
44 | (define-syntax declare
45 | (syntax-rules ()
46 | ((_ f e) (define f e))))
47 | (declare baz 1)
48 | (+ (let () (define (foo n) (+ n baz))
49 | (declare baz 100)
50 | (foo 10))
51 | baz)
52 | )
53 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/LocalSyntaxRules.scm:
--------------------------------------------------------------------------------
1 | ;;; LocalSyntaxRules.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2016 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Local when"
21 | now
22 | (let-syntax
23 | ((when (syntax-rules ()
24 | ((when test stmt1 stmt2 ...) (if test (begin stmt1 stmt2 ...))))))
25 | (let ((if #t)) (when if (set! if 'now)) if))
26 | )
27 |
28 | (
29 | "Outer"
30 | outer
31 | (let
32 | ((x 'outer))
33 | (let-syntax
34 | ((m (syntax-rules () ((m) x))))
35 | (let ((x 'inner)) (m))))
36 | )
37 |
38 | (
39 | "Local my-or"
40 | 7
41 | (letrec-syntax
42 | ((my-or
43 | (syntax-rules ()
44 | ((my-or) #f)
45 | ((my-or e) e)
46 | ((my-or e1 e2 ...) (let ((temp e1)) (if temp temp (my-or e2 ...)))))))
47 | (let ((x #f)
48 | (y 7)
49 | (temp 8)
50 | (let odd?)
51 | (if even?))
52 | (my-or x (let temp) (if y) y)))
53 | )
54 |
55 | (
56 | "Local vector match"
57 | bar
58 | (letrec-syntax
59 | ((letv
60 | (syntax-rules ()
61 | ((_ #((var val) ...) exp exp* ...) (let ((var val) ...) exp exp* ...)))))
62 | (letv #((foo 'bar)) foo))
63 | )
64 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/Parameters.scm:
--------------------------------------------------------------------------------
1 | ;;; Parameters.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2016 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Global parameter definition"
21 | 1
22 | (define p (make-parameter 1))
23 | (p)
24 | )
25 |
26 | (
27 | "Global parameter value modification"
28 | (1 2 2)
29 | (list (p) (begin (p 2) (p)) (p))
30 | )
31 |
32 | (
33 | "Global parameter definition with converter"
34 | 101
35 | (define (inc n) (+ n 1))
36 | (define q (make-parameter 100 inc))
37 | (q)
38 | )
39 |
40 | (
41 | "Global parameter value modification with converter"
42 | (101 201 201)
43 | (list (q) (begin (q 200) (q)) (q))
44 | )
45 |
46 | (
47 | "Parameterization"
48 | ((2 201) (10 1001) (2 201))
49 | (define (foo) (list (p) (q)))
50 | (list (foo) (parameterize ((p 10)(q 1000)) (foo)) (foo))
51 | )
52 |
53 | (
54 | "Parameterization and local modification"
55 | ((3 203) ((11 1003) (12 1005)) (4 205))
56 | (define (bar) (p (+ (p) 1))(q (+ (q) 1))(list (p) (q)))
57 | (list (bar) (parameterize ((p 10)(q 1000)) (list (bar) (bar))) (bar))
58 | )
59 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/Ports.scm:
--------------------------------------------------------------------------------
1 | ;;; Ports.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2016 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Reading/writing characters with string ports"
21 | "This is a smilie: 😀, and a flag: 🇩🇪."
22 | (let ((in (open-input-string "This is a smilie: 😀, and a flag: 🇩🇪."))
23 | (out (open-output-string)))
24 | (do ((ch (read-char in) (read-char in)))
25 | ((eof-object? ch) (get-output-string out))
26 | (write-char ch out)))
27 | )
28 |
29 | (
30 | "Reading/writing lines with string ports"
31 | 5
32 | (let ((in (open-input-string "line 1\nline 2\n3\n\nline 5")))
33 | (do ((line (read-line in) (read-line in))
34 | (i 0 (+ i 1)))
35 | ((eof-object? line) i)))
36 | )
37 |
38 | (
39 | "Reading/writing bytes with binary ports"
40 | #u8(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)
41 | (let ((in (open-input-bytevector #u8(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)))
42 | (out (open-output-bytevector)))
43 | (do ((byte (read-u8 in) (read-u8 in)))
44 | ((eof-object? byte) (get-output-bytevector out))
45 | (write-u8 byte out)))
46 | )
47 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/Records.scm:
--------------------------------------------------------------------------------
1 | ;;; Records.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2016 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Record types"
21 | ("recordtype" (one two three) 1)
22 | (define rtype (make-record-type "recordtype" '(one two three)))
23 | (list (record-type-name rtype)
24 | (record-type-field-names rtype)
25 | (record-type-field-index rtype 'two))
26 | )
27 |
28 | (
29 | "Manual records"
30 | (1 2 3)
31 | (define rec (make-record rtype))
32 | (record-set! rec 0 1)
33 | (record-set! rec 1 2)
34 | (record-set! rec 2 3)
35 | (list (record-ref rec 0)
36 | (record-ref rec 1)
37 | (record-ref rec 2))
38 | )
39 |
40 | (
41 | "Record predicates"
42 | (#t #t #t #f #f)
43 | (list (record? rtype)
44 | (record-type? rtype)
45 | (record? rec)
46 | (record-type? rec)
47 | (record? #(1 2 3)))
48 | )
49 |
50 | (
51 | "Define record type"
52 | (#t #t #t #t #t #t)
53 | (define-record-type pare (kons x y) pare? (x kar set-kar!) (y kdr))
54 | (list (record-type? pare)
55 | (procedure? kons)
56 | (procedure? pare?)
57 | (procedure? kar)
58 | (procedure? set-kar!)
59 | (procedure? kdr))
60 | )
61 |
62 | (
63 | "Use defined record type"
64 | (#t #t #t 1 7 3)
65 | (define k (kons 1 (kons 2 (kons 3 #f))))
66 | (set-kar! (kdr k) 7)
67 | (list (record? k)
68 | (record? (kdr k))
69 | (and (pare? k) (pare? (kdr k)))
70 | (kar k)
71 | (kar (kdr k))
72 | (kar (kdr (kdr k))))
73 | )
74 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Code/SRFI35.scm:
--------------------------------------------------------------------------------
1 | ;;; SRFI35.scm
2 | ;;; Regression test data
3 | ;;;
4 | ;;; Author: Matthias Zenger
5 | ;;; Copyright © 2017 ObjectHub. All rights reserved.
6 | ;;;
7 | ;;; Licensed under the Apache License, Version 2.0 (the "License");
8 | ;;; you may not use this file except in compliance with the License.
9 | ;;; You may obtain a copy of the License at
10 | ;;;
11 | ;;; http://www.apache.org/licenses/LICENSE-2.0
12 | ;;;
13 | ;;; Unless required by applicable law or agreed to in writing, software
14 | ;;; distributed under the License is distributed on an "AS IS" BASIS,
15 | ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | ;;; See the License for the specific language governing permissions and
17 | ;;; limitations under the License.
18 |
19 | (
20 | "Conditions 1"
21 | (#t #t #f "V1" "a1")
22 | (import (srfi 35))
23 | (define-condition-type &c &condition c? (x c-x))
24 | (define-condition-type &c1 &c c1? (a c1-a))
25 | (define-condition-type &c2 &c c2? (b c2-b))
26 | (define v1 (make-condition &c1 'x "V1" 'a "a1"))
27 | (list (c? v1) (c1? v1) (c2? v1) (c-x v1) (c1-a v1))
28 | )
29 |
30 | (
31 | "Conditions 2"
32 | (#t #f #t "V2" "b2")
33 | (define v2 (condition (&c2 (x "V2") (b "b2"))))
34 | (list (c? v2) (c1? v2) (c2? v2) (c-x v2) (c2-b v2))
35 | )
36 |
37 | (
38 | "Conditions 3"
39 | (#t #t #t "V3/1" "a3" "b3")
40 | (define v3 (condition (&c1 (x "V3/1") (a "a3")) (&c2 (b "b3"))))
41 | (list (c? v3) (c1? v3) (c2? v3) (c-x v3) (c1-a v3) (c2-b v3))
42 | )
43 |
44 | (
45 | "Conditions 4"
46 | (#t #t #t "V1" "a1" "b2")
47 | (define v4 (make-compound-condition v1 v2))
48 | (list (c? v4) (c1? v4) (c2? v4) (c-x v4) (c1-a v4) (c2-b v4))
49 | )
50 |
51 | (
52 | "Conditions 5"
53 | (#t #t #t "V2" "a3" "b2")
54 | (define v5 (make-compound-condition v2 v3))
55 | (list (c? v5) (c1? v5) (c2? v5) (c-x v5) (c1-a v5) (c2-b v5))
56 | )
57 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 2.5
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Tests/LispKitTests/SmallTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LispKitTests.swift
3 | // LispKitTests
4 | //
5 | // Created by Matthias Zenger on 14/01/2016.
6 | // Copyright © 2016 ObjectHub. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | import XCTest
22 | @testable import LispKit
23 |
24 |
25 | class SmallTests: LispKitTestCase {
26 |
27 | func testPlus() {
28 | XCTAssertEqual(self.eval("(+ 1 2 3 4)"), self.value("10"))
29 | assertStackEmpty()
30 | }
31 |
32 | func testCapturesInLetrec() {
33 | XCTAssertEqual(
34 | self.eval("(define (foo x) " +
35 | " (letrec ((mult (lambda (n) (* n x y))) (y (+ x x))) (+ x y (mult 3))))" +
36 | "(foo 12)"), self.value("900"))
37 | assertStackEmpty()
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-minimal
--------------------------------------------------------------------------------