freenode/#lisp - IRC Chatlog
Search
9:29:37
rk[ghost]
so i have been toying around with writing a basic lisp interpreter for RV32IMAC; besides McArthys papers.. any other good suggestion resources for the fundamentals of the metacircular evaluator and such?
9:31:17
beach
The only reason I can see to write a Lisp interpreter would be in order to learn about language implementation.
9:32:22
rk[ghost]
jackdaniel: fair points.. but in the end.. the industry drive overrules anything of interest that comes out of academia or discontent programmers
9:33:09
rk[ghost]
beach: well a good chunk of it is to get back in the programming mindset.. quit my job about 1.5 years ago to go farm..
9:33:57
jackdaniel
risky statement, I'd say that it adapts some of it, but overruling is rather a rare exception
9:34:05
beach
rk[ghost]: If all you want is to program, there are more useful things to write than another Lisp interpreter.
9:35:23
rk[ghost]
beach: aye, but sorta /need/ (surely it is a want, but meh) an interpreter to move on to the next step of my toy project..
9:36:06
rk[ghost]
think CCL would compile for RV32IMAC.. i suppose i could have just tried and found out..
9:37:39
rk[ghost]
i have a Hifive1.. and i really really would prefer not to have to write C for interfacing with it.. next step is to write code for a humidity / temperature sensor..
9:38:59
rk[ghost]
well.. without the interpreter.. how is the board suppose to evaluate lisp code i send over UART?
9:42:25
rk[ghost]
risc-v 32i (mac << you can ignore this mostly.. just specific modules) architecture
9:50:51
jackdaniel
you may put eval there and repl, that's not overly hard. My point is, that having simply interpreter on the machine won't give you much
9:51:28
jackdaniel
and it will be awfully slow and limited, while if you write compiler to run somewhere else, you could have for instance macros etc, which get compiled and uploaed into that machine
9:52:36
jackdaniel
if you are interested in simply running interpreter, check out uLisp, armpit scheme, microscheme - your description fits most uLisp imo
9:53:19
jackdaniel
rk[ghost]: then take uLisp, provide the lacking glue and don't waste time on making same thing over again
9:54:28
jackdaniel
but I'd say that in my opinion it's far from being a start for software/hardware revolution / redo in better manner
9:54:46
jackdaniel
just convenience hack to scratch the itch (i.e live coding and love for parenthesis:)
9:54:50
rk[ghost]
is there a good framework for message passing in CL? (i know there is LFE.. but since this is CL channel.. thought i would ask)
9:57:21
rk[ghost]
cross compiling doesn't seem to work for my use case.. as that assume that the hifive1 is connected to another machine..
9:59:14
rk[ghost]
jackdaniel: oh! this toy project for lisp interpreter on rv32imac has 0 to do with my previous statements of software/hardware revolution.
10:04:13
rk[ghost]
anyhoot- thanks again for ya'lls comments. i quite understand that any of my effort is superfluous..
10:11:06
jackdaniel
that's not true, writing interpreter is a good learning experience. But if you want just some lisp on the machine, much more effective way would be porting one of the mentioned languages to your machine
11:31:39
james__
; The symbol "HOST-ENT-ADDRESS-TYPE" is not external in the SB-BSD-SOCKETS package.
12:02:56
beach
My idea for testing the Earley-based lambda-list parsers is to create simple ad-hoc hand-written parsers with skimpy error checking, and then compare the results of applying both parser types to the same lambda list.
12:06:44
beach
It beats the alternative, which is to check that the parse tree is correct by manually parsing the input of every test case.
16:03:06
beach
KZiemian: Are you saying you want to know whether "e.g." should be followed by a comma or not?
16:04:03
KZiemian
beach: yes, there are many change this small, but I try to note every one that is not whiespace or not important to code
16:04:29
KZiemian
phoe: The type real includes all numbers that represent mathematical real numbers, though there are mathematical real numbers (e.g., irrational numbers) that do not have an exact representation in Common Lisp.
17:26:08
akr[m]
Hello, CL noob here, can someone tell me what is going on here: https://pastebin.com/VRbTRvCa
17:27:51
minion
akr[m]: please look at gentle: "Common Lisp: A Gentle Introduction to Symbolic Computation" is a smoother introduction to lisp programming. http://www.cs.cmu.edu/~dst/LispBook/
17:30:50
akr[m]
I was rather confused that a simple expression that the REPL prints out would give an error when typed back
17:30:51
dlowe
akr[m]: it wasn't snarky. My answer to you would be different depending on if you have or not
17:31:54
akr[m]
well, I have programmed in about 10 languages and have a BsC. in compsci, if you really need to know
17:32:20
Bicyclidine
the repl evaluates. some values cause errors when they are evaluated. those values can of course be returned by the evaluation of some forms.
17:33:36
minion
akr[m]: please see pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
17:37:00
jackdaniel
akr[m]: they explain for instance evaluation rule, you may want to reread them then
17:44:10
aeth
akr[m]: foo(bar, baz, quux) in most languages becomes (foo bar baz quux) in Lisp. Lists in Lisp are really cons cells/pairs (such as '(foo . (bar . (baz . (quux . NIL))))) so the implementation is going to think that (foo . bar) is a function call.
17:45:27
aeth
That's equivalent to (+ 1 2) but of course no one is going to write it in the verbose way above.
17:46:05
akr[m]
yeah sorry I guess I forgot that you need to quote a list if you don't want it interpreted as a function call
18:00:20
aeth
because in the other sense of a list (in CL, "proper list") it's not: (alexandria:proper-list-p '(foo . bar)) => NIL
18:01:37
pjb
akr[m]: (cons 5 6) is a list of 3 elements: cons, 5 and 6. It's built with 3 cons cells, the last one being (6 . nil).
18:02:06
pjb
akr[m]: the list (cons 5 6) can be interpreted as a lisp function application: call the function named cons with 2 arguments: 5 and 6. So this works.
18:02:18
aeth
phoe: What I mean is that in some languages (such as Scheme) a "list" is what CL calls a "proper list". So it's one of those things where the CL-specific terminology must be learned.
18:02:32
pjb
akr[m]: but the cons cell (5 . 6) cannot be interpreted as anything in lisp. 5 is not the name of an operator. Dotted lists are not lisp source forms.
18:04:00
pjb
akr[m]: now, if you consider that eval actuall accepts the cons cell as input (it will just behave predictably by generating an error, which may be what you want), you can still consider that (5 . 6) is code, that when evaluated will generate this error.
18:05:21
pjb
(error "foo") is a lisp form. Its evaluation signals an error. (5 . 6) is also a lisp form whose evaluation signals an error. ;-)
18:05:51
pjb
akr[m]: you can establish a type theory that takes into account non-local exits, including errors.
18:06:22
pjb
akr[m]: some languages declare exceptions in function signatures: void foo(int) throws NullPointer; // stuff like that.
18:07:08
Bicyclidine
i'd say (+ 'a) is not well-typed code, and (5 . 6) is not an object of type valid-form, i guess
18:08:01
pjb
Notice how sbcl actually signals a type-error on 6, instead of a program-error on (5 . 6).
18:09:59
pjb
(handler-case (5 . 4) (error () 'yay) (:no-error (&rest ignore) 'pas-glop)) with ccl: #| ERROR: While compiling an anonymous function : In the form (5 . 4), 5 is not a symbol or lambda expression. |#
18:10:51
pjb
Anyways, the point here is that (5 . 4) is not a valid form indeed, if you put it in the source, the compiler should signal an error, so it won't be executed (even to signal an error).
18:12:05
pjb
There are differences between a CL interpreter and a CL compiler that are accepted, even if the standard tries to minimize the semantic differences between both kind of implementation.
19:18:26
pjb
So it's a good choice. But where does the size of your code enter the scene then? Reducing the size of the code won't make queries to the hash-table faster.
19:20:09
paule32
together, it can be a tree 2 + 4 = 6 so the system knows now a tree build with 2 + 4
19:24:42
pjb
If you can write down all those preferences and rules, you would get your program written for you…
19:27:40
pjb
For example, if you were able to say that you wanted to write in your source code the list of words and numbers, and have it magically used to fill a hash-table so that you can query the words or the numbers, then you would have just to write that in lisp instead of English and have your program done.
19:28:50
pjb
(defun magically-fil-hash-table (table pairs) (loop for (a b) on pairs by (function cddr) while a do (setf (gethash a table) b (gethash b table a))))
19:54:03
MrSleepy
I am looking for book recommendations I have already read "practical common lisp" and "land of lisp" I want to get even better and learn the language even deeper. Can anybody recommend me another book? If this is the wrong place to ask just lemme know where I should ask please.
20:11:18
pjb
Sorry, I don't see any documentation there, only violet buttons on some strange web page.
20:17:36
pjb
Yes, but it is amongst the systems that can't put the right spacing before and after lists…
20:24:17
pjb
Revise it and check for syntactical errors susch as this @b (Side Effects) (I assume you don't want the space after @b?)
20:34:38
pjb
This doesn't correspond to any standard lisp literal object. Implementations may interpret as something specific to the implementation. (But none is known to do so, they all signal an error).
20:36:51
pjb
paule32: and when you look at a brick, you could also instead look at the set of atoms composing this brick. And why not even the set of quarks composing the atoms composing the brick!
20:37:38
pjb
The thing that is surprising is that in lisp, we let the abstraction layer leak, so we may pun.
20:38:38
pjb
(cadr (list 1 2 3)) is an example of such punning. It should be (second (list 1 2 3)) or (cadr (cons 1 (cons 2 (cons 3 nil)))) to stay consistent.
20:40:57
shka_
pjb: one more thing, aside from my poor English, do you consider this documentation to be overall useful, would you add something or put additional conventions?
20:41:08
pjb
If you use lists of lists: ((a 1) (b 2) (c 3)) then using (cadar lol) instead of (second (first lol)) is such punning. It may be more efficient (or not, a modern compiler would generate exactly the same code). But the second matches beter the abstraction level of lists.
20:42:12
pjb
shka_: when there are too many typoes or other low-level errors like it has, I'm distracted, and cannot read the documentation. Correct it, and try again later. (But I won't be able to concentrate on it now, perhaps somebody else?).
20:42:55
paule32
may be i realize it wrong, but some things modernizations of same old code, so (list "w" . 1) seems the equal/same as ("w" . 1) <-- here without the (list
20:52:05
aeth
One should learn Latin, French, Spanish, Portuguese, Italian, Romanian, etc. It's the road to impressive multilingualism. No one needs to know that they're so similar.
20:53:42
aeth
It's like knowing Lisp Machine Lisp, Common Lisp, several Schemes, Racket, etc. Close enough that you can just focus on learning the differences.
21:03:30
whoman
one day i was curious to map out programming languages by their most closest natural languages
21:04:09
aeth
Scheme is probably Spanish, with each Scheme being a different country's local dialect.
21:06:17
aeth
No, elisp is liturgical Latin. A relic from a past era, but in its modern form heavily influenced by Italian (i.e. Common Lisp)
21:08:52
aeth
Haskell is probably a Germanic language, since ML is somewhat related to Lisp and Haskell is in that family. (Here, Romance is the Lisp family and Germanic is I guess the ML family)
21:11:23
aeth
whoman: Romance languages are like French, Italian, Spanish, Portuguese, etc. Germanic languages are like German, Swedish, Danish, Dutch, etc. English is a Germanic language with a ton of Romance language vocabulary.
21:12:17
paule32
give it a possibility to get the name that the user type in directly from the hash table?
21:14:22
whoman
aeth, oohhh, i see! i thought it was all bunched up into the same =) is russian and polish and slavik on a different 'category'?
21:15:39
aeth
whoman: Most European languages are distantly related, coming from Proto-Indo-European. Slavic (or is it Balto-Slavic?) is the third big group in Europe. There are more in Asia, too.
21:17:03
aeth
whoman: So in this analogy, Lisp 1.5 is like Latin because it's the dead language that predates all of the Lisp language family, just like Latin comes before the Romance languages.
21:21:01
aeth
whoman: In this analogy, the languages related to C are probably the Sino-Tibetan languages or something. (This includes the Chinese languages.) Very popular, but not related to Lisp.