God writes in Lisp

But 32000 different fares per flight? What was going on? That is more than 100 per seat, is that fine tuning for "customer uses iPhone? y/n, drives a XYZ, ...."?

They just like to put out all these fares that have rules to restrict when and by who and on which total routes they are usable. Multiply by fares filed to turn them on and off with seat availability[*]. Multiply by codeshares with different carriers. Did I mention the rules are turing-complete and can make up new fares in masses?

[*] Seat availability data has almost nothing to do with seats actually being free. It is a mechanism to turn on and off fares previously filed. Seat availability data changes at 10 Hz, fares get updated much more rarely in big dataset pushed - so seat availability is used to pick from previously filed fares.
 
They just like to put out all these fares that have rules to restrict when and by who and on which total routes they are usable. Multiply by fares filed to turn them on and off with seat availability[*]. Multiply by codeshares with different carriers. Did I mention the rules are turing-complete and can make up new fares in masses?

[*] Seat availability data has almost nothing to do with seats actually being free. It is a mechanism to turn on and off fares previously filed. Seat availability data changes at 10 Hz, fares get updated much more rarely in big dataset pushed - so seat availability is used to pick from previously filed fares.
😲
 
I knew some airlines would, ahem, "adjust" their pricing when you came from an IOS web browser over the people using cheaper hardware. But this looks pretty insane.
 
Experience with abcl (armed bear common lisp)
The java interop works fine,
Code:
(load "~/quicklisp/setup.lisp")
(require :abcl-contrib)
(require :jss)
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))
(format T "~a~%" (jcall (jmethod "java.lang.Math" "sqrt" (jclass "double")) (jclass "java.lang.Math") 9.0))
(format T "~a~%" (java:jstatic "sqrt" "java.lang.Math" 17.0d0))
(format T "~a~%" (#"sqrt" 'java.lang.Math 17.0d0))
(quit)
Even ltk works fine, which is surprising for a "java class".

Now starting with the book "Land of lisp (2011)"
 
abcl ,demo of compiling a library and a main calling this library separately.

library.lisp
Code:
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))
(ql:quickload "defstar")

(eval-when (:compile-toplevel :load-toplevel :execute)
  (ql:quickload "defstar"))
 
(defpackage package-library
    (:use #:cl #:defstar)
    (:export printstring))

(in-package :package-library)
(defun* (printstring -> boolean) ((s string))
    (princ s) t)

main.lisp
Code:
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))

(load "library.abcl")

(in-package :cl)
(defun main()
    (package-library:printstring "Hello World"))
(main)
(cl-user::quit)

lisp file performing the compilation
compile.lisp
Code:
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))
(load "~/quicklisp/setup.lisp")

(format t "~a~%" "COMPILING library.lisp")
(CL:COMPILE-FILE "library.lisp")

(format t "~a~%" "COMPILING main.lisp")
(CL:COMPILE-FILE "main.lisp")

(format t "~a~%" "Done compiling")
(quit)

script performing the compilation & running,
Code:
rm *.abcl
echo "COMPILING"
time abcl --noinform --noinit --nosystem --load compile.lisp
echo "RUNNING"
time abcl --noinform --noinit --nosystem --load main.abcl
 
Building an application consisting of different files , compiling as needed, using the "asdf" build system.
At first asdf is scary and complicated but it's ok.

As example i use abcl lisp:

A source file:
./src/packages.lisp
Code:
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))
(defpackage cloop
    (:use :cl :defstar)
    (:export #:printme))

A source file:
./src/main.lisp
Code:
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))
(in-package :cloop)

(defun* (printme -> boolean) ((s string))
    (princ s) t)

An asd file describing where the source files are located
./cloop.asd
Code:
(defsystem "cloop"
    :author "Alain De Vos <devosalain@ymail.com>"
    :description "My test"
    :version "0.0.1"
    :license "BSD-3-Clause"
    :depends-on (:alexandria :uiop :defstar)
    :components
        ((:module "src"
          :components
          ((:file "packages")
           (:file "main")))))

A file doing the asdf stuff,
./myasdf.lisp
Code:
(declaim (optimize (speed 3) (safety 3) (space 0) (debug 3)))

(load "~/quicklisp/setup.lisp")
(ql:quickload "alexandria")

(require :abcl-contrib)
(require :abcl-asdf)

(format t " ~a ~% "(asdf:already-loaded-systems))
(asdf:load-systems :cloop)
(format t " ~a ~% "(asdf:already-loaded-systems))
(cloop:printme "Hello World")

(cl-user::quit)
The script to compile & run,
./runme
Code:
abcl --load myasdf.lisp
 
A demonstration of abstract data types in typed-racket.

Code:
#lang typed/racket
(require typed-racket-datatype)

(define-struct person ([name : String] [age : Integer]) #:prefab #:mutable)
(define aperson (make-person "Alain" 10))
(set-person-name! aperson "Eddy")
(display (person-name aperson))
(define-type Color (U 'red 'blue 'green))
(define-datatype MyList
    (MyNil)
    (MyNode [anode : Integer][arest : MyList]))
(: alist MyList)
(define alist (MyNil))
(: blist MyList)
(define blist (MyNode 5 (MyNil)))
(when (MyNode? blist)
    (display (MyNode-anode blist)))
 
Fyi, freebsd has a few lisp implementations,
Code:
abcl-1.9.2                     Implementation of ANSI Common Lisp in Java
ecl-21.2.1_1                   ANSI Common Lisp implementation
eisl-3.60                      Interpreter and compiler compatible with ISLisp standard
janet-1.32.0                   Functional embeddable lisp with C interop, & performant data types
newlisp-10.7.5_3               LISP like scripting language
owl-lisp-0.1.23                Functional dialect of Scheme
py39-hy-0.19.0                 Dialect of Lisp that is embedded in Python
sbcl-2.4.0,1                   Common Lisp development system derived from the CMU CL system
slisp-1.2_1                    Simple Lisp interpreter
 
Back
Top