![]() ![]() ![]() Template strings are literals enclosed by single or triple double quote characters ( " or """)įollowed an identifier, such as $"Like $this.", or template-name"""string literals""". Such strings are called template strings. String Interpolation works in parse time. (lambda (#1 #3) ( - #3 #1)) Unlike Elixir, missing numbers are not checked! String Interpolation ![]() Import is relative, meaning the file path is totally based in the written file. To use variables defined in other files, import! macro could be your option. They are definitions in primitives.lisa, testers.lisa and collections.lisa. Initially, the interpreter imported the predef environment. Some of them have a implementation illustrating the general idea or procedure of that function. They are definitions signatures with doc strings. (int ( / 5 4)) => 1 Calculate factorial of 100 using fact procedure defined above. Lisa is a good calculator because Integers are implemented in BigInt, and Floats are implemented in BigDecimal.Īlso, Lisa supports Rational value calculation. ( map ( list 1 2 3) ( lambda ( i) ( + i 1))) Start Playing as A Calculator ( if ( = n 0) x (go ( - n 1) ( * n x)))) The last expression is the return value. (println! "Computing: " n) Use println! to display a string, separated by a space. ( define ( go n x) Defining a function inside a function will not affact outer scope. ( define car Is equal to define a lambda variable To convert a Map to record, use ->record procedure. Get procedure can be called as (get map key) (get map key not-found) The a attribute of record s can be accessed via: (record 'a 1 'b 2) => Record with key a to 1 and key b to 2. So you can still distinguish them via same-reference?. In most cases, () will be treated as empty list, but '() is not the same referenceĪs (). () equals to empty-list '() in most lisp dialects, so does lisa. Or using get which will return () when index being out of bounds. (nth s 1) => Access 1 element in a sequence. If index is out of bounds, throwing IndexOutOfBoundsException. If you want to access element by index, use nth. cons Construct a List like all lisp dialects do.Sequences and Lists can be constructed by primitive function seq and list. A naive lisp interpreter written in Scala.ĭesigned to be interactive with Scala/Java. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |