GithubHelp home page GithubHelp logo

Comments (7)

sasagawa888 avatar sasagawa888 commented on August 22, 2024

I don't think the ISlisp standard requires that the with-open-input-file retain its position when reopening the file.

I also looked into dev / stdin. In this case EOF could not be detected.The following code will work.
echo -ne "foo\nbar\nbaz\n" | eisl -s run.lsp

Word: foo
Word: bar
Word: baz

from eisl.

wasamasa avatar wasamasa commented on August 22, 2024

Yes, but it shouldn't discard input just because it doesn't end with a newline. To quote the standard:

Reads a line of characters from input-stream and returns them as a string (without the newline
character at the end of the line). If an end-of-stream is reached before the next newline character
and a non-empty line has been read prior to the end-of-stream, that line is returned.

So even with no newline at the end, three words should be returned.

from eisl.

sasagawa888 avatar sasagawa888 commented on August 22, 2024

I was surprised at the idea of treating Lisp as a script using Unix pipes. I learned Lisp in the 1980s. There was no idea of a scripting language at the time, and Lisp was mainly applied to artificial intelligence. It was a culture shock for me.

from eisl.

wasamasa avatar wasamasa commented on August 22, 2024

It's just a way to supply input with newlines, nothing more. But yes, Unix has taken over.

from eisl.

wasamasa avatar wasamasa commented on August 22, 2024

I've adjusted the first example to use (open-file "/dev/stdin") now and it works as expected. Still, it's odd that EOF is handled correctly with an opened file and incorrectly with (standard-input).

from eisl.

sasagawa888 avatar sasagawa888 commented on August 22, 2024

I fixed it.

from eisl.

wasamasa avatar wasamasa commented on August 22, 2024

Thanks!

from eisl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.