Live data from Hacker News

10 REM"_(C2SLFF4

beej.us

21–30 of 52 posts

Re: 10 REM"_(C2SLFF4

#21

See this is why I never understood LISP people proudly proclaiming that “code is data and data is code”… we were doing this in BASIC for decades already!

The thing is in Lisp, data with a nice structure that you can easily work with is evaluatable as code; and all the code that runs has a nice structure and is easy to work with! You cannot easily manipulate and transform BASIC programs from within BASIC, and you cannot easily do anything in machine code.

But maybe this is part of what Gerald Sussman was talking about when he called Lisp a "low level language": like machine code, Lisp has the nice property that its default data representation is used for building directly executable programs.

Re: 10 REM"_(C2SLFF4

#22
post #7

Earlier quoted context omitted.

I managed to get that easter egg into libvirt - it listens on ports 16509 and 16514 ( https://libvirt.org/remote.html ).

Sorry, I’m lost after looking at that page. Can you explain your comment?

Libvirt listens on ports 16509 and 16514 out of the box, in reference to ZX81 BASIC where the program starts at (address) 16509 and the first byte in a REM statement (commonly used to store machine code) is 16514.

Re: 10 REM"_(C2SLFF4

#24
I remember that my ZX Spectrum 48k came with a big orange book of BASIC programs to type in.

One of which was some sort of mystical “reflect on the runes” program that printed ancient symbols to contemplate. It had a written comment in the docs that it would self destruct after three attempts “to guard against frivolous use”. And, sure enough, if you typed it in without understanding it - there was the BASIC command that soft reset your computer on the third iteration! I can’t remember that command now - RANDOMIZE USR 0 perhaps? Happy days.

Re: 10 REM"_(C2SLFF4

#25

See this is why I never understood LISP people proudly proclaiming that “code is data and data is code”… we were doing this in BASIC for decades already!

“code is data and data is code” is a fact of computing. What LISP does is to make it an official feature of the language and provide nice abstraction for it. A lot of languages want you to use some cumbersome reflection library, a dangerous eval function, or a crippled macro mechanism. With LISP, you just use the language mechanism in order to write code that process code.

> “code is data and data is code” is a fact of computing

The general purpose computers we have today all follow that principal, yes. However it's not a fundamental fact of computing. Turing machines, cellular automata provide other paradigms. And if those aren't practical enough for you, ASIC programming is Turing complete but cannot access its code as data.

Re: 10 REM"_(C2SLFF4

#26
post #7

This is exactly how we used to do machine code on the Sinclair ZX81, too, where there was no way to declare a block of memory as "off limits" to BASIC, and no DATA statements like in the later (and much bigger) ZX Spectrum BASIC. Then you'd do "RANDOMISE USR 16514" to start it. Actually USR was interesting because it would pass back the contents of BC when your machine code routine returned to BASIC.

I managed to get that easter egg into libvirt - it listens on ports 16509 and 16514 ( https://libvirt.org/remote.html ).

I noticed that :-)

Re: 10 REM"_(C2SLFF4

#27

I remember that my ZX Spectrum 48k came with a big orange book of BASIC programs to type in. One of which was some sort of mystical “reflect on the runes” program that printed ancient symbols to contemplate. It had a written comment in the docs that it would self destruct after three attempts “to guard against frivolous use”. And, sure enough, if you typed it in without understanding it - there was the BASIC command…

IIRC it was something like "hexagrams" which printed the I Ching hexagrams[0]

[0] https://www.iching-online.com/hexagrams/

Re: 10 REM"_(C2SLFF4

#28

Earlier quoted context omitted.

“code is data and data is code” is a fact of computing. What LISP does is to make it an official feature of the language and provide nice abstraction for it. A lot of languages want you to use some cumbersome reflection library, a dangerous eval function, or a crippled macro mechanism. With LISP, you just use the language mechanism in order to write code that process code.

> “code is data and data is code” is a fact of computing The general purpose computers we have today all follow that principal, yes. However it's not a fundamental fact of computing. Turing machines, cellular automata provide other paradigms. And if those aren't practical enough for you, ASIC programming is Turing complete but cannot access its code as data.

State transition in the turing machine are not modifiable, but one of the core advantages of the TM is that it's powerful enough to emulate state transition. So you can model the states of the new machine as data, add the transition mechanism as code, feed those to the TM and you have a new machine that can interpret input that was unrecognizable by the previous one. That's how programming languages works.

So yes, you can't modify the actual embodiment of the state transition if it does not offer you the capability to do so. But as long as it interprets data in a TM manner (input and output are colocated and the alphabet is the same), you can write code that will interpret data as code and manipulate code as data. Not by modifying the base substrate, but by adding a virtualization layer on top.

Re: 10 REM"_(C2SLFF4

#29

I remember that my ZX Spectrum 48k came with a big orange book of BASIC programs to type in. One of which was some sort of mystical “reflect on the runes” program that printed ancient symbols to contemplate. It had a written comment in the docs that it would self destruct after three attempts “to guard against frivolous use”. And, sure enough, if you typed it in without understanding it - there was the BASIC command…

IIRC it was something like "hexagrams" which printed the I Ching hexagrams[0] [0] https://www.iching-online.com/hexagrams/

Looks like.

https://zx.tr/basinc/help/topics/manual_appd.html, scroll down. "Here is a program to throw coins for the I Ching. (Unfortunately it produces the patterns upside down. but you might not worry about this.)"

Last statement: NEW.

Re: 10 REM"_(C2SLFF4

#30

Earlier quoted context omitted.

> “code is data and data is code” is a fact of computing The general purpose computers we have today all follow that principal, yes. However it's not a fundamental fact of computing. Turing machines, cellular automata provide other paradigms. And if those aren't practical enough for you, ASIC programming is Turing complete but cannot access its code as data.

State transition in the turing machine are not modifiable, but one of the core advantages of the TM is that it's powerful enough to emulate state transition. So you can model the states of the new machine as data, add the transition mechanism as code, feed those to the TM and you have a new machine that can interpret input that was unrecognizable by the previous one. That's how programming languages works. So yes, yo…

That's less "code is data is a fact of computing" and more "if you ignore the part of code that's not data then all code is data".
Post reply on HN